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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/01-apps-list.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/02-apps-detail.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/03-roles-list.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/04-roles-detail.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/05-xray-legend.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/06-used-by.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/07-guided-path.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/08-mobile-toolbar.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/09-mobile-role.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/10-light-apps.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/ui-polish/12-shortcuts.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions frontend/e2e/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,44 @@ test("An ?app= link opens straight onto that app's stack", async ({ page }) => {
await page.goto("/?app=netflix");
await expect(page.getByRole("region", { name: "Famous apps" }).getByRole("heading", { name: "Netflix" })).toBeVisible({ timeout: 20_000 });
});

test("Apps show logos, arrow keys move through the grid, and ← / → step between apps", async ({ page }) => {
await page.goto("/?app=");
const panel = page.getByRole("region", { name: "Famous apps" });
await expect(panel.locator(".apps-grid svg").first()).toBeVisible({ timeout: 20_000 });
const first = panel.locator(".apps-grid button").first();
await first.focus();
await page.keyboard.press("ArrowRight");
await expect(panel.locator(".apps-grid button").nth(1)).toBeFocused();
await page.keyboard.press("End");
await expect(panel.locator(".apps-grid button").last()).toBeFocused();
await panel.locator(".apps-grid button").first().click();
await expect(panel.getByRole("heading", { name: "Netflix" })).toBeVisible();
await panel.getByRole("button", { name: /^Next: / }).click();
await expect(panel.getByRole("heading", { name: "Spotify" })).toBeVisible();
await page.keyboard.press("[");
await expect(panel.getByRole("heading", { name: "Netflix" })).toBeVisible();
});

test("Roles have emojis, ?role= opens the list, and ] steps to the next role", async ({ page }) => {
await page.goto("/?role=");
const panel = page.getByRole("region", { name: "Role paths" });
await expect(panel.locator(".role-list .role-emoji").first()).toHaveText("🎨", { timeout: 20_000 });
await panel.getByRole("button", { name: /Frontend engineer/ }).click();
await expect(panel.getByRole("heading", { name: "Frontend engineer" })).toBeVisible();
await page.keyboard.press("]");
await expect(panel.getByRole("heading", { name: "Backend engineer" })).toBeVisible();
await expect(page).toHaveURL(/[?&]role=backend-engineer/);
});

