Skip to content

Commit 5abda33

Browse files
committed
feat(ai): add AI Fundamentals module with 11 interactive sections
- Add AI feature module with Introduction, ML Lifecycle, Feature Engineering, Neural Networks, Loss Functions, Gradient Descent, Backpropagation, Generalization, Training vs Inference, Word Embeddings, RAG Pipeline - Add rose/fuchsia/violet theme colors for AI module - Wire routing in App.tsx, Header.tsx, and Sidebar.tsx - All sections include interactive SVG visualizations with controls
1 parent 41f0c80 commit 5abda33

17 files changed

Lines changed: 3996 additions & 1 deletion

src/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const BigOPage = lazy(() => import('./features/bigo'));
2727
const PythonPage = lazy(() => import('./features/python'));
2828
const SystemDesignPage = lazy(() => import('./features/systemdesign'));
2929
const TypeScriptPage = lazy(() => import('./features/typescript'));
30+
const AIFundamentalsPage = lazy(() => import('./features/ai'));
3031

3132
const App: React.FC = () => {
3233
// Initialize analytics on app mount
@@ -154,6 +155,14 @@ const App: React.FC = () => {
154155
</SuspenseRoute>
155156
}
156157
/>
158+
<Route
159+
path="/ai"
160+
element={
161+
<SuspenseRoute>
162+
<AIFundamentalsPage />
163+
</SuspenseRoute>
164+
}
165+
/>
157166
</Routes>
158167
</main>
159168
</div>

src/components/Header.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ChevronDown,
1515
BookOpen,
1616
Boxes,
17+
Brain,
1718
} from 'lucide-react';
1819
import { useUI } from '../shared/contexts';
1920

@@ -109,6 +110,12 @@ const Header: React.FC = () => {
109110
icon: <GitBranch className="w-4 h-4" />,
110111
description: 'Version control mastery',
111112
},
113+
{
114+
label: 'AI Fundamentals',
115+
path: '/ai',
116+
icon: <Brain className="w-4 h-4" />,
117+
description: 'AI & Machine Learning fundamentals',
118+
},
112119
],
113120
},
114121
];
@@ -172,6 +179,7 @@ const Header: React.FC = () => {
172179
if (path === '/git') return 'text-orange-600 bg-orange-50';
173180
if (path === '/datastructures' || path === '/systemdesign') return 'text-blue-600 bg-blue-50';
174181
if (path === '/bigo') return 'text-purple-600 bg-purple-50';
182+
if (path === '/ai') return 'text-rose-600 bg-rose-50';
175183
return 'text-gray-700 hover:bg-gray-50';
176184
};
177185

src/components/Sidebar.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ const getThemeColorClass = (
5252
buttonHover: 'hover:text-emerald-600',
5353
border: 'border-emerald-100',
5454
},
55+
rose: {
56+
active: 'bg-rose-100 text-rose-800 border-rose-500',
57+
hover: 'hover:bg-rose-50 hover:text-rose-700',
58+
buttonActive: 'text-rose-600 hover:text-rose-700',
59+
buttonHover: 'hover:text-rose-600',
60+
border: 'border-rose-100',
61+
},
5562
};
5663

5764
const colors = colorMap[theme.primary] || colorMap.blue;
@@ -299,6 +306,19 @@ const sidebarSections: Record<string, Array<SidebarItem>> = {
299306
{ label: 'Best Practices', path: '/typescript?section=Best%20Practices' },
300307
{ label: 'Migration Guide', path: '/typescript?section=Migration%20Guide' },
301308
],
309+
'/ai': [
310+
{ label: 'Introduction', path: '/ai?section=Introduction' },
311+
{ label: 'ML Lifecycle', path: '/ai?section=ML%20Lifecycle' },
312+
{ label: 'Feature Engineering', path: '/ai?section=Feature%20Engineering' },
313+
{ label: 'Neural Networks', path: '/ai?section=Neural%20Networks' },
314+
{ label: 'Loss Functions', path: '/ai?section=Loss%20Functions' },
315+
{ label: 'Gradient Descent', path: '/ai?section=Gradient%20Descent' },
316+
{ label: 'Backpropagation', path: '/ai?section=Backpropagation' },
317+
{ label: 'Generalization', path: '/ai?section=Generalization' },
318+
{ label: 'Training vs Inference', path: '/ai?section=Training%20vs%20Inference' },
319+
{ label: 'Word Embeddings', path: '/ai?section=Word%20Embeddings' },
320+
{ label: 'RAG Pipeline', path: '/ai?section=RAG%20Pipeline' },
321+
],
302322
'/': [],
303323
'/about': [],
304324
};
@@ -323,7 +343,9 @@ const Sidebar: React.FC = () => {
323343
| 'bigo'
324344
| 'python'
325345
| 'systemdesign'
326-
| 'typescript' => {
346+
| 'typescript'
347+
| 'ai' => {
348+
if (path.includes('/ai')) return 'ai';
327349
if (path.includes('javascript')) return 'javascript';
328350
if (path.includes('python')) return 'python';
329351
if (path.includes('react')) return 'react';
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, { Suspense } from 'react';
2+
import { useLocation } from 'react-router-dom';
3+
4+
// Lazy load section components for better performance
5+
import Introduction from './components/sections/Introduction';
6+
const MLLifecycle = React.lazy(() => import('./components/sections/MLLifecycle'));
7+
const FeatureEngineering = React.lazy(() => import('./components/sections/FeatureEngineering'));
8+
const NeuralNetworks = React.lazy(() => import('./components/sections/NeuralNetworks'));
9+
const LossFunctions = React.lazy(() => import('./components/sections/LossFunctions'));
10+
const GradientDescent = React.lazy(() => import('./components/sections/GradientDescent'));
11+
const Backpropagation = React.lazy(() => import('./components/sections/Backpropagation'));
12+
const Generalization = React.lazy(() => import('./components/sections/Generalization'));
13+
const TrainingVsInference = React.lazy(() => import('./components/sections/TrainingVsInference'));
14+
const WordEmbeddings = React.lazy(() => import('./components/sections/WordEmbeddings'));
15+
const RAGPipeline = React.lazy(() => import('./components/sections/RAGPipeline'));
16+
17+
const sectionComponents: Record<string, React.ComponentType> = {
18+
Introduction,
19+
'ML Lifecycle': MLLifecycle,
20+
'Feature Engineering': FeatureEngineering,
21+
'Neural Networks': NeuralNetworks,
22+
'Loss Functions': LossFunctions,
23+
'Gradient Descent': GradientDescent,
24+
Backpropagation,
25+
Generalization,
26+
'Training vs Inference': TrainingVsInference,
27+
'Word Embeddings': WordEmbeddings,
28+
'RAG Pipeline': RAGPipeline,
29+
};
30+
31+
function useQuery(): URLSearchParams {
32+
return new URLSearchParams(useLocation().search);
33+
}
34+
35+
const AIFundamentalsPage: React.FC = () => {
36+
const query = useQuery();
37+
const section = query.get('section') || 'Introduction';
38+
const Component = sectionComponents[section] || Introduction;
39+
40+
return (
41+
<div className="p-4 sm:p-6">
42+
<Suspense
43+
fallback={
44+
<div className="flex items-center justify-center h-64">
45+
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-rose-600"></div>
46+
</div>
47+
}
48+
>
49+
<Component />
50+
</Suspense>
51+
</div>
52+
);
53+
};
54+
55+
export default AIFundamentalsPage;

0 commit comments

Comments
 (0)