// Mobile diff view — counterpart of the desktop diff pane. Maps to the "diff" // reference screenshot: Changes/Files tabs, the branch + uncommitted scope rows, // a new-file header, a hunk header, and the added lines of atoms.tsx (every row // an addition, so the whole gutter runs green). Reuses the shared `Code` // highlighter and the `--color-mock-diff-*` tokens. import { ChevronDown, FileDiff, Files, GitBranch, GitPullRequest, MoreHorizontal, RefreshCw, SquareDot, X, } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Code } from "../atoms"; import { ReactFileIcon } from "../icons"; type MobileDiffMark = "add" | "remove" | "context"; interface MobileDiffLine { n: number; text: string; mark: MobileDiffMark; } const ROW_COLOR: Record = { add: "bg-mock-diff-add", remove: "bg-mock-diff-remove", context: "", }; const NUMBER_COLOR: Record = { add: "text-mock-success", remove: "text-mock-danger", context: "text-mock-fg-muted", }; const DIFF_LINES: MobileDiffLine[] = [ { n: 7, text: 'type DotTone = "success" | "danger" | "idle";', mark: "remove" }, { n: 7, text: "export type DotTone =", mark: "add" }, { n: 8, text: ' | "success"', mark: "add" }, { n: 9, text: ' | "danger"', mark: "add" }, { n: 10, text: ' | "warning"', mark: "add" }, { n: 11, text: ' | "running"', mark: "add" }, { n: 12, text: ' | "idle";', mark: "add" }, { n: 13, text: "", mark: "context" }, { n: 14, text: "interface DiffStatProps {", mark: "context" }, { n: 15, text: " add: string;", mark: "context" }, { n: 16, text: " remove: string;", mark: "context" }, { n: 17, text: "}", mark: "context" }, { n: 18, text: "", mark: "context" }, { n: 19, text: "/** Compact diff summary. */", mark: "add" }, { n: 20, text: "export function DiffStat({", mark: "add" }, { n: 21, text: " add,", mark: "add" }, { n: 22, text: " remove,", mark: "add" }, { n: 23, text: "}: DiffStatProps) {", mark: "add" }, { n: 24, text: " return (", mark: "context" }, { n: 25, text: ' ', mark: "remove" }, { n: 25, text: ' ', mark: "add" }, { n: 26, text: ' ', mark: "context" }, { n: 27, text: " +{add}", mark: "context" }, { n: 28, text: " ", mark: "context" }, { n: 29, text: ' ', mark: "context" }, { n: 30, text: " -{remove}", mark: "context" }, { n: 31, text: " ", mark: "context" }, { n: 32, text: " ", mark: "context" }, { n: 33, text: " )", mark: "remove" }, { n: 33, text: " );", mark: "add" }, { n: 34, text: "}", mark: "context" }, ]; function Tabs() { const { t } = useTranslation(); return (
{t("landing.mockup.app.files")} {t("landing.mockup.app.changes")} 3981
); } function BranchRow() { return (
main
); } function ScopeRow() { const { t } = useTranslation(); return (
{t("landing.mockup.app.uncommitted")} +2,173 -54
); } function FileHeader() { return (
atoms.tsx packages/website/src/componen… +56 -18
); } function DiffLine({ n, text, mark }: MobileDiffLine) { const comment = text.trimStart().startsWith("/") || text.trimStart().startsWith("*"); return (
{n} {comment ? {text} : }
); } const ROW_H = 26; const GUTTER_W = 44; const ROW_STYLE = { height: ROW_H }; const GUTTER_STYLE = { width: GUTTER_W }; const GUTTER_RULE_STYLE = { left: GUTTER_W }; export function MobileDiff() { const { t } = useTranslation(); return ( <>
@@ -7,20 +7,28 @@
{DIFF_LINES.map((line) => ( ))}
{t("landing.mockup.app.commits")}
); }