From 9968e0f7df1e030df2c51367e821f5d281d2b3d4 Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Wed, 30 Oct 2024 10:24:31 -0400 Subject: [PATCH] feat(web): implement notification filtering --- web/components/Notifications/List.vue | 10 +++++++--- web/components/Notifications/Sidebar.vue | 22 ++++++++++++++++------ web/composables/gql/graphql.ts | 3 ++- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/web/components/Notifications/List.vue b/web/components/Notifications/List.vue index decde3dcc..3d3367aaa 100644 --- a/web/components/Notifications/List.vue +++ b/web/components/Notifications/List.vue @@ -3,7 +3,7 @@ import { getNotifications, NOTIFICATION_FRAGMENT, } from "./graphql/notification.query"; -import type { NotificationType } from "~/composables/gql/graphql"; +import type { Importance, NotificationType } from "~/composables/gql/graphql"; import { useFragment } from "~/composables/gql/fragment-masking"; import { useQuery } from "@vue/apollo-composable"; import { vInfiniteScroll } from "@vueuse/components"; @@ -15,19 +15,22 @@ const props = withDefaults( defineProps<{ type: NotificationType; pageSize?: number; + importance?: Importance; }>(), { pageSize: 15, + importance: undefined, } ); -const { result, error, fetchMore } = useQuery(getNotifications, { +const { result, error, fetchMore } = useQuery(getNotifications, () => ({ filter: { offset: 0, limit: props.pageSize, type: props.type, + importance: props.importance, }, -}); +})); watch(error, (newVal) => { console.log("[getNotifications] error:", newVal); @@ -52,6 +55,7 @@ async function onLoadMore() { offset: notifications.value.length, limit: props.pageSize, type: props.type, + importance: props.importance, }, }, }); diff --git a/web/components/Notifications/Sidebar.vue b/web/components/Notifications/Sidebar.vue index 203df54e2..502eeff80 100644 --- a/web/components/Notifications/Sidebar.vue +++ b/web/components/Notifications/Sidebar.vue @@ -9,6 +9,7 @@ import { } from "@/components/shadcn/sheet"; import { archiveAllNotifications } from "./graphql/notification.query"; +import type { Importance} from "~/composables/gql/graphql"; import { NotificationType } from "~/composables/gql/graphql"; import { useMutation } from "@vue/apollo-composable"; @@ -16,6 +17,7 @@ const { mutate: archiveAll, loading: loadingArchiveAll } = useMutation( archiveAllNotifications ); const { teleportTarget, determineTeleportTarget } = useTeleport(); +const importance = ref(undefined);