Skip to content

Commit 1fdf482

Browse files
authored
feat: add notification for timeline switch (#4176)
1 parent e119ab6 commit 1fdf482

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

apps/desktop/layer/renderer/src/modules/entry-column/EntryColumnShortcutHandler.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { nextFrame } from "@follow/utils/dom"
88
import { EventBus } from "@follow/utils/event-bus"
99
import type { FC } from "react"
1010
import { memo, useEffect } from "react"
11+
import { toast } from "sonner"
1112

1213
import { FocusablePresets } from "~/components/common/Focusable"
1314
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
@@ -63,6 +64,11 @@ export const EntryColumnShortcutHandler: FC<{
6364

6465
const nextIndex = Math.min(currentActiveEntryIndex + 1, data.length - 1)
6566

67+
if (currentActiveEntryIndex === nextIndex) {
68+
toast.info("You are already at the last entry")
69+
return
70+
}
71+
6672
handleScrollTo(nextIndex)
6773
const nextId = data![nextIndex]
6874

@@ -80,6 +86,11 @@ export const EntryColumnShortcutHandler: FC<{
8086
const nextIndex =
8187
currentActiveEntryIndex === -1 ? data.length - 1 : Math.max(0, currentActiveEntryIndex - 1)
8288

89+
if (currentActiveEntryIndex === nextIndex) {
90+
toast.info("You are already at the first entry")
91+
return
92+
}
93+
8394
handleScrollTo(nextIndex)
8495
const nextId = data![nextIndex]
8596

0 commit comments

Comments
 (0)