summaryrefslogtreecommitdiff
path: root/apps/web/lib/queries
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-10 01:08:11 -0800
committerFuwn <[email protected]>2026-02-10 01:08:11 -0800
commit920d22332069f1ca60740c290173a95846fb38c3 (patch)
tree5909cecde94bf1acd83385a5b3d789175f2713f0 /apps/web/lib/queries
parentfix: service worker cross-origin image handling and CI env vars (diff)
downloadasa.news-920d22332069f1ca60740c290173a95846fb38c3.tar.xz
asa.news-920d22332069f1ca60740c290173a95846fb38c3.zip
feat: scoped mark-all-read, share enhancements, notification z-index
- Mark all as read now scopes to current feed/folder instead of all - Added undo button to mark-all-read toast notification - Share notes can be toggled between public and private visibility - Track share view count and display in shares list - Activity-based share expiry: views reset the expiry timer - Fixed notification panel z-index layering behind content area
Diffstat (limited to 'apps/web/lib/queries')
-rw-r--r--apps/web/lib/queries/use-mark-all-as-read.ts21
1 files changed, 20 insertions, 1 deletions
diff --git a/apps/web/lib/queries/use-mark-all-as-read.ts b/apps/web/lib/queries/use-mark-all-as-read.ts
index fdda661..d2ba82e 100644
--- a/apps/web/lib/queries/use-mark-all-as-read.ts
+++ b/apps/web/lib/queries/use-mark-all-as-read.ts
@@ -2,6 +2,7 @@
import { useMutation, useQueryClient } from "@tanstack/react-query"
import { createSupabaseBrowserClient } from "@/lib/supabase/client"
+import { toast } from "sonner"
import { queryKeys } from "./query-keys"
import { notify } from "@/lib/notify"
@@ -35,9 +36,27 @@ export function useMarkAllAsRead() {
queryClient.invalidateQueries({ queryKey: queryKeys.savedEntries.all })
const action = variables?.readState === false ? "unread" : "read"
+ const undoReadState = !(variables?.readState ?? true)
if (affectedCount > 0) {
- notify(`marked ${affectedCount} entries as ${action}`)
+ toast(`marked ${affectedCount} entries as ${action}`, {
+ action: {
+ label: "undo",
+ onClick: () => {
+ supabaseClient
+ .rpc("mark_all_as_read", {
+ p_feed_id: variables?.feedIdentifier ?? null,
+ p_folder_id: variables?.folderIdentifier ?? null,
+ p_read_state: undoReadState,
+ })
+ .then(() => {
+ queryClient.invalidateQueries({ queryKey: queryKeys.timeline.all })
+ queryClient.invalidateQueries({ queryKey: queryKeys.unreadCounts.all })
+ queryClient.invalidateQueries({ queryKey: queryKeys.savedEntries.all })
+ })
+ },
+ },
+ })
}
},
onError: (_, variables) => {