@@ -18,19 +18,20 @@ import { useEffect, useState } from 'react'
18
18
import Tippy from '@tippyjs/react'
19
19
import './pageHeader.css'
20
20
import ReactGA from 'react-ga4'
21
- import { getRandomColor } from '../../../Common'
21
+ import { ReactComponent as ICMediumPaintBucket } from '@IconsV2/ic-medium-paintbucket.svg'
22
+ import { ReactComponent as DropDownIcon } from '@Icons/ic-chevron-down.svg'
23
+ import { ReactComponent as Close } from '@Icons/ic-close.svg'
24
+ import { ReactComponent as Question } from '@Icons/ic-help-outline.svg'
25
+ import { getRandomColor , TippyCustomized , TippyTheme } from '../../../Common'
22
26
import LogoutCard from '../LogoutCard'
23
27
import { setActionWithExpiry , handlePostHogEventUpdate } from './utils'
24
28
import { InstallationType , ServerInfo , PageHeaderType } from './types'
25
29
import { getServerInfo } from './service'
26
30
import GettingStartedCard from '../GettingStartedCard/GettingStarted'
27
31
import { POSTHOG_EVENT_ONBOARDING , MAX_LOGIN_COUNT } from '../../../Common/Constants'
28
32
import HelpNav from './HelpNav'
29
- import { ReactComponent as Question } from '../../../Assets/Icon/ic-help-outline.svg'
30
- import { ReactComponent as Close } from '../../../Assets/Icon/ic-close.svg'
31
- import { ReactComponent as DropDownIcon } from '../../../Assets/Icon/ic-chevron-down.svg'
32
33
import AnnouncementBanner from '../AnnouncementBanner/AnnouncementBanner'
33
- import { useMainContext , useUserEmail } from '../../Providers'
34
+ import { useMainContext , useTheme , useUserEmail } from '../../Providers'
34
35
import { InfoIconTippy } from '../InfoIconTippy'
35
36
import { IframePromoButton } from './IframePromoButton'
36
37
@@ -50,6 +51,8 @@ const PageHeader = ({
50
51
} : PageHeaderType ) => {
51
52
const { loginCount, setLoginCount, showGettingStartedCard, setShowGettingStartedCard, setGettingStartedClicked } =
52
53
useMainContext ( )
54
+ const { showSwitchThemeLocationTippy, handleShowSwitchThemeLocationTippyChange } = useTheme ( )
55
+
53
56
const { isTippyCustomized, tippyRedirectLink, TippyIcon, tippyMessage, onClickTippyButton, additionalContent } =
54
57
tippyProps || { }
55
58
const [ showHelpCard , setShowHelpCard ] = useState ( false )
@@ -120,6 +123,17 @@ const PageHeader = ({
120
123
} )
121
124
}
122
125
126
+ const handleCloseSwitchThemeLocationTippyChange = ( ) => {
127
+ handleShowSwitchThemeLocationTippyChange ( false )
128
+ }
129
+
130
+ const renderThemePreferenceLocationTippyContent = ( ) => (
131
+ < div className = "px-16 pb-16 flexbox-col dc__gap-4" >
132
+ < h6 className = "m-0 fs-14 fw-6 lh-20" > Theme Preference</ h6 >
133
+ < p className = "m-0 fs-13 fw-4 lh-20" > You can change your theme preference here</ p >
134
+ </ div >
135
+ )
136
+
123
137
const renderLogoutHelpSection = ( ) => (
124
138
< >
125
139
< div className = "flex left cursor dc__gap-8" onClick = { onClickHelp } >
@@ -135,14 +149,30 @@ const PageHeader = ({
135
149
/>
136
150
</ div >
137
151
{ ! window . _env_ . K8S_CLIENT && (
138
- < div
139
- className = "logout-card__initial cursor fs-13 icon-dim-24 flex logout-card__initial--nav"
140
- onClick = { onClickLogoutButton }
141
- style = { { backgroundColor : getRandomColor ( email ) } }
142
- data-testid = "profile-button"
152
+ < TippyCustomized
153
+ theme = { TippyTheme . black }
154
+ className = "w-250"
155
+ placement = "bottom"
156
+ visible = { showSwitchThemeLocationTippy }
157
+ Icon = { ICMediumPaintBucket }
158
+ iconClass = "icon-dim-48 dc__no-shrink"
159
+ iconSize = { 48 }
160
+ additionalContent = { renderThemePreferenceLocationTippyContent ( ) }
161
+ showCloseButton
162
+ trigger = "manual"
163
+ interactive
164
+ arrow
165
+ onClose = { handleCloseSwitchThemeLocationTippyChange }
143
166
>
144
- { email [ 0 ] }
145
- </ div >
167
+ < div
168
+ className = "logout-card__initial cursor fs-13 icon-dim-24 flex logout-card__initial--nav"
169
+ onClick = { onClickLogoutButton }
170
+ style = { { backgroundColor : getRandomColor ( email ) } }
171
+ data-testid = "profile-button"
172
+ >
173
+ { email [ 0 ] }
174
+ </ div >
175
+ </ TippyCustomized >
146
176
) }
147
177
</ >
148
178
)
0 commit comments