@@ -22,7 +22,7 @@ import {
2222 setAnimatedLevel ,
2323} from "../../../states/header" ;
2424import { showModal } from "../../../states/modals" ;
25- import { getSnapshot , MiniSnapshot } from "../../../states/snapshot" ;
25+ import { getSnapshot } from "../../../states/snapshot" ;
2626import { getFocus } from "../../../states/test" ;
2727import { cn } from "../../../utils/cn" ;
2828import { getLevelFromTotalXp } from "../../../utils/levels" ;
@@ -171,12 +171,12 @@ export function Nav(): JSXElement {
171171 </ Button >
172172 < AnimePresence exitBeforeEnter >
173173 < Show
174- when = { getSnapshot ( ) !== undefined }
174+ when = { getSnapshot ( ) }
175175 fallback = {
176176 < Anime
177177 initial = { { opacity : 0 } }
178- animate = { { opacity : 1 , duration : 125 } }
179- exit = { { opacity : 0 , duration : 125 } }
178+ animate = { { opacity : 1 , duration : 1250 } }
179+ exit = { { opacity : 0 , duration : 1250 } }
180180 >
181181 < Show when = { showLoginButton ( ) } >
182182 < Button
@@ -197,71 +197,68 @@ export function Nav(): JSXElement {
197197 </ Anime >
198198 }
199199 >
200- { ( _ ) => {
201- const snap = getSnapshot ( ) as MiniSnapshot ;
202- return (
203- < Anime
204- initial = { { opacity : 0 } }
205- animate = { { opacity : 1 , duration : 125 } }
206- exit = { { opacity : 0 , duration : 125 } }
200+ { ( snap ) => (
201+ < Anime
202+ initial = { { opacity : 0 } }
203+ animate = { { opacity : 1 , duration : 1250 } }
204+ exit = { { opacity : 0 , duration : 1250 } }
205+ >
206+ < div
207+ ref = { accountMenuRef }
208+ class = { cn (
209+ "relative" ,
210+ ! getFocus ( ) &&
211+ "hover:**:data-[ui-element='accountMenu']:pointer-events-auto hover:**:data-[ui-element='accountMenu']:opacity-100" ,
212+ "has-focus-visible:**:data-[ui-element='accountMenu']:pointer-events-auto has-focus-visible:**:data-[ui-element='accountMenu']:opacity-100" ,
213+ getAccountMenuOpen ( ) &&
214+ "**:data-[ui-element='accountMenu']:pointer-events-auto **:data-[ui-element='accountMenu']:opacity-100" ,
215+ ) }
216+ // oxlint-disable-next-line react/no-unknown-property
217+ on :click = { ( e : MouseEvent ) => {
218+ if ( isCoarse ( ) ) {
219+ if ( e . target instanceof HTMLAnchorElement ) {
220+ if ( e . target . dataset [ "navItem" ] === "account" ) {
221+ e . preventDefault ( ) ;
222+ e . stopPropagation ( ) ;
223+ }
224+ setAccountMenuOpen ( ( prev ) => ! prev ) ;
225+ }
226+ }
227+ } }
207228 >
208- < div
209- ref = { accountMenuRef }
229+ < Button
230+ variant = "text"
210231 class = { cn (
211- "relative" ,
212- ! getFocus ( ) &&
213- "hover:**:data-[ui-element='accountMenu']:pointer-events-auto hover:**:data-[ui-element='accountMenu']:opacity-100" ,
214- "has-focus-visible:**:data-[ui-element='accountMenu']:pointer-events-auto has-focus-visible:**:data-[ui-element='accountMenu']:opacity-100" ,
215- getAccountMenuOpen ( ) &&
216- "**:data-[ui-element='accountMenu']:pointer-events-auto **:data-[ui-element='accountMenu']:opacity-100" ,
232+ "h-full" ,
233+ "hover:**:data-[ui-element='userLevel']:bg-(--themable-button-hover-text)" ,
234+ { "opacity-(--nav-focus-opacity)" : getFocus ( ) } ,
217235 ) }
218- // oxlint-disable-next-line react/no-unknown-property
219- on :click = { ( e : MouseEvent ) => {
220- if ( isCoarse ( ) ) {
221- if ( e . target instanceof HTMLAnchorElement ) {
222- if ( e . target . dataset [ "navItem" ] === "account" ) {
223- e . preventDefault ( ) ;
224- e . stopPropagation ( ) ;
225- }
226- setAccountMenuOpen ( ( prev ) => ! prev ) ;
227- }
228- }
236+ href = "/account"
237+ router-link
238+ dataset = { {
239+ "data-nav-item" : "account" ,
229240 } }
230241 >
231- < Button
232- variant = "text"
233- class = { cn (
234- "h-full" ,
235- "hover:**:data-[ui-element='userLevel']:bg-(--themable-button-hover-text)" ,
236- { "opacity-(--nav-focus-opacity)" : getFocus ( ) } ,
237- ) }
238- href = "/account"
239- router-link
240- dataset = { {
241- "data-nav-item" : "account" ,
242- } }
243- >
244- < User
245- user = { snap }
246- showAvatar = { true }
247- iconsOnly = { true }
248- hideNameOnSmallScreens = { true }
249- level = { getAnimatedLevel ( ) }
250- showSpinner = { getAccountButtonSpinner ( ) }
251- showNotificationBubble = { showFriendsNotificationBubble ( ) }
252- fontClass = "text-em-xs"
253- />
254- </ Button >
255- < AccountMenu
256- showFriendsNotificationBubble = { showFriendsNotificationBubble ( ) }
242+ < User
243+ user = { snap ( ) }
244+ showAvatar = { true }
245+ iconsOnly = { true }
246+ hideNameOnSmallScreens = { true }
247+ level = { getAnimatedLevel ( ) }
248+ showSpinner = { getAccountButtonSpinner ( ) }
249+ showNotificationBubble = { showFriendsNotificationBubble ( ) }
250+ fontClass = "text-em-xs"
257251 />
258- </ div >
259- < div class = "relative" >
260- < AccountXpBar />
261- </ div >
262- </ Anime >
263- ) ;
264- } }
252+ </ Button >
253+ < AccountMenu
254+ showFriendsNotificationBubble = { showFriendsNotificationBubble ( ) }
255+ />
256+ </ div >
257+ < div class = "relative" >
258+ < AccountXpBar />
259+ </ div >
260+ </ Anime >
261+ ) }
265262 </ Show >
266263 </ AnimePresence >
267264 </ nav >
0 commit comments