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
19 changes: 16 additions & 3 deletions apps/web/src/components/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,14 @@ export function AppShell({ children }: AppShellProps) {
<OnboardingProvider>
<ChoosePathWizard />
<div
className={`sam-void flex h-screen flex-col gap-2.5 ${chatImmersive ? 'p-1.5' : 'p-2.5'}`}
className="sam-void flex h-screen flex-col gap-[var(--sam-shell-gap)] p-[var(--sam-shell-frame)]"
data-chat-immersive={chatImmersive ? 'on' : undefined}
style={{
// The frame and the gap under the app bar. Full-bleed pages read these to reach
// the screen edge and the app bar with their scrollers (`OverviewLayout`).
['--sam-shell-frame' as string]: chatImmersive ? '6px' : '10px',
['--sam-shell-gap' as string]: '10px',
}}
>
<SkipToContent />
<MobileAppBar
Expand Down Expand Up @@ -395,12 +401,19 @@ export function AppShell({ children }: AppShellProps) {
<OnboardingProvider>
<ChoosePathWizard />
<div
className="sam-void grid h-screen overflow-hidden p-4 transition-[grid-template-columns] duration-200 ease-out motion-reduce:transition-none"
className="sam-void grid h-screen overflow-hidden p-[var(--sam-shell-frame)] transition-[grid-template-columns] duration-200 ease-out motion-reduce:transition-none"
style={{
gridTemplateColumns: `${navWidth}px minmax(0, 1fr)`,
gridTemplateRows: 'minmax(0, 1fr) auto',
// Zen collapses the nav column to nothing, so it must not keep a gutter either.
columnGap: navWidth > 0 ? 'var(--sam-space-gutter)' : 0,
columnGap: 'var(--sam-shell-gap)',
// The frame, the gap between the nav and the content, and how far the content's
// left edge is from the nav or, in Zen, the screen edge. Full-bleed pages read these
// to reach the screen edge and the nav with their scrollers (`OverviewLayout`).
['--sam-shell-frame' as string]: '16px',
['--sam-shell-gap' as string]: navWidth > 0 ? 'var(--sam-space-gutter)' : '0px',
['--sam-shell-inset-start' as string]:
navWidth > 0 ? 'var(--sam-space-gutter)' : 'var(--sam-shell-frame)',
['--sam-void-x' as string]: '58%',
}}
>
Expand Down
7 changes: 5 additions & 2 deletions apps/web/src/components/inbox/InboxRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,18 @@ export const InboxRow = memo(function InboxRow({
: first.ref === selectedRef;
return (
<li className={`relative list-none ${stack ? 'pb-1.5' : ''}`} data-testid="inbox-row">
{/* The cards behind the first one. The front card is translucent, so each back card is
clipped to the 3px it shows below the card in front of it: unclipped, its outline and
fill showed through the front card. */}
{stack && (
<>
<span
aria-hidden="true"
className="absolute inset-x-5 bottom-0 h-3 rounded-b-xl border-x border-b border-[var(--sam-hairline)] bg-[var(--sam-glass-v2-fill-quiet)]"
className="absolute inset-x-5 bottom-0 h-3 rounded-b-xl border-x border-b border-[var(--sam-hairline)] bg-[var(--sam-glass-v2-fill-quiet)] [clip-path:inset(9px_0_0_0)]"
/>
<span
aria-hidden="true"
className="absolute inset-x-3 bottom-[3px] h-3 rounded-b-xl border-x border-b border-[var(--sam-hairline)] bg-[var(--sam-glass-v2-fill-quiet)]"
className="absolute inset-x-3 bottom-[3px] h-3 rounded-b-xl border-x border-b border-[var(--sam-hairline)] bg-[var(--sam-glass-v2-fill-quiet)] [clip-path:inset(9px_0_0_0)]"
/>
</>
)}
Expand Down
41 changes: 21 additions & 20 deletions apps/web/src/pages/ideas/parts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ export function IdeaStateIcon({
size = 'md',
}: {
state: IdeaDerivedStatus['state'];
size?: 'sm' | 'md' | 'lg';
/** `glyph`: the bare 18px icon in the state's colour, for rows whose other icons are bare. */
size?: 'glyph' | 'sm' | 'md' | 'lg';
}) {
const meta = STATE_ICONS[state];
if (size === 'glyph') {
return (
<span className="inline-flex shrink-0" style={{ color: meta.color }} aria-hidden>
<meta.Icon size={18} />
</span>
);
}
const box =
size === 'lg'
? 'h-11 w-11 rounded-xl'
Expand Down Expand Up @@ -322,20 +330,17 @@ export function IdeaRow({
item,
projectId,
leading,
compact = false,
}: {
item: IdeaListItem;
projectId: string;
leading?: ReactNode;
/** A summary list (the Project Overview): a small icon and no counts line. */
compact?: boolean;
}) {
const line = ideaRowLine(item);
const counts = ideaCountsLine(item.counts);
return (
<RowLink
to={projectIdeaPath(projectId, item.ideaId)}
leading={leading ?? <IdeaStateIcon state={item.derived.state} size={compact ? 'sm' : 'md'} />}
leading={leading ?? <IdeaStateIcon state={item.derived.state} />}
title={item.title}
// No flex wrapper here: `RowLink` clamps the subtitle with `line-clamp`, which is a
// `-webkit-box`, and a flex child inside one is not clamped at all — an idea whose
Expand All @@ -351,22 +356,18 @@ export function IdeaRow({
</>
}
meta={
compact ? (
<span className="flex min-w-0 flex-wrap items-center gap-2">
<span className="sr-only">{IDEA_STATE_LABELS[item.derived.state]}.</span>
) : (
<span className="flex min-w-0 flex-wrap items-center gap-2">
<span className="sr-only">{IDEA_STATE_LABELS[item.derived.state]}.</span>
{/*
Wraps rather than truncates. Four counts at their widest — "137 updates · 50+
chats · 50+ files · 50+ PRs" — do not fit a 375px row or a 340px side column, and
truncating cut a count in half ("50+ …"), which is worse than a second line. The
content is short words and numbers, so there is nothing here that can refuse to
wrap the way a long unbroken title can.
*/}
{counts && <span className="min-w-0">{counts}</span>}
{item.viaConnector && <ConnectorChip clientName={item.viaConnector} />}
</span>
)
{/*
Wraps rather than truncates. Four counts at their widest — "137 updates · 50+
chats · 50+ files · 50+ PRs" — do not fit a 375px row or a 340px side column, and
truncating cut a count in half ("50+ …"), which is worse than a second line. The
content is short words and numbers, so there is nothing here that can refuse to
wrap the way a long unbroken title can.
*/}
{counts && <span className="min-w-0">{counts}</span>}
{item.viaConnector && <ConnectorChip clientName={item.viaConnector} />}
</span>
}
testId="idea-row"
/>
Expand Down
29 changes: 25 additions & 4 deletions apps/web/src/pages/project-overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,31 @@ function usePhoneChatControl(projectId: string) {

const GUTTER = 'gap-[var(--sam-space-gutter)]';

/*
* Nothing between a pane and the void may clip, or the pane's shadow is cut off at that box's
* edge (rule 80). The page has to scroll, so each scroller's box reaches out to whatever is next
* to it (the screen edge, the app bar or nav, the task box, the other column) and pads back the
* same distance: the panes stay where they were, their shadows fall inside the scroller, and a
* pane scrolled out of view passes under its neighbour instead of being cut in mid-air.
* `--sam-shell-frame`, `--sam-shell-gap` and `--sam-shell-inset-start` come from `AppShell`.
*
* On desktop the two columns' boxes overlap in the gutter between them. The main column stacks
* above the rail (`md:z-10`) so its own scrollbar, which now sits in that gutter, stays
* reachable; what it covers there is only the rail's transparent padding.
*/
const PHONE_SCROLL_BLEED =
'-mx-[var(--sam-shell-frame)] px-[var(--sam-shell-frame)] -mt-[var(--sam-shell-gap)] pt-[var(--sam-shell-gap)] -mb-[var(--sam-space-gutter)] pb-[var(--sam-space-gutter)]';
const DESKTOP_MAIN_BLEED =
'md:-mt-[var(--sam-shell-frame)] md:pt-[var(--sam-shell-frame)] md:-ml-[var(--sam-shell-inset-start)] md:pl-[var(--sam-shell-inset-start)] md:-mr-[var(--sam-space-gutter)] md:pr-[var(--sam-space-gutter)] md:-mb-[var(--sam-space-gutter)] md:pb-[var(--sam-space-gutter)]';
const DESKTOP_RAIL_BLEED =
'md:-mt-[var(--sam-shell-frame)] md:pt-[var(--sam-shell-frame)] md:-mr-[var(--sam-shell-frame)] md:pr-[var(--sam-shell-frame)] md:-mb-[var(--sam-shell-frame)] md:pb-[var(--sam-shell-frame)] md:-ml-[var(--sam-space-gutter)] md:pl-[var(--sam-space-gutter)]';

/**
* Phone: the scroller is a flex column and both column wrappers are `display: contents`, so
* every section is a flex item ordered by `PHONE_ORDER`. Desktop: the scroller is `contents`,
* so the two columns become grid items of the root and each scrolls on its own.
* so the two columns become grid items of the root and each scrolls on its own. Every scroller
* bleeds into its surroundings (`PHONE_SCROLL_BLEED` and the desktop pair) so it never clips a
* pane's shadow; the task box stacks above the scroller that reaches its top edge.
*/
export function OverviewLayout({
main,
Expand All @@ -89,17 +110,17 @@ export function OverviewLayout({
data-testid="project-overview"
>
<div
className={`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto ${GUTTER} md:contents`}
className={`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto ${GUTTER} ${PHONE_SCROLL_BLEED} md:contents`}
data-testid="overview-scroll"
>
<div
className={`contents md:relative md:col-start-1 md:row-start-1 md:flex md:min-h-0 md:min-w-0 md:flex-col md:overflow-y-auto ${GUTTER}`}
className={`contents md:relative md:z-10 md:col-start-1 md:row-start-1 md:flex md:min-h-0 md:min-w-0 md:flex-col md:overflow-y-auto ${GUTTER} ${DESKTOP_MAIN_BLEED}`}
data-testid="overview-main"
>
{main}
</div>
<div
className={`contents md:relative md:col-start-2 md:row-span-2 md:row-start-1 md:flex md:min-h-0 md:min-w-0 md:flex-col md:overflow-y-auto ${GUTTER}`}
className={`contents md:relative md:col-start-2 md:row-span-2 md:row-start-1 md:flex md:min-h-0 md:min-w-0 md:flex-col md:overflow-y-auto ${GUTTER} ${DESKTOP_RAIL_BLEED}`}
data-testid="overview-rail"
>
{rail}
Expand Down
46 changes: 42 additions & 4 deletions apps/web/src/pages/project-overview/sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import type { ReactNode } from 'react';
import { Link } from 'react-router';

import { projectIdeaPath } from '../../lib/project-routes';
import { formatMsSpan, formatTimeFromNow } from '../../lib/time-utils';
import { IdeaRow } from '../ideas/parts';
import { IdeaStateIcon, LiveDot } from '../ideas/parts';
import { IDEA_STATE_LABELS, ideaRowLine } from '../ideas/view-model';
import type { ViewerPausedChats } from './NeedsYouSection';

/** A section's heading: its name, an optional count, and the link to its full page. */
Expand Down Expand Up @@ -271,6 +273,42 @@
);
}

/**
* A recent idea, shaped like every other Overview row (same padding, icon column, type and
* hover) so it lines up with the merged pull requests in the same pane. The Ideas page's own
* row (`IdeaRow`) is a full-width list row with dividers and counts, which is the wrong shape
* here.
*/
function RecentIdeaRow({ item, projectId }: { item: IdeaListItem; projectId: string }) {

Check warning on line 282 in apps/web/src/pages/project-overview/sections.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=raphaeltm_simple-agent-manager&issues=AaHlj8HbxHJDvo96qIoU&open=AaHlj8HbxHJDvo96qIoU&pullRequest=2816
return (
<li className="list-none">
<Link
to={projectIdeaPath(projectId, item.ideaId)}
className="flex min-h-12 min-w-0 items-start gap-3 rounded-lg px-2 py-2 no-underline hover:bg-surface-hover"
data-testid="overview-recent-idea"
>
<span className="mt-0.5 flex shrink-0">
<IdeaStateIcon state={item.derived.state} size="glyph" />
</span>
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
<span className="line-clamp-2 break-words text-[15px] font-medium leading-snug text-fg-primary">
{item.title}
</span>
<span className="line-clamp-1 text-[13px] text-fg-muted [overflow-wrap:anywhere]">
<span className="sr-only">{IDEA_STATE_LABELS[item.derived.state]}. </span>
{item.derived.state === 'working' && (
<>
<LiveDot />{' '}
</>
)}
{ideaRowLine(item)}
</span>
</span>
</Link>
</li>
);
}

function MergedPullRequestRow({ pr }: { pr: OverviewMergedPullRequest }) {
const mergedAt = pr.mergedAt ? Date.parse(pr.mergedAt) : Number.NaN;
return (
Expand Down Expand Up @@ -322,11 +360,11 @@
<Section label="Recently" className={className}>
<SectionHead title="Recently" to={`/projects/${projectId}/ideas`} linkLabel="Ideas" />
{ideas.length > 0 && (
<div className="flex flex-col" data-testid="overview-recent-ideas">
<ul className="m-0 flex flex-col p-0" data-testid="overview-recent-ideas">
{ideas.map((item) => (
<IdeaRow key={item.ideaId} item={item} projectId={projectId} compact />
<RecentIdeaRow key={item.ideaId} item={item} projectId={projectId} />
))}
</div>
</ul>
)}
{pullRequests.length > 0 && (
<ul className="m-0 flex flex-col p-0">
Expand Down
Loading
Loading