Skip to content

Commit

Permalink
router fixes for Manifesto
Browse files Browse the repository at this point in the history
  • Loading branch information
wheattoast11 committed Nov 21, 2024
1 parent 98c7e92 commit 25a5ad5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
Expand All @@ -22,8 +20,10 @@ jobs:
run: npm ci
- name: Build
run: npm run build
- name: Add .nojekyll file
run: touch dist/.nojekyll
- name: Add routing files
run: |
cp dist/index.html dist/404.html
touch dist/.nojekyll
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intuition Labs LLC - AI Research & Consulting</title>
<!-- Start Single Page Apps for GitHub Pages -->
<script type="text/javascript">
// Single Page Apps for GitHub Pages
// MIT License
// https://github.com/rafgraph/spa-github-pages
(function(l) {
if (l.search[1] === '/' ) {
var decoded = l.search.slice(1).split('&').map(function(s) {
Expand All @@ -20,7 +16,6 @@
}
}(window.location))
</script>
<!-- End Single Page Apps for GitHub Pages -->
</head>
<body>
<div id="root"></div>
Expand Down
7 changes: 5 additions & 2 deletions main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { createRoot } from 'react-dom/client';
import App from './src/App';
import './style.css';

// Create React root for main app
const root = createRoot(document.getElementById('root'));
root.render(<App />);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
25 changes: 13 additions & 12 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import Home from './pages/Home';
import Manifesto from './pages/Manifesto';
import { Scene } from './three/Scene';
Expand All @@ -23,11 +23,13 @@ function App() {
videoContainer.id = 'remotion-video';
document.body.appendChild(videoContainer);

// Create React root for video
const videoRoot = createRoot(videoContainer);
const root = document.createElement('div');
root.id = 'remotion-root';
videoContainer.appendChild(root);

const videoRoot = createRoot(root);
videoRoot.render(<RemotionVideo />);

// Cleanup on unmount
return () => {
if (videoContainer.parentNode) {
videoContainer.parentNode.removeChild(videoContainer);
Expand All @@ -36,15 +38,14 @@ function App() {
}, []);

return (
<>
<Router>
<canvas id="bg"></canvas>
<Router>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/manifesto" element={<Manifesto />} />
</Routes>
</Router>
</>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/manifesto" element={<Manifesto />} />
<Route path="*" element={<Navigate to="/" />} />
</Routes>
</Router>
);
}

Expand Down
3 changes: 0 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ export default defineConfig({
},
resolve: {
extensions: ['.js', '.jsx']
},
server: {
historyApiFallback: true
}
});

0 comments on commit 25a5ad5

Please sign in to comment.