create transitionPage
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
25f8ed3f25
commit
920f651e2b
2 changed files with 28 additions and 1 deletions
25
src/pages/transitionPage.jsx
Normal file
25
src/pages/transitionPage.jsx
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// TransitionPage.jsx
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
function TransitionPage({data , onChanged}){
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Set a timer for 5 seconds (5000 milliseconds)
|
||||||
|
const timer = setTimeout(() => {
|
||||||
|
// Navigate to the target page after the timer expires
|
||||||
|
onChanged(data.goTo-1)// Change '/targetPage' to your desired route
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
|
// Cleanup the timer on component unmount
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, [navigate]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TransitionPage;
|
|
@ -7,7 +7,7 @@ import StoryPage from './storyPage';
|
||||||
import ConversationPage from './conversationPage.jsx';
|
import ConversationPage from './conversationPage.jsx';
|
||||||
import OptionPage from './optionPage.jsx';
|
import OptionPage from './optionPage.jsx';
|
||||||
import LoadingScene from './components/loadingScene.jsx';
|
import LoadingScene from './components/loadingScene.jsx';
|
||||||
|
import TransitionPage from './transitionPage.jsx';
|
||||||
|
|
||||||
function VitualNovelHandler() {
|
function VitualNovelHandler() {
|
||||||
const [data, setData] = useState(null);
|
const [data, setData] = useState(null);
|
||||||
|
@ -69,6 +69,8 @@ function VitualNovelHandler() {
|
||||||
return <ConversationPage data={currentStepData} onClicked={handleNextStep}/>;
|
return <ConversationPage data={currentStepData} onClicked={handleNextStep}/>;
|
||||||
case "option":
|
case "option":
|
||||||
return <OptionPage data={currentStepData} onClicked={handleNextStep}/>;
|
return <OptionPage data={currentStepData} onClicked={handleNextStep}/>;
|
||||||
|
case "transition":
|
||||||
|
return <TransitionPage data={currentStepData} onChanged={handleNextStep}/>
|
||||||
default:
|
default:
|
||||||
return <LoadingScene />;
|
return <LoadingScene />;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue