@@ -39,6 +39,21 @@ const navLinks = links.map((link) => {
3939    ... link  
4040  } 
4141}) 
42+ const =  ref (false )
43+ const =  ref (false )
44+ onMounted (async  () =>  {
45+   const =  import .meta .dev  ?  ' http://localhost:3000/api/authenticated' :  ' https://admin.hub.nuxt.com/api/authenticated'  
46+   await  $fetch (endpoint , { 
47+     credentials: ' include'  
48+   }).then ((state :  { authenticated:  boolean  }) =>  { 
49+     authenticated .value  =  state .authenticated  
50+   }).catch (() =>  { 
51+     authenticated .value  =  false  
52+   }) 
53+   nextTick (() =>  { 
54+     ready .value  =  true  
55+   }) 
56+ }) 
4257script >
4358
4459<template >
@@ -51,19 +66,24 @@ const navLinks = links.map((link) => {
5166    </template >
5267
5368    <template  #right >
54-       <UTooltip  text =" Search" :shortcuts =" [metaSymbol, 'K']" :popper =" { strategy: 'absolute' }" 
55-         <UContentSearchButton  :label =" null" 
56-       </UTooltip >
57-       <UButton  variant =" ghost" label =" Log in" to =" https://admin.hub.nuxt.com/" color =" black" class =" hidden sm:block" external  />
58-       <UButton  variant =" solid" label =" Sign up" to =" https://admin.hub.nuxt.com/" class =" hidden sm:block" external  />
69+       <div  class =" flex items-center gap-1.5 transition-opacity duration-300" :class =" [ready ? 'opacity-100' : 'opacity-0']" 
70+         <UTooltip  text =" Search" :shortcuts =" [metaSymbol, 'K']" :popper =" { strategy: 'absolute' }" 
71+           <UContentSearchButton  :label =" null" 
72+         </UTooltip >
73+         <UButton  v-if =" ready && !authenticated" size =" sm" variant =" ghost" label =" Log in" to =" https://admin.hub.nuxt.com/" color =" black" class =" hidden sm:inline-flex" external  />
74+         <UButton  v-if =" ready && !authenticated" size =" sm" variant =" solid" label =" Sign up" to =" https://admin.hub.nuxt.com/" class =" hidden sm:inline-flex" external  />
75+         <UButton  v-if =" ready && authenticated" size =" sm" icon =" i-ph-app-window-duotone" label =" Dashboard" to =" https://admin.hub.nuxt.com/" color =" black" class =" hidden sm:inline-flex" external  />
76+       </div >
5977    </template >
6078
6179    <template  #panel >
62-       <UNavigationTree  :links =" navLinks" : default-open= " 1 " :multiple =" false" :ui =" { accordion: { button: { label: 'font-normal' } } }" 
80+       <UNavigationTree  :links =" navLinks" default-open  :multiple =" false" :ui =" { accordion: { button: { label: 'font-normal' } } }" 
6381
6482      <div  class =" flex flex-col gap-y-2 mt-4" 
65-         <UButton  variant =" solid" label =" Log in" to =" https://admin.hub.nuxt.com/" color =" white" class =" flex justify-center sm:hidden" external  />
66-         <UButton  variant =" solid" label =" Sign up" to =" https://admin.hub.nuxt.com/" class =" flex justify-center text-gray-900 bg-primary sm:hidden" external  />
83+         <UDivider  class =" mb-4" 
84+         <UButton  v-if =" ready && !authenticated" variant =" solid" label =" Log in" to =" https://admin.hub.nuxt.com/" color =" white" class =" flex justify-center sm:hidden" external  />
85+         <UButton  v-if =" ready && !authenticated" variant =" solid" label =" Sign up" to =" https://admin.hub.nuxt.com/" class =" flex justify-center text-gray-900 bg-primary sm:hidden" external  />
86+         <UButton  v-if =" ready && authenticated" variant =" solid" color =" black" icon =" i-ph-app-window-duotone" label =" Dashboard" to =" https://admin.hub.nuxt.com/" class =" flex justify-center text-gray-900 bg-primary sm:hidden" external  />
6787      </div >
6888    </template >
6989  </UHeader >
0 commit comments