test("On a phone the toolbar scrolls behind a → button instead of running off-screen", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/");
await expect(page.getByText(/\d+ nodes · \d+ edges/)).toBeAttached({ timeout: 20_000 });
const more = page.getByRole("button", { name: "Scroll atlas modes right" });
await expect(more).toBeVisible();
await more.click();
await expect(page.getByRole("button", { name: /Switch to (light|dark) theme/ })).toBeInViewport();
const width = await page.evaluate(() => document.documentElement.scrollWidth);
expect(width).toBeLessThanOrEqual(390);
});
63 changes: 21 additions & 42 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@vitejs/plugin-react": "^4.3.3",
"eslint": "^9.13.0",
"jsdom": "^25.0.1",
"simple-icons": "^16.38.1",
"typescript": "^5.6.3",
"typescript-eslint": "^8.12.2",
"vite": "^5.4.10",
Expand Down
40 changes: 40 additions & 0 deletions frontend/scripts/build-app-logos.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* global console, process */
// Writes src/content/appLogos.ts: one brand mark per famous app, taken from Simple Icons
// (CC0, https://simpleicons.org). Only the 40-odd marks the Apps panel needs are kept, so
// the chunk stays small; it loads on demand the first time a logo is drawn.
// Apps with no mark in Simple Icons (some brands asked to be removed) get a monogram tile.
// Run after adding an app to data/seed/apps.json: node scripts/build-app-logos.mjs
// Logos are trademarks of their owners and are shown only to identify each company.
import { readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import * as icons from "simple-icons";

// App id (apps.json) -> Simple Icons slug, where it differs or needs a pick.
const SLUG = {
"khan-academy": "khanacademy",
"x-twitter": "x",
"google-search": "google",
"stack-overflow": "stackoverflow",
};

const root = join(import.meta.dirname, "..");
const apps = JSON.parse(readFileSync(join(root, "..", "data", "seed", "apps.json"), "utf8"));
const bySlug = new Map(Object.values(icons).filter((i) => i && i.slug).map((i) => [i.slug, i]));
const out = {};
const missing = [];
for (const app of apps) {
const icon = bySlug.get(SLUG[app.id] ?? app.id);
if (icon) out[app.id] = { hex: icon.hex, path: icon.path };
else missing.push(app.id);
}
const lines = Object.entries(out).map(([id, l]) => ` ${JSON.stringify(id)}: { hex: "${l.hex}", path: ${JSON.stringify(l.path)} },`);
writeFileSync(join(root, "src", "content", "appLogos.ts"), `// Generated by scripts/build-app-logos.mjs from Simple Icons (CC0). Do not edit by hand.
// Logos are trademarks of their owners, shown only to identify each company.
// No mark available (shown as a monogram): ${missing.join(", ") || "none"}.
export interface BrandMark { hex: string; path: string }
export const APP_LOGOS: Record<string, BrandMark> = {
${lines.join("\n")}
};
`);
console.log(`wrote ${Object.keys(out).length} logos; monogram for: ${missing.join(", ") || "none"}`);
process.exit(0);
8 changes: 5 additions & 3 deletions frontend/scripts/check-bundle-size.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ import { gzipSync } from "node:zlib";
// lazily loaded chunk (src/content/data.ts), which loads alongside the graph.
// content: that chunk. ~24 KB with 145 paths / 11 roles / 22 apps, ~49 KB after the
// 3,000-node content pass (257 paths / 32 roles / 40 apps).
const BUDGETS = { js: 172_000, css: 15_000, woff2: 60_000, graph: 280_000, content: 56_000 };
// logos: famous-app brand marks (src/content/appLogos.ts), fetched when the Apps panel or a
// "Used by" chip first draws. ~14 KB for 35 marks.
const BUDGETS = { js: 172_000, css: 15_000, woff2: 60_000, graph: 280_000, content: 56_000, logos: 18_000 };
const dir = join(process.cwd(), "dist", "assets");
let failed = false;
const totals = { js: 0, css: 0, woff2: 0, content: 0 };
const totals = { js: 0, css: 0, woff2: 0, content: 0, logos: 0 };
for (const file of readdirSync(dir)) {
const ext = file.split(".").pop();
if (!(ext in totals)) continue;
const buf = readFileSync(join(dir, file));
// The entry chunk counts as js and the content chunk on its own; other lazy chunks load on demand.
const key = ext === "js" && file.startsWith("data-") ? "content" : ext;
const key = ext === "js" && file.startsWith("data-") ? "content" : ext === "js" && file.startsWith("appLogos-") ? "logos" : ext;
if (key === "js" && !file.startsWith("index-")) continue;
const size = ext === "woff2" ? statSync(join(dir, file)).size : gzipSync(buf).length;
totals[key] += size;
Expand Down
31 changes: 22 additions & 9 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ import { connectionPath } from "./graph/compare";
import { StackPanel } from "./components/StackPanel";
import { readStack, writeStack, type StackParams } from "./recommend/stackLink";
import { RolePanel } from "./components/RolePanel";
import { readRole, writeRole } from "./graph/roles";
import { readRole, readRolesOpen, writeRole } from "./graph/roles";
import { AppsPanel } from "./components/AppsPanel";
import { ScrollRow } from "./components/ScrollRow";
import { useStepKeys } from "./components/StepNav";
import { arrowNav } from "./util/arrowNav";
import { readApp, readAppsOpen, writeApp } from "./graph/apps";
import { PathsLibrary } from "./components/PathsLibrary";
import {
Expand Down Expand Up @@ -137,12 +140,12 @@ export default function App() {
window.history.replaceState(null, "", `${window.location.pathname}${query ? `?${query}` : ""}`);
}, [stackParams]);
// Role / career lens: ?role=<id> reopens a role's path.
const [roleOpen, setRoleOpen] = useState(() => readRole(window.location.search) !== null);
const [roleOpen, setRoleOpen] = useState(() => readRolesOpen(window.location.search));
const [roleId, setRoleId] = useState<string | null>(() => readRole(window.location.search));
const [roleHighlight, setRoleHighlight] = useState<{ nodes: string[]; edges: string[] }>({ nodes: [], edges: [] });
const onRoleHighlight = useCallback((nodes: string[], edges: string[]) => setRoleHighlight({ nodes, edges }), []);
useEffect(() => {
const query = writeRole(window.location.search, roleOpen ? roleId : null);
const query = writeRole(window.location.search, roleOpen ? roleId : null, roleOpen);
window.history.replaceState(null, "", `${window.location.pathname}${query ? `?${query}` : ""}`);
}, [roleOpen, roleId]);
// Famous apps: ?app=<id> reopens an app's stack (?app= alone opens the list).
Expand Down Expand Up @@ -589,6 +592,14 @@ export default function App() {
setJourneyStep(step);
navigate(journeys()[index].steps[step].id);
}, [navigate, openStack]);
// [ / ] and the ← Previous / Next → buttons step through the guided path being followed.
const journeyPrev = useMemo(() => journeyIndex === null || journeyStep === 0 ? null : () => {
setJourneyStep(journeyStep - 1); navigate(journeys()[journeyIndex].steps[journeyStep - 1].id);
}, [journeyIndex, journeyStep, navigate]);
const journeyNext = useMemo(() => journeyIndex === null || journeyStep >= journeys()[journeyIndex].steps.length - 1 ? null : () => {
setJourneyStep(journeyStep + 1); navigate(journeys()[journeyIndex].steps[journeyStep + 1].id);
}, [journeyIndex, journeyStep, navigate]);
useStepKeys(journeyIndex !== null && !xrayOpen && !pathsOpen && !roleOpen && !appsOpen, journeyPrev, journeyNext);
const nextPath = useMemo(() => journeyIndex === null || journeyStep !== journeys()[journeyIndex].steps.length - 1
? null : suggestNextPath(pathEntries, journeys(), journeyIndex, donePaths), [pathEntries, journeyIndex, journeyStep, donePaths]);
// A returning visitor with an unfinished path is offered to pick it up from the hero.
Expand Down Expand Up @@ -682,7 +693,8 @@ export default function App() {
)}
{/* Atlas tools: one quiet, uniform group. Labels collapse to icons on phones;
each keeps its full accessible name. */}
<nav className="topbar-tools" aria-label="Atlas modes">
<ScrollRow className="topbar-tools-row" label="atlas modes">
<nav className="topbar-tools" aria-label="Atlas modes" data-arrow-nav onKeyDown={arrowNav}>
<button type="button" className="tool" aria-label={compareMode ? "Exit compare" : "Compare"}
aria-pressed={compareMode} title="Compare two technologies" onClick={() => {
setCompareMode((open) => !open); setJourneyIndex(null); openStack(false); setRoleOpen(false); setAppsOpen(false); setCompareFirst(selected && nodesById.get(selected)?.node_type === "technology" ? selected : null); setCompareSecond(null);
Expand Down Expand Up @@ -720,6 +732,7 @@ export default function App() {
title={`Switch to ${theme === "dark" ? "light" : "dark"} theme`}
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}><Icon name={theme === "dark" ? "sun" : "moon"} /></button>
</nav>
</ScrollRow>
<div className="topbar-meta">
<span>
{state.graph.nodes.length} nodes · {state.graph.edges.length} edges
Expand Down Expand Up @@ -850,7 +863,7 @@ export default function App() {
onClick={() => { setJourneyIndex(null); handleSelect(null); }}>×</button>
</div>
<h2 className="journey-title">{journey.title}</h2>
<ol className="journey-dots" aria-label={`Step ${journeyStep + 1} of ${journey.steps.length}`}>
<ol className="journey-dots" aria-label={`Step ${journeyStep + 1} of ${journey.steps.length}`} data-arrow-nav onKeyDown={arrowNav}>
{journey.steps.map((step, i) => (
<li key={step.id}>
<button type="button" aria-current={i === journeyStep ? "step" : undefined}
Expand All @@ -872,11 +885,11 @@ export default function App() {
</div>
)}
<div className="journey-actions">
<button disabled={journeyStep === 0} onClick={() => { setJourneyStep(journeyStep - 1); navigate(journey.steps[journeyStep - 1].id); }}>Previous</button>
<button type="button" className="journey-prev" disabled={journeyStep === 0} title="Previous step ( [ )" onClick={journeyPrev ?? undefined}><span aria-hidden>←</span> Previous</button>
<button type="button" className="journey-share" onClick={() => {
void navigator.clipboard?.writeText(window.location.href).then(() => { setPathCopied(true); window.setTimeout(() => setPathCopied(false), 1500); }, () => undefined);
}}>{pathCopied ? "Link copied" : "Copy link"}</button>
<button disabled={journeyStep === journey.steps.length - 1} onClick={() => { setJourneyStep(journeyStep + 1); navigate(journey.steps[journeyStep + 1].id); }}>Next</button>
<button type="button" className="journey-next" disabled={journeyStep === journey.steps.length - 1} title="Next step ( ] )" onClick={journeyNext ?? undefined}>Next <span aria-hidden>→</span></button>
</div>
</section>}
{pathsOpen && <PathsLibrary entries={pathEntries} done={donePaths} progress={pathProgress}
Expand Down Expand Up @@ -930,7 +943,7 @@ export default function App() {
<h1 className="hero-title">
Every technology, and how it connects. <span>{state.graph.nodes.length} of them.</span>
</h1>
<div className="hero-actions">
<div className="hero-actions" data-arrow-nav onKeyDown={arrowNav}>
<button type="button" className="hero-primary" onClick={() => setHeroVisible(false)}>
Explore the atlas
</button>
Expand All @@ -941,7 +954,7 @@ export default function App() {
X-ray a repo
</button>
</div>
<p className="hero-paths">
<p className="hero-paths" data-arrow-nav onKeyDown={arrowNav}>
{resumePath ? <>
<span>Welcome back.</span>{" "}
<button type="button" onClick={() => startPath(resumePath.index, Math.min(pathProgress[resumePath.slug] ?? 0, resumePath.stepCount - 1))}>
Expand Down
Loading
Loading