ui(onboarding): flat tab navigation + fix vertical-stacked button text
Onboarding was a 7-step linear wizard, same information hierarchy as Settings but behaving like a modal. Replace with the SettingsShell tab pattern: one row of six tabs (nodecheck / providers / company / modelpool / executionmode / mission), free navigation, per-tab completion ticks derived from the wizard's own validation rules. Sub-fixes on the same pass: - ActionButton: add whitespace-nowrap + shrink-0 so "选择" never stacks vertically on narrow containers. Global — every caller gets the correct behavior - CompanyStep: CEO Runtime Provider/Model go vertical (space-y-3 instead of grid-cols-2) so long names like "Fireworks AI" / "Kimi K2.5 Turbo Preview 0911" stay readable; workspace-path Input wrapped in min-w-0 flex-1 container so it yields, not the button - MarkdownBody: render react-markdown in chat bubbles (was plain text) i18n: added onboarding.stepsAria for the tablist label.
This commit is contained in:
1 parent
ff5e22092a
commit
c83d670050
16 files changed
+352
-60
No files matched your search
@@ -39,7 +39,7 @@ export function ActionButton({
|
||||
type={type}
|
||||
aria-label={iconOnly ? (ariaLabel ?? label) : ariaLabel}
|
||||
title={iconOnly ? label : undefined}
|
||||
className={`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 inline-flex items-center rounded-lg border text-[12px] font-bold transition-all duration-150 active:scale-[0.97] active:translate-y-px ${sizing} ${toneClass} ${isDisabled ? "pointer-events-none opacity-60" : ""} ${loading ? "scale-[0.98]" : ""}`}
|
||||
className={`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 inline-flex shrink-0 items-center whitespace-nowrap rounded-lg border text-[12px] font-bold transition-all duration-150 active:scale-[0.97] active:translate-y-px ${sizing} ${toneClass} ${isDisabled ? "pointer-events-none opacity-60" : ""} ${loading ? "scale-[0.98]" : ""}`}
|
||||
onClick={onClick}
|
||||
disabled={isDisabled}
|
||||
aria-busy={loading}
|
||||
@@ -49,7 +49,7 @@ export function ActionButton({
|
||||
) : Icon ? (
|
||||
<Icon size={16} />
|
||||
) : null}
|
||||
{iconOnly ? null : <span>{label}</span>}
|
||||
{iconOnly ? null : <span className="whitespace-nowrap">{label}</span>}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { memo } from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
|
||||
/**
|
||||
* Read-only markdown renderer used by message bubbles, comment bodies, and
|
||||
* other agent-authored text. AI agents consistently emit GFM flavour (bold,
|
||||
* bullet lists, numbered lists, inline code, fenced blocks, tables), so we
|
||||
* ship those plus strikethrough and task lists.
|
||||
*
|
||||
* Security: `react-markdown` disables HTML by default. We do not pass the
|
||||
* `rehype-raw` plugin, so any `<script>` / inline SVG in a message body is
|
||||
* rendered as literal text. Links open in the user's default browser via
|
||||
* Electron's window behaviour; we annotate them with `target="_blank"` and
|
||||
* `rel="noreferrer"` as a belt-and-suspenders guard against clipboard
|
||||
* spoofing.
|
||||
*
|
||||
* Style tokens stay aligned with `text-muted-foreground` bodies elsewhere —
|
||||
* the renderer overrides only the elements markdown introduces (lists,
|
||||
* code, tables, headings), inheriting the color / size / leading from the
|
||||
* wrapping container.
|
||||
*/
|
||||
export const MarkdownBody = memo(function MarkdownBody({ body }: { body: string }) {
|
||||
return (
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
components={{
|
||||
p: ({ children }) => <p className="mb-2 last:mb-0">{children}</p>,
|
||||
ul: ({ children }) => <ul className="mb-2 ml-4 list-disc space-y-0.5 last:mb-0 marker:text-muted-foreground/60">{children}</ul>,
|
||||
ol: ({ children }) => <ol className="mb-2 ml-4 list-decimal space-y-0.5 last:mb-0 marker:text-muted-foreground/60">{children}</ol>,
|
||||
li: ({ children }) => <li className="pl-1">{children}</li>,
|
||||
strong: ({ children }) => <strong className="font-semibold text-foreground">{children}</strong>,
|
||||
em: ({ children }) => <em className="italic">{children}</em>,
|
||||
del: ({ children }) => <del className="text-muted-foreground/60">{children}</del>,
|
||||
code: ({ className, children }) => {
|
||||
const isBlock = (className ?? "").startsWith("language-");
|
||||
if (isBlock) {
|
||||
return (
|
||||
<code className="block whitespace-pre overflow-x-auto rounded-md bg-muted/70 px-3 py-2 font-mono text-[12px] leading-relaxed text-foreground">
|
||||
{children}
|
||||
</code>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<code className="rounded-sm bg-muted/70 px-1 py-0.5 font-mono text-[12px] text-foreground">
|
||||
{children}
|
||||
</code>
|
||||
);
|
||||
},
|
||||
pre: ({ children }) => <pre className="mb-2 last:mb-0">{children}</pre>,
|
||||
blockquote: ({ children }) => (
|
||||
<blockquote className="mb-2 border-l-2 border-border pl-3 italic last:mb-0">
|
||||
{children}
|
||||
</blockquote>
|
||||
),
|
||||
a: ({ href, children }) => (
|
||||
<a
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-primary underline decoration-dotted underline-offset-2 hover:opacity-80"
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
),
|
||||
h1: ({ children }) => <h1 className="mb-1 mt-2 text-[14px] font-semibold text-foreground first:mt-0">{children}</h1>,
|
||||
h2: ({ children }) => <h2 className="mb-1 mt-2 text-[13px] font-semibold text-foreground first:mt-0">{children}</h2>,
|
||||
h3: ({ children }) => <h3 className="mb-1 mt-2 text-[13px] font-semibold text-foreground first:mt-0">{children}</h3>,
|
||||
table: ({ children }) => (
|
||||
<div className="mb-2 overflow-x-auto last:mb-0">
|
||||
<table className="w-full border-collapse text-[12px]">{children}</table>
|
||||
</div>
|
||||
),
|
||||
th: ({ children }) => <th className="border border-border bg-muted/40 px-2 py-1 text-left font-semibold text-foreground">{children}</th>,
|
||||
td: ({ children }) => <td className="border border-border px-2 py-1">{children}</td>,
|
||||
hr: () => <hr className="my-2 border-border" />,
|
||||
}}
|
||||
>
|
||||
{body}
|
||||
</ReactMarkdown>
|
||||
);
|
||||
});
|
||||
@@ -33,7 +33,7 @@ export function StatusPill({ status }: { status: string }) {
|
||||
const displayLabel = checking ? "checking" : status.replaceAll("_", " ");
|
||||
|
||||
return (
|
||||
<span className={`inline-flex items-center gap-2 text-[11px] font-bold uppercase tracking-[0.12em] ${toneClass}`}>
|
||||
<span className={`inline-flex shrink-0 items-center gap-2 whitespace-nowrap text-[11px] font-bold uppercase tracking-[0.12em] ${toneClass}`}>
|
||||
{checking ? (
|
||||
<span className="h-2 w-2 animate-pulse rounded-full bg-[color:var(--muted-foreground)]" aria-hidden="true" />
|
||||
) : (
|
||||
|
||||
Reference in new issue
Block a user