Skip to content

Commit

Permalink
refactor: new command abstractions in follow (RSSNext#1566)
Browse files Browse the repository at this point in the history
* feat: implement command abstractions and hooks

* chore: register follow commands in search command context

* refactor: replace entry actions with command buttons in entry header

* chore: add usePopulatedEntry hook

* feat: add user focus context with atom hooks

* fix: types

* refactor: redesign command system

* refactor: update command button and hotkey hooks for improved type safety

* refactor: update command types for consistency and add new command types

* refactor: enhance entry actions component with dynamic command buttons

* chore: clean code

* refactor: streamline entry content handling and enhance command button configuration

* refactor: enhance command handling and streamline entry actions integration

* refactor: deprecate command button components and simplify command registration

* fix: disable shortcut in modal present

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
Co-authored-by: Innei <tukon479@gmail.com>
  • Loading branch information
lawvs and Innei authored Nov 19, 2024
1 parent 4cbf8a5 commit ea8c8d0
Show file tree
Hide file tree
Showing 29 changed files with 1,968 additions and 395 deletions.
2 changes: 1 addition & 1 deletion apps/renderer/src/atoms/context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const useShowWebContextMenu = () => {

// Menu

type BaseMenuItemText = {
export type BaseMenuItemText = {
type: "text"
label: string
click?: () => void
Expand Down
4 changes: 4 additions & 0 deletions apps/renderer/src/components/ui/modal/stacked/hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button } from "@follow/components/ui/button/index.js"
import type { DragControls } from "framer-motion"
import { atom, useAtomValue } from "jotai"
import type { ResizeCallback, ResizeStartCallback } from "re-resizable"
import { useCallback, useContext, useId, useRef, useState } from "react"
import { flushSync } from "react-dom"
Expand Down Expand Up @@ -203,3 +204,6 @@ export const useDialog = (): DialogInstance => {
}),
}
}

const modalStackLengthAtom = atom((get) => get(modalStackAtom).length)
export const useHasModal = () => useAtomValue(modalStackLengthAtom) > 0
4 changes: 2 additions & 2 deletions apps/renderer/src/constants/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type Shortcuts = Record<
string,
Record<string, { name: I18nKeysForShortcuts; key: string; extra?: string }>
>
export const shortcuts: Shortcuts = {
export const shortcuts = {
feeds: {
add: {
name: "keys.feeds.add",
Expand Down Expand Up @@ -114,7 +114,7 @@ export const shortcuts: Shortcuts = {
key: "Meta+K",
},
},
}
} as const satisfies Shortcuts

export const shortcutsType: { [key in keyof typeof shortcuts]: I18nKeysForShortcuts } = {
feeds: "keys.type.feeds",
Expand Down
Loading

0 comments on commit ea8c8d0

Please sign in to comment.