Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(web): polish the What's new and welcome moments (#4693)

Raghav Chamadiya77698ef27f91
diff --git a/packages/web/messages/en.json b/packages/web/messages/en.json
index c3427043a..0f82e87fb 100644
--- a/packages/web/messages/en.json
+++ b/packages/web/messages/en.json
@@ -1476,6 +1476,8 @@
"connectFailed": "Couldn't connect {name}",
"copyPrompt": "Copy prompt",
"prompt": "Connect repowise to {name} for this repo. Run `{command}` in the repo root, then restart {name} so it loads the repowise tools. Run `repowise doctor` to check the connection.",
+ "listLabel": "Agents on this machine",
+ "moreAgents": "{count, plural, one {# more agent} other {# more agents}} found. Setup lists them all.",
"askLabel": "Ask it something",
"askRisk": "Which files are riskiest to change, and why?",
"askHotspot": "Why does {path} change so often?",
@@ -1487,16 +1489,15 @@
},
"yours": {
"title": "Make it <em>yours</em>",
- "lede": "Both are optional. You can change them any time in Settings.",
- "modelTitle": "Add a model for the parts that need one",
- "optional": "Optional",
+ "lede": "Every part is optional. Change any of it later in Settings.",
+ "modelTitle": "Add a model where it helps",
"gets": {
"docs": "Docs that explain how and why",
"chat": "Chat in this dashboard",
"answers": "Written answers for your agent",
"local": "Your key or sign-in stays here"
},
- "detectedLabel": "Found on this machine",
+ "detected": "Found on this machine: {names}.",
"syncTitle": "Keep the index in sync",
"syncBody": "Updates after each commit through a git hook.",
"syncFailed": "Couldn't change sync",
diff --git a/packages/web/messages/zh-CN.json b/packages/web/messages/zh-CN.json
index cb8bda6d1..6871097ae 100644
--- a/packages/web/messages/zh-CN.json
+++ b/packages/web/messages/zh-CN.json
@@ -1476,6 +1476,8 @@
"connectFailed": "无法连接 {name}",
"copyPrompt": "复制提示词",
"prompt": "为此仓库将 repowise 连接到 {name}。在仓库根目录运行 `{command}`,然后重启 {name},让它加载 repowise 工具。运行 `repowise doctor` 检查连接。",
+ "listLabel": "本机上的智能体",
+ "moreAgents": "还找到 {count} 个智能体。设置页列出了全部。",
"askLabel": "问它一个问题",
"askRisk": "哪些文件改动风险最高?为什么?",
"askHotspot": "为什么 {path} 改动如此频繁?",
@@ -1487,16 +1489,15 @@
},
"yours": {
"title": "按<em>你的方式</em>设置",
- "lede": "两项都是可选的。你可以随时在设置中更改。",
- "modelTitle": "为需要模型的部分添加一个模型",
- "optional": "可选",
+ "lede": "每一项都是可选的,之后可在设置中随时更改。",
+ "modelTitle": "在有用的地方添加模型",
"gets": {
"docs": "解释原理和原因的文档",
"chat": "在此仪表板中对话",
"answers": "为你的智能体撰写的回答",
"local": "你的密钥或登录信息保留在本机"
},
- "detectedLabel": "在本机找到",
+ "detected": "在本机找到:{names}。",
"syncTitle": "保持索引同步",
"syncBody": "每次提交后通过 git 钩子更新。",
"syncFailed": "无法更改同步设置",
diff --git a/packages/web/src/components/layout/moment-shell.tsx b/packages/web/src/components/layout/moment-shell.tsx
index f003000f0..15fea6fe3 100644
--- a/packages/web/src/components/layout/moment-shell.tsx
+++ b/packages/web/src/components/layout/moment-shell.tsx
@@ -4,35 +4,77 @@ import { cn } from "@repowise-dev/ui/lib/cn";
/**
* The shared look of the dialogs that present instead of asking: What's new and
* the welcome. A deeper ground than the overlay plane, a glow band behind a
- * display heading, and cards with a series-coloured left edge.
+ * display heading, and quiet cards keyed by a series-coloured dot.
+ *
+ * One scale for both: display title, 15px body, 12px caption, 10px micro;
+ * 16px gutters on a phone and 32px on a desktop; a 12px shell radius and 8px
+ * inside it.
*/
-/** The dialog ground. Pass to `DialogContent` with the dialog's own sizing. */
-export const MOMENT_GROUND = "gap-0 bg-[var(--color-release-ground)] p-0";
+/** The dialog ground, plus a 44px close target in the top corner. Pass to
+ * `DialogContent` with the dialog's own sizing. */
+export const MOMENT_GROUND =
+ "gap-0 bg-[var(--color-release-ground)] p-0 " +
+ "[&>button:last-child]:right-2 [&>button:last-child]:top-2 [&>button:last-child]:grid [&>button:last-child]:size-11 [&>button:last-child]:place-items-center [&>button:last-child]:rounded-lg [&>button:last-child]:bg-[color-mix(in_srgb,var(--color-release-ground)_80%,transparent)] [&>button:last-child]:ring-offset-0";
+
+/** Below 561px a full-height sheet; above, a centred dialog. Add the desktop
+ * width (`min-[561px]:max-w-*`) and height at the call site. */
+export const MOMENT_SHEET =
+ "left-0 top-0 flex h-dvh max-h-none w-full max-w-none translate-x-0 translate-y-0 flex-col overflow-hidden rounded-none border-0 " +
+ "min-[561px]:left-[50%] min-[561px]:top-[50%] min-[561px]:max-h-[85vh] min-[561px]:translate-x-[-50%] min-[561px]:translate-y-[-50%] min-[561px]:rounded-xl min-[561px]:border";
+
+/** Horizontal gutters for every part of a moment: band, body and footer. */
+export const MOMENT_GUTTER = "px-4 min-[561px]:px-8";
export const MOMENT_MICRO =
- "font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]";
+ "font-mono text-[10px] font-normal uppercase leading-4 tracking-[0.12em] text-[var(--color-text-tertiary)]";
+
+/** Body copy: ledes, row titles, highlight titles. */
+export const MOMENT_BODY = "text-[15px] leading-6";
-/** A gentle rise on open; the global reduced-motion rule flattens it. */
+/** Secondary copy under a row or figure. */
+export const MOMENT_CAPTION = "text-xs leading-5 text-[var(--color-text-secondary)] [text-wrap:pretty]";
+
+/** A counted figure: one size across both moments. */
+export const MOMENT_FIGURE =
+ "text-[22px] font-semibold leading-7 tabular-nums tracking-tight text-[var(--color-text-primary)]";
+
+/** A short fade and a 4px rise, eased out; reduced motion skips it. */
export const MOMENT_ENTER =
- "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 duration-500";
+ "motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-200 motion-safe:ease-out";
-/** The display heading's type, without its weight. */
+/** The display heading: one size per breakpoint, balanced so no word sits
+ * alone on the last line. */
export const MOMENT_DISPLAY =
- "font-serif text-4xl tracking-tight text-[var(--color-text-primary)] sm:text-5xl";
+ "font-serif text-[32px] font-normal leading-[1.1] tracking-tight text-[var(--color-text-primary)] [text-wrap:balance] min-[561px]:text-[44px]";
-/** A card on the moment ground; set `borderLeftColor` to its series colour. */
+/** A card on the moment ground. */
export const MOMENT_CARD =
- "rounded-lg border border-[var(--color-border-default)] border-l-[3px] bg-[var(--color-release-card)]";
+ "rounded-lg border border-[var(--color-border-default)] bg-[var(--color-release-card)]";
+
+/** A quiet text action: links and copy buttons inside a moment. */
+export const MOMENT_LINK =
+ "rounded text-xs font-medium text-[var(--color-text-primary)] underline decoration-[var(--color-border-hover)] underline-offset-[3px] hover:decoration-[var(--color-text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]";
+
+/** A micro-label with the series dot that keys a card. */
+export function MomentLabel({ color, children }: { color: string; children: ReactNode }) {
+ return (
+ <span className={cn(MOMENT_MICRO, "flex items-center gap-2")}>
+ <span aria-hidden className="size-1.5 shrink-0 rounded-full" style={{ background: color }} />
+ {children}
+ </span>
+ );
+}
/** The glow bands, fading into the dialog ground. Solid stops, checked by
* contrast-check.py. What's new runs orange into plum; the welcome runs plum
- * into blue. */
+ * into blue. Each reaches the ground before the far edge, so it reads as a
+ * wash behind the heading. */
const BANDS = {
release:
- "linear-gradient(120deg, var(--color-release-glow-1) 0%, var(--color-release-glow-2) 55%, var(--color-release-ground) 100%)",
+ "linear-gradient(120deg, var(--color-release-glow-1) 0%, var(--color-release-glow-2) 45%, var(--color-release-ground) 90%)",
welcome:
- "linear-gradient(120deg, var(--color-release-glow-2) 0%, var(--color-release-glow-3) 55%, var(--color-release-ground) 100%)",
+ "linear-gradient(120deg, var(--color-release-glow-2) 0%, var(--color-release-glow-3) 45%, var(--color-release-ground) 90%)",
} as const;
export type MomentTone = keyof typeof BANDS;
@@ -49,7 +91,11 @@ export function MomentBand({
}) {
return (
<header
- className={cn("border-b border-[var(--color-border-default)] px-6 pb-6 pt-6 sm:px-8", className)}
+ className={cn(
+ "shrink-0 border-b border-[var(--color-border-default)] pb-6 pt-6 min-[561px]:pt-8",
+ MOMENT_GUTTER,
+ className,
+ )}
style={{ backgroundImage: BANDS[tone] }}
>
{children}
diff --git a/packages/web/src/components/layout/release-moment.tsx b/packages/web/src/components/layout/release-moment.tsx
index c5d36ee9b..d8a1d07f6 100644
--- a/packages/web/src/components/layout/release-moment.tsx
+++ b/packages/web/src/components/layout/release-moment.tsx
@@ -63,13 +63,21 @@ function useReleaseMoment(firstRepoId: string | null) {
const [preview, setPreview] = useState(false);
const version = meta?.server_version ?? null;
+ // The query as the page loaded: the welcome drops `?tour=1` once it opens,
+ // which may be before the version arrives.
+ const loadSearch = useRef<string | null>(null);
+ useEffect(() => {
+ loadSearch.current ??= window.location.search;
+ }, []);
+
// Once per version: StrictMode runs effects twice in development, and the
// second run would read the version the first one stored.
const decided = useRef<string | null>(null);
useEffect(() => {
if (!version || !meta || decided.current === version) return;
decided.current = version;
- const next = decideMoment(version, meta.highlights ?? [], window.location.search);
+ const search = loadSearch.current ?? window.location.search;
+ const next = decideMoment(version, meta.highlights ?? [], search);
setPreview(next.preview);
setMoment(next.moment);
// `meta` refreshes hourly with the same version; the version is the key.
diff --git a/packages/web/src/components/layout/release-notes.tsx b/packages/web/src/components/layout/release-notes.tsx
index 5bf26ae5c..90da31f68 100644
--- a/packages/web/src/components/layout/release-notes.tsx
+++ b/packages/web/src/components/layout/release-notes.tsx
@@ -10,11 +10,15 @@ import type { ChangelogEntry, ChangelogHighlight, ReleaseStats } from "@/lib/api
import { linkPullRequests, resolveHighlightHref } from "@/lib/release-moment";
import { NewMark } from "./new-mark";
import {
+ MOMENT_BODY,
+ MOMENT_CAPTION,
MOMENT_CARD,
MOMENT_DISPLAY,
MOMENT_ENTER as ENTER,
+ MOMENT_FIGURE,
MOMENT_MICRO as MICRO,
MomentBand,
+ MomentLabel,
} from "./moment-shell";
export function releaseName(version: string, nextLabel: string): string {
@@ -38,16 +42,12 @@ export function ReleaseHeader({
id={`release-${entry.version}`}
className={`mt-3 flex flex-wrap items-baseline gap-x-3 gap-y-1 ${ENTER}`}
>
- <span className={`${MOMENT_DISPLAY} font-light`}>
- {releaseName(entry.version, t("nextRelease"))}
- </span>
+ <span className={MOMENT_DISPLAY}>{releaseName(entry.version, t("nextRelease"))}</span>
{entry.label && (
- <span className="font-mono text-xs text-[var(--color-text-secondary)]">{entry.label}</span>
+ <span className="font-mono text-xs tabular-nums text-[var(--color-text-secondary)]">{entry.label}</span>
)}
</h3>
- {entry.version === "unreleased" && (
- <p className="mt-2 text-xs text-[var(--color-text-secondary)]">{t("unreleasedNote")}</p>
- )}
+ {entry.version === "unreleased" && <p className={`${MOMENT_CAPTION} mt-2`}>{t("unreleasedNote")}</p>}
</MomentBand>
);
}
@@ -72,18 +72,18 @@ export function ReleaseNotes({
const sections = entry.sections.filter((s) => s.items.length > 0);
return (
- <article className="space-y-8" aria-labelledby={`release-${entry.version}`}>
+ <article className={`space-y-10 ${ENTER}`} aria-labelledby={`release-${entry.version}`}>
{entry.summary && (
- <div className="text-[var(--color-text-secondary)] [text-wrap:pretty]">
+ <div className="max-w-[68ch] text-[var(--color-text-secondary)] [text-wrap:pretty]">
<Markdown content={linkPullRequests(entry.summary)} density="narrow" fill />
</div>
)}
{entry.stats && <ReleaseNumbers stats={entry.stats} />}
{highlights.length > 0 && (
<Block id={`highlights-${entry.version}`} title={t("highlightsTitle")}>
- <ul className="grid gap-2.5 sm:grid-cols-2">
+ <ul className="grid gap-3 min-[561px]:grid-cols-2 min-[561px]:[&>li:last-child:nth-child(odd)]:col-span-2">
{highlights.map((h, i) => (
- <li key={h.id} className={`flex ${ENTER}`}>
+ <li key={h.id} className="flex">
<HighlightItem
highlight={h}
href={resolveHighlightHref(h.href, repoId)}
@@ -121,8 +121,8 @@ function Block({ id, title, children }: { id: string; title: string; children: R
);
}
-/** A card only when it opens something; a highlight with no page keeps its
- * colour as a dot and stays plain. */
+/** Every highlight is the same card, keyed by its series dot; one with a page
+ * opens it, one without says where it lives. */
function HighlightItem({
highlight: h,
href,
@@ -140,40 +140,39 @@ function HighlightItem({
const t = useTranslations("shell.whatsNewModal");
const body = (
<>
- <p className="flex items-baseline gap-2 text-[15px] font-medium text-[var(--color-text-primary)]">
- {h.title}
+ <p className={`${MOMENT_BODY} flex items-start gap-3 font-medium text-[var(--color-text-primary)]`}>
+ <span className="flex min-w-0 items-center gap-2">
+ <span aria-hidden className="size-1.5 shrink-0 rounded-full" style={{ background: color }} />
+ {h.title}
+ </span>
{fresh && <NewMark />}
</p>
- {h.blurb && (
- <p className="mt-1 text-xs leading-relaxed text-[var(--color-text-secondary)] [text-wrap:pretty]">
- {h.blurb}
- </p>
- )}
+ {h.blurb && <p className={`${MOMENT_CAPTION} mt-1 pl-3.5`}>{h.blurb}</p>}
</>
);
+ const card = `${MOMENT_CARD} flex w-full flex-col p-4`;
if (href) {
return (
<Link
href={href}
onClick={onNavigate}
- className={`${MOMENT_CARD} group flex w-full flex-col px-4 py-3 no-underline transition-colors hover:border-[var(--color-border-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]`}
- style={{ borderLeftColor: color }}
+ className={`${card} group no-underline transition-colors hover:border-[var(--color-border-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]`}
>
{body}
- <span className="mt-auto inline-flex items-center gap-1 pt-2 text-xs text-[var(--color-accent-primary)] group-hover:underline">
+ <span className="mt-auto inline-flex items-center gap-1 pl-3.5 pt-3 text-xs font-medium text-[var(--color-text-primary)]">
{t("open")}
- <ArrowRight aria-hidden className="h-3 w-3" />
+ <ArrowRight
+ aria-hidden
+ className="h-3 w-3 motion-safe:transition-transform motion-safe:duration-150 group-hover:translate-x-0.5"
+ />
</span>
</Link>
);
}
return (
- <div className="flex w-full gap-3 px-1 py-3">
- <span aria-hidden className="mt-1.5 h-2 w-2 shrink-0 rounded-full" style={{ background: color }} />
- <div className="min-w-0">
- {body}
- {h.href && <p className="mt-1.5 text-xs text-[var(--color-text-tertiary)]">{t("inEachRepo")}</p>}
- </div>
+ <div className={card}>
+ {body}
+ {h.href && <p className="mt-auto pl-3.5 pt-3 text-xs text-[var(--color-text-tertiary)]">{t("inEachRepo")}</p>}
</div>
);
}
@@ -189,12 +188,12 @@ function ChangeSection({ name, items }: { name: string; items: string[] }) {
if (e.currentTarget.open) setOpened(true);
}}
>
- <summary className="flex cursor-pointer list-none items-baseline gap-2 rounded py-2 text-sm text-[var(--color-text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]">
- <span aria-hidden className="text-[var(--color-text-tertiary)] group-open/section:rotate-90 motion-safe:transition-transform">
+ <summary className="flex min-h-11 cursor-pointer list-none items-center gap-2 rounded text-[var(--color-text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]">
+ <span aria-hidden className="w-3 text-[var(--color-text-tertiary)] group-open/section:rotate-90 motion-safe:transition-transform motion-safe:duration-150">
›
</span>
- <span className="font-medium">{name}</span>
- <span className="text-xs tabular-nums text-[var(--color-text-tertiary)]">
+ <span className={`${MOMENT_BODY} font-medium`}>{name}</span>
+ <span className="ml-auto text-xs tabular-nums text-[var(--color-text-tertiary)]">
{t("sectionCount", { count: items.length })}
</span>
</summary>
@@ -209,7 +208,7 @@ function SectionBody({ items }: { items: string[] }) {
[items],
);
return (
- <div className="pb-2 pl-4 text-[var(--color-text-secondary)]">
+ <div className="pb-3 pl-5 text-[var(--color-text-secondary)]">
<Markdown content={content} density="compact" fill />
</div>
);
@@ -221,8 +220,8 @@ interface Figure {
sub?: string | undefined;
}
-/** "By the numbers": large figures, each over a short bar in its series
- * colour, then the thank-you. No names: the counts carry the credit. */
+/** "By the numbers": a row of figures, each keyed by its series dot, then the
+ * thank-you. No names: the counts carry the credit. */
export function ReleaseNumbers({ stats }: { stats: ReleaseStats }) {
const t = useTranslations("shell.whatsNewModal");
const format = useFormatter();
@@ -267,27 +266,18 @@ export function ReleaseNumbers({ stats }: { stats: ReleaseStats }) {
<p className={MICRO}>
{t("numbersTitle")} · {t("numbersSince", { days: stats.days, since: stats.since })}
</p>
- <dl className="grid grid-cols-2 gap-x-6 gap-y-5 sm:grid-cols-3 lg:grid-cols-5">
+ <dl className={`${MOMENT_CARD} grid grid-cols-2 gap-x-6 gap-y-6 p-4 min-[561px]:grid-cols-3`}>
{figures.map((f, i) => (
- <div key={f.label} className={`min-w-0 ${ENTER}`}>
- <span
- aria-hidden
- className="mb-2.5 block h-[3px] w-8 rounded-full"
- style={{ background: seriesColor(i) }}
- />
- <dt className={MICRO}>{f.label}</dt>
- <dd className="mt-1 text-3xl font-semibold tabular-nums tracking-tight text-[var(--color-text-primary)]">
- {f.value}
- </dd>
- {f.sub && (
- <dd className="mt-1 text-xs tabular-nums leading-snug text-[var(--color-text-secondary)]">
- {f.sub}
- </dd>
- )}
+ <div key={f.label} className="min-w-0">
+ <dt>
+ <MomentLabel color={seriesColor(i)}>{f.label}</MomentLabel>
+ </dt>
+ <dd className={`${MOMENT_FIGURE} mt-2`}>{f.value}</dd>
+ {f.sub && <dd className={`${MOMENT_CAPTION} mt-1 tabular-nums`}>{f.sub}</dd>}
</div>
))}
</dl>
- <p className="text-sm leading-relaxed text-[var(--color-text-secondary)] [text-wrap:pretty]">
+ <p className={`${MOMENT_BODY} max-w-[68ch] text-[var(--color-text-secondary)] [text-wrap:pretty]`}>
{first
? t("thanksFirst", { count: n(stats.contributors), first: n(first) })
: t("thanks", { count: n(stats.contributors) })}
diff --git a/packages/web/src/components/layout/whats-new-modal.tsx b/packages/web/src/components/layout/whats-new-modal.tsx
index b022552b5..bca863903 100644
--- a/packages/web/src/components/layout/whats-new-modal.tsx
+++ b/packages/web/src/components/layout/whats-new-modal.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { usePathname } from "next/navigation";
import {
Dialog,
@@ -9,10 +9,11 @@ import {
DialogHeader,
DialogTitle,
} from "@repowise-dev/ui/ui/dialog";
+import type { ChangelogEntry } from "@/lib/api/meta";
import { useChangelog } from "@/lib/hooks/use-meta-version";
import { highlightRepoId } from "@/lib/release-moment";
import { useTranslations } from "next-intl";
-import { MOMENT_GROUND } from "./moment-shell";
+import { MOMENT_GROUND, MOMENT_GUTTER, MOMENT_MICRO, MOMENT_SHEET } from "./moment-shell";
import { ReleaseHeader, ReleaseNotes, releaseName } from "./release-notes";
/** How many earlier releases the switcher lists. */
@@ -35,6 +36,7 @@ export function WhatsNewModal({ open, onOpenChange, version, fresh = false }: Wh
// Only fetch once the modal is opened.
const { entries, error, isLoading } = useChangelog(open);
const [selected, setSelected] = useState<string | null>(null);
+ const scroller = useRef<HTMLDivElement>(null);
// Each opening starts on the release it was opened for.
useEffect(() => {
@@ -52,7 +54,7 @@ export function WhatsNewModal({ open, onOpenChange, version, fresh = false }: Wh
const title = (
<DialogHeader>
- <DialogTitle className="font-mono text-[10px] font-normal uppercase tracking-[0.12em] text-[var(--color-text-secondary)]">
+ <DialogTitle className={`${MOMENT_MICRO} pr-10`}>
{t("whatsNewModal.title")}
</DialogTitle>
<DialogDescription className="sr-only">{t("whatsNewModal.description")}</DialogDescription>
@@ -61,76 +63,93 @@ export function WhatsNewModal({ open, onOpenChange, version, fresh = false }: Wh
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- {/* Its own deeper ground and a glow band: the release moment is the one
- dialog that presents rather than asks. */}
- <DialogContent className={`${MOMENT_GROUND} max-h-[85vh] overflow-y-auto sm:max-w-3xl`}>
- {entry ? (
- <ReleaseHeader key={`h-${entry.version}`} entry={entry} title={title} />
- ) : (
- <div className="px-6 pt-6 sm:px-8">{title}</div>
- )}
+ {/* Its own deeper ground and a glow band: a moment presents instead of
+ asking. */}
+ <DialogContent
+ data-moment
+ className={`${MOMENT_GROUND} ${MOMENT_SHEET} min-[561px]:h-auto min-[561px]:max-w-3xl`}
+ >
+ {/* One scroll for band and notes; the close button stays put. */}
+ <div ref={scroller} className="min-h-0 flex-1 overflow-y-auto overscroll-contain">
+ {entry ? (
+ <ReleaseHeader key={`h-${entry.version}`} entry={entry} title={title} />
+ ) : (
+ <div className={`${MOMENT_GUTTER} pt-6 min-[561px]:pt-8`}>{title}</div>
+ )}
- <div className="space-y-8 px-6 py-6 sm:px-8">
- {isLoading && (
- <p className="text-sm text-[var(--color-text-tertiary)]">
- {t("whatsNewModal.loading")}
- </p>
- )}
- {error && (
- <p className="text-sm text-[var(--color-text-tertiary)]">
- {t.rich("whatsNewModal.unavailable", {
- link: (chunks) => (
- <a
- href="https://github.com/repowise-dev/repowise/releases"
- target="_blank"
- rel="noreferrer"
- className="text-[var(--color-accent-primary)] underline"
- >
- {chunks}
- </a>
- ),
- })}
- </p>
- )}
+ <div className={`${MOMENT_GUTTER} space-y-10 pb-[max(2rem,env(safe-area-inset-bottom))] pt-6`}>
+ {isLoading && (
+ <p className="text-xs text-[var(--color-text-tertiary)]">{t("whatsNewModal.loading")}</p>
+ )}
+ {error && (
+ <p className="text-xs text-[var(--color-text-tertiary)]">
+ {t.rich("whatsNewModal.unavailable", {
+ link: (chunks) => (
+ <a
+ href="https://github.com/repowise-dev/repowise/releases"
+ target="_blank"
+ rel="noreferrer"
+ className="text-[var(--color-accent-primary)] underline"
+ >
+ {chunks}
+ </a>
+ ),
+ })}
+ </p>
+ )}
- {entry && (
- <ReleaseNotes
- key={entry.version}
- entry={entry}
- repoId={highlightRepoId(pathname)}
- fresh={fresh && entry === fallback}
- onNavigate={() => onOpenChange(false)}
- />
- )}
+ {entry && (
+ <ReleaseNotes
+ key={entry.version}
+ entry={entry}
+ repoId={highlightRepoId(pathname)}
+ fresh={fresh && entry === fallback}
+ onNavigate={() => onOpenChange(false)}
+ />
+ )}
- {earlier.length > 0 && (
- <nav
- aria-label={t("whatsNewModal.earlier")}
- className="space-y-1.5 border-t border-[var(--color-border-default)] pt-4"
- >
- <p className="font-mono text-[10px] uppercase tracking-[0.12em] text-[var(--color-text-tertiary)]">
- {t("whatsNewModal.earlier")}
- </p>
- <ul className="flex flex-wrap gap-x-4 gap-y-1">
- {earlier.map((e) => (
- <li key={e.version}>
- <button
- type="button"
- onClick={() => setSelected(e.version)}
- className="rounded text-xs text-[var(--color-accent-primary)] underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
- >
- {releaseName(e.version, t("whatsNewModal.nextRelease"))}
- {e.label && (
- <span className="ml-1 text-[var(--color-text-tertiary)]">{e.label}</span>
- )}
- </button>
- </li>
- ))}
- </ul>
- </nav>
- )}
+ {earlier.length > 0 && (
+ <EarlierReleases
+ entries={earlier}
+ onSelect={(v) => {
+ setSelected(v);
+ scroller.current?.scrollTo?.({ top: 0 });
+ }}
+ />
+ )}
+ </div>
</div>
</DialogContent>
</Dialog>
);
}
+
+/** The switcher to earlier releases, as quiet version chips. */
+function EarlierReleases({
+ entries,
+ onSelect,
+}: {
+ entries: ChangelogEntry[];
+ onSelect: (version: string) => void;
+}) {
+ const t = useTranslations("shell.whatsNewModal");
+ return (
+ <nav aria-label={t("earlier")} className="space-y-3">
+ <p className={MOMENT_MICRO}>{t("earlier")}</p>
+ <ul className="flex flex-wrap gap-2">
+ {entries.map((e) => (
+ <li key={e.version}>
+ <button
+ type="button"
+ onClick={() => onSelect(e.version)}
+ className="inline-flex h-11 items-center gap-2 rounded-lg border border-[var(--color-border-default)] px-3 font-mono text-xs tabular-nums text-[var(--color-text-primary)] transition-colors hover:border-[var(--color-border-hover)] hover:bg-[var(--color-bg-elevated)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] min-[561px]:h-8"
+ >
+ {releaseName(e.version, t("nextRelease"))}
+ {e.label && <span className="text-[var(--color-text-tertiary)]">{e.label}</span>}
+ </button>
+ </li>
+ ))}
+ </ul>
+ </nav>
+ );
+}
diff --git a/packages/web/src/components/welcome/welcome-dialog.test.tsx b/packages/web/src/components/welcome/welcome-dialog.test.tsx
index 1d296e806..5bf5f169a 100644
--- a/packages/web/src/components/welcome/welcome-dialog.test.tsx
+++ b/packages/web/src/components/welcome/welcome-dialog.test.tsx
@@ -188,6 +188,35 @@ describe("WelcomeDialog", () => {
fireEvent.click(screen.getByRole("button", { name: "Write the docs" }));
expect(mocks.openSheet).toHaveBeenCalled();
});
+
+ it("moves on with Enter from the heading, but not from a control", () => {
+ renderDialog();
+ fireEvent.keyDown(document.activeElement!, { key: "Enter" });
+ expect(screen.getByText("Step 2 of 3")).toBeTruthy();
+ fireEvent.keyDown(screen.getByRole("button", { name: "Back" }), { key: "Enter" });
+ expect(screen.getByText("Step 2 of 3")).toBeTruthy();
+ fireEvent.keyDown(document.activeElement!, { key: "Enter" });
+ expect(screen.getByText("Step 3 of 3")).toBeTruthy();
+ // The last step leaves Enter to the Finish link.
+ fireEvent.keyDown(document.activeElement!, { key: "Enter" });
+ expect(screen.getByText("Step 3 of 3")).toBeTruthy();
+ });
+
+ it("lists connected agents first, a few at most, and shortens config paths", () => {
+ const many = ["a", "b", "c", "d", "e"].map((id) => ({
+ id,
+ display_name: `Agent ${id}`,
+ installed: true,
+ connected: id === "e",
+ config_files: { repo: [`C:\\work\\repo\\.${id}\\mcp.json`] },
+ }));
+ renderDialog({ setup: setup({ agents: many }) });
+ fireEvent.click(screen.getByRole("button", { name: "Next: your agent" }));
+ const names = screen.getAllByRole("heading", { level: 4 }).map((h) => h.textContent);
+ expect(names).toEqual(["Agent e", "Agent a", "Agent b", "Agent c"]);
+ expect(screen.getByText("1 more agent found. Setup lists them all.")).toBeTruthy();
+ expect(screen.getByText(".a/mcp.json").getAttribute("title")).toBe("C:\\work\\repo\\.a\\mcp.json");
+ });
});
describe("hosted row", () => {
diff --git a/packages/web/src/components/welcome/welcome-dialog.tsx b/packages/web/src/components/welcome/welcome-dialog.tsx
index 9ea794080..b7e3bc19f 100644
--- a/packages/web/src/components/welcome/welcome-dialog.tsx
+++ b/packages/web/src/components/welcome/welcome-dialog.tsx
@@ -1,7 +1,7 @@
"use client";
import Link from "next/link";
-import { useEffect, useRef, useState, type ReactNode } from "react";
+import { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
import { useTranslations } from "next-intl";
import {
Dialog,
@@ -13,11 +13,14 @@ import { Button } from "@repowise-dev/ui/ui/button";
import type { SetupResponse } from "@/lib/api/setup";
import type { WelcomeLens } from "@/lib/welcome-moment";
import {
+ MOMENT_BODY,
MOMENT_DISPLAY,
MOMENT_EMPHASIS,
MOMENT_ENTER,
MOMENT_GROUND,
+ MOMENT_GUTTER,
MOMENT_MICRO,
+ MOMENT_SHEET,
MomentBand,
} from "@/components/layout/moment-shell";
import { WelcomeStepRepo } from "./welcome-step-repo";
@@ -27,10 +30,12 @@ import { WelcomeStepYours } from "./welcome-step-yours";
const STEPS = ["repo", "agent", "yours"] as const;
type Step = (typeof STEPS)[number];
-/** Below 561px the dialog is a full-height sheet; above, a centred dialog. */
-const SHEET =
- "left-0 top-0 flex h-dvh max-h-none w-full max-w-none translate-x-0 translate-y-0 flex-col overflow-hidden rounded-none border-0 " +
- "min-[561px]:left-[50%] min-[561px]:top-[50%] min-[561px]:h-auto min-[561px]:max-h-[85vh] min-[561px]:max-w-[720px] min-[561px]:translate-x-[-50%] min-[561px]:translate-y-[-50%] min-[561px]:rounded-[14px] min-[561px]:border";
+/** One fixed height on a desktop, so the footer stays put between steps;
+ * the body scrolls inside it. A phone gets the full-height sheet. */
+const SIZE = "min-[561px]:h-[min(680px,85vh)] min-[561px]:max-w-[720px]";
+
+/** 44px on a phone, the compact 36px above. */
+const FOOTER_BUTTON = "h-11 min-[561px]:h-9";
export interface WelcomeDialogProps {
open: boolean;
@@ -45,26 +50,44 @@ export interface WelcomeDialogProps {
hotspotPath: string | null;
}
+/** Enter on the dialog itself (not on a control inside it) moves on a step.
+ * Keydowns from portalled children (the model sheet, the sync confirm)
+ * bubble here through React, so the target must sit in this dialog's DOM. */
+function advancesOnEnter(e: KeyboardEvent<HTMLElement>): boolean {
+ const modified = [e.shiftKey, e.metaKey, e.ctrlKey, e.altKey, e.nativeEvent.isComposing].some(Boolean);
+ if (e.key !== "Enter" || modified) return false;
+ const target = e.target as HTMLElement;
+ if (!e.currentTarget.contains(target)) return false;
+ return !target.closest(
+ "button, a, input, textarea, select, summary, [role=button], [role=switch], [role=radio], [contenteditable=true]",
+ );
+}
+
/**
* The three-step welcome: what repowise found, the agent that can read it,
* and the optional parts. Built on the What's new shell with a plum-to-blue
- * band. Esc or the close button ends it at any step.
+ * band. Esc or the close button ends it at any step; Enter moves on.
*/
export function WelcomeDialog(props: WelcomeDialogProps) {
const { open, onOpenChange, repoId } = props;
const t = useTranslations("welcome");
const [index, setIndex] = useState(0);
const step = STEPS[index]!;
+ const last = index === STEPS.length - 1;
const heading = useRef<HTMLHeadingElement>(null);
+ const body = useRef<HTMLDivElement>(null);
// Each opening starts at the first step.
useEffect(() => {
if (open) setIndex(0);
}, [open]);
- // The heading names the step; moving focus there announces it.
+ // The heading names the step; moving focus there announces it. A new step
+ // starts at the top of the scroll.
useEffect(() => {
- if (open) heading.current?.focus();
+ if (!open) return;
+ body.current?.scrollTo?.({ top: 0 });
+ heading.current?.focus();
}, [index, open]);
const close = () => onOpenChange(false);
@@ -72,77 +95,98 @@ export function WelcomeDialog(props: WelcomeDialogProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
- className={`${MOMENT_GROUND} ${SHEET}`}
+ data-moment
+ className={`${MOMENT_GROUND} ${MOMENT_SHEET} ${SIZE}`}
onOpenAutoFocus={(e) => {
e.preventDefault();
heading.current?.focus();
}}
+ onKeyDown={(e) => {
+ if (!last && advancesOnEnter(e)) {
+ e.preventDefault();
+ setIndex(index + 1);
+ }
+ }}
>
{/* Band and body scroll; the footer and the close button stay put. */}
- <div className="min-h-0 flex-1 overflow-y-auto">
- <MomentBand tone="welcome" className="max-[560px]:px-[18px] max-[560px]:pb-4 max-[560px]:pt-[18px]">
- <p className={`${MOMENT_MICRO} pr-8`}>{t("eyebrow")}</p>
- <DialogTitle
- ref={heading}
- tabIndex={-1}
- className={`${MOMENT_DISPLAY} mt-3 font-normal leading-[1.08] outline-none max-[560px]:text-[29px] ${MOMENT_ENTER}`}
- >
- <StepTitle step={step} repoName={props.repoName} />
- </DialogTitle>
- <DialogDescription className="mt-2 text-sm text-[var(--color-text-secondary)] [text-wrap:pretty]">
- <StepLede step={step} fileCount={props.fileCount} years={props.years} />
- </DialogDescription>
- <StepIndicator index={index} />
- </MomentBand>
-
- <div className="flex-1 px-6 pb-2 pt-5 sm:px-8 max-[560px]:px-[18px]">
- {step === "repo" && (
- <WelcomeStepRepo repoId={repoId} lenses={props.lenses} onNavigate={close} />
- )}
- {step === "agent" && (
- <WelcomeStepAgent repoId={repoId} setup={props.setup} hotspotPath={props.hotspotPath} />
- )}
- {step === "yours" && <WelcomeStepYours repoId={repoId} setup={props.setup} />}
- </div>
- </div>
-
- <footer className="flex flex-col-reverse gap-3 border-t border-[var(--color-border-default)] bg-[var(--color-release-ground)] px-[18px] pb-[18px] pt-3 min-[561px]:flex-row min-[561px]:items-center min-[561px]:justify-between min-[561px]:border-t-0 min-[561px]:px-8 min-[561px]:pb-5 min-[561px]:pt-3.5">
- <span className="text-center text-xs text-[var(--color-text-tertiary)] min-[561px]:text-left">
- {t("stepOf", { step: index + 1, total: STEPS.length })}
- </span>
- <div className="flex flex-col-reverse gap-2 min-[561px]:flex-row">
- {index === 0 ? (
- <Button variant="ghost" size="sm" className="h-9 max-[560px]:w-full" onClick={close}>
- {t("skip")}
- </Button>
- ) : (
- <Button
- variant="ghost"
- size="sm"
- className="h-9 max-[560px]:w-full"
- onClick={() => setIndex(index - 1)}
+ <div ref={body} className="min-h-0 flex-1 overflow-y-auto overscroll-contain">
+ <MomentBand tone="welcome">
+ <p className={`${MOMENT_MICRO} pr-10`}>{t("eyebrow")}</p>
+ <div key={step} className={MOMENT_ENTER}>
+ <DialogTitle ref={heading} tabIndex={-1} className={`${MOMENT_DISPLAY} mt-3 outline-none`}>
+ <StepTitle step={step} repoName={props.repoName} />
+ </DialogTitle>
+ <DialogDescription
+ className={`${MOMENT_BODY} mt-3 max-w-[56ch] text-[var(--color-text-secondary)] [text-wrap:pretty]`}
>
- {t("back")}
- </Button>
+ <StepLede step={step} fileCount={props.fileCount} years={props.years} />
+ </DialogDescription>
+ </div>
+ </MomentBand>
+
+ <div key={step} className={`${MOMENT_GUTTER} py-6 ${MOMENT_ENTER}`}>
+ {step === "repo" && (
+ <WelcomeStepRepo repoId={repoId} lenses={props.lenses} onNavigate={close} />
)}
- {index < STEPS.length - 1 ? (
- <Button size="sm" className="h-9 max-[560px]:w-full" onClick={() => setIndex(index + 1)}>
- {index === 0 ? t("nextAgent") : t("nextYours")}
- </Button>
- ) : (
- <Button asChild size="sm" className="h-9 max-[560px]:w-full">
- <Link href={`/repos/${encodeURIComponent(repoId)}/settings/setup`} onClick={close}>
- {t("finish")}
- </Link>
- </Button>
+ {step === "agent" && (
+ <WelcomeStepAgent repoId={repoId} setup={props.setup} hotspotPath={props.hotspotPath} />
)}
+ {step === "yours" && <WelcomeStepYours repoId={repoId} setup={props.setup} />}
</div>
- </footer>
+ </div>
+
+ <StepFooter index={index} repoId={repoId} onStep={setIndex} onClose={close} />
</DialogContent>
</Dialog>
);
}
+/** Stays put across steps: the step indicator, then Skip or Back and the one
+ * ink primary on the right. */
+function StepFooter({
+ index,
+ repoId,
+ onStep,
+ onClose,
+}: {
+ index: number;
+ repoId: string;
+ onStep: (index: number) => void;
+ onClose: () => void;
+}) {
+ const t = useTranslations("welcome");
+ const primary = `${FOOTER_BUTTON} flex-1 min-[561px]:flex-none`;
+ return (
+ <footer
+ className={`${MOMENT_GUTTER} flex shrink-0 flex-col gap-3 border-t border-[var(--color-border-default)] bg-[var(--color-release-ground)] pb-[max(1rem,env(safe-area-inset-bottom))] pt-4 min-[561px]:flex-row min-[561px]:items-center min-[561px]:justify-between`}
+ >
+ <StepIndicator index={index} />
+ <div className="flex gap-2">
+ {index === 0 ? (
+ <Button variant="ghost" className={FOOTER_BUTTON} onClick={onClose}>
+ {t("skip")}
+ </Button>
+ ) : (
+ <Button variant="ghost" className={FOOTER_BUTTON} onClick={() => onStep(index - 1)}>
+ {t("back")}
+ </Button>
+ )}
+ {index < STEPS.length - 1 ? (
+ <Button className={primary} onClick={() => onStep(index + 1)}>
+ {index === 0 ? t("nextAgent") : t("nextYours")}
+ </Button>
+ ) : (
+ <Button asChild className={primary}>
+ <Link href={`/repos/${encodeURIComponent(repoId)}/settings/setup`} onClick={onClose}>
+ {t("finish")}
+ </Link>
+ </Button>
+ )}
+ </div>
+ </footer>
+ );
+}
+
function StepTitle({ step, repoName }: { step: Step; repoName: string }) {
const t = useTranslations("welcome");
const em = (chunks: ReactNode) => <span style={MOMENT_EMPHASIS}>{chunks}</span>;
@@ -164,38 +208,34 @@ function StepLede({ step, fileCount, years }: { step: Step; fileCount: number; y
);
}
-/** Three short bars with their names: done, current, then upcoming. */
+/** Three short segments, filled up to the current step, then the count. The
+ * step names are for screen readers; the heading names the step on screen. */
function StepIndicator({ index }: { index: number }) {
const t = useTranslations("welcome");
return (
- <ol aria-label={t("stepsLabel")} className="mt-4 flex flex-wrap gap-x-4 gap-y-1 text-xs">
- {STEPS.map((s, i) => {
- const state = i < index ? "done" : i === index ? "current" : "next";
- return (
- <li
- key={s}
- aria-current={state === "current" ? "step" : undefined}
- className={`flex items-center gap-1.5 ${
- state === "current"
- ? "font-medium text-[var(--color-text-primary)]"
- : "text-[var(--color-text-tertiary)]"
- }`}
- >
- <span
- aria-hidden
- className={`inline-block h-0.5 w-4 ${
- state === "current"
- ? "bg-[var(--color-text-primary)]"
- : state === "done"
- ? "bg-[var(--color-success)]"
- : "bg-[var(--color-border-hover)]"
- }`}
- />
- {t(`steps.${s}`)}
- {state === "done" && <span className="sr-only">{t("stepDone")}</span>}
- </li>
- );
- })}
- </ol>
+ <div className="flex items-center gap-3">
+ <ol aria-label={t("stepsLabel")} className="flex items-center gap-1">
+ {STEPS.map((s, i) => {
+ const state = i < index ? "done" : i === index ? "current" : "next";
+ return (
+ <li key={s} aria-current={state === "current" ? "step" : undefined} className="flex">
+ <span
+ aria-hidden
+ className={`block h-1 rounded-full motion-safe:transition-[width,background-color] motion-safe:duration-200 motion-safe:ease-out ${
+ state === "current" ? "w-6" : "w-3"
+ } ${state === "next" ? "bg-[var(--color-border-hover)]" : "bg-[var(--color-text-primary)]"}`}
+ />
+ <span className="sr-only">
+ {t(`steps.${s}`)}
+ {state === "done" && ` ${t("stepDone")}`}
+ </span>
+ </li>
+ );
+ })}
+ </ol>
+ <span className="text-xs tabular-nums text-[var(--color-text-tertiary)]">
+ {t("stepOf", { step: index + 1, total: STEPS.length })}
+ </span>
+ </div>
);
}
diff --git a/packages/web/src/components/welcome/welcome-step-agent.tsx b/packages/web/src/components/welcome/welcome-step-agent.tsx
index f1b1141cf..84c375bba 100644
--- a/packages/web/src/components/welcome/welcome-step-agent.tsx
+++ b/packages/web/src/components/welcome/welcome-step-agent.tsx
@@ -8,11 +8,20 @@ import { AiPromptButton } from "@repowise-dev/ui/health/ai-prompt-button";
import { CommandLine } from "@repowise-dev/ui/shared/command-line";
import { toFriendlyMessage } from "@repowise-dev/ui/lib/errors";
import { connectSetupAgent, type SetupResponse } from "@/lib/api/setup";
-import { MOMENT_MICRO } from "@/components/layout/moment-shell";
+import {
+ MOMENT_BODY,
+ MOMENT_CAPTION,
+ MOMENT_CARD,
+ MOMENT_LINK,
+ MOMENT_MICRO,
+} from "@/components/layout/moment-shell";
type SetupAgent = NonNullable<SetupResponse["agents"]>[number];
-const ROW = "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-t border-[var(--color-border-default)] py-2.5 max-[560px]:grid-cols-1";
+/** Rows shown before the rest are left to Setup, which lists every agent. */
+const AGENTS_SHOWN = 4;
+
+const ROW = "flex flex-col gap-3 py-4 first:pt-0 last:pb-0 min-[561px]:flex-row min-[561px]:items-center min-[561px]:justify-between";
/** The first config file `repowise agents add` writes for this agent, if known. */
function firstConfigFile(agent: SetupAgent): string | null {
@@ -22,6 +31,15 @@ function firstConfigFile(agent: SetupAgent): string | null {
return null;
}
+/** The end of a config path: the file, with its folder when that is a dot
+ * folder (`.cursor/mcp.json`). The full path stays in the tooltip. */
+export function shortConfigPath(path: string): string {
+ const parts = path.split(/[\\/]/).filter(Boolean);
+ const file = parts[parts.length - 1] ?? path;
+ const dir = parts[parts.length - 2];
+ return dir?.startsWith(".") ? `${dir}/${file}` : file;
+}
+
/** Copies `text`; false when the clipboard is blocked. */
async function copyText(text: string): Promise<boolean> {
try {
@@ -32,7 +50,8 @@ async function copyText(text: string): Promise<boolean> {
}
}
-/** Step 2: the agents found on this machine, and two questions to try. */
+/** Step 2: the agents found on this machine, connected ones first, and two
+ * questions to try. */
export function WelcomeStepAgent({
repoId,
setup,
@@ -45,43 +64,57 @@ export function WelcomeStepAgent({
const t = useTranslations("welcome.agent");
// Connected here, before the setup data catches up.
const [connected, setConnected] = useState<Record<string, boolean>>({});
- const agents = (setup?.agents ?? []).filter((a) => a.installed || a.connected);
+ const found = (setup?.agents ?? [])
+ .filter((a) => a.installed || a.connected)
+ .sort((a, b) => Number(b.connected) - Number(a.connected));
+ const agents = found.slice(0, AGENTS_SHOWN);
+ const more = found.length - agents.length;
const questions = [
t("askRisk"),
hotspotPath ? t("askHotspot", { path: hotspotPath }) : t("askStart"),
];
return (
- <div>
- {agents.length === 0 ? (
- <p className="border-t border-[var(--color-border-default)] py-2.5 text-xs text-[var(--color-text-secondary)]">
- {t("none")}
- </p>
- ) : (
- agents.map((agent) => (
- <AgentRow
- key={agent.id}
- repoId={repoId}
- agent={agent}
- connected={connected[agent.id] ?? agent.connected}
- writesAllowed={setup?.writes_allowed ?? false}
- callsKnown={setup?.calls_available ?? false}
- onConnected={(value) => setConnected((c) => ({ ...c, [agent.id]: value }))}
- />
- ))
- )}
- <h3 className={`${MOMENT_MICRO} mt-4`}>{t("askLabel")}</h3>
- <ul className="mt-2 flex flex-col gap-1.5">
- {questions.map((q) => (
- <li
- key={q}
- className="flex items-center justify-between gap-3 rounded-md border border-[var(--color-border-default)] bg-[var(--color-release-card)] px-2.5 py-2 text-[13px] text-[var(--color-text-primary)]"
- >
- <span className="min-w-0 [overflow-wrap:anywhere]">{q}</span>
- <CopyQuestion text={q} />
- </li>
- ))}
- </ul>
+ <div className="space-y-8">
+ <section aria-labelledby="welcome-agents">
+ <h3 id="welcome-agents" className={`${MOMENT_MICRO} mb-3`}>
+ {t("listLabel")}
+ </h3>
+ {agents.length === 0 ? (
+ <p className={MOMENT_CAPTION}>{t("none")}</p>
+ ) : (
+ <ul className="divide-y divide-[var(--color-border-default)]">
+ {agents.map((agent) => (
+ <AgentRow
+ key={agent.id}
+ repoId={repoId}
+ agent={agent}
+ connected={connected[agent.id] ?? agent.connected}
+ writesAllowed={setup?.writes_allowed ?? false}
+ callsKnown={setup?.calls_available ?? false}
+ onConnected={(value) => setConnected((c) => ({ ...c, [agent.id]: value }))}
+ />
+ ))}
+ </ul>
+ )}
+ {more > 0 && <p className={`${MOMENT_CAPTION} mt-3`}>{t("moreAgents", { count: more })}</p>}
+ </section>
+
+ <section aria-labelledby="welcome-ask">
+ <h3 id="welcome-ask" className={`${MOMENT_MICRO} mb-3`}>
+ {t("askLabel")}
+ </h3>
+ <ul className={`${MOMENT_CARD} divide-y divide-[var(--color-border-default)]`}>
+ {questions.map((q) => (
+ <li key={q} className="flex items-center justify-between gap-4 py-1 pl-4 pr-2">
+ <span className={`${MOMENT_BODY} min-w-0 py-2 text-[var(--color-text-primary)] [overflow-wrap:anywhere]`}>
+ {q}
+ </span>
+ <CopyQuestion text={q} />
+ </li>
+ ))}
+ </ul>
+ </section>
</div>
);
}
@@ -103,7 +136,6 @@ function AgentRow({
onConnected: (value: boolean) => void;
}) {
const t = useTranslations("welcome.agent");
- const format = useFormatter();
const [busy, setBusy] = useState(false);
const name = agent.display_name;
const command = `repowise agents add --target=${agent.id}`;
@@ -127,50 +159,97 @@ function AgentRow({
const file = firstConfigFile(agent);
return (
- <div className={ROW}>
+ <li className={ROW}>
<div className="min-w-0">
- <h4 className="flex items-center gap-2 text-[13px] font-semibold text-[var(--color-text-primary)]">
+ <h4 className={`${MOMENT_BODY} flex items-center gap-2 font-medium text-[var(--color-text-primary)]`}>
<span
aria-hidden
- className="h-[7px] w-[7px] shrink-0 rounded-full"
- style={{ background: connected ? "var(--color-success)" : "var(--color-text-tertiary)" }}
+ className="size-1.5 shrink-0 rounded-full"
+ style={{ background: connected ? "var(--color-success)" : "var(--color-border-hover)" }}
/>
{name}
</h4>
- <p className="mt-0.5 text-xs text-[var(--color-text-secondary)] [overflow-wrap:anywhere]">
+ <p className={`${MOMENT_CAPTION} pl-3.5 [overflow-wrap:anywhere]`}>
{connected
? t("connected")
: file
- ? t.rich("installed", { file, mono: (c) => <span className="font-mono">{c}</span> })
+ ? t.rich("installed", {
+ file: shortConfigPath(file),
+ mono: (c) => (
+ <span className="font-mono" title={file}>
+ {c}
+ </span>
+ ),
+ })
: t("installedNoFile")}
</p>
- {!connected && !writesAllowed && <CommandLine command={command} />}
+ {!connected && !writesAllowed && (
+ <div className="mt-2 pl-3.5">
+ <CommandLine command={command} />
+ </div>
+ )}
</div>
- {connected ? (
- callsKnown && (
- <span className="text-xs text-[var(--color-text-tertiary)]">
- {agent.first_call_at
- ? t("firstCall", { when: format.relativeTime(new Date(agent.first_call_at)) })
- : t("waiting")}
- </span>
- )
- ) : (
- <span className="flex flex-wrap items-center justify-end gap-1.5 max-[560px]:justify-start">
- <AiPromptButton
- label={t("copyPrompt")}
- copiedLabel={t("copied")}
- failedLabel={t("copyFailed")}
- ariaLabel={`${t("copyPrompt")}: ${name}`}
- copyText={() => t("prompt", { name, command })}
- />
- {writesAllowed && (
- <Button variant="outline" size="sm" disabled={busy} onClick={() => void connect()}>
- {busy ? t("connecting") : t("connect")}
- </Button>
- )}
- </span>
+ <RowAction
+ connected={connected}
+ callsKnown={callsKnown}
+ firstCallAt={agent.first_call_at ?? null}
+ writesAllowed={writesAllowed}
+ busy={busy}
+ name={name}
+ buildPrompt={() => t("prompt", { name, command })}
+ onConnect={() => void connect()}
+ />
+ </li>
+ );
+}
+
+/** The right side of an agent row: its call status once connected, or the
+ * two ways to connect it. */
+function RowAction({
+ connected,
+ callsKnown,
+ firstCallAt,
+ writesAllowed,
+ busy,
+ name,
+ buildPrompt,
+ onConnect,
+}: {
+ connected: boolean;
+ callsKnown: boolean;
+ firstCallAt: string | null;
+ writesAllowed: boolean;
+ busy: boolean;
+ name: string;
+ buildPrompt: () => string;
+ onConnect: () => void;
+}) {
+ const t = useTranslations("welcome.agent");
+ const format = useFormatter();
+ if (connected) {
+ if (!callsKnown) return null;
+ return (
+ <span className="shrink-0 pl-3.5 text-xs text-[var(--color-text-tertiary)] min-[561px]:pl-0">
+ {firstCallAt ? t("firstCall", { when: format.relativeTime(new Date(firstCallAt)) }) : t("waiting")}
+ </span>
+ );
+ }
+ return (
+ <span className="flex shrink-0 flex-wrap items-center gap-2 pl-3.5 min-[561px]:pl-0">
+ <AiPromptButton
+ label={t("copyPrompt")}
+ copiedLabel={t("copied")}
+ failedLabel={t("copyFailed")}
+ ariaLabel={`${t("copyPrompt")}: ${name}`}
+ copyText={buildPrompt}
+ className="max-[560px]:h-11"
+ />
+ {writesAllowed && (
+ <Button variant="outline" size="sm" className="h-11 min-[561px]:h-8" disabled={busy} onClick={onConnect}>
+ {busy ? t("connecting") : t("connect")}
+ </Button>
)}
- </div>
+ </span>
);
}
@@ -186,7 +265,7 @@ function CopyQuestion({ text }: { text: string }) {
window.setTimeout(() => setCopied(false), 1600);
}}
aria-label={copied ? t("copied") : t("copyQuestion", { question: text })}
- className="shrink-0 rounded text-xs font-medium text-[var(--color-text-primary)] underline decoration-[var(--color-border-hover)] underline-offset-[3px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
+ className={`${MOMENT_LINK} grid min-h-11 min-w-11 shrink-0 place-items-center px-2`}
>
{copied ? t("copied") : t("copy")}
</button>
diff --git a/packages/web/src/components/welcome/welcome-step-repo.tsx b/packages/web/src/components/welcome/welcome-step-repo.tsx
index e2c15cd55..6fa609786 100644
--- a/packages/web/src/components/welcome/welcome-step-repo.tsx
+++ b/packages/web/src/components/welcome/welcome-step-repo.tsx
@@ -7,7 +7,14 @@ import { seriesColor } from "@repowise-dev/ui/shared/series";
import type { HealthBand } from "@repowise-dev/types/health";
import { commitsViewHref } from "@/lib/changes";
import type { WelcomeLens } from "@/lib/welcome-moment";
-import { MOMENT_CARD, MOMENT_ENTER, MOMENT_MICRO } from "@/components/layout/moment-shell";
+import {
+ MOMENT_CAPTION,
+ MOMENT_CARD,
+ MOMENT_FIGURE,
+ MOMENT_LINK,
+ MOMENT_MICRO,
+ MomentLabel,
+} from "@/components/layout/moment-shell";
/** Series index per lens, as the design colours them. */
const SERIES_OF: Record<WelcomeLens["key"], number> = {
@@ -28,9 +35,6 @@ const BAND_DOT: Record<HealthBand, string> = {
at_risk: "var(--color-error)",
};
-const LINK =
- "mt-1.5 self-start rounded text-xs font-medium text-[var(--color-text-primary)] underline decoration-[var(--color-border-hover)] underline-offset-[3px] hover:decoration-[var(--color-text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]";
-
interface CardText {
label: string;
value: string;
@@ -40,7 +44,8 @@ interface CardText {
open: string;
}
-/** Step 1: one card per lens the index measured. */
+/** Step 1: one card per lens the index measured. An odd last card spans the
+ * row, so the grid never ends on a gap. */
export function WelcomeStepRepo({
repoId,
lenses,
@@ -55,29 +60,21 @@ export function WelcomeStepRepo({
if (lenses.length === 0) return null;
return (
<section aria-labelledby="welcome-standout">
- <h3 id="welcome-standout" className={`${MOMENT_MICRO} mb-2`}>
+ <h3 id="welcome-standout" className={`${MOMENT_MICRO} mb-3`}>
{t("standout")}
</h3>
- <ul className="grid grid-cols-1 gap-2.5 min-[561px]:grid-cols-2">
+ <ul className="grid grid-cols-1 gap-3 min-[561px]:grid-cols-2 min-[561px]:[&>li:last-child:nth-child(odd)]:col-span-2">
{lenses.map((lens) => {
const c = text(lens);
return (
- <li
- key={lens.key}
- className={`${MOMENT_CARD} flex min-w-0 flex-col gap-0.5 px-3 py-2.5 ${MOMENT_ENTER}`}
- style={{ borderLeftColor: seriesColor(SERIES_OF[lens.key]) }}
- >
- <span className={MOMENT_MICRO}>{c.label}</span>
- <span className="flex items-baseline gap-2 text-[22px] font-semibold tabular-nums tracking-tight text-[var(--color-text-primary)]">
- {c.value}
- {c.unit && (
- <span className="text-xs font-normal text-[var(--color-text-secondary)]">{c.unit}</span>
- )}
- </span>
- <p className="text-xs text-[var(--color-text-secondary)] [overflow-wrap:anywhere] [text-wrap:pretty]">
- {c.caption}
+ <li key={lens.key} className={`${MOMENT_CARD} flex min-w-0 flex-col p-4`}>
+ <MomentLabel color={seriesColor(SERIES_OF[lens.key])}>{c.label}</MomentLabel>
+ <p className="mt-2 flex items-baseline gap-2">
+ <span className={MOMENT_FIGURE}>{c.value}</span>
+ {c.unit && <span className="text-xs text-[var(--color-text-secondary)]">{c.unit}</span>}
</p>
- <Link href={c.href} onClick={onNavigate} className={LINK}>
+ <p className={`${MOMENT_CAPTION} mt-1 [overflow-wrap:anywhere]`}>{c.caption}</p>
+ <Link href={c.href} onClick={onNavigate} className={`${MOMENT_LINK} mt-auto self-start pt-3`}>
{c.open}
</Link>
</li>
@@ -88,7 +85,7 @@ export function WelcomeStepRepo({
);
}
-const mono = (chunks: ReactNode) => <span className="font-mono text-[11.5px]">{chunks}</span>;
+const mono = (chunks: ReactNode) => <span className="font-mono text-[0.95em]">{chunks}</span>;
/** The words and route for each lens. */
function useLensText(repoId: string): (lens: WelcomeLens) => CardText {
@@ -104,7 +101,7 @@ function useLensText(repoId: string): (lens: WelcomeLens) => CardText {
value: lens.score.toFixed(1),
unit: lens.band && (
<span className="inline-flex items-center gap-1.5">
- <span aria-hidden className="h-[7px] w-[7px] rounded-full" style={{ background: BAND_DOT[lens.band] }} />
+ <span aria-hidden className="size-1.5 rounded-full" style={{ background: BAND_DOT[lens.band] }} />
{t(`band.${lens.band}`)}
</span>
),
diff --git a/packages/web/src/components/welcome/welcome-step-yours.tsx b/packages/web/src/components/welcome/welcome-step-yours.tsx
index a905d667a..5aede40fa 100644
--- a/packages/web/src/components/welcome/welcome-step-yours.tsx
+++ b/packages/web/src/components/welcome/welcome-step-yours.tsx
@@ -2,7 +2,7 @@
import { useState } from "react";
import useSWR from "swr";
-import { useTranslations } from "next-intl";
+import { useFormatter, useTranslations } from "next-intl";
import { toast } from "sonner";
import { Button } from "@repowise-dev/ui/ui/button";
import { Switch } from "@repowise-dev/ui/ui/switch";
@@ -14,10 +14,10 @@ import { setSetupHook, type SetupResponse } from "@/lib/api/setup";
import { getProviders } from "@/lib/api/providers";
import { hostedLink } from "@/lib/hosted";
import { useModelUpgrade } from "@/components/model-upgrade/model-upgrade";
-import { MOMENT_MICRO } from "@/components/layout/moment-shell";
+import { MOMENT_BODY, MOMENT_CAPTION, MOMENT_LINK } from "@/components/layout/moment-shell";
-const ROW = "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-t border-[var(--color-border-default)] py-2.5";
-const DOT = "h-[7px] w-[7px] shrink-0 rounded-full";
+const ROW = "flex items-center justify-between gap-4 py-4 last:pb-0";
+const ROW_TITLE = `${MOMENT_BODY} font-medium text-[var(--color-text-primary)]`;
/** Whether to offer hosted: tips on, and not already signed in. */
export function showsHostedRow(setup: SetupResponse | null): boolean {
@@ -28,28 +28,27 @@ export function showsHostedRow(setup: SetupResponse | null): boolean {
export function WelcomeStepYours({ repoId, setup }: { repoId: string; setup: SetupResponse | null }) {
const t = useTranslations("welcome.yours");
return (
- <div>
+ <div className="space-y-4">
{setup && setup.model.docs_mode !== "llm" && <ModelBox repoId={repoId} />}
- <SyncRow repoId={repoId} setup={setup} />
- {showsHostedRow(setup) && (
- <div className={ROW}>
- <div className="min-w-0">
- <h4 className="flex items-center gap-2 text-[13px] font-semibold text-[var(--color-text-primary)]">
- <span aria-hidden className={DOT} style={{ background: "var(--color-info)" }} />
- {t("teamTitle")}
- </h4>
- <p className="mt-0.5 text-xs text-[var(--color-text-secondary)]">{t("teamBody")}</p>
- </div>
- <a
- href={hostedLink("welcome", "team")}
- target="_blank"
- rel="noreferrer"
- className="rounded text-xs font-medium text-[var(--color-text-primary)] underline decoration-[var(--color-border-hover)] underline-offset-[3px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"
- >
- {t("teamLink")}
- </a>
- </div>
- )}
+ <ul className="divide-y divide-[var(--color-border-default)]">
+ <SyncRow repoId={repoId} setup={setup} />
+ {showsHostedRow(setup) && (
+ <li className={ROW}>
+ <div className="min-w-0">
+ <h4 className={ROW_TITLE}>{t("teamTitle")}</h4>
+ <p className={MOMENT_CAPTION}>{t("teamBody")}</p>
+ </div>
+ <a
+ href={hostedLink("welcome", "team")}
+ target="_blank"
+ rel="noreferrer"
+ className={`${MOMENT_LINK} shrink-0`}
+ >
+ {t("teamLink")}
+ </a>
+ </li>
+ )}
+ </ul>
</div>
);
}
@@ -65,9 +64,11 @@ function useDetectedSources(repoId: string): ModelSource[] {
return orderModelSources(data?.providers ?? []).filter((s) => s.detected);
}
+/** The model offer: the one plum surface in the welcome. */
function ModelBox({ repoId }: { repoId: string }) {
const t = useTranslations("welcome.yours");
const tm = useTranslations("modelUpgrade");
+ const format = useFormatter();
const { openSheet, sheet } = useModelUpgrade(repoId);
const detected = useDetectedSources(repoId);
const sourceName = (s: ModelSource) =>
@@ -77,42 +78,27 @@ function ModelBox({ repoId }: { repoId: string }) {
return (
<section
aria-labelledby="welcome-model"
- className="mb-3 rounded-[10px] border border-[color-mix(in_srgb,var(--color-model)_30%,transparent)] bg-[var(--color-model-muted)] p-3.5"
+ className="rounded-lg border border-[color-mix(in_srgb,var(--color-model)_30%,transparent)] bg-[var(--color-model-muted)] p-4"
>
- <div className="flex items-baseline justify-between gap-2.5">
- <h4 id="welcome-model" className="text-[13.5px] font-semibold text-[var(--color-text-primary)]">
- {t("modelTitle")}
- </h4>
- <span className={MOMENT_MICRO}>{t("optional")}</span>
- </div>
- <ul className="my-2.5 grid grid-cols-1 gap-x-3.5 gap-y-1.5 text-xs text-[var(--color-text-secondary)] min-[561px]:grid-cols-2">
+ <h4 id="welcome-model" className={ROW_TITLE}>
+ {t("modelTitle")}
+ </h4>
+ <ul className="mt-3 grid grid-cols-1 gap-x-4 gap-y-2 text-xs text-[var(--color-text-secondary)] min-[561px]:grid-cols-2">
{gets.map((g) => (
- <li key={g} className="flex items-baseline gap-2">
- <span aria-hidden className={`${DOT} translate-y-[-1px]`} style={{ background: "var(--color-model)" }} />
+ <li key={g} className="flex items-center gap-2">
+ <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-[var(--color-model)]" />
{g}
</li>
))}
</ul>
- {detected.length > 0 && (
- <div className="mb-3">
- <p className={`${MOMENT_MICRO} mb-1`}>{t("detectedLabel")}</p>
- <ul className="flex flex-col gap-1">
- {detected.map((s) => (
- <li
- key={s.id}
- className="rounded-md border border-[var(--color-border-default)] bg-[var(--color-release-card)] px-2.5 py-1.5 text-[12.5px] text-[var(--color-text-primary)]"
- >
- {sourceName(s)}
- </li>
- ))}
- </ul>
- </div>
- )}
- <div className="flex justify-end">
+ <div className="mt-4 flex flex-col gap-3 min-[561px]:flex-row min-[561px]:items-center min-[561px]:justify-between">
+ <p className={MOMENT_CAPTION}>
+ {detected.length > 0 &&
+ t("detected", { names: format.list(detected.map(sourceName), { type: "conjunction" }) })}
+ </p>
<Button
- size="sm"
onClick={openSheet}
- className="h-8 bg-[var(--color-model)] text-[var(--color-text-on-model)] hover:bg-[var(--color-model-hover)] focus-visible:ring-[var(--color-model)] max-[560px]:w-full"
+ className="h-11 shrink-0 bg-[var(--color-model)] text-[var(--color-text-on-model)] hover:bg-[var(--color-model-hover)] focus-visible:ring-[var(--color-model)] min-[561px]:h-9"
>
{tm("write")}
</Button>
@@ -151,20 +137,26 @@ function SyncRow({ repoId, setup }: { repoId: string; setup: SetupResponse | nul
}
return (
- <div className={ROW}>
+ <li className={ROW}>
<div className="min-w-0">
- <h4 id="welcome-sync" className="text-[13px] font-semibold text-[var(--color-text-primary)]">
+ <h4 id="welcome-sync" className={ROW_TITLE}>
{t("syncTitle")}
</h4>
- <p className="mt-0.5 text-xs text-[var(--color-text-secondary)]">{t("syncBody")}</p>
- {!writesAllowed && !installed && <CommandLine command="repowise hook install" />}
+ <p className={MOMENT_CAPTION}>{t("syncBody")}</p>
+ {!writesAllowed && !installed && (
+ <div className="mt-2">
+ <CommandLine command="repowise hook install" />
+ </div>
+ )}
</div>
+ {/* The unchecked track is drawn in the border tone so it reads on the
+ moment ground. */}
<Switch
aria-labelledby="welcome-sync"
checked={installed}
disabled={!writesAllowed || busy}
onCheckedChange={(next) => (next ? void apply(true) : setConfirmOff(true))}
- className="data-[state=checked]:bg-[var(--color-success)]"
+ className="data-[state=unchecked]:bg-[var(--color-border-hover)]"
/>
<ConfirmDialog
open={confirmOff}
@@ -176,6 +168,6 @@ function SyncRow({ repoId, setup }: { repoId: string; setup: SetupResponse | nul
loading={busy}
onConfirm={() => apply(false)}
/>
- </div>
+ </li>
);
}
diff --git a/packages/web/src/lib/release-moment.test.ts b/packages/web/src/lib/release-moment.test.ts
index 2988430d8..605c203ed 100644
--- a/packages/web/src/lib/release-moment.test.ts
+++ b/packages/web/src/lib/release-moment.test.ts
@@ -128,6 +128,12 @@ describe("decideMoment", () => {
expect(decideMoment("0.57.0", [HL("/settings")], "")).toEqual({ moment: "dialog", preview: false });
expect(readNewSurfaces()?.routes).toEqual(["/settings"]);
});
+
+ it("stays quiet on a tour load and keeps the upgrade for the next session", () => {
+ window.localStorage.setItem("repowise:last-seen-server-version", "0.56.0");
+ expect(decideMoment("0.57.0", [], "?tour=1")).toEqual({ moment: "none", preview: false });
+ expect(window.localStorage.getItem("repowise:last-seen-server-version")).toBe("0.56.0");
+ });
});
describe("highlight repository", () => {
diff --git a/packages/web/src/lib/release-moment.ts b/packages/web/src/lib/release-moment.ts
index aa2b334f4..6b922688f 100644
--- a/packages/web/src/lib/release-moment.ts
+++ b/packages/web/src/lib/release-moment.ts
@@ -258,7 +258,11 @@ export function decideMoment(
): { moment: UpgradeMoment; preview: boolean } {
const replay = previewMoment(search);
if (replay) return { moment: replay, preview: true };
- if (sessionMomentTaken()) return { moment: "none", preview: false };
+ // `?tour=1` opens the welcome on this load: one dialog at a time, and the
+ // upgrade (left unstored) waits for the next session.
+ if (sessionMomentTaken() || new URLSearchParams(search).get("tour") === "1") {
+ return { moment: "none", preview: false };
+ }
const moment = takeUpgradeMoment(version, highlights.length > 0);
if (moment !== "none") {
startNewSurfaces(version, highlights);
diff --git a/packages/web/src/styles/globals.css b/packages/web/src/styles/globals.css
index cf81f1dee..4c15e6fb8 100644
--- a/packages/web/src/styles/globals.css
+++ b/packages/web/src/styles/globals.css
@@ -6,3 +6,13 @@
*/
@import "@repowise-dev/ui/styles.css";
+
+/* A moment is a full-screen sheet on a phone, and the chat dock (which sits
+ * above dialogs) would cover its footer buttons. The dock exposes no hook of
+ * its own, so this keys off its offset variable; give the dock a data
+ * attribute if its classes move. */
+@media (max-width: 560px) {
+ body:has([data-moment][data-state="open"]) [class*="chat-dock-bottom-offset"] {
+ display: none;
+ }
+}