+
{name}
);
diff --git a/FE/src/components/programDetail/attendee/BluredAttedee.tsx b/FE/src/components/programDetail/attendee/BluredAttedee.tsx
new file mode 100644
index 00000000..6ebd367d
--- /dev/null
+++ b/FE/src/components/programDetail/attendee/BluredAttedee.tsx
@@ -0,0 +1,25 @@
+import { attendStatuses } from "./AttendeeInfo.container";
+import AttendeeStatus from "./AttendeeStatus";
+import { MemberAttendStatusInfoDto } from "@/apis/dtos/member.dto";
+import MemberList from "@/components/common/MemberList";
+
+const members: MemberAttendStatusInfoDto[] = [
+ {
+ memberId: 1,
+ name: "김민수",
+ attendStatus: "attend",
+ },
+];
+
+export default function BluredAttedee() {
+ return (
+
+ {attendStatuses.map((status) => (
+
+ ))}
+
+ );
+}
From 17e031c7fc4f57b371cb3e3c5233ab00b5e2de07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A5=E1=86=AB?=
=?UTF-8?q?=E1=84=80=E1=85=B2?=
Date: Fri, 5 Apr 2024 15:50:36 +0900
Subject: [PATCH 13/45] =?UTF-8?q?refactor:=20=EB=B0=98=EB=B3=B5=EB=90=98?=
=?UTF-8?q?=EB=8A=94=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=98=B8?=
=?UTF-8?q?=EC=B6=9C=EC=9D=84=20=EB=B0=98=EB=B3=B5=EB=AC=B8=EC=9C=BC?=
=?UTF-8?q?=EB=A1=9C=20=EC=B9=98=ED=99=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
반복되는 컴포넌트 호출을 반복문으로 변경
#9
---
.../attendee/AttendeeInfo.container.tsx | 22 ++++++++++++-------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx b/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx
index 2d6b4e2a..e6240e65 100644
--- a/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx
+++ b/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx
@@ -2,6 +2,7 @@
import { ErrorBoundary } from "react-error-boundary";
import AttendeeInfo from "./AttendeeInfo";
+import BluredAttedee from "./BluredAttedee";
import ErrorFallback from "@/components/common/ErrorFallback";
import { CheckIsLoggedIn } from "@/utils/authWithStorage";
@@ -9,20 +10,25 @@ interface AttendeeInfoContainerProps {
programId: number;
}
+export const attendStatuses = [
+ "attend",
+ "late",
+ "absent",
+ "nonResponse",
+] as const;
+
const AttendeeInfoContainer = ({ programId }: AttendeeInfoContainerProps) => {
const isLoggedIn = CheckIsLoggedIn();
return (
- {!isLoggedIn && (
-
- 로그인이 필요한 페이지입니다.
-
+ {isLoggedIn ? (
+ attendStatuses.map((status) => (
+
+ ))
+ ) : (
+
)}
-
-
-
-
);
From 182b0a70d18f0e1ad9160bc6ae3f28d4a4271246 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A5=E1=86=AB?=
=?UTF-8?q?=E1=84=80=E1=85=B2?=
Date: Fri, 5 Apr 2024 16:02:35 +0900
Subject: [PATCH 14/45] =?UTF-8?q?feat:=20=EB=B8=94=EB=9F=AC=EC=B2=98?=
=?UTF-8?q?=EB=A6=AC=20=EB=AA=A9=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
블러처리 목 데이터 추가
#9
---
.../attendee/AttendeeInfo.container.tsx | 18 +++++----
.../programDetail/attendee/BluredAttedee.tsx | 40 ++++++++++++-------
2 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx b/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx
index e6240e65..eff4c5d0 100644
--- a/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx
+++ b/FE/src/components/programDetail/attendee/AttendeeInfo.container.tsx
@@ -22,13 +22,17 @@ const AttendeeInfoContainer = ({ programId }: AttendeeInfoContainerProps) => {
return (
- {isLoggedIn ? (
- attendStatuses.map((status) => (
-
- ))
- ) : (
-
- )}
+ {isLoggedIn
+ ? attendStatuses.map((status) => (
+
+ ))
+ : attendStatuses.map((status) => (
+
+ ))}
);
diff --git a/FE/src/components/programDetail/attendee/BluredAttedee.tsx b/FE/src/components/programDetail/attendee/BluredAttedee.tsx
index 6ebd367d..ee73847d 100644
--- a/FE/src/components/programDetail/attendee/BluredAttedee.tsx
+++ b/FE/src/components/programDetail/attendee/BluredAttedee.tsx
@@ -1,25 +1,35 @@
-import { attendStatuses } from "./AttendeeInfo.container";
import AttendeeStatus from "./AttendeeStatus";
import { MemberAttendStatusInfoDto } from "@/apis/dtos/member.dto";
import MemberList from "@/components/common/MemberList";
+import { AttendStatus } from "@/types/member";
-const members: MemberAttendStatusInfoDto[] = [
- {
- memberId: 1,
- name: "김민수",
- attendStatus: "attend",
- },
-];
+const mockMember: MemberAttendStatusInfoDto = {
+ memberId: 1,
+ name: "20기 박건규",
+ attendStatus: "attend",
+};
-export default function BluredAttedee() {
+interface BluredAttedeeProps {
+ status: AttendStatus;
+}
+
+export default function BluredAttedee({ status }: BluredAttedeeProps) {
+ const population =
+ status === "attend"
+ ? 52
+ : status === "late"
+ ? 3
+ : status === "absent"
+ ? 1
+ : 0;
+ const members = Array.from({ length: population }, (_, i) => ({
+ ...mockMember,
+ memberId: i + 1,
+ }));
return (
- {attendStatuses.map((status) => (
-
- ))}
+
+
);
}
From 5805f283efc53f5af125899245b9819df15bd945 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A5=E1=86=AB?=
=?UTF-8?q?=E1=84=80=E1=85=B2?=
Date: Fri, 5 Apr 2024 16:28:47 +0900
Subject: [PATCH 15/45] =?UTF-8?q?feat:=20Auth=20=ED=99=95=EC=9D=B8=20?=
=?UTF-8?q?=EB=A1=9C=EC=A7=81=EC=9D=84=20=EC=BB=B4=ED=8F=AC=EB=84=8C?=
=?UTF-8?q?=ED=8A=B8=EB=A1=9C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
이전처럼 훅으로 로직 처리시 한 곳에서 일괄 처리가 불가능함
이를 layout에서 처리하기 위해서 컴포넌트로 구현
#9
---
FE/src/app/(private)/layout.tsx | 10 +++++++---
FE/src/components/common/validate/Auth.tsx | 22 ++++++++++++++++++++++
FE/src/hooks/useAuthValidate.tsx | 18 ------------------
3 files changed, 29 insertions(+), 21 deletions(-)
create mode 100644 FE/src/components/common/validate/Auth.tsx
delete mode 100644 FE/src/hooks/useAuthValidate.tsx
diff --git a/FE/src/app/(private)/layout.tsx b/FE/src/app/(private)/layout.tsx
index 3496d446..b3876d21 100644
--- a/FE/src/app/(private)/layout.tsx
+++ b/FE/src/app/(private)/layout.tsx
@@ -1,8 +1,12 @@
import { PropsWithChildren } from "react";
-import useAuthValidate from "@/hooks/useAuthValidate";
+import AuthValidate from "@/components/common/validate/Auth";
const PrivateLayout = ({ children }: PropsWithChildren) => {
- useAuthValidate();
- return <>{children}>;
+ return (
+ <>
+
+ {children}
+ >
+ );
};
export default PrivateLayout;
diff --git a/FE/src/components/common/validate/Auth.tsx b/FE/src/components/common/validate/Auth.tsx
new file mode 100644
index 00000000..0f87d9d6
--- /dev/null
+++ b/FE/src/components/common/validate/Auth.tsx
@@ -0,0 +1,22 @@
+"use client";
+
+import { useRouter } from "next/navigation";
+import { useEffect } from "react";
+import ROUTES from "@/constants/ROUTES";
+import { deleteTokenInfo } from "@/utils/authWithStorage";
+
+const AuthValidate = () => {
+ const router = useRouter();
+ useEffect(() => {
+ const accessToken = localStorage.getItem("accessToken");
+ const tokenExpiration = localStorage.getItem("tokenExpiration");
+
+ if (!accessToken || !tokenExpiration) {
+ deleteTokenInfo();
+ router.push(ROUTES.LOGIN);
+ }
+ }, []);
+
+ return <>>;
+};
+export default AuthValidate;
diff --git a/FE/src/hooks/useAuthValidate.tsx b/FE/src/hooks/useAuthValidate.tsx
deleted file mode 100644
index 8a262405..00000000
--- a/FE/src/hooks/useAuthValidate.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-"use client";
-
-import { useRouter } from "next/navigation";
-import { useEffect } from "react";
-import ROUTES from "@/constants/ROUTES";
-import { CheckIsLoggedIn, deleteTokenInfo } from "@/utils/authWithStorage";
-
-const useAuthValidate = () => {
- const router = useRouter();
- useEffect(() => {
- const isLoggedIn = CheckIsLoggedIn();
- if (!isLoggedIn) {
- deleteTokenInfo();
- router.push(ROUTES.LOGIN);
- }
- }, []);
-};
-export default useAuthValidate;
From 6777b23484862449f57f0d28bf2e095872dd5891 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A5=E1=86=AB?=
=?UTF-8?q?=E1=84=80=E1=85=B2?=
Date: Fri, 5 Apr 2024 16:47:06 +0900
Subject: [PATCH 16/45] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?=
=?UTF-8?q?=EC=9D=B4=20=EB=90=98=EC=96=B4=EC=9E=88=EC=A7=80=20=EC=95=8A?=
=?UTF-8?q?=EC=9C=BC=EB=A9=B4=20=ED=97=A4=EB=8D=94=EC=97=90=20=EB=A1=9C?=
=?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EB=B2=84=ED=8A=BC=20=ED=91=9C=EC=8B=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
로그인이 되어 있지 않다면 헤더에 유저 버튼 및 행사생성 버튼을 로그인 버튼으로 변경
#9
---
FE/src/components/common/header/Header.tsx | 14 +++++++++++--
.../common/header/LoginRedirectBtn.tsx | 20 +++++++++++++++++++
FE/src/components/common/header/Logo.tsx | 2 --
FE/src/components/common/header/UserBtn.tsx | 2 --
4 files changed, 32 insertions(+), 6 deletions(-)
create mode 100644 FE/src/components/common/header/LoginRedirectBtn.tsx
diff --git a/FE/src/components/common/header/Header.tsx b/FE/src/components/common/header/Header.tsx
index 53c27539..585855e0 100644
--- a/FE/src/components/common/header/Header.tsx
+++ b/FE/src/components/common/header/Header.tsx
@@ -1,14 +1,24 @@
+"use client";
import CreateBtn from "./CreateBtn";
+import LoginRedirectBtn from "./LoginRedirectBtn";
import Logo from "./Logo";
import UserBtn from "./UserBtn";
+import { CheckIsLoggedIn } from "@/utils/authWithStorage";
const Header = () => {
+ const isLoggedIn = CheckIsLoggedIn();
return (
-
-
+ {isLoggedIn ? (
+ <>
+
+
+ >
+ ) : (
+
+ )}
);
diff --git a/FE/src/components/common/header/LoginRedirectBtn.tsx b/FE/src/components/common/header/LoginRedirectBtn.tsx
new file mode 100644
index 00000000..06ff0a15
--- /dev/null
+++ b/FE/src/components/common/header/LoginRedirectBtn.tsx
@@ -0,0 +1,20 @@
+import Image from "next/image";
+import Link from "../Link";
+import ROUTES from "@/constants/ROUTES";
+
+const LOGIN = "로그인 후 사용해주세요!";
+
+export default function LoginRedirectBtn() {
+ return (
+
+
+ {LOGIN}
+
+ );
+}
diff --git a/FE/src/components/common/header/Logo.tsx b/FE/src/components/common/header/Logo.tsx
index db45bdf3..e01fab4d 100644
--- a/FE/src/components/common/header/Logo.tsx
+++ b/FE/src/components/common/header/Logo.tsx
@@ -1,5 +1,3 @@
-"use client";
-
import Image from "next/image";
import { usePathname, useRouter } from "next/navigation";
import ROUTES from "@/constants/ROUTES";
diff --git a/FE/src/components/common/header/UserBtn.tsx b/FE/src/components/common/header/UserBtn.tsx
index ada937e9..921fc870 100644
--- a/FE/src/components/common/header/UserBtn.tsx
+++ b/FE/src/components/common/header/UserBtn.tsx
@@ -1,5 +1,3 @@
-"use client";
-
import Image from "next/image";
import UserActiveModal from "./Modal/UserActiveModal";
import useModal from "@/hooks/useModal";
From a692b1450fa66f5a090e336ce387683f73d7fd64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A5=E1=86=AB?=
=?UTF-8?q?=E1=84=80=E1=85=B2?=
Date: Fri, 5 Apr 2024 20:21:30 +0900
Subject: [PATCH 17/45] =?UTF-8?q?feat:=20=EC=9C=A0=EC=A0=80=20=EC=83=81?=
=?UTF-8?q?=ED=83=9C=20=EB=AA=A8=EB=8B=AC=EC=9D=98=20=EC=83=81=ED=83=9C?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EB=A1=9C?=
=?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EB=B2=84=ED=8A=BC=EC=9C=BC=EB=A1=9C=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
유저 상태 모달의 상태 변경 버튼을 로그인 버튼으로 수정
#9
---
.../userAttendModal/LoginModal.tsx | 24 +++++++++++++++++++
.../UserAttendModal.container.tsx | 14 +++++++----
.../userAttendModal/UserAttendModal.tsx | 2 --
3 files changed, 34 insertions(+), 6 deletions(-)
create mode 100644 FE/src/components/programDetail/userAttendModal/LoginModal.tsx
diff --git a/FE/src/components/programDetail/userAttendModal/LoginModal.tsx b/FE/src/components/programDetail/userAttendModal/LoginModal.tsx
new file mode 100644
index 00000000..d3f4a3bf
--- /dev/null
+++ b/FE/src/components/programDetail/userAttendModal/LoginModal.tsx
@@ -0,0 +1,24 @@
+// import AttendToggleLabel from "./AttendToggleLabel";
+import Link from "next/link";
+import AttendStatusToggle from "@/components/common/attendStatusToggle/AttendStatusToggle";
+import StatusToggleItem from "@/components/common/attendStatusToggle/StatusToggleItem";
+import ROUTES from "@/constants/ROUTES";
+
+export default function LoginModal() {
+ return (
+
+
+
+
+
로그인 후 사용해주세요!
+
{}}
+ />
+
+ );
+}
diff --git a/FE/src/components/programDetail/userAttendModal/UserAttendModal.container.tsx b/FE/src/components/programDetail/userAttendModal/UserAttendModal.container.tsx
index ee68ae12..f6f0bd28 100644
--- a/FE/src/components/programDetail/userAttendModal/UserAttendModal.container.tsx
+++ b/FE/src/components/programDetail/userAttendModal/UserAttendModal.container.tsx
@@ -3,10 +3,12 @@
import classNames from "classnames";
import Image from "next/image";
import { ErrorBoundary } from "react-error-boundary";
+import LoginModal from "./LoginModal";
import UserAttendModal from "./UserAttendModal";
import ErrorFallbackNoIcon from "@/components/common/ErrorFallbackNoIcon";
import useModal from "@/hooks/useModal";
import useOutsideRef from "@/hooks/useOutsideRef";
+import { CheckIsLoggedIn } from "@/utils/authWithStorage";
interface UserAttendModalProps {
programId: number;
@@ -15,6 +17,7 @@ interface UserAttendModalProps {
const UserAttendModalContainer = ({ programId }: UserAttendModalProps) => {
const { isOpen, openModal, closeModal } = useModal();
const modalRef = useOutsideRef(closeModal);
+ const isLoggedIn = CheckIsLoggedIn();
const modalStyle = classNames(
"fixed left-0 z-10 flex h-60 w-full flex-col items-center gap-5 rounded-t-3xl border-t-2 bg-background shadow-2xl transition-all duration-500",
@@ -26,7 +29,6 @@ const UserAttendModalContainer = ({ programId }: UserAttendModalProps) => {
const handleOpenModal = (e: React.MouseEvent) => {
e.stopPropagation();
- console.log("hi", isOpen);
isOpen ? closeModal() : openModal();
};
@@ -46,9 +48,13 @@ const UserAttendModalContainer = ({ programId }: UserAttendModalProps) => {
style={{ width: 38, height: 6 }}
/>
-