Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 56 additions & 6 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion server/prisma/seed-opentype.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dotenv/config';
import opentype from 'opentype.js';
import path from 'path';
import { fileURLToPath } from 'url';
import prisma from './prisma.client.ts';
import prisma from './prisma.client.js';;

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -20,6 +20,7 @@ async function seed() {
__dirname,
'..',
'..',
'..',
'public',
'fonts',
'UncialAntiqua-Regular.ttf',
Expand Down
46 changes: 23 additions & 23 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,41 @@ function App() {
// const [user, setUser] = useState(null);
// const [authStatus, setAuthStatus]= useState<"loading"|"done">("loading");

// useEffect(()=> {
// fetch("/api/auth/me", { credentials: "include" })
// .then(res => res.json())
// .then(data => {
// if(data.user){
// setUser(data.user);
// }
// setAuthStatus("done");
// })
// .catch(()=> setAuthStatus("done"));
// }, []);

// if (authStatus === "loading"){
// return <div> Loading Auth... </div>
// }
// useEffect(()=> {
// fetch("/api/auth/me", { credentials: "include" })
// .then(res => res.json())
// .then(data => {
// if(data.user){
// setUser(data.user);
// }
// setAuthStatus("done");
// })
// .catch(()=> setAuthStatus("done"));
// }, []);

// if (authStatus === "loading"){
// return <div> Loading Auth... </div>
// }
const { isLoading } = useUser()

if (isLoading) {
return <div>Loading...</div>
return <div className='maincontainer'></div>
}


console.log('App render - isLoading:', isLoading, 'path:', window.location.pathname)
return (
<Routes>
{/* Auth flow */}
<Route path="/login" element={<LandingPage/>} />
<Route path="/" element={<LandingPage/>} />
<Route path="/login" element={<LandingPage />} />
<Route path="/" element={<LandingPage />} />

{/* User */}
<Route path="/settings" element={<ProtectedRoute><UserSettings/></ProtectedRoute>} />
<Route path="/profile" element={<ProtectedRoute><UserProfile/></ProtectedRoute>} />
<Route path="/settings" element={<ProtectedRoute><UserSettings /></ProtectedRoute>} />
<Route path="/profile" element={<ProtectedRoute><UserProfile /></ProtectedRoute>} />

{/* Main Room Nav */}
<Route path="/destroy-sigil" element={<ProtectedRoute><SigilDestroy/></ProtectedRoute>}/>
<Route path="/home" element={<ProtectedRoute><HomeRoom/></ProtectedRoute>} />
<Route path="/destroy-sigil" element={<ProtectedRoute><SigilDestroy /></ProtectedRoute>} />
<Route path="/home" element={<ProtectedRoute><HomeRoom /></ProtectedRoute>} />
<Route path="/charge-sigil" element={<ProtectedRoute><SigilCharge /></ProtectedRoute>} />
<Route path="/grimoire" element={<ProtectedRoute><Grimoire /></ProtectedRoute>} />
<Route path="/make-sigil" element={<ProtectedRoute><MakeSigil /></ProtectedRoute>} />
Expand Down
2 changes: 1 addition & 1 deletion src/assets/AltarButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/Bookshelf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/assets/BookshelfButton.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/assets/DestroyButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/GrimoireButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/InsideLino.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/LibraryLino.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/MapButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/ProfileButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/SigilBook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/assets/WriteButton.svg

This file was deleted.

1 change: 1 addition & 0 deletions src/assets/WritingButton.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/components/LogInAuth/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useUser } from '@/context/UserContext';

export default function ProtectedRoute({ children }: { children: React.ReactNode }) {
const { user, isLoading } = useUser()

if (isLoading) {
return <div>Loading...</div>
}
console.log('ProtectedRoute render - isLoading:', isLoading, 'user:', !!user, 'path:', window.location.pathname)
if (isLoading) {
return <div className='maincontainer'></div>
}

if (!user) {
return <Navigate to="/" replace />
Expand Down
67 changes: 34 additions & 33 deletions src/components/SigilRoomHome/ChargeSigil/SigilCharge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Menu from '../../Parts/Menu'
import { Link, useNavigate, useSearchParams } from "react-router-dom"

import { useNavigate, useSearchParams } from "react-router-dom"
import ChangeEmotion from './ChargeComponents/ChangeEmotion'
import { useState, useEffect, useRef } from 'react'
import { useUser } from '@/context/UserContext'
Expand Down Expand Up @@ -31,71 +30,73 @@ export default function ChargeSigil() {
.catch(err => console.error(err))
}, [sigilId])

if (!user) { return null }
if (!sigilData) {
return (
<p>Loading Sigil!</p>
)
}

const handleSave = async () => {
try {
const res = await fetch(`/api/sigils/${sigilData.id}/charge`, { method: 'PATCH' });
if (!res.ok) { throw new Error('Failed to charge sigil'); }
const updatedSigil = await res.json();
navigate(`/sigil-page?sigilId=${updatedSigil.id}`)
setTimeout(() => navigate(`/sigil-page?sigilId=${updatedSigil.id}`), 100)
} catch (error) {
console.error(error);
}
}

if (!user) { return null }
if (!sigilData) { return <p>Loading Sigil!</p> }

return (
<div className='maincontainer'>
<Menu />
<div ref={scrollRef} className={`scrollcontainer ${isCharging ? 'noscroll' : ''}`}>
{isCharging && (
<SplashCursor
BACK_COLOR={{ r: 0, g: 0, b: 0 }}
TRANSPARENT={true}
SPLAT_RADIUS={0.2}
SPLAT_FORCE={6000}
DENSITY_DISSIPATION={3.5}
VELOCITY_DISSIPATION={2}
/>
)}
<div className='chargesigil'>
<div ref={scrollRef} className='scrollcontainer' style={{ overflowX: isCharging ? 'hidden' : 'scroll' }}>
<div className='chargesigil' >
<Menu />
<h1>ChargeSigil</h1>


{isCharging && (
<SplashCursor
BACK_COLOR={{ r: 0, g: 0, b: 0 }}
TRANSPARENT={true}
SPLAT_RADIUS={0.2}
SPLAT_FORCE={6000}
DENSITY_DISSIPATION={3.5}
VELOCITY_DISSIPATION={2}
/>
)}

{sigilData.imageData ? (
{sigilData.imageData && (
<img className="sigilbox" src={sigilData.imageData} alt={sigilData.name} />
) : (
<img className="sigilbox" src="src/assets/dummySigil.svg" alt="placeholderSigil" />
)}

<ChangeEmotion emotion={emotion} setEmotion={setEmotion} />

{!isCharging && (
<button
className='navbutton'
style={{ position: 'relative', zIndex: 20, backgroundColor: "#e0e0e0"}}
onClick={() => setIsCharging(true)}
disabled={!emotion}>
disabled={!emotion}
>
Charge Sigil
</button>
)}

{isCharging && (
<button className='navbutton' onClick={handleSave}>
<button
className='navbutton'
style={{ position: 'relative', zIndex: 20, backgroundColor: "#e0e0e0" }}
onClick={handleSave}
>
Save your Sigil!
</button>
)}

{isCharging && (
<Link className="navbutton" to="/destroy-sigil" state={{ sigilData }}>
<button
className='navbutton'
style={{ position: 'relative', zIndex: 20, backgroundColor: "#e0e0e0"}}
onClick={() => setTimeout(() => navigate(`/destroy-sigil?sigilId=${sigilData.id}`), 100)}
>
Destroy Your Charged Sigil!
</Link>
</button>
)}

</div>
</div>
</div>
Expand Down
Loading
Loading