Bläddra i källkod

fix(app): restore new layout shortcuts (#33929)

Brendan Allan 1 månad sedan
förälder
incheckning
5565a8ee10
2 ändrade filer med 21 tillägg och 1 borttagningar
  1. 20 0
      packages/app/src/pages/layout-new.tsx
  2. 1 1
      packages/app/src/pages/new-session.tsx

+ 20 - 0
packages/app/src/pages/layout-new.tsx

@@ -3,12 +3,18 @@ import { useNavigate, useParams } from "@solidjs/router"
 import { DebugBar } from "@/components/debug-bar"
 import { HelpButton } from "@/components/help-button"
 import { Titlebar, type TitlebarUpdate } from "@/components/titlebar"
+import { useCommand } from "@/context/command"
+import { useDialog } from "@opencode-ai/ui/context/dialog"
+import { useLanguage } from "@/context/language"
 import { useNotification } from "@/context/notification"
 import { usePlatform } from "@/context/platform"
 import { setNavigate } from "@/utils/notification-click"
 import { setV2Toast, ToastRegion } from "@/utils/toast"
 
 export default function NewLayout(props: ParentProps) {
+  const command = useCommand()
+  const dialog = useDialog()
+  const language = useLanguage()
   const platform = usePlatform()
   const notification = useNotification()
   const navigate = useNavigate()
@@ -22,6 +28,20 @@ export default function NewLayout(props: ParentProps) {
     notification.session.markViewed(params.id)
   })
 
+  command.register("layout", () => [
+    {
+      id: "settings.open",
+      title: language.t("command.settings.open"),
+      category: language.t("command.category.settings"),
+      keybind: "mod+comma",
+      onSelect: () => {
+        void import("@/components/settings-v2").then((x) => {
+          dialog.show(() => <x.DialogSettings />)
+        })
+      },
+    },
+  ])
+
   const update: TitlebarUpdate = {
     version: () => {
       const state = platform.updater?.state()

+ 1 - 1
packages/app/src/pages/new-session.tsx

@@ -26,7 +26,7 @@ export default function NewSessionPage() {
   const serverSync = useServerSync()
   const comments = useComments()
   const route = useSessionKey()
-  const [searchParams, setSearchParams] = useSearchParams<{ prompt?: string }>()
+  const [searchParams, setSearchParams] = useSearchParams<{ draftId?: string; prompt?: string }>()
 
   let inputRef: HTMLDivElement | undefined