Update Transition and End page
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
288db206b0
commit
1fe0053281
4 changed files with 46 additions and 11 deletions
|
@ -10,6 +10,7 @@ import Animation from './pages/components/animation.jsx';
|
||||||
import IntroductionPage from './pages/introductionPage.jsx';
|
import IntroductionPage from './pages/introductionPage.jsx';
|
||||||
import PlayVideo from './pages/components/playVideo.jsx'
|
import PlayVideo from './pages/components/playVideo.jsx'
|
||||||
import VitualNovelHandler from './pages/vistualNovelHandler.jsx';
|
import VitualNovelHandler from './pages/vistualNovelHandler.jsx';
|
||||||
|
import EndPage from './pages/endPage.jsx';
|
||||||
|
|
||||||
createRoot(document.getElementById('root')).render(
|
createRoot(document.getElementById('root')).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
|
@ -22,6 +23,7 @@ createRoot(document.getElementById('root')).render(
|
||||||
<Route path='/video' element={<PlayVideo />} />
|
<Route path='/video' element={<PlayVideo />} />
|
||||||
<Route path="/introduction" element={<IntroductionPage />} />
|
<Route path="/introduction" element={<IntroductionPage />} />
|
||||||
<Route path='/vs/:step' element={<VitualNovelHandler />} />
|
<Route path='/vs/:step' element={<VitualNovelHandler />} />
|
||||||
|
<Route path='/end' element={<EndPage />} />
|
||||||
|
|
||||||
<Route path="*" element={<Navigate to="/" replace />} />
|
<Route path="*" element={<Navigate to="/" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|
31
src/pages/endPage.jsx
Normal file
31
src/pages/endPage.jsx
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import '../css/global.css';
|
||||||
|
import BlackButton from './components/customButton';
|
||||||
|
import LoadingScene from './components/loadingScene';
|
||||||
|
|
||||||
|
function EndPage() {
|
||||||
|
return (
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100vh',
|
||||||
|
flexDirection: 'column',
|
||||||
|
}}>
|
||||||
|
<label className='title'>The End</label>
|
||||||
|
|
||||||
|
<div style={{ height: '16vh' }} />
|
||||||
|
|
||||||
|
<BlackButton text="Play again" to='/' />
|
||||||
|
|
||||||
|
<div style={{ height: '8vh' }} />
|
||||||
|
|
||||||
|
<a href='https://xn--22cm3b8aj2d0cs4a.com/' style={{textDecoration: 'none'}}>
|
||||||
|
<BlackButton text="Mental health resources" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EndPage;
|
|
@ -17,7 +17,10 @@ function TransitionPage({data , onChanged}){
|
||||||
}, [navigate]);
|
}, [navigate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div onClick={()=>onChanged(data.goTo-1)}
|
||||||
|
style={{
|
||||||
|
height: '100vh',
|
||||||
|
width: '100vw', }}>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,17 +49,16 @@ function VitualNovelHandler() {
|
||||||
const handleNextStep = (nextstep) => {
|
const handleNextStep = (nextstep) => {
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
console.log(nextstep)
|
console.log(nextstep)
|
||||||
setCurrentStep(nextstep);
|
if (typeof nextstep !== 'number' || Number.isNaN(nextstep)) {
|
||||||
navigate(`/vs/${nextstep}`);
|
navigate(`/end`);//44 is last page
|
||||||
|
}
|
||||||
|
else{
|
||||||
// else if (nextstep < data.length - 1) {
|
setCurrentStep(nextstep);
|
||||||
// setCurrentStep(nextstep + 1);
|
navigate(`/vs/${nextstep}`);
|
||||||
// navigate(`/vs/${nextstep + 1}`);
|
}
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentStepData = data[currentStep];
|
const currentStepData = data[currentStep] === null ? "end" : data[currentStep];
|
||||||
|
|
||||||
const renderComponent = (type) => {
|
const renderComponent = (type) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -78,7 +77,7 @@ function VitualNovelHandler() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: "100svw", height: "100svh" }}>
|
<div style={{ width: "100svw", height: "100svh" }}>
|
||||||
{renderComponent(currentStepData.type)}
|
{renderComponent(currentStepData.type === null ? "end" : currentStepData.type)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue