|
|
@ -1,6 +1,5 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { navigateTo } from '#app' |
|
|
|
import { computed, navigateTo, ref, useGlobal, useNuxtApp, useProject, useRoute } from '#imports' |
|
|
|
import { computed, useGlobal, useRoute } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { signOut, signedIn, isLoading, user } = useGlobal() |
|
|
|
const { signOut, signedIn, isLoading, user } = useGlobal() |
|
|
|
|
|
|
|
|
|
|
@ -10,85 +9,96 @@ const route = useRoute() |
|
|
|
|
|
|
|
|
|
|
|
const email = computed(() => user.value?.email ?? '---') |
|
|
|
const email = computed(() => user.value?.email ?? '---') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const hasSider = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sidebar = ref<HTMLDivElement>() |
|
|
|
|
|
|
|
|
|
|
|
const logout = () => { |
|
|
|
const logout = () => { |
|
|
|
signOut() |
|
|
|
signOut() |
|
|
|
navigateTo('/signin') |
|
|
|
navigateTo('/signin') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { hooks } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** when page suspensions have finished, check if a sidebar element was teleported into the layout */ |
|
|
|
|
|
|
|
hooks.hook('page:finish', () => { |
|
|
|
|
|
|
|
if (sidebar.value) { |
|
|
|
|
|
|
|
hasSider.value = sidebar.value?.children.length > 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<a-layout id="nc-app" has-sider> |
|
|
|
<a-layout id="nc-app" has-sider> |
|
|
|
<div id="nc-sidebar-left" /> |
|
|
|
<Transition name="slide"> |
|
|
|
|
|
|
|
<div v-show="hasSider" id="nc-sidebar-left" ref="sidebar" /> |
|
|
|
|
|
|
|
</Transition> |
|
|
|
|
|
|
|
|
|
|
|
<a-layout class="!flex-col"> |
|
|
|
<a-layout class="!flex-col"> |
|
|
|
<Transition name="layout"> |
|
|
|
<a-layout-header |
|
|
|
<a-layout-header |
|
|
|
v-if="!route.meta.public && signedIn && !route.meta.hideHeader" |
|
|
|
v-if="!route.meta.public && signedIn && !route.meta.hideHeader" |
|
|
|
class="flex !bg-primary items-center text-white pl-4 pr-5 shadow-lg" |
|
|
|
class="flex !bg-primary items-center text-white pl-4 pr-5 shadow-lg" |
|
|
|
> |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
v-if="route.name === 'index' || route.name === 'project-index-create' || route.name === 'project-index-create-external'" |
|
|
|
|
|
|
|
class="transition-all duration-200 p-2 cursor-pointer transform hover:scale-105 nc-noco-brand-icon" |
|
|
|
|
|
|
|
@click="navigateTo('/')" |
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<img width="35" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" /> |
|
|
|
v-if=" |
|
|
|
</div> |
|
|
|
route.name === 'index' || route.name === 'project-index-create' || route.name === 'project-index-create-external' |
|
|
|
|
|
|
|
" |
|
|
|
|
|
|
|
class="transition-all duration-200 p-2 cursor-pointer transform hover:scale-105 nc-noco-brand-icon" |
|
|
|
|
|
|
|
@click="navigateTo('/')" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<img width="35" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" /> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="!text-white flex justify-center"> |
|
|
|
<div class="!text-white flex justify-center"> |
|
|
|
<div v-show="isLoading" class="flex items-center gap-2 ml-3"> |
|
|
|
<div v-show="isLoading" class="flex items-center gap-2 ml-3"> |
|
|
|
{{ $t('general.loading') }} |
|
|
|
{{ $t('general.loading') }} |
|
|
|
|
|
|
|
|
|
|
|
<MdiReload :class="{ 'animate-infinite animate-spin': isLoading }" /> |
|
|
|
<MdiReload :class="{ 'animate-infinite animate-spin': isLoading }" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="flex-1" /> |
|
|
|
<div class="flex-1" /> |
|
|
|
|
|
|
|
|
|
|
|
<GeneralReleaseInfo /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<GeneralShareBaseButton v-if="!isSharedBase" /> |
|
|
|
<GeneralReleaseInfo /> |
|
|
|
|
|
|
|
|
|
|
|
<a-tooltip placement="bottom" :mouse-enter-delay="1"> |
|
|
|
<GeneralShareBaseButton v-if="!isSharedBase" /> |
|
|
|
<template #title> Switch language</template> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="flex pr-4 items-center text-white"> |
|
|
|
<a-tooltip placement="bottom" :mouse-enter-delay="1"> |
|
|
|
<GeneralLanguage class="cursor-pointer text-2xl hover:text-accent" /> |
|
|
|
<template #title> Switch language</template> |
|
|
|
</div> |
|
|
|
|
|
|
|
</a-tooltip> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<template v-if="signedIn && !isSharedBase"> |
|
|
|
<div class="flex pr-4 items-center text-white"> |
|
|
|
<a-dropdown :trigger="['click']"> |
|
|
|
<GeneralLanguage class="cursor-pointer text-2xl hover:text-accent" /> |
|
|
|
<MdiDotsVertical class="md:text-xl cursor-pointer hover:text-accent nc-menu-accounts text-white" @click.prevent /> |
|
|
|
</div> |
|
|
|
|
|
|
|
</a-tooltip> |
|
|
|
<template #overlay> |
|
|
|
|
|
|
|
<a-menu class="!py-0 leading-8 !rounded"> |
|
|
|
<template v-if="signedIn && !isSharedBase"> |
|
|
|
<a-menu-item key="0" class="!rounded-t"> |
|
|
|
<a-dropdown :trigger="['click']"> |
|
|
|
<nuxt-link v-t="['c:navbar:user:email']" class="nc-project-menu-item group !no-underline" to="/user"> |
|
|
|
<MdiDotsVertical class="md:text-xl cursor-pointer hover:text-accent nc-menu-accounts text-white" @click.prevent /> |
|
|
|
<MdiAt class="mt-1 group-hover:text-accent" /> |
|
|
|
|
|
|
|
|
|
|
|
<template #overlay> |
|
|
|
<span class="prose group-hover:text-primary"> {{ email }}</span> |
|
|
|
<a-menu class="!py-0 leading-8 !rounded"> |
|
|
|
</nuxt-link> |
|
|
|
<a-menu-item key="0" class="!rounded-t"> |
|
|
|
</a-menu-item> |
|
|
|
<nuxt-link v-t="['c:navbar:user:email']" class="nc-project-menu-item group !no-underline" to="/user"> |
|
|
|
|
|
|
|
<MdiAt class="mt-1 group-hover:text-accent" /> |
|
|
|
<a-menu-divider class="!m-0" /> |
|
|
|
|
|
|
|
|
|
|
|
<span class="prose group-hover:text-primary"> {{ email }}</span> |
|
|
|
<a-menu-item key="1" class="!rounded-b group"> |
|
|
|
</nuxt-link> |
|
|
|
<div v-t="['a:navbar:user:sign-out']" class="nc-project-menu-item group" @click="logout"> |
|
|
|
</a-menu-item> |
|
|
|
<MdiLogout class="group-hover:text-accent" /> |
|
|
|
|
|
|
|
|
|
|
|
<a-menu-divider class="!m-0" /> |
|
|
|
<span class="prose group-hover:text-primary"> |
|
|
|
|
|
|
|
{{ $t('general.signOut') }} |
|
|
|
<a-menu-item key="1" class="!rounded-b group"> |
|
|
|
</span> |
|
|
|
<div v-t="['a:navbar:user:sign-out']" class="nc-project-menu-item group" @click="logout"> |
|
|
|
</div> |
|
|
|
<MdiLogout class="group-hover:text-accent" /> |
|
|
|
</a-menu-item> |
|
|
|
|
|
|
|
</a-menu> |
|
|
|
<span class="prose group-hover:text-primary"> |
|
|
|
</template> |
|
|
|
{{ $t('general.signOut') }} |
|
|
|
</a-dropdown> |
|
|
|
</span> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</a-layout-header> |
|
|
|
</a-menu-item> |
|
|
|
</Transition> |
|
|
|
</a-menu> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</a-dropdown> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</a-layout-header> |
|
|
|
|
|
|
|
|
|
|
|
<a-tooltip placement="bottom"> |
|
|
|
<a-tooltip placement="bottom"> |
|
|
|
<template #title> Switch language</template> |
|
|
|
<template #title> Switch language</template> |
|
|
|