diff --git a/apps/desktop/src/renderer/src/components/ui/button/CommandActionButton.tsx b/apps/desktop/src/renderer/src/components/ui/button/CommandActionButton.tsx index d3ae89e7f..22e72cc7c 100644 --- a/apps/desktop/src/renderer/src/components/ui/button/CommandActionButton.tsx +++ b/apps/desktop/src/renderer/src/components/ui/button/CommandActionButton.tsx @@ -16,6 +16,14 @@ export const CommandActionButton = forwardRef + return ( + + ) }, ) diff --git a/apps/desktop/src/renderer/src/hooks/biz/useEntryActions.tsx b/apps/desktop/src/renderer/src/hooks/biz/useEntryActions.tsx index af72b34dd..747ace95b 100644 --- a/apps/desktop/src/renderer/src/hooks/biz/useEntryActions.tsx +++ b/apps/desktop/src/renderer/src/hooks/biz/useEntryActions.tsx @@ -20,7 +20,7 @@ import { shortcuts } from "~/constants/shortcuts" import { apiClient } from "~/lib/api-fetch" import { COMMAND_ID } from "~/modules/command/commands/id" import { getCommand, useRunCommandFn } from "~/modules/command/hooks/use-command" -import type { FollowCommandId, FollowCommandMap } from "~/modules/command/types" +import type { FollowCommandId } from "~/modules/command/types" import { useToolbarOrderMap } from "~/modules/customize-toolbar/hooks" import { useEntry } from "~/store/entry" import { useFeedById } from "~/store/feed" @@ -68,7 +68,7 @@ export const toggleEntryReadability = async ({ id, url }: { id: string; url: str } } -type EntryActionMenuItemConfig = { +interface EntryActionMenuItemConfig { id: FollowCommandId onClick: () => void hide?: boolean @@ -82,7 +82,6 @@ type EntryActionMenuItemConfig = { export class EntryActionMenuItem extends MenuItemText { protected privateConfig: EntryActionMenuItemConfig - private cmd: FollowCommandMap[keyof FollowCommandMap] | null = null constructor(config: EntryActionMenuItemConfig) { const cmd = getCommand(config.id) || null super({ @@ -91,7 +90,7 @@ export class EntryActionMenuItem extends MenuItemText { click: () => config.onClick?.(), hide: !cmd || config.hide, }) - this.cmd = cmd + this.privateConfig = config } diff --git a/apps/desktop/src/renderer/src/modules/command/commands/entry.tsx b/apps/desktop/src/renderer/src/modules/command/commands/entry.tsx index fe06892ac..dab085263 100644 --- a/apps/desktop/src/renderer/src/modules/command/commands/entry.tsx +++ b/apps/desktop/src/renderer/src/modules/command/commands/entry.tsx @@ -348,7 +348,10 @@ export const useRegisterEntryCommands = () => { }, { id: COMMAND_ID.entry.readability, - label: t("entry_content.header.readability"), + label: { + title: t("entry_content.header.readability"), + description: t("entry_content.header.readability_description"), + }, icon: (props) => ( ), diff --git a/apps/desktop/src/renderer/src/modules/command/types.ts b/apps/desktop/src/renderer/src/modules/command/types.ts index 4ea4f5733..8e84bec41 100644 --- a/apps/desktop/src/renderer/src/modules/command/types.ts +++ b/apps/desktop/src/renderer/src/modules/command/types.ts @@ -56,7 +56,7 @@ export interface Command< readonly id: T["id"] readonly label: { title: string - subTitle?: string + description?: string } readonly icon?: ReactNode | ((props?: { isActive?: boolean }) => ReactNode) readonly category: CommandCategory @@ -80,8 +80,8 @@ export interface CommandOptions< label: | string | (() => string) - | { title: string; subTitle?: string } - | (() => { title: string; subTitle?: string }) + | { title: string; description?: string } + | (() => { title: string; description?: string }) icon?: ReactNode | ((props?: { isActive?: boolean }) => ReactNode) category?: CommandCategory run: T["fn"] diff --git a/apps/desktop/src/renderer/src/modules/entry-content/actions/header-actions.tsx b/apps/desktop/src/renderer/src/modules/entry-content/actions/header-actions.tsx index 3814833dc..dc08ac81a 100644 --- a/apps/desktop/src/renderer/src/modules/entry-content/actions/header-actions.tsx +++ b/apps/desktop/src/renderer/src/modules/entry-content/actions/header-actions.tsx @@ -42,7 +42,7 @@ export const EntryHeaderActions = ({ onClick={config.onClick!} shortcut={config.shortcut!} clickableDisabled={config.disabled} - tooltipDefaultOpen={config.notice} + highlightMotion={config.notice} id={`${config.entryId}/${config.id}`} /> ) diff --git a/apps/mobile/web-app/html-renderer/src/components/link.tsx b/apps/mobile/web-app/html-renderer/src/components/link.tsx index d0b18b652..1c9d71d3d 100644 --- a/apps/mobile/web-app/html-renderer/src/components/link.tsx +++ b/apps/mobile/web-app/html-renderer/src/components/link.tsx @@ -21,7 +21,7 @@ export const MarkdownLink = (props: LinkProps) => { React.ReactNode) tooltip?: React.ReactNode + tooltipDescription?: React.ReactNode tooltipSide?: "top" | "bottom" tooltipDefaultOpen?: boolean active?: boolean @@ -22,7 +23,10 @@ export interface ActionButtonProps { enableHoverableContent?: boolean size?: "sm" | "base" | "lg" id?: string - + /** + * Use motion effects to prompt and guide users to pay attention or click this button + */ + highlightMotion?: boolean /** * @description only trigger shortcut when focus with in `` * @default false @@ -47,9 +51,11 @@ export const ActionButton = React.forwardRef< icon, id, tooltip, + tooltipDescription, className, tooltipSide, tooltipDefaultOpen, + highlightMotion, children, active, shortcut, @@ -82,9 +88,14 @@ export const ActionButton = React.forwardRef< "hover:bg-theme-item-hover data-[state=open]:bg-theme-item-active rounded-md duration-200", "disabled:cursor-not-allowed disabled:opacity-50", clickableDisabled && "cursor-not-allowed opacity-50", + highlightMotion && + "before:via-theme-accent/30 relative before:absolute before:inset-0 before:animate-[shine_6s_ease-in-out_infinite] before:rounded-md before:bg-gradient-to-r before:from-transparent before:to-transparent before:bg-[length:200%_100%]", actionButtonStyleVariant.size[size], className, )} + style={{ + ...(highlightMotion && { animationDelay: "0.5s" }), + }} type="button" disabled={disabled} onClick={ @@ -137,13 +148,21 @@ export const ActionButton = React.forwardRef< {Trigger} - - {tooltip} - {!!finalShortcut && ( - - {finalShortcut} - - )} + + + {tooltip} + {!!finalShortcut && ( + + {finalShortcut} + + )} + + {tooltipDescription ? ( + {tooltipDescription} + ) : null} diff --git a/packages/components/src/ui/segment/index.tsx b/packages/components/src/ui/segment/index.tsx index 26315041e..1c197cf65 100644 --- a/packages/components/src/ui/segment/index.tsx +++ b/packages/components/src/ui/segment/index.tsx @@ -57,7 +57,7 @@ export const SegmentItem: Component<{ type="button" role="tab" className={cn( - "ring-offset-background data-[state=active]:text-foreground relative inline-flex items-center justify-center whitespace-nowrap px-3 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + "ring-offset-background data-[state=active]:text-text relative inline-flex items-center justify-center whitespace-nowrap px-3 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", "focus-visible:ring-accent/30 h-full rounded-md", className, )} diff --git a/packages/components/src/ui/tooltip/styles.ts b/packages/components/src/ui/tooltip/styles.ts index f5fd746ae..83d22f751 100644 --- a/packages/components/src/ui/tooltip/styles.ts +++ b/packages/components/src/ui/tooltip/styles.ts @@ -1,6 +1,6 @@ export const tooltipStyle = { content: [ - "relative z-[101] bg-white px-2 py-1 text-foreground dark:bg-neutral-950", + "relative z-[101] bg-white px-2 py-1 text-text dark:bg-neutral-950", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0", "rounded-lg text-sm", "max-w-[75ch] select-text", diff --git a/packages/utils/src/link-parser.ts b/packages/utils/src/link-parser.ts index fa630def9..6dc70af6d 100644 --- a/packages/utils/src/link-parser.ts +++ b/packages/utils/src/link-parser.ts @@ -50,7 +50,7 @@ export const isXUrl = defineLinkParser({ export const isV2exUrl = defineLinkParser({ name: "v2ex", validator: (url) => url.hostname.includes("v2ex.com"), - icon: "i-simple-icons-v2ex text-foreground", + icon: "i-simple-icons-v2ex text-text", }) export const isPixivUrl = defineLinkParser({