Implementation of storing input name in sessionStorage and Implementation of /vs/:char/:step #1

Merged
latenightdef merged 4 commits from mrrpmeowfurry/fifty-shades-of-bully:main into main 2025-06-19 02:48:06 +00:00
3 changed files with 23 additions and 6 deletions
Showing only changes of commit d1c91abcc3 - Show all commits

View file

@ -8,6 +8,12 @@ import Animation from './components/animation.jsx';
function ConversationPage({data , onClicked}) {
const backgroundSRC = `${import.meta.env.VITE_ASSETS_URL}/${data.background}`
const [name] = useState(() => {
return sessionStorage.getItem("name") || '';
});
const DialogText = data.text.replace("{name}", name);
const DialogName = data.name.replace("{name}", name);
return (
<div
@ -29,11 +35,11 @@ function ConversationPage({data , onClicked}) {
</div>
<div style={{width:'60vw'}}>
<div className='nameBox title'>
{data.name}
{DialogName}
</div>
</div>
<div className='textBox title' style={{overflow: 'scroll',}}>
{data.text}
{DialogText}
</div>
</div>
);

View file

@ -1,10 +1,16 @@
import '../css/global.css'
import '../css/customInput.css'
import BlackButton from './components/customButton'
import { useState } from 'react';
import { useState, useEffect } from 'react';
function NamePage() {
const [name, setName] = useState('');
const [name, setName] = useState(() => {
return sessionStorage.getItem("name") || '';
});
useEffect(() => {
sessionStorage.setItem("name", name);
}, [name]);
return (
<div style={{
@ -35,4 +41,4 @@ function NamePage() {
)
}
export default NamePage
export default NamePage

View file

@ -5,6 +5,11 @@ import '../css/textBox.css';
function StoryPage({data , onClicked}) {
const backgroundSRC = `${import.meta.env.VITE_ASSETS_URL}/${data.background}`
const [name] = useState(() => {
return sessionStorage.getItem("name") || '';
});
const DialogText = data.text.replace("{name}", name);
return (
<div
@ -22,7 +27,7 @@ function StoryPage({data , onClicked}) {
}}
>
<div className='textBox title' style={{marginTop: '50vh', overflow: 'scroll',}}>
{data.text}
{DialogText}
</div>
</div>
);