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
336 changes: 232 additions & 104 deletions packages/app-bundle/manifest.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ test.describe("smoke: session timeline", () => {

const spacer = scroller.locator('[data-timeline-row="bottom-spacer"]')
await expect(spacer).toBeVisible()
expect(await spacer.evaluate((element) => element.getBoundingClientRect().height)).toBe(64)
expect(await spacer.evaluate((element) => element.getBoundingClientRect().height)).toBe(24)
await expect
.poll(() => scroller.evaluate((element) => element.scrollHeight - element.clientHeight - element.scrollTop))
.toBeLessThanOrEqual(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@

document.documentElement.dataset.theme = themeId
document.documentElement.dataset.colorScheme = mode
// Brand ground, tracking harmoniqs.json palette.neutral (dark #000, light #fff).
// This paints before any stylesheet, so a stock literal here shows through as
// the old brand for the first frame.
document.documentElement.style.backgroundColor = isDark ? "#0F0F0D" : "#ffffff"
// Pre-paint ground, tracking harmoniqs.json's deepest ground per scheme:
// dark keeps the stock neutral #080808 (the brand cream-black read as warm
// against VS Code's chrome), light is the brand white. This paints before any
// stylesheet, so a wrong literal here shows through for the first frame.
document.documentElement.style.backgroundColor = isDark ? "#080808" : "#ffffff"

// Update theme-color meta tag to match app color scheme
var metas = document.querySelectorAll("meta[name='theme-color']")
if (metas.length > 0) metas[0].setAttribute("content", isDark ? "#0F0F0D" : "#ffffff")
if (metas.length > 0) metas[0].setAttribute("content", isDark ? "#080808" : "#ffffff")

if (themeId === "oc-2") return // stock theme needs no cached CSS

Expand Down
45 changes: 42 additions & 3 deletions packages/app-bundle/overlay/packages/app/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ import { setPendingAutoSend } from "@/pages/new-session/new-session-draft-contro
import { PromptProvider } from "@/context/prompt"
import { ServerConnection, ServerProvider, serverName, useServer } from "@/context/server"
import { SettingsProvider, useSettings } from "@/context/settings"
import { TabsProvider, useTabs, type DraftTab } from "@/context/tabs"
import { TabsProvider, tabHref, useTabs, type DraftTab } from "@/context/tabs"
import { SDKProvider, useSDK } from "@/context/sdk"
import { resolveLandingDirectory } from "@/pages/new-session-landing"
import { WslServersProvider } from "@/wsl/context"
import DirectoryLayout, { DirectoryDataProvider } from "@/pages/directory-layout"
import LegacyLayout from "@/pages/layout"
Expand All @@ -74,7 +75,6 @@ import { bugDockController } from "@/pages/session/composer/bug-dock-controller"
import { postBugReportPoke } from "@/utils/amicode-bug-report"

import { SessionPage, SessionRouteErrorBoundary, TargetSessionRouteContent } from "@/pages/session"
import { NewHome } from "@/pages/home"
import { LegacyHome } from "@/pages/home/legacy-home"
import { AmicodeFileRefBridge } from "@/components/amicode-file-ref-bridge"
import { DevToolsReopenBridge } from "@/components/settings-dialog"
Expand Down Expand Up @@ -741,7 +741,7 @@ function Routes(props: { serverScoped?: JSX.Element }) {
</Route>
</Route>
<Show when={settings.general.newLayoutDesigns()}>
<Route path="/" component={NewHome} />
<Route path="/" component={NewSessionLanding} />
<Route path="/:dir/session/:id" component={NewLayoutLegacySessionRedirect} />
<Route path="/server/:serverKey/session/:id" component={TargetSessionRoute} />
</Show>
Expand All @@ -750,6 +750,45 @@ function Routes(props: { serverScoped?: JSX.Element }) {
)
}

/** Landing route when the Home/Dashboard page is removed: creates a new draft
* session tab on mount and navigates to it. If a session tab already exists,
* navigates to the most recent one instead of creating a duplicate. */
function NewSessionLanding() {
const tabs = useTabs()
const global = useGlobal()
const navigate = useNavigate()

const land = () => {
// If there's already a session or draft tab, navigate to it
const existing = tabs.store.find((tab) => tab.type === "session" || tab.type === "draft")
if (existing) {
navigate(tabHref(existing), { replace: true })
return
}

// Otherwise create a new draft — find a server + directory to use
const connections = global.servers.list()
const conn = connections[0]
if (!conn) return // no server connected yet — will re-render when one connects

// projects.list() is the client-side store of OPENED projects, which is empty
// on a fresh profile and for servers running outside any registered project
// (the amicode chat server spawns in an internal scaffold dir). Falling back
// to a server-known worktree keeps this route from rendering nothing at all.
const ctx = global.ensureServerCtx(conn)
const directory = resolveLandingDirectory(ctx.projects.list(), ctx.sync.data.project[0]?.worktree)
if (!directory) return // nothing to land on yet — re-renders when sync arrives

tabs.newDraft({ server: ServerConnection.key(conn), directory }, "")
}

return (
<Show when={tabs.ready()}>
{(() => { land(); return null })()}
</Show>
)
}

function NewLayoutLegacySessionRedirect() {
const server = useServer()
const tabs = useTabs()
Expand Down
Loading
Loading