Skip to content

Commit

Permalink
feat: support shortcut to toggle wide mode
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Oct 9, 2024
1 parent 190a18e commit b7a054f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/renderer/src/components/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FeedNotFoundErrorFallback } from "./FeedNotFound"
import { ModalErrorFallback } from "./ModalError"
import { PageErrorFallback } from "./PageError"

export const ErrorFallbackMap = {
const ErrorFallbackMap = {
[ErrorComponentType.Modal]: ModalErrorFallback,
[ErrorComponentType.Page]: PageErrorFallback,
[ErrorComponentType.FeedFoundCanBeFollow]: FeedFoundCanBeFollowErrorFallback,
Expand Down
4 changes: 4 additions & 0 deletions apps/renderer/src/constants/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export const shortcuts = {
name: "keys.layout.showShortcuts",
key: "H",
},
toggleWideMode: {
name: "keys.layout.toggleWideMode",
key: "Meta+[",
},
},
entries: {
refetch: {
Expand Down
2 changes: 1 addition & 1 deletion apps/renderer/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const getOS = memoize((): OS => {
iosPlatforms = ["iPhone", "iPad", "iPod"]
// @ts-expect-error
const platform = window.navigator.userAgentData?.platform || window.navigator.platform
let os = ""
let os = platform

if (macosPlatforms.includes(platform)) {
os = "macOS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ const WideModeButton = () => {
}}
>
<ActionButton
shortcut={shortcuts.layout.toggleWideMode.key}
onClick={() => {
setUISetting("wideMode", !isWideMode)
window.posthog?.capture("Switch to Wide Mode", {
Expand Down
3 changes: 2 additions & 1 deletion apps/renderer/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IN_ELECTRON } from "@follow/shared/constants"
import { wrapCreateBrowserRouter } from "@sentry/react"
import { createBrowserRouter, createHashRouter } from "react-router-dom"

import { Component as App } from "./App"
import { ErrorElement } from "./components/common/ErrorElement"
import { NotFound } from "./components/common/NotFound"
import { buildGlobRoutes } from "./lib/route-builder"
Expand All @@ -18,7 +19,7 @@ if (window.SENTRY_RELEASE) {
export const router = routerCreator([
{
path: "/",
lazy: () => import("./App"),
Component: App,
children: tree,
errorElement: <ErrorElement />,
},
Expand Down
1 change: 1 addition & 0 deletions locales/shortcuts/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"keys.feeds.switchToView": "Switch to View",
"keys.layout.showShortcuts": "Show/Hide Shortcuts",
"keys.layout.toggleSidebar": "Show/Hide Feed Sidebar",
"keys.layout.toggleWideMode": "Toggle Wide Mode",
"keys.type.audio": "audio",
"keys.type.entries": "entries",
"keys.type.entry": "entry",
Expand Down

0 comments on commit b7a054f

Please sign in to comment.