1
- import { useState } from "react"
2
1
import {
3
2
IonAvatar ,
4
3
IonButton ,
@@ -17,12 +16,14 @@ import { useQuery } from "@tanstack/react-query"
17
16
import { cogOutline , eye , hourglass , library } from "ionicons/icons"
18
17
import { FullpageInfo , FullpageLoading , StatDisplay } from "../components"
19
18
import { getProfile , IProfile } from "../api"
20
- import { Settings } from "../modal"
21
19
import { useAuth } from "../hooks"
22
20
import "./Profile.css"
23
21
24
- const ProfilePage : React . FC < { hasUpdate : boolean } > = ( { hasUpdate } ) => {
25
- const [ openSettingsDialog , setOpenSettingsDialog ] = useState < boolean > ( false )
22
+ interface Props {
23
+ openSettings : React . Dispatch < React . SetStateAction < boolean > >
24
+ }
25
+
26
+ const ProfilePage : React . FC < Props > = ( { openSettings } ) => {
26
27
const betaBanner = import . meta. env . VITE_BETA_BANNER
27
28
28
29
const [ { username, token } , saveAuth , clearAuth ] = useAuth ( )
@@ -39,7 +40,7 @@ const ProfilePage: React.FC<{ hasUpdate: boolean }> = ({ hasUpdate }) => {
39
40
< IonContent fullscreen >
40
41
< IonHeader translucent >
41
42
< IonToolbar >
42
- < IonButton fill = "clear" size = "large" slot = "end" onClick = { ( ) => setOpenSettingsDialog ( true ) } >
43
+ < IonButton fill = "clear" size = "large" slot = "end" onClick = { ( ) => openSettings ( true ) } >
43
44
< IonIcon icon = { cogOutline } > </ IonIcon >
44
45
</ IonButton >
45
46
</ IonToolbar >
@@ -48,13 +49,6 @@ const ProfilePage: React.FC<{ hasUpdate: boolean }> = ({ hasUpdate }) => {
48
49
text = { isError ? "An error occurred when loading information." : "You are not logged in." }
49
50
/>
50
51
</ IonContent >
51
-
52
- < Settings
53
- open = { openSettingsDialog }
54
- hasUpdate = { hasUpdate }
55
- onClose = { ( ) => setOpenSettingsDialog ( false ) }
56
- onSave = { ( ) => setOpenSettingsDialog ( false ) }
57
- />
58
52
</ IonPage >
59
53
)
60
54
}
@@ -75,7 +69,7 @@ const ProfilePage: React.FC<{ hasUpdate: boolean }> = ({ hasUpdate }) => {
75
69
< div className = "avatar-background" style = { { backgroundImage : `url(${ data ?. banner_url } )` } } >
76
70
< IonHeader translucent >
77
71
< IonToolbar >
78
- < IonButton fill = "clear" size = "large" slot = "end" onClick = { ( ) => setOpenSettingsDialog ( true ) } >
72
+ < IonButton fill = "clear" size = "large" slot = "end" onClick = { ( ) => openSettings ( true ) } >
79
73
< IonIcon icon = { cogOutline } > </ IonIcon >
80
74
</ IonButton >
81
75
</ IonToolbar >
@@ -108,13 +102,6 @@ const ProfilePage: React.FC<{ hasUpdate: boolean }> = ({ hasUpdate }) => {
108
102
/>
109
103
</ div >
110
104
</ IonContent >
111
-
112
- < Settings
113
- open = { openSettingsDialog }
114
- hasUpdate = { hasUpdate }
115
- onClose = { ( ) => setOpenSettingsDialog ( false ) }
116
- onSave = { ( ) => setOpenSettingsDialog ( false ) }
117
- />
118
105
</ IonPage >
119
106
)
120
107
}
0 commit comments