Skip to content

Commit 8cbedd1

Browse files
authored
Merge pull request #80 from SWMTheFirstTake/dev
Dev
2 parents b0fc195 + 242c2d5 commit 8cbedd1

56 files changed

Lines changed: 1430 additions & 1498 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/chat/[roomId]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default function ChatRoomPage({ params }: ChatRoomPageProps) {
6060
<div className="lg:hidden">
6161
<ChatHeader />
6262
</div>
63-
<div className="flex h-[calc(100vh-5rem)] lg:h-[100vh]">
63+
<div className="flex h-[100vh]">
6464
{/* 데스크톱: 좌우 분할 레이아웃 */}
6565
<div className="hidden lg:flex w-full lg:w-1/2 h-full lg:transition-all lg:duration-300">
6666
<ChatPanel />
@@ -78,7 +78,7 @@ export default function ChatRoomPage({ params }: ChatRoomPageProps) {
7878
</div>
7979

8080
{/* 모바일/태블릿: 단일 패널 레이아웃 */}
81-
<div className="lg:hidden w-full h-[calc(100vh-5rem)]">
81+
<div className="lg:hidden w-full h-[calc(100vh-4.1rem)]">
8282
{panel === 'chat' && <ChatPanel />}
8383
{panel === 'closet' && <ClosetPanel />}
8484
{panel === 'codination' && <CodinationPanel />}

app/globals.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import 'tailwindcss';
22
@plugin "@tailwindcss/typography";
3+
@custom-variant dark (&:where(.dark, .dark *));
34

45
html {
56
font-size: 62.5%;

app/layout.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ export default function RootLayout({
8989
<link rel="apple-touch-icon" href="/TFT_icon.png" />
9090
</head>
9191
<body className={`${plus_jakarta_sans.variable} ${noto_sans_kr.variable} antialiased min-h-screen flex flex-col`}>
92-
<main className="flex-grow text-blue">
92+
<main className="flex-grow text-blue dark:text-blue-250">
9393
<JotaiProvider>
9494
<QueryProvider>
9595
<ServerAuthProvider>
96-
<StorageInitializer>
97-
{children}
98-
</StorageInitializer>
96+
<StorageInitializer>{children}</StorageInitializer>
9997
</ServerAuthProvider>
10098
</QueryProvider>
10199
</JotaiProvider>

component-structure.puml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,5 @@ note right of State
168168
end note
169169

170170
@enduml
171+
172+

data-flow.puml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,5 @@ group Error Handling
104104
end
105105

106106
@enduml
107+
108+

frontend-architecture.puml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,5 @@ note top of Panels
169169
end note
170170

171171
@enduml
172+
173+

src/api/authAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ export const getAuthMe = async () => requestAPI<any>(`/api/auth/me`, 'GET');
77
export const getAuthKakaoCallback = async (): Promise<APIResponse<User>> => {
88
const response = await requestAPI<APIUser>(`/api/auth/kakao/callback`, 'GET');
99
if (response.status == 'fail') return response;
10+
1011
return {
1112
status: response.status,
1213
message: response.message,
1314
data: {
1415
userId: response.data.userId,
1516
username: response.data.nickname,
1617
modelImage: null,
17-
darkMode: false,
1818
},
1919
};
2020
};

src/atoms/authAtoms.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { atom } from 'jotai';
22

33
export const userAtom = atom<User | null>(null);
4+
export const darkModeAtom = atom<boolean>(false);
45
export const isInitializedAtom = atom<boolean>(false);
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'use client';
2+
3+
import { useEffect, useState } from 'react';
4+
import { useAtom } from 'jotai';
5+
import { darkModeAtom } from '@/atoms/authAtoms';
6+
import { initializeUserSettings } from '@/lib/indexedDB';
7+
8+
interface DarkModeInitializerProps {
9+
initialUser?: User | null;
10+
}
11+
12+
export default function DarkModeInitializer({ initialUser }: DarkModeInitializerProps) {
13+
const [isDarkMode, setIsDarkMode] = useAtom(darkModeAtom);
14+
const [isInitialized, setIsInitialized] = useState(false);
15+
16+
// 사용자 프로필에서 다크모드 설정 로드
17+
useEffect(() => {
18+
const loadDarkModeSettingFromDB = async () => {
19+
console.log('DarkModeInitializer: Loading dark mode setting for user:', initialUser);
20+
21+
if (initialUser?.userId) {
22+
try {
23+
// 설정 초기화 (기존 설정이 있으면 로드, 없으면 기본값으로 초기화)
24+
const settings = await initializeUserSettings(initialUser.userId);
25+
console.log('DarkModeInitializer: Initialized settings:', settings);
26+
27+
const isDarkMode = settings.theme === 'dark';
28+
console.log('DarkModeInitializer: Setting dark mode to:', isDarkMode);
29+
setIsDarkMode(isDarkMode);
30+
} catch (error) {
31+
console.error('DarkModeInitializer: Failed to initialize settings:', error);
32+
setIsDarkMode(false);
33+
}
34+
} else {
35+
console.log('DarkModeInitializer: No user ID, using default false');
36+
setIsDarkMode(false);
37+
}
38+
setIsInitialized(true);
39+
};
40+
41+
loadDarkModeSettingFromDB();
42+
}, [initialUser, setIsDarkMode]);
43+
44+
// 다크모드 상태에 따라 HTML 클래스 적용
45+
useEffect(() => {
46+
if (isInitialized) {
47+
console.log('DarkModeInitializer: Applying dark mode to HTML:', isDarkMode);
48+
if (isDarkMode) {
49+
document.documentElement.classList.add('dark');
50+
} else {
51+
document.documentElement.classList.remove('dark');
52+
}
53+
}
54+
}, [isDarkMode, isInitialized]);
55+
56+
return null; // 렌더링하지 않음
57+
}

src/components/auth/AuthJotaiInitializer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export default function AuthJotaiInitializer({ initialUser }: AuthJotaiInitializ
2525

2626
if (initialUser.userId) {
2727
try {
28-
console.log('asdfiiqqnq치치치치');
2928
await saveToIndexedDB(STORE_NAMES.USER_PROFILE, initialUser);
3029
} catch (profileError) {
3130
console.error('UserProfile 로드 실패:', profileError);

0 commit comments

Comments
 (0)