Skip to content

Commit 8970d56

Browse files
committed
scaling from 1 to millions of users
1 parent 7a0ffd0 commit 8970d56

File tree

9 files changed

+1758
-19
lines changed

9 files changed

+1758
-19
lines changed

attendabot/frontend/src/App.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ body {
1919
padding: var(--space-6);
2020
}
2121

22+
.app.app-wide {
23+
max-width: 1400px;
24+
}
25+
2226
/* ========================================
2327
Header
2428
======================================== */

attendabot/frontend/src/components/RootLayout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ export function RootLayout() {
2222
}
2323

2424
// Not logged in and not on login page → redirect to login
25-
if (!loggedIn && location.pathname !== "/") {
25+
// (simulations are public — no auth required)
26+
if (!loggedIn && location.pathname !== "/" && !location.pathname.startsWith("/simulations")) {
2627
return <Navigate to="/" replace />;
2728
}
2829

2930
// Logged in but role couldn't be determined (getMe() failed)
30-
if (loggedIn && !role && location.pathname !== "/") {
31+
if (loggedIn && !role && location.pathname !== "/" && !location.pathname.startsWith("/simulations")) {
3132
return (
3233
<div className="app">
3334
<header>

attendabot/frontend/src/components/SimulationsHub.tsx

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ const simulations = [
1111
description: "Interactive animations of common authentication systems",
1212
url: "/simulations/auth",
1313
},
14+
{
15+
id: "scaling",
16+
title: "Scale From Zero to Millions",
17+
description:
18+
'Watch a web architecture evolve from a single server to global infrastructure. infrastructure. Based on "System Design Interview Volume 1" by Alex Xu.',
19+
url: "/simulations/scaling",
20+
},
1421
];
1522

1623
/** Renders a grid of available simulation cards. */
@@ -20,7 +27,13 @@ export function SimulationsHub() {
2027
return (
2128
<div className="panel" style={{ gridColumn: "span 2" }}>
2229
<h2>Simulations</h2>
23-
<div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))", gap: "var(--space-5)" }}>
30+
<div
31+
style={{
32+
display: "grid",
33+
gridTemplateColumns: "repeat(auto-fill, minmax(280px, 1fr))",
34+
gap: "var(--space-5)",
35+
}}
36+
>
2437
{simulations.map((sim) => (
2538
<div
2639
key={sim.id}
@@ -31,26 +44,27 @@ export function SimulationsHub() {
3144
boxShadow: "4px 4px 0 rgba(0, 0, 0, 0.15)",
3245
}}
3346
>
34-
<h3 style={{
35-
margin: "0 0 var(--space-3) 0",
36-
fontSize: "var(--text-base)",
37-
textTransform: "uppercase",
38-
letterSpacing: "0.05em",
39-
}}>
47+
<h3
48+
style={{
49+
margin: "0 0 var(--space-3) 0",
50+
fontSize: "var(--text-base)",
51+
textTransform: "uppercase",
52+
letterSpacing: "0.05em",
53+
}}
54+
>
4055
{sim.title}
4156
</h3>
42-
<p style={{
43-
color: "var(--color-slate)",
44-
fontSize: "var(--text-base)",
45-
margin: "0 0 var(--space-5) 0",
46-
lineHeight: "1.6",
47-
}}>
57+
<p
58+
style={{
59+
color: "var(--color-slate)",
60+
fontSize: "var(--text-base)",
61+
margin: "0 0 var(--space-5) 0",
62+
lineHeight: "1.6",
63+
}}
64+
>
4865
{sim.description}
4966
</p>
50-
<button
51-
className="primary-btn"
52-
onClick={() => navigate(sim.url)}
53-
>
67+
<button className="primary-btn" onClick={() => navigate(sim.url)}>
5468
Open
5569
</button>
5670
</div>

attendabot/frontend/src/pages/SimulatorPage.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import { useParams, useNavigate } from "react-router";
77
import SimulatorApp from "../simulations/SimulatorApp";
88
import { flows } from "../simulations/flowData";
9+
import ScalingSimulatorApp from "../simulations/ScalingSimulatorApp";
10+
import { scalingFrames } from "../simulations/scalingData";
911

1012
/** Thin wrapper that maps URL params to SimulatorApp props. */
1113
export function SimulatorPage() {
@@ -26,6 +28,20 @@ export function SimulatorPage() {
2628
);
2729
}
2830

31+
if (kind === "scaling") {
32+
const frameIndex = flowId ? scalingFrames.findIndex((f) => f.id === flowId) : 0;
33+
const activeFrame = frameIndex >= 0 ? frameIndex : 0;
34+
35+
return (
36+
<div className="app app-wide">
37+
<ScalingSimulatorApp
38+
activeFrame={activeFrame}
39+
onFrameChange={(i) => navigate(`/simulations/scaling/${scalingFrames[i].id}`)}
40+
/>
41+
</div>
42+
);
43+
}
44+
2945
return (
3046
<div className="app">
3147
<p>Unknown simulation: {kind}</p>

0 commit comments

Comments
 (0)