App.vue
1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<script setup>
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { Button, ToastHost } from '@drama/ui'
import { session, setToken } from './api.js'
import LoginModal from './LoginModal.vue'
const { t } = useI18n()
const router = useRouter()
function logout() {
setToken(null)
router.push('/')
}
</script>
<template>
<header class="voko-top">
<router-link to="/" class="voko-brand">VOKO</router-link>
<nav class="voko-top-nav" :aria-label="t('nav.label')">
<template v-if="session.loggedIn">
<router-link to="/agents">{{ t('agents.title') }}</router-link>
<Button variant="ghost" @click="logout">{{ t('nav.logout') }}</Button>
</template>
<template v-else>
<Button variant="ghost" @click="router.push({ path: '/login', query: { next: '/agents' } })">{{ t('nav.login') }}</Button>
<Button @click="router.push({ path: '/login', query: { next: '/agents' } })">{{ t('nav.connect') }}</Button>
</template>
</nav>
</header>
<main class="voko-shell">
<router-view />
<ToastHost />
</main>
<LoginModal />
</template>
<style>
body {
margin: 0;
background: var(--drama-color-bg);
color: var(--drama-color-text);
}
.voko-top {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 1040px;
margin: 0 auto;
padding: var(--drama-space-md) var(--drama-space-md) 0;
}
.voko-brand {
font-weight: 800;
font-size: var(--drama-font-size-lg, 1.25rem);
letter-spacing: 0.08em;
text-decoration: none;
color: inherit;
}
.voko-top-nav {
display: flex;
align-items: center;
gap: var(--drama-space-md);
}
.voko-shell {
max-width: 1040px;
margin: 0 auto;
padding: var(--drama-space-md) var(--drama-space-md) var(--drama-space-xl);
}
.voko-field {
display: flex;
flex-direction: column;
gap: var(--drama-space-sm);
margin-bottom: var(--drama-space-md);
}
</style>