Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ function createMainWindow(): BrowserWindow {
minWidth: 840,
minHeight: 620,
// The web shell draws its own title bar (workspace switcher) beside the
// inset traffic lights, which sit centered in its 48px height.
// inset traffic lights, which sit centered in its 40px height.
...(process.platform === "darwin" && {
titleBarStyle: "hiddenInset",
trafficLightPosition: { x: 14, y: 18 },
trafficLightPosition: { x: 14, y: 14 },
}),
// Windows and Linux take the window's icon; macOS ignores it for the Dock's.
icon: ICON,
Expand Down
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

/* The app's desktop tint (--cw-desktop in style.css), so the swap to the app does not shift colour. */
body {
background: color-mix(in oklab, var(--t-bg) 96%, var(--t-text));
background: var(--cw-desktop, var(--t-bg));
color: var(--t-text);
font:
13px/1.4 system-ui,
var(--text-ui, 12px) / 1.4 var(--font-sans, system-ui),
-apple-system,
"Segoe UI",
sans-serif;
Expand Down
34 changes: 11 additions & 23 deletions apps/web/src/components/composer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CornerDownLeft, X, type LucideIcon } from "lucide-react";
import type { ComponentProps, ReactNode, Ref } from "react";
import type { ReactNode, Ref } from "react";

import { cn } from "@/lib/utils";
import { isMac } from "@codeworksh/widget/view";
Expand Down Expand Up @@ -48,10 +48,8 @@ export function Composer({
return (
<div className="w-full">
<form
// Raised like a frame (the theme's top-down gradient, top highlight and shadows), with a deeper
// drop so it still floats when it sits inside one.
className={cn(
"relative z-10 flex flex-col rounded-[22px] border border-edge bg-linear-to-b from-frame-top to-frame to-60% shadow-[inset_0_1px_0_var(--cw-highlight),0_1px_2px_var(--cw-shadow-near),0_14px_36px_-12px_var(--cw-shadow-far)] transition-colors focus-within:border-edge-focus",
"composer-surface relative z-10 flex flex-col transition-colors duration-120 focus-within:border-edge-focus",
className,
)}
onSubmit={(event) => {
Expand Down Expand Up @@ -84,20 +82,20 @@ export function Composer({
placeholder={placeholder}
aria-label="Prompt"
// Grows with its text, from four lines (one when compact) up to about nine, then scrolls.
className={`block max-h-52 w-full resize-none bg-transparent text-[14px] leading-relaxed text-ink outline-none [field-sizing:content] placeholder:text-ink-muted ${compact ? "min-h-6" : "min-h-19.5"}`}
className={`block max-h-52 w-full resize-none bg-transparent text-body text-ink outline-none [field-sizing:content] placeholder:text-ink-muted ${compact ? "min-h-6" : "min-h-19.5"}`}
/>
</div>
<div className={`flex items-center gap-2 ${compact ? "px-2.5 pb-2.5" : "px-4 pb-4"}`}>
{/* Pulled left by a control's padding, so the first one's icon lines up with the prompt's text. */}
<div className="-ml-2.5 flex min-w-0 flex-1 items-center gap-1 text-[14px] font-medium text-ink-muted">
<div className="-ml-2.5 flex min-w-0 flex-1 flex-wrap items-center gap-1 text-ui font-medium text-ink-muted">
{controls}
</div>
{actions}
</div>
</form>
{tray !== undefined && (
// Inset from the card's rounded corners, tucked under its bottom edge.
<div className="mx-5.5 -mt-4 flex items-center gap-2 rounded-b-[16px] border border-edge bg-frame/60 px-2 pt-5 pb-1 text-[12px] text-ink-muted/70">
<div className="mx-3 -mt-3 flex items-center gap-2 rounded-b-lg border border-edge bg-selection-subtle px-2 pt-4 pb-1 text-ui text-ink-muted">
{tray}
</div>
)}
Expand All @@ -106,17 +104,7 @@ export function Composer({
}

/** Shared expanded surface for starting a session and replying to one. */
export function PromptComposer(props: ComponentProps<typeof Composer>) {
return (
<Composer
{...props}
className={cn(
"rounded-xl bg-frame-top [&_textarea]:rounded-lg [&_textarea]:bg-ink/4 [&_textarea]:px-3 [&_textarea]:py-2",
props.className,
)}
/>
);
}
export const PromptComposer = Composer;

export function ComposerHeader({
title,
Expand All @@ -128,9 +116,9 @@ export function ComposerHeader({
readonly onClose?: () => void;
}) {
return (
<div className="flex h-10 items-center gap-2 px-4 text-[12px] text-ink-muted">
<Icon className="size-3.5 text-brand" aria-hidden />
<span className="flex-1 font-medium text-ink">{title}</span>
<div className="flex h-pane items-center gap-2 px-4 text-ui text-ink-muted">
<Icon className="size-3.5" aria-hidden />
<span className="flex-1 font-medium">{title}</span>
{onClose !== undefined && (
<button
type="button"
Expand Down Expand Up @@ -159,7 +147,7 @@ export function ComposerSubmit({
<button
type="submit"
disabled={disabled}
className="flex h-8 shrink-0 items-center gap-2 rounded-md bg-brand px-3 text-[12px] font-medium text-brand-ink outline-none hover:brightness-110 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-frame press disabled:pointer-events-none disabled:opacity-50"
className="flex h-7 shrink-0 items-center gap-2 rounded-md bg-primary px-2.5 text-ui font-medium text-primary-foreground outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-frame press disabled:pointer-events-none disabled:bg-primary/25 disabled:text-primary-foreground/60"
title={title ?? `${label} (Enter)`}
>
{label}
Expand Down Expand Up @@ -188,7 +176,7 @@ export function ComposerButton({
title={label}
disabled={disabled}
onClick={onClick}
className="grid size-8 shrink-0 place-items-center rounded-full bg-brand text-brand-ink shadow-xs transition-[opacity,scale,filter] duration-150 ease-out enabled:hover:brightness-110 enabled:active:scale-[0.97] disabled:opacity-64"
className="grid size-7 shrink-0 place-items-center rounded-md bg-primary text-primary-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring press enabled:hover:bg-primary/90 disabled:bg-primary/25 disabled:text-primary-foreground/60"
>
{children}
</button>
Expand Down
11 changes: 6 additions & 5 deletions apps/web/src/landing/landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ export function Landing() {
<div className="flex h-full min-w-0 flex-col select-none">
<main className="relative flex min-h-0 flex-1 flex-col items-center overflow-auto px-4">
<div className="flex-[0.8]" />
<Wordmark className="pointer-events-none w-[min(88%,44rem)] shrink-0 text-brand opacity-15" />
<div className="mt-10 w-full max-w-2xl shrink-0">
<Wordmark className="pointer-events-none w-[min(60%,22rem)] shrink-0 text-ink opacity-20" />
<p className="mt-5 text-body text-ink-muted">What would you like to work on?</p>
<div className="mt-6 w-full max-w-2xl shrink-0">
{notice !== undefined && <ComposerNotice {...notice} />}
<PromptComposer
header={<ComposerHeader title="New Session" icon={SquarePen} />}
header={<ComposerHeader title="New session" icon={SquarePen} />}
autoFocus
value={query}
onChange={setQuery}
onSubmit={() => void send()}
placeholder="Ask for changes, send follow-ups, or attach images"
placeholder="Describe a task or ask a question…"
controls={
<>
<ModelPicker
Expand All @@ -105,7 +106,7 @@ export function Landing() {
/>
</>
}
actions={<ComposerSubmit label="Start Session" disabled={!canSend} />}
actions={<ComposerSubmit label="Start session" disabled={!canSend} />}
tray={
<>
<DropdownMenu>
Expand Down
23 changes: 13 additions & 10 deletions apps/web/src/landing/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,23 @@ export function SessionsSidebar() {
aria-label="Search sessions"
value={query}
onChange={(event) => setQuery(event.target.value)}
className="h-8 rounded-lg border-transparent bg-transparent pl-8 text-sm shadow-none focus-visible:bg-ink/5"
className="h-7 rounded-md border-transparent bg-transparent pl-8 text-ui shadow-none focus-visible:bg-selection-subtle"
/>
</div>
<button
type="button"
onClick={startNew}
className="mt-1 flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-sm text-ink transition-colors outline-none hover:bg-ink/5 focus-visible:bg-ink/5"
className="mt-1 flex h-7 w-full items-center gap-2 rounded-md px-2.5 text-left text-ui text-ink outline-none hover:bg-selection-subtle focus-visible:ring-2 focus-visible:ring-ring press"
>
<SquarePen className="size-3.5 text-ink-muted" aria-hidden />
New
New session
</button>
</div>
</SidebarHeader>
<SidebarContent className="px-2 pt-2 pb-2">
<SidebarContent className="gap-0 px-2 pb-2">
<h2 className="flex h-7 shrink-0 items-center px-2.5 text-2xs font-medium text-ink-muted">
Recent sessions
</h2>
{problem !== undefined ? (
<OpenProviderSettings
problem={problem}
Expand All @@ -103,18 +106,18 @@ export function SessionsSidebar() {
<Empty>
{place.kind === "none" && result.value.length === 0 ? (
<>
<span>No Projects Yet</span>
<span>No projects yet</span>
{addProject !== undefined && (
<EmptyAction
icon={<Plus className="-mx-0.5 size-3" strokeWidth={2} aria-hidden />}
onClick={addProject}
>
Add Project
Add project
</EmptyAction>
)}
</>
) : (
<span>No Sessions Yet</span>
<span>No sessions yet</span>
)}
</Empty>
)
Expand All @@ -126,16 +129,16 @@ export function SessionsSidebar() {
type="button"
title={`${session.project.path}\n${isMac ? "⌘" : "Ctrl"}-click opens it in a new frame\n⇧-click opens it in a new workspace`}
aria-current={sessionAddress(session.id) === current ? "true" : undefined}
className="block w-full rounded-lg px-2.5 py-2 text-left transition-colors outline-none hover:bg-ink/5 focus-visible:bg-ink/5 aria-current:bg-ink/8"
className="block w-full rounded-md px-2.5 py-2 text-left outline-none hover:bg-selection-subtle focus-visible:ring-2 focus-visible:ring-ring aria-current:bg-selection"
onClick={(event) => open(session, event)}
onAuxClick={(event) => open(session, event)}
>
<div className="flex h-5 min-w-0 items-center gap-1.5 text-xs text-ink-muted">
<div className="flex h-4 min-w-0 items-center gap-1.5 text-2xs text-ink-muted">
<Monogram id={session.project.id} name={session.project.name} />
<span className="min-w-0 flex-1 truncate">{session.project.name}</span>
<span className="shrink-0 tabular-nums">{ago(session.updated)}</span>
</div>
<div className="mt-1 truncate text-sm text-ink">{session.title}</div>
<div className="mt-1 truncate text-ui text-ink">{session.title}</div>
</button>
</li>
))}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ function Root() {
return (
<SidebarProvider
className="app-shell h-full min-h-0 flex-col bg-desktop"
style={{ "--sidebar-width": "15rem" } as CSSProperties}
style={{ "--sidebar-width": "16.25rem" } as CSSProperties}
widthStorageKey="codework.sidebar.width"
>
<NavigationControls />
<div className="mb-2 mr-2 ml-[52px] flex min-h-0 flex-1 overflow-hidden rounded-xl bg-frame">
<div className="mb-2 mr-2 ml-rail flex min-h-0 flex-1 overflow-hidden rounded-xl border border-edge bg-frame">
<Navigation />
{inSettings ? <SettingsSidebar /> : <SessionsSidebar />}
<div className="flex min-w-0 flex-1 flex-col overflow-hidden">
Expand Down
12 changes: 6 additions & 6 deletions apps/web/src/settings/blocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export function Page({
children: ReactNode;
}) {
return (
<div className="mx-auto flex w-full max-w-248 flex-col gap-8 px-5 py-8 text-sm sm:px-8 sm:py-10">
<div className="@container mx-auto flex w-full max-w-conversation flex-col gap-6 px-5 py-8 text-ui sm:px-8">
<header className="flex flex-col gap-2">
<div className="flex items-center gap-4">
<h1 className="min-w-0 flex-1 text-2xl/tight font-semibold tracking-tight">{title}</h1>
<h1 className="min-w-0 flex-1 text-[22px]/tight font-semibold tracking-tight">{title}</h1>
{actions}
</div>
{description !== undefined && <p className="text-ink-muted">{description}</p>}
Expand All @@ -31,8 +31,8 @@ export function Page({

export function Section({ title, children }: { title: string; children: ReactNode }) {
return (
<section className="flex flex-col gap-3">
<h2 className="text-sm font-semibold">{title}</h2>
<section className="flex flex-col gap-2">
<h2 className="flex min-h-7 items-center text-ui font-medium text-ink-muted">{title}</h2>
{children}
</section>
);
Expand All @@ -54,10 +54,10 @@ export function Row({
children?: ReactNode;
}) {
return (
<div className="flex flex-col items-start gap-3 px-4 py-4 sm:flex-row sm:items-center sm:gap-4">
<div className="flex flex-col items-start gap-3 px-4 py-3 @min-[560px]:flex-row @min-[560px]:items-center @min-[560px]:gap-4">
<div className="flex min-w-0 flex-1 flex-col gap-1">
<span className="font-medium">{title}</span>
{description !== undefined && <span className="text-sm text-ink-muted">{description}</span>}
{description !== undefined && <span className="text-ui text-ink-muted">{description}</span>}
</div>
{children}
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/settings/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function SettingsSidebar() {
return (
<Sidebar collapsible="offcanvas" className="shell-sidebar select-none">
<SidebarHeader className="gap-1 px-2 pt-2 pb-2">
<h1 className="flex h-8 items-center px-2.5 text-sm font-semibold text-ink">Settings</h1>
<h1 className="flex h-7 items-center px-2.5 text-ui font-medium text-ink">Settings</h1>
<div className="relative">
<Search
className="pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-ink-muted"
Expand All @@ -37,7 +37,7 @@ export function SettingsSidebar() {
placeholder="Search"
aria-label="Search settings"
value={query}
className="h-8 rounded-lg border-transparent bg-transparent pl-8 text-sm shadow-none focus-visible:bg-ink/5"
className="h-7 rounded-md border-transparent bg-transparent pl-8 text-ui shadow-none focus-visible:bg-selection-subtle"
onChange={(event) => setQuery(event.target.value)}
onKeyDown={(event) => {
const first = matches[0];
Expand Down Expand Up @@ -65,7 +65,7 @@ export function SettingsSidebar() {
<SidebarMenuButton
asChild
isActive={current}
className="h-8 rounded-lg px-2.5 text-sm text-ink-muted data-[active=true]:bg-ink/8 data-[active=true]:text-ink"
className="h-7 rounded-md px-2.5 text-ui text-ink-muted data-[active=true]:bg-selection data-[active=true]:text-ink"
>
<Link to={to} aria-current={current ? "page" : undefined}>
<Icon className="size-4" strokeWidth={1.5} aria-hidden />
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/shell/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function Navigation() {
return (
<nav
aria-label="Main navigation"
className="fixed top-12 bottom-0 left-0 z-20 flex w-[52px] flex-col items-center gap-2 bg-desktop pt-2 pb-3 select-none"
className="fixed top-titlebar bottom-0 left-0 z-20 flex w-rail flex-col items-center gap-2 bg-desktop pt-2 pb-3 select-none"
>
<Tooltip>
<TooltipTrigger asChild>
Expand Down Expand Up @@ -47,4 +47,4 @@ export function Navigation() {
}

const destination =
"grid size-8 place-items-center rounded-lg text-ink-muted outline-none hover:bg-ink/5 hover:text-ink focus-visible:ring-2 focus-visible:ring-ring aria-[current=page]:bg-ink/8 aria-[current=page]:text-ink press [-webkit-app-region:no-drag]";
"grid size-8 place-items-center rounded-md text-ink-muted outline-none hover:bg-selection-subtle hover:text-ink focus-visible:ring-2 focus-visible:ring-ring aria-[current=page]:bg-selection aria-[current=page]:text-ink press [-webkit-app-region:no-drag]";
15 changes: 6 additions & 9 deletions apps/web/src/shell/switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ export function Switcher({ workspaces, active }: SwitcherProps) {
});

return (
<nav
aria-label="Workspaces"
className="ml-3 flex min-w-0 items-center rounded-xl bg-ink/5 p-1 [-webkit-app-region:no-drag]"
>
<nav aria-label="Workspaces" className="flex min-w-0 items-center gap-1 [-webkit-app-region:no-drag]">
{workspaces.map((workspace, index) => {
const current = workspace.id === active?.id;
const tab = showing(workspace);
Expand All @@ -113,19 +110,19 @@ export function Switcher({ workspaces, active }: SwitcherProps) {
{index > 0 && (
<span aria-hidden className={`mx-0.5 h-4 w-px shrink-0 bg-ink/12 ${divider ? "" : "invisible"}`} />
)}
<div className="group relative flex h-8 w-56 min-w-16 shrink basis-56">
<div className="group relative flex h-tab w-56 min-w-16 shrink basis-56">
<Link
{...workspaceRoute(workspace)}
aria-current={current ? "page" : undefined}
title={`${tab}\n${shortcutLabel(index + 1)}`}
className={`flex size-full min-w-0 items-center gap-2 rounded-lg pr-3 pl-1.5 group-hover:pr-8 outline-none focus-visible:ring-2 focus-visible:ring-ring ${
className={`flex size-full min-w-0 items-center gap-2 rounded-md pr-3 pl-2 group-hover:pr-8 outline-none focus-visible:ring-2 focus-visible:ring-ring ${
current
? "border border-edge bg-linear-to-b from-frame-top to-frame text-ink shadow-frame"
: "border border-transparent text-ink-muted hover:bg-ink/5 hover:text-ink"
? "bg-selection text-ink"
: "bg-ink/4 text-ink-muted hover:bg-selection-subtle hover:text-ink"
}`}
>
<span
className={`grid size-6 shrink-0 place-items-center rounded-md border ${current ? "border-edge bg-frame-top text-ink shadow-xs" : "border-transparent text-ink-muted"}`}
className={`grid size-4 shrink-0 place-items-center ${current ? "text-ink" : "text-ink-muted"}`}
>
<AppWindow className="size-3.5" strokeWidth={1.75} aria-hidden />
</span>
Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/shell/titlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const insetTitleBar = window.desktopBridge?.platform === "darwin";

/** A square title-bar button; it opts out of the window's drag region so it can be clicked. */
export const chromeButton =
"grid size-7 shrink-0 place-items-center rounded-lg text-ink-muted press [-webkit-app-region:no-drag] hover:bg-ink/5 hover:text-ink disabled:opacity-40 disabled:hover:bg-transparent";
"grid size-6 shrink-0 place-items-center rounded-md text-ink-muted press [-webkit-app-region:no-drag] hover:bg-selection-subtle hover:text-ink disabled:opacity-40 disabled:hover:bg-transparent";

/** Window-level navigation remains available on Home, workspaces, and settings. */
export function NavigationControls() {
Expand All @@ -28,10 +28,10 @@ export function NavigationControls() {
const index = useLocation({ select: (location) => location.state.__TSR_index });
const canGoForward = index < router.history.length - 1;
return (
<header className="flex h-12 w-full shrink-0 items-center border-b border-edge/50 bg-desktop pr-2 select-none [-webkit-app-region:drag]">
<header className="flex h-titlebar w-full shrink-0 items-center bg-desktop pr-2 select-none [-webkit-app-region:drag]">
<div
className={`flex shrink-0 items-center gap-1 px-2 ${insetTitleBar ? "min-w-44 pl-20" : "min-w-28"}`}
style={{ width: withSidebar ? "calc(52px + var(--sidebar-width))" : undefined }}
style={{ width: withSidebar ? "calc(var(--cw-rail-width) + var(--sidebar-width))" : undefined }}
>
<button
type="button"
Expand Down
Loading
Loading