Skip to content

Commit

Permalink
Merge pull request #1389 from innovationacademy-kr/fe/dev/feat_profil…
Browse files Browse the repository at this point in the history
…e_layout

[FE] FEAT : profile layout
  • Loading branch information
YESHYUNGSEOK authored Oct 13, 2023
2 parents b7b60c5 + 90ea7c7 commit 5331370
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 82 deletions.
5 changes: 4 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import LoginPage from "@/pages/LoginPage";
import MainPage from "@/pages/MainPage";
import AdminMainPage from "@/pages/admin/AdminMainPage";
import LoadingAnimation from "@/components/Common/LoadingAnimation";
import ProfilePage from "./pages/ProfilePage";
import "./firebase-messaging-sw"


const NotFoundPage = lazy(() => import("@/pages/NotFoundPage"));
const LoginFailurePage = lazy(() => import("@/pages/LoginFailurePage"));
const AdminLayout = lazy(() => import("@/pages/admin/AdminLayout"));
Expand All @@ -29,7 +31,8 @@ function App(): React.ReactElement {
<Route path="login" element={<LoginPage />} />
<Route path="home" element={<HomePage />} />
<Route path="main" element={<MainPage />} />
<Route path="log" element={<LogPage />} />
<Route path="profile/log" element={<LogPage />} />
<Route path="profile" element={<ProfilePage />} />
</Route>
{/* admin용 라우터 */}
<Route path="/admin/" element={<AdminLayout />}>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/assets/images/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions frontend/src/assets/images/profile-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ const LeftMainNavContainer = ({ isAdmin }: { isAdmin?: boolean }) => {
closeAll();
};

const onClickProfileButton = () => {
navigator("profile");
closeAll();
};

const onClickLogoutButton = (): void => {
const adminToken = isAdmin ? "admin_" : "";
if (import.meta.env.VITE_IS_LOCAL === "true") {
Expand Down Expand Up @@ -138,6 +143,7 @@ const LeftMainNavContainer = ({ isAdmin }: { isAdmin?: boolean }) => {
onClickSearchButton={onClickSearchButton}
onClickLogoutButton={onClickLogoutButton}
onClickClubButton={onClickClubButton}
onClickProfileButton={onClickProfileButton}
isAdmin={isAdmin}
/>
);
Expand Down
121 changes: 57 additions & 64 deletions frontend/src/components/LeftNav/LeftMainNav/LeftMainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ILeftMainNav {
onClickLentLogButton: React.MouseEventHandler;
onClickSearchButton: React.MouseEventHandler;
onClickClubButton: React.MouseEventHandler;
onClickProfileButton: React.MouseEventHandler;
isAdmin?: boolean;
}

Expand All @@ -23,6 +24,7 @@ const LeftMainNav = ({
onClickLentLogButton,
onClickSearchButton,
onClickClubButton,
onClickProfileButton,
isAdmin,
}: ILeftMainNav) => {
return (
Expand Down Expand Up @@ -58,75 +60,66 @@ const LeftMainNav = ({
<BottomSectionStyled>
<BottomBtnsStyled>
{isAdmin && (
<BottomBtnStyled
className={
pathname.includes("search")
? "active cabiButton"
: " cabiButton"
}
src={"/src/assets/images/search.svg"}
onClick={onClickSearchButton}
>
<div></div>
Search
</BottomBtnStyled>
)}
{!isAdmin && (
<BottomBtnStyled
className={
pathname.includes("log") ? "active cabiButton" : " cabiButton"
}
src={"/src/assets/images/log.svg"}
onClick={onClickLentLogButton}
>
<div></div>
Log
</BottomBtnStyled>
)}
<BottomBtnStyled
src={"/src/assets/images/slack.svg"}
className="cabiButton"
>
<a
href="https://42born2code.slack.com/archives/C02V6GE8LD7"
target="_blank"
title="슬랙 캐비닛 채널 새창으로 열기"
>
<div></div>
Contact
</a>
</BottomBtnStyled>
<BottomBtnStyled
src={"/src/assets/images/clubIconGray.svg"}
className="cabiButton"
>
{isAdmin ? (
<>
<a onClick={onClickClubButton}>
<>
<BottomBtnStyled
className={
pathname.includes("search")
? "active cabiButton"
: " cabiButton"
}
src={"/src/assets/images/search.svg"}
onClick={onClickSearchButton}
>
<div></div>
Search
</BottomBtnStyled>
<BottomBtnStyled
src={"/src/assets/images/slack.svg"}
className="cabiButton"
>
<a
href="https://42born2code.slack.com/archives/C02V6GE8LD7"
target="_blank"
title="슬랙 캐비닛 채널 새창으로 열기"
>
<div></div>
Club
Contact
</a>
</>
) : (
<a
href="https://docs.google.com/forms/d/e/1FAIpQLSfp-d7qq8gTvmQe5i6Gtv_mluNSICwuv5pMqeTBqt9NJXXP7w/closedform"
target="_blank"
title="동아리 사물함 사용 신청서 새창으로 열기"
</BottomBtnStyled>
<BottomBtnStyled
src={"/src/assets/images/clubIconGray.svg"}
className="cabiButton"
onClick={onClickClubButton}
>
<div></div>
Club
</a>
)}
</BottomBtnStyled>

<BottomBtnStyled
className="cabiButton"
onClick={onClickLogoutButton}
src={"/src/assets/images/close-square.svg"}
>
<div></div>
Logout
</BottomBtnStyled>
</BottomBtnStyled>
<BottomBtnStyled
className="cabiButton"
onClick={onClickLogoutButton}
src={"/src/assets/images/close-square.svg"}
>
<div></div>
Logout
</BottomBtnStyled>
</>
)}
{!isAdmin && (
<>
<BottomBtnStyled
className={
pathname.includes("profile")
? "active cabiButton"
: " cabiButton"
}
src={"/src/assets/images/profile-circle.svg"}
onClick={onClickProfileButton}
>
<div></div>
Profile
</BottomBtnStyled>
</>
)}
</BottomBtnsStyled>
</BottomSectionStyled>
</LeftNavStyled>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/LeftNav/LeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import styled from "styled-components";
import LeftMainNavContainer from "@/components/LeftNav/LeftMainNav/LeftMainNav.container";
import LeftSectionNavContainer from "@/components/LeftNav/LeftSectionNav/LeftSectionNav.container";

const LeftNav: React.FC<{ isVisible: boolean; isAdmin?: boolean }> = ({
isAdmin,
isVisible,
}) => {
const LeftNav: React.FC<{
isVisible: boolean;
isAdmin?: boolean;
}> = ({ isAdmin, isVisible }) => {
return (
<LeftNavWrapStyled id="leftNavWrap">
<LeftMainNavContainer isAdmin={isAdmin} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useLocation, useNavigate } from "react-router-dom";
import { useRecoilState, useRecoilValue } from "recoil";
import { currentSectionNameState } from "@/recoil/atoms";
import { currentFloorSectionState } from "@/recoil/selectors";
Expand All @@ -9,20 +10,54 @@ const LeftSectionNavContainer = ({ isVisible }: { isVisible: boolean }) => {
const [currentFloorSection, setCurrentFloorSection] = useRecoilState<string>(
currentSectionNameState
);

const navigator = useNavigate();
const { pathname } = useLocation();
const { closeLeftNav } = useMenu();
const isProfilePage: boolean = location.pathname.includes("profile");

const onClickSection = (section: string) => {
closeLeftNav();
setCurrentFloorSection(section);
};

const onClickProfile = () => {
closeLeftNav();
navigator("profile");
};

const onClickLentLogButton = () => {
closeLeftNav();
navigator("profile/log");
};

const onClickSlack = () => {
window.open(
"https://42born2code.slack.com/archives/C02V6GE8LD7",
"_blank",
"noopener noreferrer"
);
};

const onClickClubForm = () => {
window.open(
"https://docs.google.com/forms/d/e/1FAIpQLSfp-d7qq8gTvmQe5i6Gtv_mluNSICwuv5pMqeTBqt9NJXXP7w/closedform",
"_blank",
"noopener noreferrer"
);
};

return (
<LeftSectionNav
pathname={pathname}
isVisible={isVisible}
onClickSection={onClickSection}
isProfile={isProfilePage}
currentFloorSection={currentFloorSection}
floorSection={floorSection}
onClickSection={onClickSection}
onClickProfile={onClickProfile}
onClickLentLogButton={onClickLentLogButton}
onClickSlack={onClickSlack}
onClickClubForm={onClickClubForm}
/>
);
};
Expand Down
Loading

0 comments on commit 5331370

Please sign in to comment.