mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(notifications): target one tab on click, deep-link worktree sessions, action-first payload
The service worker broadcast every notification click on a BroadcastChannel, so every open tab navigated, and it focused the first client regardless of what it showed. It now picks the tab already on the target path, then the focused tab, then any visible tab, and posts NOTIFICATION_CLICK to that client only; the page subscribes through onNotificationClick. Notifications from OpenCode workspace and forge loop worktrees fell back to / because the directory is not a repos row; the service now resolves the parent repo through the shared OpenCode project id. Assistant sessions get the assistant=1 parameter the Assistant view requires. Payload puts the action in the title and the repo in the body, carries a timestamp and renotify, uses the 512px icon and a monochrome 96px badge, and the service worker types it with the shared schema, which gains priority, timestamp, and renotify.
This commit is contained in:
1 parent
91f37961e8
commit
1327ed1af9
11 files changed
+438
-92
No files matched your search
@@ -58,6 +58,8 @@ export const PushNotificationPayloadSchema = z.object({
|
||||
icon: z.string().optional(),
|
||||
badge: z.string().optional(),
|
||||
tag: z.string().optional(),
|
||||
timestamp: z.number().optional(),
|
||||
renotify: z.boolean().optional(),
|
||||
data: z
|
||||
.object({
|
||||
url: z.string().optional(),
|
||||
@@ -66,6 +68,7 @@ export const PushNotificationPayloadSchema = z.object({
|
||||
directory: z.string().optional(),
|
||||
repoId: z.number().optional(),
|
||||
repoName: z.string().optional(),
|
||||
priority: z.enum(["normal", "high"]).optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
Reference in new issue
Block a user