From b2dce81de1ea4a7ad80859bedea2278e8935a14b Mon Sep 17 00:00:00 2001 From: choi Date: Fri, 20 Dec 2024 15:27:44 +0900 Subject: [PATCH] =?UTF-8?q?getProfile=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/watch/[watchId]/page.tsx | 226 +++++++++++++++---------------- src/features/main/bar.tsx | 17 ++- 2 files changed, 116 insertions(+), 127 deletions(-) diff --git a/src/app/watch/[watchId]/page.tsx b/src/app/watch/[watchId]/page.tsx index ec56e39..397655c 100644 --- a/src/app/watch/[watchId]/page.tsx +++ b/src/app/watch/[watchId]/page.tsx @@ -30,17 +30,9 @@ export default function WatchPage() { const [mobile, setMobile] = useState(false); const isMobile = useMediaQuery({ maxWidth: 768 }); - const checkResize = () => { - if (isMobile) { - setMobile(true); - } else { - setMobile(false); - } - }; - useEffect(() => { - checkResize(); - }, []); + setMobile(isMobile); + }, [isMobile]); const [view, setView] = useState("nowPlaying"); const router = useRouter(); @@ -58,124 +50,122 @@ export default function WatchPage() { <> {!mobile && (
-
- -
-
- - -
+
+
e.stopPropagation()} - className="flex items-center flex-2 space-x-4" + onClick={handleClick} + className="relative flex w-full items-center justify-between" > - - - - - -
-
- e.stopPropagation()} /> - -
-
- -
-
01:53
-
- -
-
03:10
-
- -
-
-
-
- albumcover + + +
+
e.stopPropagation()} + className="flex items-center flex-2 space-x-4" + > + + + + + +
+
+ e.stopPropagation()} /> +
+
-
WHIPLASH
-
- - 에스파 - - · - - WHIPLASH - +
+ +
+
01:53
+
+
+
03:10
- -
-
- {view === "nowPlaying" ? ( - - ) : ( -
- Fancy 이건 참 화려해 -
- It's glowing and it's flashy (yeah) -
- 알아, 적당함이 뭔지 keep it classy -
- 따라 하지 넌 또 하나부터 열까지 (yeah) -
- 아닌척하지 (yeah) -
- Under pressure, body sweating, can you focus? (Hoo) -
- I deliver, I can promise, I'm the coldest (cold) -
- 외면해도 소용없지 don't you blow it? + +
+
+
+
+ albumcover
- )} +
+
WHIPLASH
+
+ + 에스파 + + · + + WHIPLASH + +
+
+ +
+
+ {view === "nowPlaying" ? ( + + ) : ( +
+ Fancy 이건 참 화려해 +
+ It's glowing and it's flashy (yeah) +
+ 알아, 적당함이 뭔지 keep it classy +
+ 따라 하지 넌 또 하나부터 열까지 (yeah) +
+ 아닌척하지 (yeah) +
+ Under pressure, body sweating, can you focus? (Hoo) +
+ I deliver, I can promise, I'm the coldest (cold) +
+ 외면해도 소용없지 don't you blow it? +
+ )} +
-
-
- )} - {mobile && ( - + )} + {mobile && } ); } diff --git a/src/features/main/bar.tsx b/src/features/main/bar.tsx index 5e1bcc4..a0210bc 100644 --- a/src/features/main/bar.tsx +++ b/src/features/main/bar.tsx @@ -45,7 +45,7 @@ export function Bar() { const [uploadOpen, setUploadOpen] = useState(false); const [settingOpen, setSettingOpen] = useState(false); - const [profileData, setProfileData] = useState(); + const [profileData, setProfileData] = useState(); const uploadRef = useRef(null); useOutsideClick(uploadRef, () => setUploadOpen(false)); @@ -55,16 +55,12 @@ export function Bar() { useEffect(() => { const getProfileData = async () => { - try { - const data = await getProfile(); - setProfileData(data); - } catch (error) { - console.error("프로필 로딩 실패:", error); - } + const data = await getProfile(); + setProfileData(data); }; getProfileData(); - }, [profileData]) + }, []); const links = [ { @@ -114,7 +110,10 @@ export function Bar() { title: "프로필", icon: ( - + {user?.name ? ( user.name.charAt(0).toUpperCase()