+
+ {translate(
+ 'auto.components.right.sidebar.edge.peek.tip.title',
+ 'Hover the right edge to peek'
+ )}
+ {/* Tooltip-style caret pointing at the window edge. */}
+
+
+
+ )
}
diff --git a/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.test.ts b/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.test.ts
index b1738ffa908..3e484fdc411 100644
--- a/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.test.ts
+++ b/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.test.ts
@@ -1,18 +1,10 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { toast } from 'sonner'
+import { describe, expect, it, vi } from 'vitest'
import {
- RIGHT_SIDEBAR_EDGE_PEEK_TIP_TOAST_ID,
- shouldShowRightSidebarEdgePeekTip,
- showRightSidebarEdgePeekTip
+ RIGHT_SIDEBAR_EDGE_PEEK_TIP_VISIBLE_MS,
+ markRightSidebarEdgePeekTipDismissed,
+ shouldShowRightSidebarEdgePeekTip
} from './right-sidebar-edge-peek-tip'
-vi.mock('sonner', () => ({
- toast: {
- info: vi.fn(),
- dismiss: vi.fn()
- }
-}))
-
describe('shouldShowRightSidebarEdgePeekTip', () => {
it('shows only when edge peek is enabled and the tip is not dismissed', () => {
expect(shouldShowRightSidebarEdgePeekTip(null)).toBe(true)
@@ -35,27 +27,16 @@ describe('shouldShowRightSidebarEdgePeekTip', () => {
})
})
-describe('showRightSidebarEdgePeekTip', () => {
- beforeEach(() => {
- vi.mocked(toast.info).mockReset()
- })
-
- it('shows a dismissible info toast and persists dismiss on close', () => {
+describe('markRightSidebarEdgePeekTipDismissed', () => {
+ it('persists the one-shot dismiss flag', () => {
const updateSettings = vi.fn().mockResolvedValue(undefined)
- showRightSidebarEdgePeekTip({ updateSettings })
-
- expect(toast.info).toHaveBeenCalledTimes(1)
- const [, options] = vi.mocked(toast.info).mock.calls[0] as [
- string,
- {
- id: string
- onDismiss?: () => void
- onAutoClose?: () => void
- }
- ]
- expect(options.id).toBe(RIGHT_SIDEBAR_EDGE_PEEK_TIP_TOAST_ID)
-
- options.onDismiss?.()
+ markRightSidebarEdgePeekTipDismissed({ updateSettings })
expect(updateSettings).toHaveBeenCalledWith({ rightSidebarEdgePeekTipDismissed: true })
})
})
+
+describe('RIGHT_SIDEBAR_EDGE_PEEK_TIP_VISIBLE_MS', () => {
+ it('stays brief (tooltip-length, not toast-length)', () => {
+ expect(RIGHT_SIDEBAR_EDGE_PEEK_TIP_VISIBLE_MS).toBe(1000)
+ })
+})
diff --git a/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.ts b/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.ts
index ecb6fd129c8..d3bcc42f734 100644
--- a/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.ts
+++ b/src/renderer/src/components/right-sidebar/right-sidebar-edge-peek-tip.ts
@@ -1,12 +1,11 @@
-import { toast } from 'sonner'
import type { GlobalSettings } from '../../../../shared/types'
-import { translate } from '@/i18n/i18n'
import {
isRightSidebarEdgePeekEnabled,
isRightSidebarEdgePeekTipDismissed
} from './right-sidebar-edge-peek-preference'
-export const RIGHT_SIDEBAR_EDGE_PEEK_TIP_TOAST_ID = 'right-sidebar-edge-peek-tip'
+/** How long the one-shot edge-peek hint stays visible. */
+export const RIGHT_SIDEBAR_EDGE_PEEK_TIP_VISIBLE_MS = 1000
type TipSettings = Pick<
GlobalSettings,
@@ -17,33 +16,10 @@ export function shouldShowRightSidebarEdgePeekTip(settings: TipSettings): boolea
return isRightSidebarEdgePeekEnabled(settings) && !isRightSidebarEdgePeekTipDismissed(settings)
}
-export function showRightSidebarEdgePeekTip(args: {
+export function markRightSidebarEdgePeekTipDismissed(args: {
updateSettings: (updates: Partial