fix: tapping on avatar should show switcher on mobile

This commit is contained in:
Daniel Roe 2022-11-27 22:57:20 +00:00
parent 9687330dd4
commit 834eca2ad2
No known key found for this signature in database
GPG key ID: 22D5008E4F5D9B55
2 changed files with 2 additions and 11 deletions

View file

@ -24,7 +24,7 @@ const nav = ref<HTMLDivElement>()
</div> </div>
<div flex items-center> <div flex items-center>
<slot name="actions" /> <slot name="actions" />
<NavUser v-if="isSmallScreen" :nav="nav" /> <NavUser v-if="isSmallScreen" />
</div> </div>
</div> </div>
<slot name="header" /> <slot name="header" />

View file

@ -4,16 +4,7 @@ import type { ComponentPublicInstance } from 'vue'
const avatar = ref<ComponentPublicInstance>() const avatar = ref<ComponentPublicInstance>()
const switcher = ref() const switcher = ref()
const router = useRouter()
const goProfile = () => {
router.push(`/@${currentUser.value!.account.username}`)
}
let showSwitcher = $ref(false) let showSwitcher = $ref(false)
onLongPress(avatar, () => {
showSwitcher = true
})
onClickOutside(avatar, () => { onClickOutside(avatar, () => {
showSwitcher = false showSwitcher = false
@ -26,6 +17,7 @@ onClickOutside(avatar, () => {
v-model:shown="showSwitcher" v-model:shown="showSwitcher"
:triggers="[]" :triggers="[]"
:auto-hide="false" :auto-hide="false"
@click="showSwitcher = true"
> >
<div style="-webkit-touch-callout: none;"> <div style="-webkit-touch-callout: none;">
<AccountAvatar <AccountAvatar
@ -33,7 +25,6 @@ onClickOutside(avatar, () => {
:account="currentUser.account" :account="currentUser.account"
h="2em" h="2em"
:draggable="false" :draggable="false"
@click.stop="goProfile"
/> />
</div> </div>