extract Login out of Support.vue as its own dialog; add copy button and reminder to save key
This commit is contained in:
parent
8b3f1aa14b
commit
ed1b4cb22a
3 changed files with 126 additions and 81 deletions
|
|
@ -7,12 +7,15 @@ import { useTheme } from '@/components/theme-provider'
|
|||
import { useNostrStore } from '@/stores/nostr'
|
||||
import { useRouter } from 'vue-router'
|
||||
import LogoutDialog from '@/components/ui/logout-dialog/LogoutDialog.vue'
|
||||
import Login from '@/components/Login.vue'
|
||||
import { Dialog, DialogContent } from '@/components/ui/dialog'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const { theme, setTheme } = useTheme()
|
||||
const nostrStore = useNostrStore()
|
||||
const router = useRouter()
|
||||
const isOpen = ref(false)
|
||||
const showLoginDialog = ref(false)
|
||||
|
||||
const navigation = computed(() => [
|
||||
{ name: t('nav.home'), href: '/' },
|
||||
|
|
@ -37,8 +40,13 @@ const toggleLocale = () => {
|
|||
localStorage.setItem('locale', newLocale)
|
||||
}
|
||||
|
||||
const handleLogout = () => {
|
||||
nostrStore.logout()
|
||||
const handleLogout = async () => {
|
||||
await nostrStore.logout()
|
||||
router.push('/')
|
||||
}
|
||||
|
||||
const openLogin = () => {
|
||||
showLoginDialog.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -79,7 +87,8 @@ const handleLogout = () => {
|
|||
<template v-if="nostrStore.isLoggedIn">
|
||||
<LogoutDialog :onLogout="handleLogout" />
|
||||
</template>
|
||||
<Button v-else variant="ghost" size="icon" @click="router.push('/support')" class="text-muted-foreground hover:text-foreground">
|
||||
<Button v-else variant="ghost" size="icon" @click="openLogin"
|
||||
class="text-muted-foreground hover:text-foreground">
|
||||
<LogIn class="h-5 w-5" />
|
||||
</Button>
|
||||
|
||||
|
|
@ -108,4 +117,11 @@ const handleLogout = () => {
|
|||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Login Dialog -->
|
||||
<Dialog v-model:open="showLoginDialog">
|
||||
<DialogContent class="sm:max-w-md">
|
||||
<Login @success="showLoginDialog = false" />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue