|
|
@@ -58,6 +58,7 @@ export function Titlebar() {
|
|
|
})
|
|
|
|
|
|
const path = () => `${location.pathname}${location.search}${location.hash}`
|
|
|
+ const home = createMemo(() => !params.dir)
|
|
|
const creating = createMemo(() => {
|
|
|
if (!params.dir) return false
|
|
|
if (params.id) return false
|
|
|
@@ -198,91 +199,93 @@ export function Titlebar() {
|
|
|
/>
|
|
|
</div>
|
|
|
</Show>
|
|
|
- <div class="flex items-center gap-1 shrink-0">
|
|
|
- <TooltipKeybind
|
|
|
- class={web() ? "hidden xl:flex shrink-0 ml-14" : "hidden xl:flex shrink-0 ml-2"}
|
|
|
- placement="bottom"
|
|
|
- title={language.t("command.sidebar.toggle")}
|
|
|
- keybind={command.keybind("sidebar.toggle")}
|
|
|
- >
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- class="group/sidebar-toggle titlebar-icon w-8 h-6 p-0 box-border"
|
|
|
- onClick={layout.sidebar.toggle}
|
|
|
- aria-label={language.t("command.sidebar.toggle")}
|
|
|
- aria-expanded={layout.sidebar.opened()}
|
|
|
+ <Show when={!home()}>
|
|
|
+ <div class="flex items-center gap-1 shrink-0">
|
|
|
+ <TooltipKeybind
|
|
|
+ class={web() ? "hidden xl:flex shrink-0 ml-14" : "hidden xl:flex shrink-0 ml-2"}
|
|
|
+ placement="bottom"
|
|
|
+ title={language.t("command.sidebar.toggle")}
|
|
|
+ keybind={command.keybind("sidebar.toggle")}
|
|
|
>
|
|
|
- <Icon size="small" name={layout.sidebar.opened() ? "sidebar-active" : "sidebar"} />
|
|
|
- </Button>
|
|
|
- </TooltipKeybind>
|
|
|
- <div class="hidden xl:flex items-center shrink-0">
|
|
|
- <Show when={params.dir}>
|
|
|
- <div
|
|
|
- class="flex items-center shrink-0 w-8 mr-1"
|
|
|
- aria-hidden={layout.sidebar.opened() ? "true" : undefined}
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ class="group/sidebar-toggle titlebar-icon w-8 h-6 p-0 box-border"
|
|
|
+ onClick={layout.sidebar.toggle}
|
|
|
+ aria-label={language.t("command.sidebar.toggle")}
|
|
|
+ aria-expanded={layout.sidebar.opened()}
|
|
|
>
|
|
|
+ <Icon size="small" name={layout.sidebar.opened() ? "sidebar-active" : "sidebar"} />
|
|
|
+ </Button>
|
|
|
+ </TooltipKeybind>
|
|
|
+ <div class="hidden xl:flex items-center shrink-0">
|
|
|
+ <Show when={params.dir}>
|
|
|
<div
|
|
|
- class="transition-opacity"
|
|
|
- classList={{
|
|
|
- "opacity-100 duration-120 ease-out": !layout.sidebar.opened(),
|
|
|
- "opacity-0 duration-120 ease-in delay-0 pointer-events-none": layout.sidebar.opened(),
|
|
|
- }}
|
|
|
+ class="flex items-center shrink-0 w-8 mr-1"
|
|
|
+ aria-hidden={layout.sidebar.opened() ? "true" : undefined}
|
|
|
>
|
|
|
- <TooltipKeybind
|
|
|
- placement="bottom"
|
|
|
- title={language.t("command.session.new")}
|
|
|
- keybind={command.keybind("session.new")}
|
|
|
- openDelay={2000}
|
|
|
+ <div
|
|
|
+ class="transition-opacity"
|
|
|
+ classList={{
|
|
|
+ "opacity-100 duration-120 ease-out": !layout.sidebar.opened(),
|
|
|
+ "opacity-0 duration-120 ease-in delay-0 pointer-events-none": layout.sidebar.opened(),
|
|
|
+ }}
|
|
|
>
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- icon={creating() ? "new-session-active" : "new-session"}
|
|
|
- class="titlebar-icon w-8 h-6 p-0 box-border"
|
|
|
- disabled={layout.sidebar.opened()}
|
|
|
- tabIndex={layout.sidebar.opened() ? -1 : undefined}
|
|
|
- onClick={() => {
|
|
|
- if (!params.dir) return
|
|
|
- navigate(`/${params.dir}/session`)
|
|
|
- }}
|
|
|
- aria-label={language.t("command.session.new")}
|
|
|
- aria-current={creating() ? "page" : undefined}
|
|
|
- />
|
|
|
- </TooltipKeybind>
|
|
|
+ <TooltipKeybind
|
|
|
+ placement="bottom"
|
|
|
+ title={language.t("command.session.new")}
|
|
|
+ keybind={command.keybind("session.new")}
|
|
|
+ openDelay={2000}
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ icon={creating() ? "new-session-active" : "new-session"}
|
|
|
+ class="titlebar-icon w-8 h-6 p-0 box-border"
|
|
|
+ disabled={layout.sidebar.opened()}
|
|
|
+ tabIndex={layout.sidebar.opened() ? -1 : undefined}
|
|
|
+ onClick={() => {
|
|
|
+ if (!params.dir) return
|
|
|
+ navigate(`/${params.dir}/session`)
|
|
|
+ }}
|
|
|
+ aria-label={language.t("command.session.new")}
|
|
|
+ aria-current={creating() ? "page" : undefined}
|
|
|
+ />
|
|
|
+ </TooltipKeybind>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ </Show>
|
|
|
+ <div
|
|
|
+ class="flex items-center gap-0 transition-transform"
|
|
|
+ classList={{
|
|
|
+ "translate-x-0": !layout.sidebar.opened(),
|
|
|
+ "-translate-x-[36px]": layout.sidebar.opened(),
|
|
|
+ "duration-180 ease-out": !layout.sidebar.opened(),
|
|
|
+ "duration-180 ease-in": layout.sidebar.opened(),
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Tooltip placement="bottom" value={language.t("common.goBack")} openDelay={2000}>
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ icon="chevron-left"
|
|
|
+ class="titlebar-icon w-6 h-6 p-0 box-border"
|
|
|
+ disabled={!canBack()}
|
|
|
+ onClick={back}
|
|
|
+ aria-label={language.t("common.goBack")}
|
|
|
+ />
|
|
|
+ </Tooltip>
|
|
|
+ <Tooltip placement="bottom" value={language.t("common.goForward")} openDelay={2000}>
|
|
|
+ <Button
|
|
|
+ variant="ghost"
|
|
|
+ icon="chevron-right"
|
|
|
+ class="titlebar-icon w-6 h-6 p-0 box-border"
|
|
|
+ disabled={!canForward()}
|
|
|
+ onClick={forward}
|
|
|
+ aria-label={language.t("common.goForward")}
|
|
|
+ />
|
|
|
+ </Tooltip>
|
|
|
</div>
|
|
|
- </Show>
|
|
|
- <div
|
|
|
- class="flex items-center gap-0 transition-transform"
|
|
|
- classList={{
|
|
|
- "translate-x-0": !layout.sidebar.opened(),
|
|
|
- "-translate-x-[36px]": layout.sidebar.opened(),
|
|
|
- "duration-180 ease-out": !layout.sidebar.opened(),
|
|
|
- "duration-180 ease-in": layout.sidebar.opened(),
|
|
|
- }}
|
|
|
- >
|
|
|
- <Tooltip placement="bottom" value={language.t("common.goBack")} openDelay={2000}>
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- icon="chevron-left"
|
|
|
- class="titlebar-icon w-6 h-6 p-0 box-border"
|
|
|
- disabled={!canBack()}
|
|
|
- onClick={back}
|
|
|
- aria-label={language.t("common.goBack")}
|
|
|
- />
|
|
|
- </Tooltip>
|
|
|
- <Tooltip placement="bottom" value={language.t("common.goForward")} openDelay={2000}>
|
|
|
- <Button
|
|
|
- variant="ghost"
|
|
|
- icon="chevron-right"
|
|
|
- class="titlebar-icon w-6 h-6 p-0 box-border"
|
|
|
- disabled={!canForward()}
|
|
|
- onClick={forward}
|
|
|
- aria-label={language.t("common.goForward")}
|
|
|
- />
|
|
|
- </Tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </Show>
|
|
|
<div id="opencode-titlebar-left" class="flex items-center gap-3 min-w-0 px-2" />
|
|
|
</div>
|
|
|
|