From 32cf6c2e3dce467848b8ee8166a9dd342bb59ff9 Mon Sep 17 00:00:00 2001 From: upsiflu Date: Sat, 14 Dec 2024 19:23:29 +0100 Subject: [PATCH] feat(ui): [WIP] use new Ui components for user menu in sidebar --- front/src/components/common/ActorAvatar.vue | 2 +- front/src/components/ui/Popover.vue | 6 + .../src/components/ui/popover/PopoverItem.vue | 4 + front/src/ui/components/Sidebar.vue | 23 +-- front/src/ui/components/UserMenu.vue | 156 ++++++++++++++++++ 5 files changed, 171 insertions(+), 20 deletions(-) create mode 100644 front/src/ui/components/UserMenu.vue diff --git a/front/src/components/common/ActorAvatar.vue b/front/src/components/common/ActorAvatar.vue index bd52ac226..1d86d41fc 100644 --- a/front/src/components/common/ActorAvatar.vue +++ b/front/src/components/common/ActorAvatar.vue @@ -5,7 +5,7 @@ import { hashCode, intToRGB } from '~/utils/color' import { computed } from 'vue' interface Props { - actor: Actor + actor: { full_username : string; preferred_username?:string; icon?:Actor["icon"] } } const props = defineProps() diff --git a/front/src/components/ui/Popover.vue b/front/src/components/ui/Popover.vue index 08ea68ab3..4eb1c3184 100644 --- a/front/src/components/ui/Popover.vue +++ b/front/src/components/ui/Popover.vue @@ -36,6 +36,12 @@ const { width: popoverWidth, height: popoverHeight } = useElementBounding(popove whenever(open, update, { immediate: true }) const { width: screenWidth, height: screenHeight } = useScreenSize() + +// TODO (basic functionality): +// - I can't operate the popup with a keyboard. Remove barrier for people not using a mouse (A11y) +// - Switching to submenus is error-prone. When moving cursor into freshly opened submenu, it should not close if the cursor crosses another menu item +// - Large menus disappear. When menus get big, they need to scroll. + const position = computed(() => { if (positioning === 'vertical' || isMobile.value) { let offsetTop = top.value + height.value diff --git a/front/src/components/ui/popover/PopoverItem.vue b/front/src/components/ui/popover/PopoverItem.vue index c8150ef3b..db65b51de 100644 --- a/front/src/components/ui/popover/PopoverItem.vue +++ b/front/src/components/ui/popover/PopoverItem.vue @@ -25,3 +25,7 @@ emit('internal:id', id) + + diff --git a/front/src/ui/components/Sidebar.vue b/front/src/ui/components/Sidebar.vue index f827001f2..370db2c16 100644 --- a/front/src/ui/components/Sidebar.vue +++ b/front/src/ui/components/Sidebar.vue @@ -7,6 +7,8 @@ import { useStore } from '~/store' import Input from '~/components/ui/Input.vue' import Pill from '~/components/ui/Pill.vue' import Link from '~/components/ui/Link.vue' +import ActorAvatar from '~/components/common/ActorAvatar.vue' +import UserMenu from './UserMenu.vue' const searchQuery = ref('') @@ -57,25 +59,8 @@ const uploads = useUploadsStore() - - - - - + +