@@ -38,7 +38,7 @@ import { HighlightsProvider } from "@/context/highlights" |
38 | 38 | import { LanguageProvider, type Locale, useLanguage } from "@/context/language" |
39 | 39 | import { LayoutProvider } from "@/context/layout" |
40 | 40 | import { ModelsProvider } from "@/context/models" |
41 | | -import { NotificationProvider } from "@/context/notification" |
| 41 | +import { NotificationProvider, useNotification } from "@/context/notification" |
42 | 42 | import { PermissionProvider } from "@/context/permission" |
43 | 43 | import { PromptProvider } from "@/context/prompt" |
44 | 44 | import { ServerConnection, ServerProvider, serverName, useServer } from "@/context/server" |
@@ -316,9 +316,7 @@ function ServerScopedProviders(props: ServerScopedShellProps) { |
316 | 316 | return ( |
317 | 317 | <PermissionProvider directory={props.directory}> |
318 | 318 | <LayoutProvider> |
319 | | - <NotificationProvider directory={props.directory} sessionID={props.sessionID}> |
320 | | - <ModelsProvider directory={props.directory}>{props.children}</ModelsProvider> |
321 | | - </NotificationProvider> |
| 319 | + <ModelsProvider directory={props.directory}>{props.children}</ModelsProvider> |
322 | 320 | </LayoutProvider> |
323 | 321 | </PermissionProvider> |
324 | 322 | ) |
@@ -345,13 +343,23 @@ function NewAppLayout(props: ParentProps) { |
345 | 343 | function TargetServerScopedProviders(props: ServerScopedShellProps) { |
346 | 344 | return ( |
347 | 345 | <PermissionProvider directory={props.directory}> |
348 | | - <NotificationProvider directory={props.directory} sessionID={props.sessionID}> |
349 | | - <ModelsProvider directory={props.directory}>{props.children}</ModelsProvider> |
350 | | - </NotificationProvider> |
| 346 | + <MarkSessionNotificationsViewed sessionID={props.sessionID} /> |
| 347 | + <ModelsProvider directory={props.directory}>{props.children}</ModelsProvider> |
351 | 348 | </PermissionProvider> |
352 | 349 | ) |
353 | 350 | } |
354 | 351 |
|
| 352 | +function MarkSessionNotificationsViewed(props: { sessionID?: () => string | undefined }) { |
| 353 | + const notification = useNotification() |
| 354 | + createEffect(() => { |
| 355 | + const sessionID = props.sessionID?.() |
| 356 | + if (!notification.ready() || !sessionID) return |
| 357 | + if (notification.session.unseenCount(sessionID) === 0) return |
| 358 | + notification.session.markViewed(sessionID) |
| 359 | + }) |
| 360 | + return null |
| 361 | +} |
| 362 | + |
355 | 363 | function SessionProviders(props: ParentProps) { |
356 | 364 | return ( |
357 | 365 | <TerminalProvider> |
@@ -560,11 +568,13 @@ export function AppInterface(props: { |
560 | 568 | component={props.router ?? Router} |
561 | 569 | root={(routerProps) => ( |
562 | 570 | <TabsProvider> |
563 | | - <ServerShell> |
564 | | - <Show when={useSettings().general.newLayoutDesigns()} fallback={routerProps.children}> |
565 | | - <NewAppLayout>{routerProps.children}</NewAppLayout> |
566 | | - </Show> |
567 | | - </ServerShell> |
| 571 | + <NotificationProvider> |
| 572 | + <ServerShell> |
| 573 | + <Show when={useSettings().general.newLayoutDesigns()} fallback={routerProps.children}> |
| 574 | + <NewAppLayout>{routerProps.children}</NewAppLayout> |
| 575 | + </Show> |
| 576 | + </ServerShell> |
| 577 | + </NotificationProvider> |
568 | 578 | </TabsProvider> |
569 | 579 | )} |
570 | 580 | > |
|