Skip to content

Commit

Permalink
feat: shorcuts tab in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jun 19, 2024
1 parent 7b34989 commit 694b6a3
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions icons/mgc/hotkey_cute_re.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/renderer/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ export const settingTabs = [
path: "actions",
className: "i-mgc-magic-2-cute-re",
},
{
name: "Shortcuts",
path: "shortcuts",
className: "i-mgc-hotkey-cute-re",
},
{
name: "Profile",
path: "profile",
Expand Down
50 changes: 50 additions & 0 deletions src/renderer/src/lib/shortcuts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
export const shortcuts = {
subscriptions: {
previous: {
name: "Previous Subscription",
key: "p",
},
next: {
name: "Next Subscription",
key: "n",
},
toggleFolder: {
name: "Toggle Folder",
key: "x",
},
add: {
name: "Add Subscription",
key: "ctrl+t, ⌘+t",
},
},
entries: {
refetch: {
name: "Refetch",
key: "r",
},
previous: {
name: "Previous Entry",
key: "k, up",
},
next: {
name: "Next Entry",
key: "j, down",
},
toggleRead: {
name: "Toggle Read",
key: "m",
},
toggleStarred: {
name: "Toggle Starred",
key: "s",
},
openInBrower: {
name: "Open in Browser",
key: "b, ↩︎",
},
markAllAsRead: {
name: "Mark All as Read",
key: "a",
},
},
}
26 changes: 26 additions & 0 deletions src/renderer/src/pages/settings/shortcuts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { shortcuts } from "@renderer/lib/shortcuts"
import { cn } from "@renderer/lib/utils"
import { SettingsTitle } from "@renderer/modules/settings/title"

export function Component() {
return (
<>
<SettingsTitle path="shortcuts" className="mb-4" />
<div className="space-y-6">
{Object.keys(shortcuts).map((type) => (
<section key={type}>
<div className="mb-2 text-sm capitalize">{type}</div>
<div className="rounded-md border text-[13px] text-zinc-600">
{Object.keys(shortcuts[type]).map((action, index) => (
<div key={`${type}-${action}`} className={cn("flex items-center justify-between px-3 py-1.5", index % 2 && "bg-native/40")}>
<div>{shortcuts[type][action].name}</div>
<div className="uppercase">{shortcuts[type][action].key}</div>
</div>
))}
</div>
</section>
))}
</div>
</>
)
}

0 comments on commit 694b6a3

Please sign in to comment.