summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/pages
diff options
context:
space:
mode:
authorJay <[email protected]>2026-04-16 23:31:00 -0400
committerGitHub <[email protected]>2026-04-17 03:31:00 +0000
commitfbbab9d6c8a03c4cd5bed0d13a85f52e3aca47ce (patch)
tree883ade9bc40164adaf14e69069068971cda17cee /packages/app/src/pages
parentcccb907a9b3df7eb6fae71ee9e2392dccc73e9d3 (diff)
downloadopencode-fbbab9d6c8a03c4cd5bed0d13a85f52e3aca47ce.tar.gz
opencode-fbbab9d6c8a03c4cd5bed0d13a85f52e3aca47ce.zip
feat(app): hide desktop titlebar tools behind settings (#19029)
Co-authored-by: Brendan Allan <[email protected]> Co-authored-by: Brendan Allan <[email protected]>
Diffstat (limited to 'packages/app/src/pages')
-rw-r--r--packages/app/src/pages/session/session-side-panel.tsx176
-rw-r--r--packages/app/src/pages/session/use-session-commands.tsx21
2 files changed, 107 insertions, 90 deletions
diff --git a/packages/app/src/pages/session/session-side-panel.tsx b/packages/app/src/pages/session/session-side-panel.tsx
index cddbea84d..06cbec48b 100644
--- a/packages/app/src/pages/session/session-side-panel.tsx
+++ b/packages/app/src/pages/session/session-side-panel.tsx
@@ -19,6 +19,9 @@ import { useCommand } from "@/context/command"
import { useFile, type SelectedLineRange } from "@/context/file"
import { useLanguage } from "@/context/language"
import { useLayout } from "@/context/layout"
+import { usePlatform } from "@/context/platform"
+import { useSettings } from "@/context/settings"
+import { useSync } from "@/context/sync"
import { createFileTabListSync } from "@/pages/session/file-tab-scroll"
import { FileTabContent } from "@/pages/session/file-tabs"
import { createOpenSessionFileTab, createSessionTabs, getTabReorderIndex, type Sizing } from "@/pages/session/helpers"
@@ -39,6 +42,9 @@ export function SessionSidePanel(props: {
size: Sizing
}) {
const layout = useLayout()
+ const platform = usePlatform()
+ const settings = useSettings()
+ const sync = useSync()
const file = useFile()
const language = useLanguage()
const command = useCommand()
@@ -46,9 +52,10 @@ export function SessionSidePanel(props: {
const { sessionKey, tabs, view } = useSessionLayout()
const isDesktop = createMediaQuery("(min-width: 768px)")
+ const shown = createMemo(() => platform.platform !== "desktop" || settings.general.showFileTree())
const reviewOpen = createMemo(() => isDesktop() && view().reviewPanel.opened())
- const fileOpen = createMemo(() => isDesktop() && layout.fileTree.opened())
+ const fileOpen = createMemo(() => isDesktop() && shown() && layout.fileTree.opened())
const open = createMemo(() => reviewOpen() || fileOpen())
const reviewTab = createMemo(() => isDesktop())
const panelWidth = createMemo(() => {
@@ -341,98 +348,99 @@ export function SessionSidePanel(props: {
</div>
</div>
- <div
- id="file-tree-panel"
- aria-hidden={!fileOpen()}
- inert={!fileOpen()}
- class="relative min-w-0 h-full shrink-0 overflow-hidden"
- classList={{
- "pointer-events-none": !fileOpen(),
- "transition-[width] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":
- !props.size.active(),
- }}
- style={{ width: treeWidth() }}
- >
+ <Show when={shown()}>
<div
- class="h-full flex flex-col overflow-hidden group/filetree"
- classList={{ "border-l border-border-weaker-base": reviewOpen() }}
+ id="file-tree-panel"
+ aria-hidden={!fileOpen()}
+ inert={!fileOpen()}
+ class="relative min-w-0 h-full shrink-0 overflow-hidden"
+ classList={{
+ "pointer-events-none": !fileOpen(),
+ "transition-[width] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] motion-reduce:transition-none":
+ !props.size.active(),
+ }}
+ style={{ width: treeWidth() }}
>
- <Tabs
- variant="pill"
- value={fileTreeTab()}
- onChange={setFileTreeTabValue}
- class="h-full"
- data-scope="filetree"
+ <div
+ class="h-full flex flex-col overflow-hidden group/filetree"
+ classList={{ "border-l border-border-weaker-base": reviewOpen() }}
>
- <Tabs.List>
- <Tabs.Trigger value="changes" class="flex-1" classes={{ button: "w-full" }}>
- {props.reviewCount()}{" "}
- {language.t(
- props.reviewCount() === 1 ? "session.review.change.one" : "session.review.change.other",
- )}
- </Tabs.Trigger>
- <Tabs.Trigger value="all" class="flex-1" classes={{ button: "w-full" }}>
- {language.t("session.files.all")}
- </Tabs.Trigger>
- </Tabs.List>
- <Tabs.Content value="changes" class="bg-background-stronger px-3 py-0">
- <Switch>
- <Match when={props.hasReview() || !props.diffsReady()}>
- <Show
- when={props.diffsReady()}
- fallback={
- <div class="px-2 py-2 text-12-regular text-text-weak">
- {language.t("common.loading")}
- {language.t("common.loading.ellipsis")}
- </div>
- }
- >
+ <Tabs
+ variant="pill"
+ value={fileTreeTab()}
+ onChange={setFileTreeTabValue}
+ class="h-full"
+ data-scope="filetree"
+ >
+ <Tabs.List>
+ <Tabs.Trigger value="changes" class="flex-1" classes={{ button: "w-full" }}>
+ {props.reviewCount()}{" "}
+ {language.t(
+ props.reviewCount() === 1 ? "session.review.change.one" : "session.review.change.other",
+ )}
+ </Tabs.Trigger>
+ <Tabs.Trigger value="all" class="flex-1" classes={{ button: "w-full" }}>
+ {language.t("session.files.all")}
+ </Tabs.Trigger>
+ </Tabs.List>
+ <Tabs.Content value="changes" class="bg-background-stronger px-3 py-0">
+ <Switch>
+ <Match when={props.hasReview() || !props.diffsReady()}>
+ <Show
+ when={props.diffsReady()}
+ fallback={
+ <div class="px-2 py-2 text-12-regular text-text-weak">
+ {language.t("common.loading")}
+ {language.t("common.loading.ellipsis")}
+ </div>
+ }
+ >
+ <FileTree
+ path=""
+ class="pt-3"
+ allowed={diffFiles()}
+ kinds={kinds()}
+ draggable={false}
+ active={props.activeDiff}
+ onFileClick={(node) => props.focusReviewDiff(node.path)}
+ />
+ </Show>
+ </Match>
+ </Switch>
+ </Tabs.Content>
+ <Tabs.Content value="all" class="bg-background-stronger px-3 py-0">
+ <Switch>
+ <Match when={nofiles()}>{empty(language.t("session.files.empty"))}</Match>
+ <Match when={true}>
<FileTree
path=""
class="pt-3"
- allowed={diffFiles()}
+ modified={diffFiles()}
kinds={kinds()}
- draggable={false}
- active={props.activeDiff}
- onFileClick={(node) => props.focusReviewDiff(node.path)}
+ onFileClick={(node) => openTab(file.tab(node.path))}
/>
- </Show>
- </Match>
- <Match when={true}>{empty(props.empty())}</Match>
- </Switch>
- </Tabs.Content>
- <Tabs.Content value="all" class="bg-background-stronger px-3 py-0">
- <Switch>
- <Match when={nofiles()}>{empty(language.t("session.files.empty"))}</Match>
- <Match when={true}>
- <FileTree
- path=""
- class="pt-3"
- modified={diffFiles()}
- kinds={kinds()}
- onFileClick={(node) => openTab(file.tab(node.path))}
- />
- </Match>
- </Switch>
- </Tabs.Content>
- </Tabs>
- </div>
- <Show when={fileOpen()}>
- <div onPointerDown={() => props.size.start()}>
- <ResizeHandle
- direction="horizontal"
- edge="start"
- size={layout.fileTree.width()}
- min={200}
- max={480}
- onResize={(width) => {
- props.size.touch()
- layout.fileTree.resize(width)
- }}
- />
+ </Match>
+ </Switch>
+ </Tabs.Content>
+ </Tabs>
</div>
- </Show>
- </div>
+ <Show when={fileOpen()}>
+ <div onPointerDown={() => props.size.start()}>
+ <ResizeHandle
+ direction="horizontal"
+ edge="start"
+ size={layout.fileTree.width()}
+ min={200}
+ max={480}
+ onResize={(width) => {
+ props.size.touch()
+ layout.fileTree.resize(width)
+ }}
+ />
+ </div>
+ </Show>
+ </div>
+ </Show>
</div>
</aside>
</Show>
diff --git a/packages/app/src/pages/session/use-session-commands.tsx b/packages/app/src/pages/session/use-session-commands.tsx
index b5d254463..9bbeb10bd 100644
--- a/packages/app/src/pages/session/use-session-commands.tsx
+++ b/packages/app/src/pages/session/use-session-commands.tsx
@@ -7,8 +7,10 @@ import { useLanguage } from "@/context/language"
import { useLayout } from "@/context/layout"
import { useLocal } from "@/context/local"
import { usePermission } from "@/context/permission"
+import { usePlatform } from "@/context/platform"
import { usePrompt } from "@/context/prompt"
import { useSDK } from "@/context/sdk"
+import { useSettings } from "@/context/settings"
import { useSync } from "@/context/sync"
import { useTerminal } from "@/context/terminal"
import { showToast } from "@opencode-ai/ui/toast"
@@ -39,8 +41,10 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
const language = useLanguage()
const local = useLocal()
const permission = usePermission()
+ const platform = usePlatform()
const prompt = usePrompt()
const sdk = useSDK()
+ const settings = useSettings()
const sync = useSync()
const terminal = useTerminal()
const layout = useLayout()
@@ -66,6 +70,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
})
const activeFileTab = tabState.activeFileTab
const closableTab = tabState.closableTab
+ const shown = () => platform.platform !== "desktop" || settings.general.showFileTree()
const idle = { type: "idle" as const }
const status = () => sync.data.session_status[params.id ?? ""] ?? idle
@@ -457,12 +462,16 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
keybind: "mod+shift+r",
onSelect: () => view().reviewPanel.toggle(),
}),
- viewCommand({
- id: "fileTree.toggle",
- title: language.t("command.fileTree.toggle"),
- keybind: "mod+\\",
- onSelect: () => layout.fileTree.toggle(),
- }),
+ ...(shown()
+ ? [
+ viewCommand({
+ id: "fileTree.toggle",
+ title: language.t("command.fileTree.toggle"),
+ keybind: "mod+\\",
+ onSelect: () => layout.fileTree.toggle(),
+ }),
+ ]
+ : []),
viewCommand({
id: "input.focus",
title: language.t("command.input.focus"),