Skip to content

Commit 1f22862

Browse files
committed
Finally got emulation working!
1 parent 59b1781 commit 1f22862

File tree

13 files changed

+478
-704
lines changed

13 files changed

+478
-704
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview",
1111
"prepare": "husky install",
1212
"dev:worker": "wrangler dev",
13-
"dev:vite": "vite"
13+
"dev:vite": "vite --host"
1414
},
1515
"dependencies": {
1616
"@headlessui/react": "^2.2.0",

public/wasm/zx_emulator.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/wasm/zx_emulator.wasm

1.11 KB
Binary file not shown.

src/App.tsx

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,74 +14,85 @@ import { Helmet, HelmetProvider } from 'react-helmet-async'
1414
import { initFacebookPixel } from './utils/FacebookPixel'
1515
import Banner from './components/Banner'
1616

17-
// Create a new component to handle route changes
18-
function RouteTracker() {
17+
// Create a new component to handle route changes and layout
18+
function Layout() {
1919
const location = useLocation();
20+
const isEmulatorRoute = location.pathname === '/emulator';
2021

2122
useEffect(() => {
2223
const ReactPixel = initFacebookPixel();
2324
ReactPixel.pageView();
2425
}, [location]);
2526

26-
return null;
27+
if (isEmulatorRoute) {
28+
return (
29+
<main>
30+
<Routes>
31+
<Route path="/emulator" element={<Emulator />} />
32+
</Routes>
33+
</main>
34+
);
35+
}
36+
37+
return (
38+
<div className="min-h-screen bg-gray-900 text-gray-100">
39+
<Banner />
40+
<Navbar />
41+
<main>
42+
<Routes>
43+
<Route path="/" element={<Home />} />
44+
<Route path="/faq" element={<FAQ />} />
45+
<Route path="/docs" element={<Docs />} />
46+
<Route path="/firmware" element={<Firmware />} />
47+
<Route path="/github" element={<GitHub />} />
48+
<Route path="/games" element={<Games />} />
49+
<Route path="/games/:id" element={<GameDetail />} />
50+
<Route path="*" element={
51+
<div className="flex min-h-[calc(100vh-4rem)] items-center justify-center">
52+
<h1 className="text-4xl font-bold text-gray-100">404 - Page Not Found</h1>
53+
</div>
54+
} />
55+
</Routes>
56+
</main>
57+
</div>
58+
);
2759
}
2860

2961
function App() {
3062
return (
3163
<HelmetProvider>
3264
<SerialProvider>
3365
<Router>
34-
<div className="min-h-screen bg-gray-900 text-gray-100">
35-
<Banner />
36-
<RouteTracker />
37-
<Helmet>
38-
<title>ESP32 Rainbow - ZX Spectrum Emulator</title>
39-
<meta name="description" content="A ZX Spectrum emulator built using an ESP32 microcontroller. Features composite video output, PS/2 keyboard support, and SD card storage for loading games." />
40-
41-
{/* JSON-LD structured data */}
42-
<script type="application/ld+json">
43-
{JSON.stringify({
44-
"@context": "https://schema.org",
66+
<Helmet>
67+
<title>ESP32 Rainbow - ZX Spectrum Emulator</title>
68+
<meta name="description" content="A ZX Spectrum emulator built using an ESP32 microcontroller. Features composite video output, PS/2 keyboard support, and SD card storage for loading games." />
69+
70+
{/* JSON-LD structured data */}
71+
<script type="application/ld+json">
72+
{JSON.stringify({
73+
"@context": "https://schema.org",
74+
"@type": "Product",
75+
"name": "ESP32 Rainbow ZX Spectrum Emulator",
76+
"description": "A ZX Spectrum emulator built using an ESP32 microcontroller. Features composite video output, PS/2 keyboard support, and SD card storage for loading games.",
77+
"brand": {
78+
"@type": "Brand",
79+
"name": "ESP32 Rainbow"
80+
},
81+
"offers": {
82+
"@type": "Offer",
83+
"url": "https://www.crowdsupply.com/atomic14/esp32-rainbow",
84+
"availability": "https://schema.org/InStock"
85+
},
86+
"url": "https://www.esp32rainbow.com",
87+
"category": "Electronics",
88+
"isAccessoryOrSparePartFor": {
4589
"@type": "Product",
46-
"name": "ESP32 Rainbow ZX Spectrum Emulator",
47-
"description": "A ZX Spectrum emulator built using an ESP32 microcontroller. Features composite video output, PS/2 keyboard support, and SD card storage for loading games.",
48-
"brand": {
49-
"@type": "Brand",
50-
"name": "ESP32 Rainbow"
51-
},
52-
"offers": {
53-
"@type": "Offer",
54-
"url": "https://www.crowdsupply.com/atomic14/esp32-rainbow",
55-
"availability": "https://schema.org/InStock"
56-
},
57-
"url": "https://www.esp32rainbow.com",
58-
"category": "Electronics",
59-
"isAccessoryOrSparePartFor": {
60-
"@type": "Product",
61-
"name": "ESP32 Microcontroller"
62-
}
63-
})}
64-
</script>
65-
</Helmet>
66-
<Navbar />
67-
<main>
68-
<Routes>
69-
<Route path="/" element={<Home />} />
70-
<Route path="/faq" element={<FAQ />} />
71-
<Route path="/docs" element={<Docs />} />
72-
<Route path="/firmware" element={<Firmware />} />
73-
<Route path="/emulator" element={<Emulator />} />
74-
<Route path="/github" element={<GitHub />} />
75-
<Route path="/games" element={<Games />} />
76-
<Route path="/games/:id" element={<GameDetail />} />
77-
<Route path="*" element={
78-
<div className="flex min-h-[calc(100vh-4rem)] items-center justify-center">
79-
<h1 className="text-4xl font-bold text-gray-100">404 - Page Not Found</h1>
80-
</div>
81-
} />
82-
</Routes>
83-
</main>
84-
</div>
90+
"name": "ESP32 Microcontroller"
91+
}
92+
})}
93+
</script>
94+
</Helmet>
95+
<Layout />
8596
</Router>
8697
</SerialProvider>
8798
</HelmetProvider>

src/components/Emulator.tsx

Lines changed: 0 additions & 204 deletions
This file was deleted.

src/components/GameTile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function GameTile({
7171
...(currentPage ? { page: currentPage.toString() } : {}),
7272
...(searchInput ? { search: searchInput } : {})
7373
}).toString()}`}
74-
className={`block rounded-lg p-4 transition-transform hover:scale-105 relative overflow-hidden h-64 group ${
74+
className={`block rounded-lg p-4 transition-transform hover:scale-105 relative overflow-hidden h-full group ${
7575
screenUrl ? 'hover:shadow-xl' : 'bg-gray-700 hover:bg-gray-600'
7676
}`}
7777
>

src/components/Navbar.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@ const navigationItems: NavItem[] = [
5757
/>
5858
)
5959
},
60-
// {
61-
// to: '/emulator',
62-
// label: 'Emulator',
63-
// icon: (
64-
// <path
65-
// strokeLinecap="round"
66-
// strokeLinejoin="round"
67-
// strokeWidth={2}
68-
// d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
69-
// />
70-
// )
71-
// },
7260
{
7361
to: '/github',
7462
label: 'GitHub',

0 commit comments

Comments
 (0)