mirror of
https://github.com/Gimanh/taskview-community.git
synced 2026-09-11 21:38:56 +00:00
fix: init loading
This commit is contained in:
@@ -5,12 +5,6 @@
|
||||
:ui="{ content: collapsed ? 'w-48' : 'w-(--reka-dropdown-menu-trigger-width)', group: 'max-h-screen' }"
|
||||
>
|
||||
<UButton
|
||||
v-bind="{
|
||||
...user,
|
||||
label: collapsed ? undefined : user?.name,
|
||||
description: collapsed ? undefined : user?.description,
|
||||
trailingIcon: collapsed ? undefined : 'i-lucide-chevrons-up-down'
|
||||
}"
|
||||
color="neutral"
|
||||
variant="ghost"
|
||||
block
|
||||
@@ -19,7 +13,18 @@
|
||||
:ui="{
|
||||
trailingIcon: 'text-dimmed'
|
||||
}"
|
||||
/>
|
||||
>
|
||||
<template #leading>
|
||||
<UAvatar :src="user.avatar.src" :alt="user.avatar.alt" size="2xs" />
|
||||
</template>
|
||||
<div v-if="!collapsed" class="flex flex-col items-start text-left truncate flex-1">
|
||||
<span class="truncate text-sm font-medium">{{ user.name }}</span>
|
||||
<span class="truncate text-xs text-dimmed">{{ user.description }}</span>
|
||||
</div>
|
||||
<template v-if="!collapsed" #trailing>
|
||||
<UIcon name="i-lucide-chevrons-up-down" class="size-4 text-dimmed" />
|
||||
</template>
|
||||
</UButton>
|
||||
|
||||
<template #chip-leading="{ item }">
|
||||
<div class="inline-flex items-center justify-center shrink-0 size-5">
|
||||
@@ -111,8 +116,8 @@ async function handleLogout() {
|
||||
}
|
||||
|
||||
const user = computed(() => ({
|
||||
name: orgStore.currentOrg?.name || userStore.email || userStore.login,
|
||||
description: orgStore.currentOrg ? (userStore.email || userStore.login) : undefined,
|
||||
name: orgStore.currentOrg?.name || userStore.login || userStore.email,
|
||||
description: userStore.email || userStore.login,
|
||||
avatar: {
|
||||
src: avatarImg,
|
||||
alt: userStore.email || userStore.login,
|
||||
|
||||
@@ -36,9 +36,6 @@ const { goals } = storeToRefs(goalsStore)
|
||||
const activeProjects = computed(() => goals.value.filter(p => p.archive === 0))
|
||||
const archivedProjects = computed(() => goals.value.filter(p => p.archive === 1))
|
||||
|
||||
onMounted(async () => {
|
||||
await goalsStore.fetchGoals()
|
||||
})
|
||||
|
||||
watch(() => orgStore.currentOrg, async () => {
|
||||
goalsStore.initialized = false
|
||||
|
||||
@@ -1,39 +1,41 @@
|
||||
<template>
|
||||
<UDashboardGroup
|
||||
unit="rem"
|
||||
storage="local"
|
||||
class="UDashboardGroup-test"
|
||||
>
|
||||
<UDashboardSidebar
|
||||
id="default"
|
||||
v-model:open="isSidebarOpen"
|
||||
:default-size="20"
|
||||
class="bg-elevated/25"
|
||||
:class="isSidebarCollapsed ? 'overflow-hidden min-w-0 w-0 transition-[width] duration-200 linear' : 'transition-[width] duration-200 linear'"
|
||||
:ui="{ footer: 'lg:border-t lg:border-default' }"
|
||||
<template v-if="orgStore.initialized">
|
||||
<UDashboardGroup
|
||||
unit="rem"
|
||||
storage="local"
|
||||
class="UDashboardGroup-test"
|
||||
>
|
||||
<div class="flex items-center justify-between px-1 gap-2">
|
||||
<TvGoalLikeItem
|
||||
to="/user"
|
||||
variant="taskview"
|
||||
class="flex-1"
|
||||
>
|
||||
{{ t('main') }}
|
||||
</TvGoalLikeItem>
|
||||
<NotificationBell />
|
||||
</div>
|
||||
<UDashboardSidebar
|
||||
id="default"
|
||||
v-model:open="isSidebarOpen"
|
||||
:default-size="20"
|
||||
class="bg-elevated/25"
|
||||
:class="isSidebarCollapsed ? 'overflow-hidden min-w-0 w-0 transition-[width] duration-200 linear' : 'transition-[width] duration-200 linear'"
|
||||
:ui="{ footer: 'lg:border-t lg:border-default' }"
|
||||
>
|
||||
<div class="flex items-center justify-between px-1 gap-2">
|
||||
<TvGoalLikeItem
|
||||
to="/user"
|
||||
variant="taskview"
|
||||
class="flex-1"
|
||||
>
|
||||
{{ t('main') }}
|
||||
</TvGoalLikeItem>
|
||||
<NotificationBell />
|
||||
</div>
|
||||
|
||||
<ProjectsSidebar />
|
||||
<ProjectsSidebar />
|
||||
|
||||
<template #footer="{ collapsed }">
|
||||
<UserMenu :collapsed="collapsed" />
|
||||
</template>
|
||||
</UDashboardSidebar>
|
||||
<template #footer="{ collapsed }">
|
||||
<UserMenu :collapsed="collapsed" />
|
||||
</template>
|
||||
</UDashboardSidebar>
|
||||
|
||||
<RouterView />
|
||||
</UDashboardGroup>
|
||||
<RouterView />
|
||||
</UDashboardGroup>
|
||||
|
||||
<TvMobileBottomNav />
|
||||
<TvMobileBottomNav />
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -104,6 +106,7 @@ onMounted(async () => {
|
||||
|
||||
await orgStore.fetchOrganizations()
|
||||
orgStore.restoreCurrentOrg()
|
||||
await goalsStore.fetchGoals()
|
||||
|
||||
await CapacitorUpdater.notifyAppReady()
|
||||
console.log('notifyAppReady', APP_VERSION)
|
||||
|
||||
@@ -8,6 +8,7 @@ export const useOrganizationStore = defineStore('organization', () => {
|
||||
const currentOrg = ref<Organization | null>(null)
|
||||
const members = ref<OrgMember[]>([])
|
||||
const loading = ref(false)
|
||||
const initialized = ref(false)
|
||||
|
||||
async function fetchOrganizations() {
|
||||
loading.value = true
|
||||
@@ -125,6 +126,7 @@ export const useOrganizationStore = defineStore('organization', () => {
|
||||
} else if (organizations.value.length) {
|
||||
currentOrg.value = organizations.value[0]
|
||||
}
|
||||
initialized.value = true
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -132,6 +134,7 @@ export const useOrganizationStore = defineStore('organization', () => {
|
||||
currentOrg,
|
||||
members,
|
||||
loading,
|
||||
initialized,
|
||||
fetchOrganizations,
|
||||
createOrganization,
|
||||
updateOrganization,
|
||||
|
||||
Reference in New Issue
Block a user