feat: add individual post keybinds

This commit is contained in:
James Xylight committed 2025-08-07 18:30:08 -07:00
1 parent 04bd862d59
commit 2342e89f3d
6 files changed
+111 -34

No files matched your search

+26 -1
View File
@@ -7,6 +7,10 @@ console.log('Using the following default settings from the environment:')
console.log(env)
export type View = 'cozy' | 'compact'
type Keybind = {
key: string
ctrl: boolean
}
export const SSR_ENABLED = env.PUBLIC_SSR_ENABLED?.toLowerCase() == 'true'
@@ -105,10 +109,21 @@ interface Settings {
fullMarkdown: boolean
}
voteRatioBar: boolean
keybinds: {
post: {
next: Keybind
previous: Keybind
upvote: Keybind
downvote: Keybind
save: Keybind
expand: Keybind
}
}
}
export const defaultSettings: Settings = {
settingsVer: 6,
settingsVer: 7,
expandableImages: toBool(env.PUBLIC_EXPANDABLE_IMAGES) ?? true,
markReadPosts: toBool(env.PUBLIC_MARK_READ_POSTS) ?? true,
showInstances: {
@@ -186,6 +201,16 @@ export const defaultSettings: Settings = {
fullMarkdown: toBool(env.PUBLIC_FULL_MARKDOWN) ?? false,
},
voteRatioBar: false,
keybinds: {
post: {
next: { ctrl: false, key: 'k' },
previous: { ctrl: false, key: 'j' },
upvote: { ctrl: false, key: 'n' },
downvote: { ctrl: false, key: 'm' },
save: { ctrl: true, key: 's' },
expand: { ctrl: false, key: 'h' },
},
},
}
function createSettingsState(initial: Settings): Settings {