diff --git a/src/renderer/src/components/user-button.tsx b/src/renderer/src/components/user-button.tsx index 3a1230de7..b82a13457 100644 --- a/src/renderer/src/components/user-button.tsx +++ b/src/renderer/src/components/user-button.tsx @@ -113,11 +113,11 @@ export const ProfileButton: FC = memo((props) => { > Profile - + {/* - + */} @@ -217,41 +217,41 @@ export function UserAvatar({ ) } -const AppTheme = () => { - const theme = useThemeAtomValue() - const setTheme = useSetTheme() - return ( - - - - Theme - - - )} - value={theme} - values={[ - { - value: "system", - label: "", - icon: , - }, - { - value: "light", - label: "", - icon: , - }, - { - value: "dark", - label: "", - icon: , - }, - ]} - onValueChanged={(value) => { - setTheme(value as "light" | "dark" | "system") - }} - /> - ) -} +// const AppTheme = () => { +// const theme = useThemeAtomValue() +// const setTheme = useSetTheme() +// return ( +// +// +// +// Theme +// +// +// )} +// value={theme} +// values={[ +// { +// value: "system", +// label: "", +// icon: , +// }, +// { +// value: "light", +// label: "", +// icon: , +// }, +// { +// value: "dark", +// label: "", +// icon: , +// }, +// ]} +// onValueChanged={(value) => { +// setTheme(value as "light" | "dark" | "system") +// }} +// /> +// ) +// } diff --git a/src/renderer/src/modules/entry-column/components/mark-all-button.tsx b/src/renderer/src/modules/entry-column/components/mark-all-button.tsx index 8d556a295..e7141439f 100644 --- a/src/renderer/src/modules/entry-column/components/mark-all-button.tsx +++ b/src/renderer/src/modules/entry-column/components/mark-all-button.tsx @@ -4,17 +4,21 @@ import { Button, IconButton, } from "@renderer/components/ui/button" +import { Kbd, KbdCombined } from "@renderer/components/ui/kbd/Kbd" import { Popover, PopoverContent, PopoverTrigger, } from "@renderer/components/ui/popover" import { RootPortal } from "@renderer/components/ui/portal" +import { HotKeyScopeMap } from "@renderer/constants" import { shortcuts } from "@renderer/constants/shortcuts" import { cn } from "@renderer/lib/utils" -import { AnimatePresence, m } from "framer-motion" +import { AnimatePresence, calcLength, m } from "framer-motion" import type { FC, ReactNode } from "react" import { forwardRef, Fragment, useState } from "react" +import { useHotkeys } from "react-hotkeys-hook" +import { toast } from "sonner" import { useOnClickOutside } from "usehooks-ts" import type { MarkAllFilter } from "../hooks/useMarkAll" @@ -88,19 +92,61 @@ export const MarkAllReadWithOverlay = forwardRef< ) } + useHotkeys( + shortcuts.entries.markAllAsRead.key, + () => { + setShow(false) + + let cancel = false + const undo = () => { + toast.dismiss(id) + if (cancel) return + cancel = true + } + const id = toast(, { + duration: 3000, + onAutoClose() { + if (cancel) return + handleMarkAllAsRead() + }, + action: { + label: ( + + Undo + + Meta+Z + + + ), + onClick: undo, + }, + }) + }, + { + preventDefault: true, + scopes: HotKeyScopeMap.Home, + }, + ) + return ( - Mark - - {which} - - as read - - )} + tooltip={<> + + Mark + + {which} + + as read + + {shortcut && ( +
+ + {shortcuts.entries.markAllAsRead.key} + +
+ )} + } className={className} ref={ref} onClick={() => { @@ -115,6 +161,21 @@ export const MarkAllReadWithOverlay = forwardRef< ) }) +const ConfirmMarkAllReadInfo = ({ undo }: { undo: () => any }) => { + useHotkeys("ctrl+z,meta+z", undo, { + scopes: HotKeyScopeMap.Home, + preventDefault: true, + }) + return ( +
+

Confirm mark all as read?

+ + Will confirmed automatically after 3s. + +
+ ) +} + /** * @deprecated */