From 8bdcbbf5279ab963c9c581445a79e97939c9103a Mon Sep 17 00:00:00 2001 From: lethdat Date: Sun, 25 Jan 2026 19:18:34 +0700 Subject: [PATCH] add noti --- components.d.ts | 2 + src/api/httpClientAdapter.server.ts | 8 +- src/components/DashboardLayout.vue | 43 ++++- src/components/NotificationPopover.vue | 159 ++++++++++++++++++ .../components/NotificationItem.vue | 2 +- src/routes/plans/Plans.vue | 2 +- 6 files changed, 200 insertions(+), 16 deletions(-) create mode 100644 src/components/NotificationPopover.vue diff --git a/components.d.ts b/components.d.ts index ac809d5..970e48e 100644 --- a/components.d.ts +++ b/components.d.ts @@ -28,6 +28,7 @@ declare module 'vue' { Layout: typeof import('./src/components/icons/Layout.vue')['default'] LinkIcon: typeof import('./src/components/icons/LinkIcon.vue')['default'] Message: typeof import('primevue/message')['default'] + NotificationPopover: typeof import('./src/components/NotificationPopover.vue')['default'] PageHeader: typeof import('./src/components/dashboard/PageHeader.vue')['default'] Password: typeof import('primevue/password')['default'] RootLayout: typeof import('./src/components/RootLayout.vue')['default'] @@ -61,6 +62,7 @@ declare global { const Layout: typeof import('./src/components/icons/Layout.vue')['default'] const LinkIcon: typeof import('./src/components/icons/LinkIcon.vue')['default'] const Message: typeof import('primevue/message')['default'] + const NotificationPopover: typeof import('./src/components/NotificationPopover.vue')['default'] const PageHeader: typeof import('./src/components/dashboard/PageHeader.vue')['default'] const Password: typeof import('primevue/password')['default'] const RootLayout: typeof import('./src/components/RootLayout.vue')['default'] diff --git a/src/api/httpClientAdapter.server.ts b/src/api/httpClientAdapter.server.ts index 73372e2..7ba09fc 100644 --- a/src/api/httpClientAdapter.server.ts +++ b/src/api/httpClientAdapter.server.ts @@ -29,12 +29,6 @@ export const customFetch = (url: string, options: RequestInit) => { // res.headers.forEach((value, key) => { // c.header(key, value); // }); - return fetch(apiUrl, options).then(res => { - // Forward response headers to client (especially Set-Cookie) - res.headers.forEach((value, key) => { - c.header(key, value); - }); - return res; - }); + return fetch(apiUrl, options) } } \ No newline at end of file diff --git a/src/components/DashboardLayout.vue b/src/components/DashboardLayout.vue index 764a738..ac5aca8 100644 --- a/src/components/DashboardLayout.vue +++ b/src/components/DashboardLayout.vue @@ -5,8 +5,9 @@ import Home from "@/components/icons/Home.vue"; import Video from "@/components/icons/Video.vue"; import Credit from "@/components/icons/Credit.vue"; import Upload from "./icons/Upload.vue"; +import NotificationPopover from "./NotificationPopover.vue"; import { cn } from "@/lib/utils"; -import { createStaticVNode } from "vue"; +import { createStaticVNode, ref } from "vue"; const className = ":uno: w-12 h-12 p-2 rounded-2xl hover:bg-primary/15 flex press-animated items-center justify-center"; const homeHoist = createStaticVNode(`Logo`, 1); @@ -20,19 +21,46 @@ const links = [ { href: "/upload", label: "Upload", icon: Upload, type: "a", className }, { href: "/video", label: "Video", icon: Video, type: "a", className }, { href: "/payments-and-plans", label: "Payments & Plans", icon: Credit, type: "a", className }, - { href: "/notification", label: "Notification", icon: Bell, type: "a", className }, + { href: "#notification", label: "Notification", icon: Bell, type: "notification", className }, { href: "/profile", label: "Profile", icon: profileHoist, type: "a", className: 'w-12 h-12 rounded-2xl hover:bg-primary/15 flex' }, ]; + +const notificationPopover = ref>(); + +const handleNotificationClick = (event: Event) => { + notificationPopover.value?.toggle(event); +}; + diff --git a/src/components/NotificationPopover.vue b/src/components/NotificationPopover.vue new file mode 100644 index 0000000..683cd27 --- /dev/null +++ b/src/components/NotificationPopover.vue @@ -0,0 +1,159 @@ + + + + + diff --git a/src/routes/notification/components/NotificationItem.vue b/src/routes/notification/components/NotificationItem.vue index 124090d..40da859 100644 --- a/src/routes/notification/components/NotificationItem.vue +++ b/src/routes/notification/components/NotificationItem.vue @@ -104,6 +104,6 @@ const bgClass = computed(() => { diff --git a/src/routes/plans/Plans.vue b/src/routes/plans/Plans.vue index 43ed56d..f341cfb 100644 --- a/src/routes/plans/Plans.vue +++ b/src/routes/plans/Plans.vue @@ -43,7 +43,7 @@ const currentPlan = computed(() => { return plans.value.find(p => p.id === currentPlanId.value); }); -const { data, isLoading, mutate: mutatePlans } = useSWRV("r/plans", () => client.plans.plansList()) +const { data, isLoading, mutate: mutatePlans } = useSWRV("r/plans", client.plans.plansList) watch(data, (newValue) => { if (newValue) {