From d04001e0526639954ce66f2bd750a82c8c99e075 Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Thu, 3 Oct 2024 14:40:31 -0700 Subject: [PATCH] feat: WIP create teleport composable --- web/components/Notifications/Item.vue | 5 +--- web/components/Notifications/Sidebar.vue | 15 +---------- .../shadcn/tooltip/TooltipContent.vue | 4 ++- web/composables/useTeleport.ts | 27 +++++++++++++++++++ 4 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 web/composables/useTeleport.ts diff --git a/web/components/Notifications/Item.vue b/web/components/Notifications/Item.vue index 4128a4226..6f7a33a7f 100644 --- a/web/components/Notifications/Item.vue +++ b/web/components/Notifications/Item.vue @@ -45,10 +45,7 @@ const icon = computed<{ component: Component, color: string } | null>(() => {

{{ date }}

- + diff --git a/web/components/Notifications/Sidebar.vue b/web/components/Notifications/Sidebar.vue index 45998d319..b312261a3 100644 --- a/web/components/Notifications/Sidebar.vue +++ b/web/components/Notifications/Sidebar.vue @@ -72,20 +72,7 @@ const archiveNotifications: NotificationItemProps[] = [ }, ]; -const teleportTarget = ref("#modals"); -const determineTeleportTarget = () => { - const myModalsComponent = document.querySelector("unraid-modals"); - if (!myModalsComponent?.shadowRoot) return; - - const potentialTarget = myModalsComponent.shadowRoot.querySelector("#modals"); - if (!potentialTarget) return; - - teleportTarget.value = potentialTarget; - console.log("[determineTeleportTarget] teleportTarget", teleportTarget.value); -}; -onMounted(() => { - determineTeleportTarget(); -}); +const { teleportTarget, determineTeleportTarget } = useTeleport();