koel/resources/assets/js/components/screens/ProfileScreen.vue

104 lines
3.5 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
2024-04-04 22:20:42 +00:00
<ScreenBase>
<template #header>
<ScreenHeader>Profile &amp; Preferences</ScreenHeader>
</template>
2022-04-15 14:24:30 +00:00
2024-04-04 22:20:42 +00:00
<Tabs class="-mx-6">
<TabList>
<TabButton
:selected="currentTab === 'profile'"
aria-controls="profilePaneProfile"
@click="currentTab = 'profile'"
>
Profile
</TabButton>
<TabButton
:selected="currentTab === 'preferences'"
aria-controls="profilePanePreferences"
@click="currentTab = 'preferences'"
>
Preferences
</TabButton>
<TabButton
:selected="currentTab === 'themes'"
aria-controls="profilePaneThemes"
@click="currentTab = 'themes'"
>
Themes
</TabButton>
<TabButton
:selected="currentTab === 'integrations'"
aria-controls="profilePaneIntegrations"
@click="currentTab = 'integrations'"
>
Integrations
</TabButton>
<TabButton
:selected="currentTab === 'qr'"
aria-controls="profilePaneQr"
@click="currentTab = 'qr'"
>
<QrCodeIcon :size="16" />
</TabButton>
</TabList>
2024-04-03 14:48:52 +00:00
2024-04-04 22:20:42 +00:00
<TabPanelContainer>
<TabPanel v-show="currentTab === 'profile'" id="profilePaneProfile" aria-labelledby="profilePaneProfile">
<ProfileForm />
</TabPanel>
2024-04-03 14:48:52 +00:00
2024-04-04 22:20:42 +00:00
<TabPanel
v-if="currentTab === 'preferences'"
id="profilePanePreferences"
aria-labelledby="profilePanePreferences"
>
<PreferencesForm />
</TabPanel>
2024-04-03 14:48:52 +00:00
2024-04-04 22:20:42 +00:00
<TabPanel v-if="currentTab === 'themes'" id="profilePaneThemes" aria-labelledby="profilePaneThemes">
<ThemeList />
</TabPanel>
2024-04-03 14:48:52 +00:00
2024-04-04 22:20:42 +00:00
<TabPanel
v-if="currentTab === 'integrations'"
id="profilePaneIntegrations"
aria-labelledby="profilePaneIntegrations"
>
<Integrations />
</TabPanel>
2024-04-03 14:48:52 +00:00
2024-04-04 22:20:42 +00:00
<TabPanel v-if="currentTab === 'qr'" id="profilePaneQr" aria-labelledby="profilePaneQr">
<QRLogin />
</TabPanel>
</TabPanelContainer>
</Tabs>
</ScreenBase>
2022-04-15 14:24:30 +00:00
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
2024-04-03 14:48:52 +00:00
import { QrCodeIcon } from 'lucide-vue-next'
2024-04-03 21:36:29 +00:00
import { defineAsyncComponent, ref, watch } from 'vue'
2024-04-03 14:48:52 +00:00
import { useLocalStorage } from '@/composables'
import ScreenHeader from '@/components/ui/ScreenHeader.vue'
2024-04-04 22:20:42 +00:00
import ScreenBase from '@/components/screens/ScreenBase.vue'
import TabButton from '@/components/ui/tabs/TabButton.vue'
import TabList from '@/components/ui/tabs/TabList.vue'
import TabPanelContainer from '@/components/ui/tabs/TabPanelContainer.vue'
import TabPanel from '@/components/ui/tabs/TabPanel.vue'
import Tabs from '@/components/ui/tabs/Tabs.vue'
2024-04-03 21:36:29 +00:00
const ProfileForm = defineAsyncComponent(() => import('@/components/profile-preferences/ProfileForm.vue'))
const PreferencesForm = defineAsyncComponent(() => import('@/components/profile-preferences/PreferencesForm.vue'))
const ThemeList = defineAsyncComponent(() => import('@/components/profile-preferences/ThemeList.vue'))
const Integrations = defineAsyncComponent(() => import('@/components/profile-preferences/Integrations.vue'))
const QRLogin = defineAsyncComponent(() => import('@/components/profile-preferences/QRLogin.vue'))
2024-04-03 14:48:52 +00:00
const { get, set } = useLocalStorage()
2022-04-15 14:24:30 +00:00
2024-04-03 14:48:52 +00:00
const currentTab = ref(get<'profile' | 'preferences' | 'themes' | 'integrations' | 'qr'>('profileScreenTab', 'profile'))
watch(currentTab, tab => set('profileScreenTab', tab))
</script>