Skip to content

Commit 9c9b816

Browse files
committed
feat: language and log-in/out in Settings
1 parent d56d18b commit 9c9b816

3 files changed

Lines changed: 96 additions & 57 deletions

File tree

apps/frontend/app/components/chat/ChatSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ const [DefineThreadLiItem, ReuseThreadLiItem] = createReusableTemplate<{ thread:
312312
</DropdownMenuItem>
313313
<GeneralSettingsSheet>
314314
<DropdownMenuItem class="justify-between" @select.prevent>
315-
<div>Settings</div>
315+
<div>{{ $t('settings') }}</div>
316316
<div class="i-hugeicons:settings-01" />
317317
</DropdownMenuItem>
318318
</GeneralSettingsSheet>

apps/frontend/app/components/chat/settings/GeneralSettingsSheet.vue

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,62 @@
22
import {
33
Sheet,
44
SheetContent,
5-
SheetDescription,
65
SheetHeader,
76
SheetTitle,
87
SheetTrigger,
98
} from '@/lib/shadcn/components/ui/sheet'
9+
import { useSidebar } from '~/lib/shadcn/components/ui/sidebar'
10+
11+
const { $auth } = useNuxtApp()
12+
const sidebarContext = useSidebar()
13+
const { locale, locales, setLocale } = useI18n()
14+
const computedNextLocale = computed(() => {
15+
const currentLocaleIndex = locales.value.findIndex(lO => lO.code === locale.value)
16+
return locales.value[(currentLocaleIndex + 1) % locales.value.length]!.code
17+
})
1018
</script>
1119

1220
<template>
1321
<Sheet>
1422
<SheetTrigger as-child>
1523
<slot />
1624
</SheetTrigger>
17-
<SheetContent>
25+
<SheetContent :side="sidebarContext.isMobile.value ? 'top' : 'right'" class="flex flex-col">
1826
<SheetHeader>
19-
<SheetTitle>Are you absolutely sure?</SheetTitle>
20-
<SheetDescription>
21-
This action cannot be undone. This will permanently delete your account
22-
and remove your data from our servers.
23-
</SheetDescription>
27+
<SheetTitle>{{ $t('chat.settings.general.title') }}</SheetTitle>
2428
</SheetHeader>
29+
30+
<div class="flex grow flex-col gap-4">
31+
<div class="flex items-center justify-between">
32+
<div class="flex items-center gap-2">
33+
<Button class="w-fit uppercase" variant="outline" @pointerdown="setLocale(computedNextLocale)">
34+
<div class="flex items-center text-mainGradient">
35+
<div i-hugeicons:translate class="bg-mainGradient" />: <p class="ml-1">
36+
{{ locale.substring(0, 2) }}
37+
</p>
38+
</div>
39+
</Button>
40+
</div>
41+
<div>
42+
<Button v-if="$auth.loggedIn" @click="navigateTo(getSignOutUrl(), { external: true })">
43+
{{
44+
$t('pages.home.auth.signOutButton') }}
45+
</Button>
46+
<Button v-else @click="navigateTo(getSignInUrl(), { external: true })">
47+
{{ $t('pages.home.auth.signInButton')
48+
}}
49+
</Button>
50+
</div>
51+
</div>
52+
53+
<hr>
54+
55+
<div>
56+
<SheetHeader>
57+
<SheetTitle>{{ $t('chat.settings.general.title') }}</SheetTitle>
58+
</SheetHeader>
59+
</div>
60+
</div>
2561
</SheetContent>
2662
</Sheet>
2763
</template>

0 commit comments

Comments
 (0)