diff options
| author | Adam <[email protected]> | 2025-12-09 12:36:03 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-09 12:36:06 -0600 |
| commit | ae4993f39a60aae339637e1a24ef4029aa052ccb (patch) | |
| tree | f34124b6ff9f4eaec8127e6d48945113dc939c71 | |
| parent | aa638cec487b650c7c83de547a2898e750ef3b61 (diff) | |
| download | opencode-ae4993f39a60aae339637e1a24ef4029aa052ccb.tar.gz opencode-ae4993f39a60aae339637e1a24ef4029aa052ccb.zip | |
wip(desktop): progress
| -rw-r--r-- | packages/desktop/src/pages/layout.tsx | 63 | ||||
| -rw-r--r-- | packages/ui/src/components/button.css | 3 |
2 files changed, 45 insertions, 21 deletions
diff --git a/packages/desktop/src/pages/layout.tsx b/packages/desktop/src/pages/layout.tsx index 61fa6c766..4d3f6a268 100644 --- a/packages/desktop/src/pages/layout.tsx +++ b/packages/desktop/src/pages/layout.tsx @@ -140,6 +140,42 @@ export default function Layout(props: ParentProps) { return <></> } + const ProjectVisual = (props: { directory: string; class?: string }): JSX.Element => { + const name = createMemo(() => getFilename(props.directory)) + return ( + <Switch> + <Match when={layout.sidebar.opened()}> + <Button + as={"div"} + variant="ghost" + data-active + class="flex items-center justify-between gap-3 w-full px-1 self-stretch h-8 border-none" + > + <div class="flex items-center gap-3 p-0 text-left min-w-0 grow"> + <div class="size-6 shrink-0"> + <Avatar fallback={name()} background="var(--surface-info-base)" class="size-full" /> + </div> + <span class="truncate text-14-medium text-text-strong">{name()}</span> + </div> + </Button> + </Match> + <Match when={true}> + <Button + variant="ghost" + size="large" + class="flex items-center justify-center p-0 aspect-square border-none" + data-selected={props.directory === currentDirectory()} + onClick={() => navigateToProject(props.directory)} + > + <div class="size-6 shrink-0"> + <Avatar fallback={name()} background="var(--surface-info-base)" class="size-full" /> + </div> + </Button> + </Match> + </Switch> + ) + } + const SortableProject = (props: { project: { directory: string; expanded: boolean } }): JSX.Element => { const sortable = createSortable(props.project.directory) const [projectStore] = globalSync.child(props.project.directory) @@ -147,7 +183,7 @@ export default function Layout(props: ParentProps) { const name = createMemo(() => getFilename(props.project.directory)) return ( // @ts-ignore - <div use:sortable classList={{ "opacity-0": sortable.isActiveDraggable }}> + <div use:sortable classList={{ "opacity-30": sortable.isActiveDraggable }}> <Switch> <Match when={layout.sidebar.opened()}> <Collapsible variant="ghost" defaultOpen class="gap-2 shrink-0"> @@ -239,17 +275,7 @@ export default function Layout(props: ParentProps) { </Match> <Match when={true}> <Tooltip placement="right" value={props.project.directory}> - <Button - variant="ghost" - size="large" - class="flex items-center justify-center p-0 aspect-square border-none" - data-selected={props.project.directory === currentDirectory()} - onClick={() => navigateToProject(props.project.directory)} - > - <div class="size-6 shrink-0 inset-0"> - <Avatar fallback={name()} background="var(--surface-info-base)" class="size-full" /> - </div> - </Button> + <ProjectVisual directory={props.project.directory} /> </Tooltip> </Match> </Switch> @@ -258,16 +284,11 @@ export default function Layout(props: ParentProps) { } const ProjectDragOverlay = (): JSX.Element => { - const activeName = createMemo(() => { - if (!store.activeDraggable) return undefined - return getFilename(store.activeDraggable) - }) return ( - <Show when={activeName()}> - {(name) => ( - <div class="flex items-center gap-3 px-2 py-1 bg-background-stronger rounded-md border border-border-weak-base"> - <Avatar fallback={name()} background="var(--surface-info-base)" class="size-6" /> - <span class="text-14-medium text-text-strong">{name()}</span> + <Show when={store.activeDraggable}> + {(directory) => ( + <div class="bg-background-base rounded-md"> + <ProjectVisual directory={directory()} /> </div> )} </Show> diff --git a/packages/ui/src/components/button.css b/packages/ui/src/components/button.css index a557fccb0..4cef8c7a1 100644 --- a/packages/ui/src/components/button.css +++ b/packages/ui/src/components/button.css @@ -57,6 +57,9 @@ &[data-selected="true"]:not(:disabled) { background-color: var(--surface-raised-base-hover); } + &[data-active="true"] { + background-color: var(--surface-raised-base-active); + } } &[data-variant="secondary"] { |
