feat: account switcher sidebar (#460)
* feat: account switcher sidebar * fix: defer loading sidebar until masto initialised * fix: only show user switcher for 2 or more accounts * chore: use `ofetch` (newer version of `ohymfetch`) * chore: early alpha warning * fix: handle missing user in github preview * refactor: avoid circular auto-import Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
parent
15b59ae9b9
commit
cd85871d01
11 changed files with 78 additions and 25 deletions
|
@ -1,14 +1,38 @@
|
|||
<template>
|
||||
<div h-full :class="{ zen: isZenMode }">
|
||||
<main flex w-full mxa lg:max-w-80rem>
|
||||
<div v-if="isMastoInitialised" v-show="showUserSwitcherSidebar" fixed h-full hidden md:block bg-code border-r-1 border-base>
|
||||
<UserPicker />
|
||||
</div>
|
||||
<main flex w-full mxa lg:max-w-80rem :class="isMastoInitialised && showUserSwitcherSidebar ? 'md:pl-20' : ''">
|
||||
<aside class="hidden md:block w-1/4 zen-hide" relative>
|
||||
<div sticky top-0 h-screen flex="~ col">
|
||||
<slot name="left">
|
||||
<NavTitle mx3 mt4 mb2 self-start />
|
||||
<div flex="~ col" overflow-y-auto>
|
||||
<NavSide />
|
||||
<PublishButton v-if="isMastoInitialised && currentUser" m5 />
|
||||
<div flex-auto />
|
||||
<div flex="~ col" overflow-y-auto justify-between h-full>
|
||||
<div flex flex-col>
|
||||
<NavSide />
|
||||
<PublishButton v-if="isMastoInitialised && currentUser" m5 />
|
||||
</div>
|
||||
<div flex flex-col>
|
||||
<UserSignInEntry v-if="isMastoInitialised && !currentUser" />
|
||||
<div v-if="isMastoInitialised && currentUser" py6 px4 w-full flex="~" items-center justify-between>
|
||||
<NuxtLink
|
||||
p2 rounded-full text-start w-full
|
||||
hover:bg-active cursor-pointer transition-100
|
||||
:to="getAccountRoute(currentUser.account)"
|
||||
>
|
||||
<AccountInfo :account="currentUser.account" md:break-words />
|
||||
</NuxtLink>
|
||||
<VDropdown :distance="0" placement="bottom-end">
|
||||
<button btn-action-icon :aria-label="$t('action.switch_account')">
|
||||
<div i-ri:more-2-line />
|
||||
</button>
|
||||
<template #popper="{ hide }">
|
||||
<UserSwitcher @click="hide" />
|
||||
</template>
|
||||
</VDropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
|
@ -23,28 +47,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<aside class="hidden md:none lg:block w-1/4 zen-hide">
|
||||
<div sticky top-0 h-screen flex="~ col">
|
||||
<div sticky top-0 h-screen flex="~ col" py3>
|
||||
<slot name="right">
|
||||
<SearchWidget v-if="isMastoInitialised" />
|
||||
<UserSignInEntry v-if="isMastoInitialised && !currentUser" />
|
||||
<div v-if="isMastoInitialised && currentUser" py6 px4 w-full flex="~" items-center justify-between>
|
||||
<NuxtLink
|
||||
p2 rounded-full text-start w-full
|
||||
hover:bg-active cursor-pointer transition-100
|
||||
:to="getAccountRoute(currentUser.account)"
|
||||
>
|
||||
<AccountInfo :account="currentUser.account" md:break-words />
|
||||
</NuxtLink>
|
||||
<VDropdown :distance="0" placement="bottom-end">
|
||||
<button btn-action-icon :aria-label="$t('action.switch_account')">
|
||||
<div i-ri:more-2-line />
|
||||
</button>
|
||||
<template #popper="{ hide }">
|
||||
<UserSwitcher @click="hide" />
|
||||
</template>
|
||||
</VDropdown>
|
||||
</div>
|
||||
|
||||
<div flex-auto />
|
||||
<NavFooter />
|
||||
</slot>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue