Skip to content

Commit 38f3bec

Browse files
authored
Merge pull request #28 from KGU-Vote-System/feature/13
[FEAT] : 마이페이지 개발
2 parents b934313 + bcccbe3 commit 38f3bec

File tree

9 files changed

+96
-2
lines changed

9 files changed

+96
-2
lines changed

src/app/stackflow/Stack.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { VoteResultContentScreen } from '@/screen/vote-result-content/ui';
2222
import { VoteResultScreen } from '@/screen/vote-result/ui';
2323
import { VoteScreen } from '@/screen/vote/ui';
2424
import { fetchLoginStatus } from '@/shared/utils';
25+
import { UserScreen } from '@/screen/user/ui';
26+
import { UserVoteStatusScreen } from '@/screen/user-vote-status/ui';
2527

2628
export const { Stack, useFlow } = stackflow({
2729
transitionDuration: 350,
@@ -45,6 +47,8 @@ export const { Stack, useFlow } = stackflow({
4547
VoteResultScreen,
4648
VoteResultContentScreen,
4749
HomeScreen,
50+
UserScreen,
51+
UserVoteStatusScreen,
4852
},
4953
plugins: [
5054
basicRendererPlugin(),

src/assets/icon/icon-profile.png

43.7 KB
Loading

src/assets/icon/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import UserSquareIcon from './icon-user-square.svg';
2020
import VoteCompleteIcon from './icon-vote-complete.png';
2121
import VoteIcon from './icon-vote.svg';
2222
import WriteIcon from './icon-write.svg';
23+
import ProfileIcon from './icon-profile.png';
2324

2425
export {
2526
Alert,
@@ -44,4 +45,5 @@ export {
4445
VoteCompleteIcon,
4546
VoteIcon,
4647
WriteIcon,
48+
ProfileIcon,
4749
};

src/screen/home/ui/HomeScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { PATH } from '@/shared/constants';
88
import { logout } from '@/shared/utils';
99

1010
export default function HomeScreen() {
11-
const { replace } = useFlow();
11+
const { replace, push } = useFlow();
1212

1313
return (
1414
<AppScreen
@@ -19,7 +19,7 @@ export default function HomeScreen() {
1919
replace(PATH.LOGIN, {}, { animate: false });
2020
logout();
2121
},
22-
() => {},
22+
() => push(PATH.USER, {}),
2323
)}
2424
>
2525
<HomeContainer />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { AppScreen } from '@stackflow/plugin-basic-ui';
2+
3+
import { TitleAppBar } from '@/shared/ui';
4+
import { AdminVoteResultContainer } from '@/widgets/admin-vote-result/ui';
5+
6+
export default function NoticeCreateScreen() {
7+
return (
8+
<AppScreen backgroundColor="#fff" appBar={TitleAppBar('내 투표내역 보기')}>
9+
<AdminVoteResultContainer />
10+
</AppScreen>
11+
);
12+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as UserVoteStatusScreen } from './UserVoteStatusScreen';

src/screen/user/ui/UserScreen.tsx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { AppScreen } from '@stackflow/plugin-basic-ui';
2+
import { IoChevronForward } from 'react-icons/io5';
3+
4+
import { useFlow } from '@/app/stackflow';
5+
import { ProfileIcon } from '@/assets/icon';
6+
7+
import { Button, TitleAppBar } from '@/shared/ui';
8+
import { fetchSessionData, logout } from '@/shared/utils';
9+
import { PATH } from '@/shared/constants';
10+
import type { User } from '@/shared/types';
11+
12+
export default function UserScreen() {
13+
const { name, collegeMajorName } = fetchSessionData('userInfo') as User;
14+
const { push } = useFlow();
15+
16+
return (
17+
<AppScreen backgroundColor="#fff" appBar={TitleAppBar('')}>
18+
<div className="p-normal flex size-full flex-col">
19+
<div className="mb-[35px] flex w-full flex-col items-center justify-center">
20+
<img src={ProfileIcon} className="size-25" />
21+
<p className="text-m mt-4 text-center text-2xl font-bold">{name}</p>
22+
<p className="mt-2.5">202311509</p>
23+
<p>{collegeMajorName}</p>
24+
</div>
25+
<div className="shadow-resultItem mb-[15px] flex h-42 w-full gap-x-3 rounded-lg bg-white px-3 py-[17px]">
26+
<InfoItem item="3회" label="나의 투표참여 횟수" />
27+
<div className="h-full w-[1px] bg-[#ECECEC]" />
28+
<InfoItem item="59%" label="전체 투표 참여율" />
29+
<div className="h-full w-[1px] bg-[#ECECEC]" />
30+
<InfoItem item="51%" label="학과 평균 참여율" />
31+
</div>
32+
<Button
33+
intent="gradient"
34+
className="mb-13"
35+
onClick={() => push(PATH.USER_VOTE_STATUS, {})}
36+
>
37+
내 투표내역 보기
38+
</Button>
39+
<UserScreenButton label="문의하기" onClick={() => {}} />
40+
<UserScreenButton
41+
label="로그아웃"
42+
onClick={() => {
43+
logout();
44+
}}
45+
/>
46+
</div>
47+
</AppScreen>
48+
);
49+
}
50+
51+
const InfoItem = ({ item, label }: { item: string; label: string }) => (
52+
<div className="flex flex-1 flex-col items-center justify-center gap-y-[7px]">
53+
<p className="text-m text-2xl font-bold">{item}</p>
54+
<p className="text-[13px] font-light">{label}</p>
55+
</div>
56+
);
57+
58+
const UserScreenButton = ({
59+
label,
60+
onClick,
61+
}: {
62+
label: string;
63+
onClick: () => void;
64+
}) => (
65+
<button
66+
className="shadow-resultItem mb-4 flex items-center justify-between rounded-md px-[18px] py-5"
67+
onClick={onClick}
68+
>
69+
{label}
70+
<IoChevronForward size={20} />
71+
</button>
72+
);

src/screen/user/ui/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as UserScreen } from './UserScreen';

src/shared/constants/path.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export const PATH = {
1818
VOTE_PROMISE: 'VotePromiseScreen',
1919
VOTE_RESULT: 'VoteResultScreen',
2020
VOTE_RESULT_CONTENT: 'VoteResultContentScreen',
21+
USER: 'UserScreen',
22+
USER_VOTE_STATUS: 'UserVoteStatusScreen',
2123
} as const;
2224

2325
export const RAW_PATH = {

0 commit comments

Comments
 (0)