Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
David Hill
eb0a67695e fix(ui): remove left sidebar and back/forward nav when no project 2026-03-16 16:38:41 +00:00
2 changed files with 182 additions and 161 deletions

View file

@ -58,6 +58,7 @@ export function Titlebar() {
}) })
const path = () => `${location.pathname}${location.search}${location.hash}` const path = () => `${location.pathname}${location.search}${location.hash}`
const home = createMemo(() => !params.dir)
const creating = createMemo(() => { const creating = createMemo(() => {
if (!params.dir) return false if (!params.dir) return false
if (params.id) return false if (params.id) return false
@ -175,6 +176,7 @@ export function Titlebar() {
> >
<Show when={mac()}> <Show when={mac()}>
<div class="h-full shrink-0" style={{ width: `${72 / zoom()}px` }} /> <div class="h-full shrink-0" style={{ width: `${72 / zoom()}px` }} />
<Show when={!home()}>
<div class="xl:hidden w-10 shrink-0 flex items-center justify-center"> <div class="xl:hidden w-10 shrink-0 flex items-center justify-center">
<IconButton <IconButton
icon="menu" icon="menu"
@ -186,7 +188,9 @@ export function Titlebar() {
/> />
</div> </div>
</Show> </Show>
</Show>
<Show when={!mac()}> <Show when={!mac()}>
<Show when={!home()}>
<div class="xl:hidden w-[48px] shrink-0 flex items-center justify-center"> <div class="xl:hidden w-[48px] shrink-0 flex items-center justify-center">
<IconButton <IconButton
icon="menu" icon="menu"
@ -198,7 +202,9 @@ export function Titlebar() {
/> />
</div> </div>
</Show> </Show>
</Show>
<div class="flex items-center gap-1 shrink-0"> <div class="flex items-center gap-1 shrink-0">
<Show when={!home()}>
<TooltipKeybind <TooltipKeybind
class={web() ? "hidden xl:flex shrink-0 ml-14" : "hidden xl:flex shrink-0 ml-2"} class={web() ? "hidden xl:flex shrink-0 ml-14" : "hidden xl:flex shrink-0 ml-2"}
placement="bottom" placement="bottom"
@ -282,6 +288,7 @@ export function Titlebar() {
</Tooltip> </Tooltip>
</div> </div>
</div> </div>
</Show>
</div> </div>
<div id="opencode-titlebar-left" class="flex items-center gap-3 min-w-0 px-2" /> <div id="opencode-titlebar-left" class="flex items-center gap-3 min-w-0 px-2" />
</div> </div>

View file

@ -111,6 +111,7 @@ export default function Layout(props: ParentProps) {
let scrollContainerRef: HTMLDivElement | undefined let scrollContainerRef: HTMLDivElement | undefined
const params = useParams() const params = useParams()
const home = createMemo(() => !params.dir)
const globalSDK = useGlobalSDK() const globalSDK = useGlobalSDK()
const globalSync = useGlobalSync() const globalSync = useGlobalSync()
const layout = useLayout() const layout = useLayout()
@ -2241,7 +2242,7 @@ export default function Layout(props: ParentProps) {
const sidebarContent = (mobile?: boolean) => ( const sidebarContent = (mobile?: boolean) => (
<SidebarContent <SidebarContent
mobile={mobile} mobile={mobile}
opened={() => layout.sidebar.opened()} opened={() => (home() ? false : layout.sidebar.opened())}
aimMove={aim.move} aimMove={aim.move}
projects={projects} projects={projects}
renderProject={(project) => ( renderProject={(project) => (
@ -2285,7 +2286,7 @@ export default function Layout(props: ParentProps) {
"absolute inset-y-0 left-0": true, "absolute inset-y-0 left-0": true,
"z-10": true, "z-10": true,
}} }}
style={{ width: `${Math.max(layout.sidebar.width(), 244)}px` }} style={{ width: home() ? "4rem" : `${Math.max(layout.sidebar.width(), 244)}px` }}
ref={(el) => { ref={(el) => {
setState("nav", el) setState("nav", el)
}} }}
@ -2294,13 +2295,14 @@ export default function Layout(props: ParentProps) {
}} }}
onMouseLeave={() => { onMouseLeave={() => {
aim.reset() aim.reset()
if (home()) return
if (!sidebarHovering()) return if (!sidebarHovering()) return
arm() arm()
}} }}
> >
<div class="@container w-full h-full contain-strict">{sidebarContent()}</div> <div class="@container w-full h-full contain-strict">{sidebarContent()}</div>
<Show when={layout.sidebar.opened()}> <Show when={!home() && layout.sidebar.opened()}>
<div onPointerDown={() => setState("sizing", true)}> <div onPointerDown={() => setState("sizing", true)}>
<ResizeHandle <ResizeHandle
direction="horizontal" direction="horizontal"
@ -2325,6 +2327,7 @@ export default function Layout(props: ParentProps) {
style={{ left: "calc(4rem + 12px)" }} style={{ left: "calc(4rem + 12px)" }}
/> />
<Show when={!home()}>
<div class="xl:hidden"> <div class="xl:hidden">
<div <div
classList={{ classList={{
@ -2349,22 +2352,29 @@ export default function Layout(props: ParentProps) {
{sidebarContent(true)} {sidebarContent(true)}
</nav> </nav>
</div> </div>
</Show>
<div <div
classList={{ classList={{
"absolute inset-0": true, "absolute inset-0": true,
"xl:inset-y-0 xl:right-0 xl:left-[var(--main-left)]": true, "xl:inset-y-0 xl:right-0": true,
"xl:left-[var(--main-left)]": true,
"z-20": true, "z-20": true,
"transition-[left] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[left] motion-reduce:transition-none": "transition-[left] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[left] motion-reduce:transition-none":
!state.sizing, !state.sizing,
}} }}
style={{ style={{
"--main-left": layout.sidebar.opened() ? `${Math.max(layout.sidebar.width(), 244)}px` : "4rem", "--main-left": home()
? "4rem"
: layout.sidebar.opened()
? `${Math.max(layout.sidebar.width(), 244)}px`
: "4rem",
}} }}
> >
<main <main
classList={{ classList={{
"size-full overflow-x-hidden flex flex-col items-start contain-strict border-t border-border-weak-base bg-background-base xl:border-l xl:rounded-tl-[12px]": true, "size-full overflow-x-hidden flex flex-col items-start contain-strict border-t border-border-weak-base bg-background-base": true,
"xl:border-l xl:rounded-tl-[12px]": true,
}} }}
> >
<Show when={!autoselecting()} fallback={<div class="size-full" />}> <Show when={!autoselecting()} fallback={<div class="size-full" />}>
@ -2373,6 +2383,7 @@ export default function Layout(props: ParentProps) {
</main> </main>
</div> </div>
<Show when={!home()}>
<div <div
classList={{ classList={{
"hidden xl:flex absolute inset-y-0 left-16 z-30": true, "hidden xl:flex absolute inset-y-0 left-16 z-30": true,
@ -2396,7 +2407,9 @@ export default function Layout(props: ParentProps) {
<SidebarPanel project={peekProject} merged={false} /> <SidebarPanel project={peekProject} merged={false} />
</Show> </Show>
</div> </div>
</Show>
<Show when={!home()}>
<div <div
classList={{ classList={{
"hidden xl:block pointer-events-none absolute inset-y-0 right-0 z-25 overflow-hidden": true, "hidden xl:block pointer-events-none absolute inset-y-0 right-0 z-25 overflow-hidden": true,
@ -2410,6 +2423,7 @@ export default function Layout(props: ParentProps) {
> >
<div class="h-full w-px" style={{ "box-shadow": "var(--shadow-sidebar-overlay)" }} /> <div class="h-full w-px" style={{ "box-shadow": "var(--shadow-sidebar-overlay)" }} />
</div> </div>
</Show>
</div> </div>
</div> </div>
{import.meta.env.DEV && <DebugBar />} {import.meta.env.DEV && <DebugBar />}