File tree Expand file tree Collapse file tree 5 files changed +100
-34
lines changed Expand file tree Collapse file tree 5 files changed +100
-34
lines changed Original file line number Diff line number Diff line change
1
+ import { BlurModal } from "./BlurModal" ;
2
+ import { DivButton } from "../../button/DivButton" ;
3
+
4
+ export interface CheckModalProps {
5
+ setModal : ( value : JSX . Element | undefined ) => void
6
+ checkMessage : string
7
+ cancelMessage : string
8
+ onCheck : ( ) => void
9
+ children : JSX . Element [ ]
10
+ }
11
+
12
+ export const CheckModal = ( props : CheckModalProps ) => {
13
+ return (
14
+ < BlurModal
15
+ className = { "w-[650px]" }
16
+ setModel = { props . setModal } >
17
+ < div className = { "flex flex-col items-center justify-center gap-[30px] py-[20px]" } >
18
+ { props . children }
19
+ </ div >
20
+ < div className = { "flex flex-row gap-[30px]" } >
21
+ < DivButton
22
+ className = { "flex items-center justify-center rounded-[10px] w-[250px] py-[20px] bg-photocard-stroke" }
23
+ onClick = { ( ) => {
24
+ props . setModal ( undefined )
25
+ } } >
26
+ < p className = { "text-text-black text-[26px] font-p-extra-bold" } > { props . cancelMessage } </ p >
27
+ </ DivButton >
28
+ < DivButton
29
+ className = { "flex items-center justify-center rounded-[10px] w-[250px] py-[20px] bg-highlight-orange" }
30
+ onClick = { props . onCheck } >
31
+ < p className = { "text-text-black text-[26px] font-p-extra-bold" } > { props . checkMessage } </ p >
32
+ </ DivButton >
33
+ </ div >
34
+ </ BlurModal >
35
+ )
36
+ }
Original file line number Diff line number Diff line change 1
- import { BlurModal } from "./BlurModal" ;
2
- import { DivButton } from "../../button/DivButton" ;
3
1
import { deleteSessionId } from "../../../module/cookie/SessionManager" ;
2
+ import { CheckModal } from "./CheckModal" ;
4
3
5
4
export interface LogoutModalProps {
6
5
setModal : ( value : JSX . Element | undefined ) => void
7
- onCancel : ( ) => void
8
6
}
9
7
10
8
export const LogoutModal = ( props : LogoutModalProps ) => {
11
9
return (
12
- < BlurModal
13
- className = { "w-[650px]" }
14
- setModel = { props . setModal } >
15
- < div className = { "flex flex-col items-center justify-center gap-[30px] py-[20px]" } >
16
- < p className = { "text-text-white text-[32px] font-p-semi-bold" } > 이미 로그인중입니다.</ p >
17
- < p className = { "text-text-white text-[24px] font-p-semi-bold" } > 로그아웃하시겠습니까?</ p >
18
- </ div >
19
- < div className = { "flex flex-row gap-[30px]" } >
20
- < DivButton
21
- className = { "flex items-center justify-center rounded-[10px] w-[250px] py-[20px] bg-photocard-stroke" }
22
- onClick = { props . onCancel } >
23
- < p className = { "text-text-black text-[26px] font-p-extra-bold" } > Back</ p >
24
- </ DivButton >
25
- < DivButton
26
- className = { "flex items-center justify-center rounded-[10px] w-[250px] py-[20px] bg-highlight-orange" }
27
- onClick = { ( ) => {
28
- deleteSessionId ( )
29
- location . pathname = "/"
30
- } } >
31
- < p className = { "text-text-black text-[26px] font-p-extra-bold" } > Logout</ p >
32
- </ DivButton >
33
- </ div >
34
- </ BlurModal >
10
+ < CheckModal
11
+ setModal = { props . setModal }
12
+ checkMessage = { "Logout" }
13
+ cancelMessage = { "Back" }
14
+ onCheck = { ( ) => {
15
+ deleteSessionId ( )
16
+ location . pathname = "/"
17
+ } } >
18
+ < p className = { "text-text-white text-[32px] font-p-semi-bold" } > 이미 로그인중입니다.</ p >
19
+ < p className = { "text-text-white text-[24px] font-p-semi-bold" } > 로그아웃하시겠습니까?</ p >
20
+ </ CheckModal >
35
21
)
36
22
}
Original file line number Diff line number Diff line change
1
+ import { CheckModal } from "./CheckModal" ;
2
+
3
+ export interface NeedLoginModalProps {
4
+ setModal : ( value : JSX . Element | undefined ) => void
5
+ }
6
+
7
+ export const NeedLoginModal = ( props : NeedLoginModalProps ) => {
8
+ return (
9
+ < CheckModal
10
+ setModal = { props . setModal }
11
+ checkMessage = { "Login Page" }
12
+ cancelMessage = { "Back" }
13
+ onCheck = { ( ) => {
14
+ location . pathname = "/auth/login"
15
+ } } >
16
+ < p className = { "text-text-white text-[32px] font-p-semi-bold" } > 로그인이 필요한 서비스입니다.</ p >
17
+ < p className = { "text-text-white text-[24px] font-p-semi-bold" } > 로그인 페이지로 이동하시겠습니까?</ p >
18
+ </ CheckModal >
19
+ )
20
+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import {DivIconButton} from "../button/DivIconButton";
7
7
import { LogoutModal } from "../body/modal/LogoutModal" ;
8
8
import { CurrentPage , PageName } from "../../initializer/CurrentPage" ;
9
9
import { IconTextToast } from "../body/toast/IconTextToast" ;
10
+ import { isLoggedIn , setIsLoggedIn } from "../../module/status/StatusManager" ;
11
+ import { NeedLoginModal } from "../body/modal/NeedLoginModal" ;
10
12
11
13
export const HeaderButtons = ( ) => {
12
14
@@ -29,6 +31,7 @@ export const HeaderButtons = () => {
29
31
method : HttpMethod . GET ,
30
32
url : "/user"
31
33
} ) . then ( ( response ) => {
34
+ setIsLoggedIn ( true ) ;
32
35
if ( CurrentPage . getCurrentPage ( ) == PageName . LOGIN ||
33
36
CurrentPage . getCurrentPage ( ) == PageName . SIGNUP ) {
34
37
setToast (
@@ -54,9 +57,7 @@ export const HeaderButtons = () => {
54
57
className : "rounded-[10px] h-[50px] p-[10px] hover:bg-header-hover animated" ,
55
58
onClick : ( ) => {
56
59
setModal (
57
- < LogoutModal setModal = { setModal } onCancel = { ( ) => {
58
- setModal ( undefined )
59
- } } />
60
+ < LogoutModal setModal = { setModal } />
60
61
)
61
62
}
62
63
}
@@ -83,11 +84,29 @@ export const HeaderButtons = () => {
83
84
}}
84
85
text={"내 포토카드"}
85
86
/>*/ }
86
- < HeaderButton
87
- iconUri = { "/Plus.svg" }
88
- text = { "포토카드 추가" }
89
- gotoPath = { "/add" }
90
- />
87
+ < div
88
+ onClick = { ( event ) => {
89
+ if ( ! isLoggedIn ) {
90
+ event . stopPropagation ( )
91
+ setModal (
92
+ < NeedLoginModal setModal = { setModal } />
93
+ )
94
+ } else {
95
+ location . pathname = "/add"
96
+ }
97
+ } } >
98
+ < DivIconButton
99
+ iconProps = { {
100
+ iconUri : "/Plus.svg" ,
101
+ iconWidth : "20px" ,
102
+ iconHeight : "20px"
103
+ } }
104
+ gap = { "10px" }
105
+ text = { "포토카드 추가" }
106
+ textSize = { "16px" }
107
+ className = { "rounded-[10px] h-[50px] p-[10px] hover:bg-header-hover animated" }
108
+ />
109
+ </ div >
91
110
{ authButton }
92
111
{ modal && modal }
93
112
{ toast && toast }
Original file line number Diff line number Diff line change
1
+ export let isLoggedIn = false ;
2
+
3
+ export let setIsLoggedIn = ( bool : boolean ) => {
4
+ isLoggedIn = bool
5
+ }
You can’t perform that action at this time.
0 commit comments