Skip to content

Commit f765d12

Browse files
v2
1 parent 16796a1 commit f765d12

20 files changed

Lines changed: 961 additions & 236 deletions

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/png" href="/images/fav.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>ConstCorrectness &copy;</title> </head>
7+
<title>const correctness;</title> </head>
88
<body>
99
<div id="root"></div>
1010
<script type="module" src="/src/main.tsx"></script>

package-lock.json

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"@emotion/react": "^11.14.0",
1414
"@emotion/styled": "^11.14.1",
15+
"@giscus/react": "^3.1.0",
1516
"@mdx-js/react": "^3.1.1",
1617
"@mdx-js/rollup": "^3.1.1",
1718
"@mui/icons-material": "^7.3.6",

src/components/AnatomyAttention.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ const AnatomyAttention: React.FC = () => {
826826
<div className="w-full px-4 sm:px-6 lg:px-8 text-center">
827827
<h2 className="text-2xl font-bold text-gray-900 mb-6">The Mathematical Mechanism</h2>
828828
<div className="bg-gray-50 p-6 rounded-xl border border-gray-200 font-mono text-sm md:text-base overflow-x-auto">
829-
<p className="mb-4 text-gray-500">// The Scaled Dot-Product Attention</p>
829+
<p className="mb-4 text-gray-500">{"// The Scaled Dot-Product Attention"}</p>
830830
<div className="flex justify-center items-center gap-4">
831831
<span>Attention(Q, K, V) = softmax</span>
832832
<div className="flex flex-col items-center px-2 border-l border-r border-gray-400">

src/components/GiscusComments.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
import Giscus from '@giscus/react';
3+
import { Box, useTheme } from '@mui/material';
4+
5+
const GiscusComments: React.FC = () => {
6+
const theme = useTheme();
7+
8+
return (
9+
<Box sx={{ mt: 10, pt: 6, borderTop: '1px solid', borderColor: 'divider' }}>
10+
<Giscus
11+
id="comments"
12+
repo="constcorrectness/constcorrectness.github.io"
13+
repoId="R_kgDON7uI7A" // You'll need to update this with your actual repoId
14+
category="Announcements"
15+
categoryId="DIC_kwDON7uI7M4CnR-R" // You'll need to update this with your actual categoryId
16+
mapping="pathname"
17+
term="Welcome to my blog!"
18+
reactionsEnabled="1"
19+
emitMetadata="0"
20+
inputPosition="top"
21+
theme={theme.palette.mode}
22+
lang="en"
23+
loading="lazy"
24+
/>
25+
</Box>
26+
);
27+
};
28+
29+
export default GiscusComments;

src/components/Layout.tsx

Lines changed: 55 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
import React, { useState } from 'react';
2-
import { AppBar, Toolbar, Typography, Button, Menu, MenuItem, Box, Container } from '@mui/material';
3-
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
1+
import React from 'react';
2+
import { AppBar, Toolbar, Typography, Button, Box, Container, IconButton } from '@mui/material';
43
import CodeIcon from '@mui/icons-material/Code';
4+
import { Link as RouterLink } from 'react-router-dom';
5+
import ThemeToggle from './ThemeToggle';
56

67
export const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
7-
// Dropdown State
8-
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
9-
const open = Boolean(anchorEl);
10-
11-
const handleMenuClick = (event: React.MouseEvent<HTMLElement>) => {
12-
setAnchorEl(event.currentTarget);
13-
};
14-
const handleClose = () => {
15-
setAnchorEl(null);
16-
};
17-
188
return (
19-
<Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100vh', bgcolor: '#121212', color: 'white' }}>
9+
<Box sx={{ display: 'flex', flexDirection: 'column', minHeight: '100vh', bgcolor: 'background.default', color: 'text.primary' }}>
2010

2111
{/* --- HEADER --- */}
22-
<AppBar position="static" sx={{ bgcolor: '#1e1e1e', borderBottom: '1px solid #333' }}>
12+
<AppBar
13+
position="sticky"
14+
elevation={0}
15+
sx={{
16+
bgcolor: 'background.paper',
17+
borderBottom: '1px solid',
18+
borderColor: 'divider',
19+
color: 'text.primary'
20+
}}
21+
>
2322
<Toolbar>
24-
<CodeIcon sx={{ mr: 1, color: '#61dafb' }} />
25-
<Typography variant="h6" sx={{ flexGrow: 1, fontFamily: 'monospace', fontWeight: 700 }}>
23+
<CodeIcon sx={{ mr: 1, color: 'primary.main' }} />
24+
<Typography
25+
variant="h6"
26+
component={RouterLink}
27+
to="/"
28+
sx={{
29+
flexGrow: 1,
30+
fontFamily: 'monospace',
31+
fontWeight: 700,
32+
textDecoration: 'none',
33+
color: 'inherit'
34+
}}
35+
>
2636
const correctness;
2737
</Typography>
2838

29-
<Button color="inherit" href="/">Home</Button>
30-
31-
{/* Blog Dropdown */}
32-
<Button
33-
color="inherit"
34-
endIcon={<KeyboardArrowDownIcon />}
35-
onClick={handleMenuClick}
36-
>
37-
Blog
38-
</Button>
39-
<Menu anchorEl={anchorEl} open={open} onClose={handleClose}>
40-
{/* These link to your rendered Jupyter Book pages */}
41-
<MenuItem onClick={handleClose} component="a" href="/notes/index.html">
42-
Intro & Setup
43-
</MenuItem>
44-
<MenuItem onClick={handleClose} component="a" href="/notes/structure.html">
45-
C++ Deep Dives
46-
</MenuItem>
47-
</Menu>
39+
<Box sx={{ display: { xs: 'none', md: 'flex' }, gap: 1, alignItems: 'center' }}>
40+
<Button component={RouterLink} to="/" color="inherit">Home</Button>
41+
<Button component={RouterLink} to="/notes" color="inherit">Blog</Button>
42+
<Button component="a" href="https://github.com/constcorrectness" target="_blank" color="inherit">GitHub</Button>
43+
<ThemeToggle />
44+
</Box>
4845

49-
<Button color="inherit" href="https://github.com/constcorrectness">GitHub</Button>
46+
{/* Mobile view could be added here later with a Drawer */}
47+
<Box sx={{ display: { xs: 'flex', md: 'none' } }}>
48+
<ThemeToggle />
49+
</Box>
5050
</Toolbar>
5151
</AppBar>
5252

@@ -56,11 +56,25 @@ export const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) =>
5656
</Box>
5757

5858
{/* --- FOOTER --- */}
59-
<Box component="footer" sx={{ py: 3, px: 2, mt: 'auto', backgroundColor: '#0a0a0a', textAlign: 'center' }}>
60-
<Container maxWidth="sm">
61-
<Typography variant="body2" color="#888">
59+
<Box
60+
component="footer"
61+
sx={{
62+
py: 6,
63+
px: 2,
64+
mt: 'auto',
65+
bgcolor: 'background.paper',
66+
borderTop: '1px solid',
67+
borderColor: 'divider',
68+
textAlign: 'center'
69+
}}
70+
>
71+
<Container maxWidth="md">
72+
<Typography variant="body2" color="text.secondary">
6273
© {new Date().getFullYear()} ConstCorrectness ™️
6374
</Typography>
75+
<Typography variant="caption" color="text.secondary" sx={{ display: 'block', mt: 1 }}>
76+
Built with React, MUI, and Three.js
77+
</Typography>
6478
</Container>
6579
</Box>
6680
</Box>

src/components/ModelViewer.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import React, { Suspense, useRef } from 'react';
22
import { Canvas, useFrame } from '@react-three/fiber';
33
import { OrbitControls, useGLTF, Stage, Html } from '@react-three/drei';
4-
4+
import { useTheme } from '@mui/material';
55
import * as THREE from 'three';
66

77

88
function SpinningBox() {
99
const meshRef = useRef<THREE.Mesh>(null);
10+
const theme = useTheme();
11+
1012
useFrame((_, delta) => {
1113
if (meshRef.current) {
1214
meshRef.current.rotation.x += delta * 0.5;
@@ -17,7 +19,7 @@ function SpinningBox() {
1719
return (
1820
<mesh ref={meshRef}>
1921
<boxGeometry args={[2, 2, 2]} />
20-
<meshStandardMaterial color="#61dafb" wireframe />
22+
<meshStandardMaterial color={theme.palette.primary.main} wireframe />
2123
</mesh>
2224
);
2325
}
@@ -33,16 +35,19 @@ interface ViewerProps {
3335
}
3436

3537
export const ModelViewer: React.FC<ViewerProps> = ({ modelUrl }) => {
38+
const theme = useTheme();
39+
3640
return (
3741
<Canvas shadows dpr={[1, 2]} camera={{ fov: 50 }}>
3842
<Suspense fallback={<Html center>Loading...</Html>}>
39-
{/* Stage sets up generic "nice" lighting and centering automatically */}
40-
<Stage environment="city" intensity={2.0}>
43+
<Stage
44+
environment={theme.palette.mode === 'dark' ? "city" : "apartment"}
45+
intensity={theme.palette.mode === 'dark' ? 1.0 : 0.5}
46+
>
4147
{modelUrl ? <GltfModel url={modelUrl} /> : <SpinningBox />}
4248
</Stage>
4349
</Suspense>
4450
<OrbitControls autoRotateSpeed={0.5} autoRotate />
4551
</Canvas>
4652
);
4753
};
48-

0 commit comments

Comments
 (0)