mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-17 14:24:26 +01:00
fix flash
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
import { Routes, Route } from "react-router-dom";
|
import { Routes, Route } from "react-router-dom";
|
||||||
import { AnimatePresence } from "framer-motion";
|
|
||||||
|
|
||||||
import Home from "./Home";
|
|
||||||
import Receive from "./Receive";
|
|
||||||
import Join from "./Join";
|
import Join from "./Join";
|
||||||
|
import Layout from "./components/Layout";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
@@ -12,7 +11,9 @@ function App() {
|
|||||||
|
|
||||||
<Routes>
|
<Routes>
|
||||||
{/* <Route path="/" element={<Home />} /> */}
|
{/* <Route path="/" element={<Home />} /> */}
|
||||||
<Route path="/" element={<Join />} />
|
<Route path="/" element={<Layout />}>
|
||||||
|
<Route index element={<Join />} />
|
||||||
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
19
src/Join.tsx
19
src/Join.tsx
@@ -1,13 +1,11 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { redirect } from "react-router-dom";
|
|
||||||
import button from "./components/button"
|
|
||||||
import WaitlistForm from "./components/WaitlistForm";
|
import WaitlistForm from "./components/WaitlistForm";
|
||||||
import { WaitlistAlreadyIn } from "./components/WaitlistAlreadyIn";
|
import { WaitlistAlreadyIn } from "./components/WaitlistAlreadyIn";
|
||||||
|
|
||||||
export default function Join() {
|
export default function Join() {
|
||||||
// On load, check if the user is already on the waitlist
|
// On load, check if the user is already on the waitlist
|
||||||
const [waitlisted, setWaitlisted] = useState(false);
|
const [waitlisted, setWaitlisted] = useState(false);
|
||||||
const [waitlistId, setWaitlistId] = useState(localStorage.getItem('waitlist_id') || "");
|
const [waitlistId] = useState(localStorage.getItem('waitlist_id') || "");
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
// Fetch the waitlist status from the backend
|
// Fetch the waitlist status from the backend
|
||||||
@@ -17,18 +15,17 @@ export default function Join() {
|
|||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
setWaitlisted(true);
|
setWaitlisted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
}, [waitlistId]);
|
}, [waitlistId]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="safe-top safe-left safe-right safe-bottom">
|
<>
|
||||||
<div className="disable-scrollbars max-h-screen h-full overflow-y-scroll mx-4">
|
{loading ? null : waitlisted ? <WaitlistAlreadyIn /> : <WaitlistForm />}
|
||||||
{waitlisted && !loading ? <WaitlistAlreadyIn /> : !loading ? <WaitlistForm /> : null}
|
</>
|
||||||
</div>
|
|
||||||
</div >
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
src/components/Layout.tsx
Normal file
9
src/components/Layout.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { Outlet } from "react-router-dom";
|
||||||
|
|
||||||
|
export default function Layout() {
|
||||||
|
return (<div className="safe-top safe-left safe-right safe-bottom">
|
||||||
|
<div className="disable-scrollbars max-h-screen h-full overflow-y-scroll">
|
||||||
|
<Outlet />
|
||||||
|
</div>
|
||||||
|
</div >)
|
||||||
|
}
|
||||||
16
src/main.tsx
16
src/main.tsx
@@ -1,19 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom/client'
|
import ReactDOM from 'react-dom/client'
|
||||||
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
|
import { BrowserRouter } from 'react-router-dom'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
|
|
||||||
const router = createBrowserRouter([
|
|
||||||
{
|
|
||||||
path: "/",
|
|
||||||
element: <App />,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||||
<React.StrictMode>
|
<BrowserRouter>
|
||||||
<RouterProvider router={router} />
|
<App />
|
||||||
{/* <App /> */}
|
</BrowserRouter>
|
||||||
</React.StrictMode>,
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user