mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-14 15:07:59 +00:00
actualy being able to go to start
This commit is contained in:
19
src/App.tsx
19
src/App.tsx
@@ -35,12 +35,6 @@ const PlayWrapper = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const removeLocalStorage = async () => {
|
|
||||||
localStorage.removeItem('initialGameSettings');
|
|
||||||
localStorage.removeItem('players');
|
|
||||||
localStorage.removeItem('playing');
|
|
||||||
};
|
|
||||||
|
|
||||||
const EmergencyResetButton = styled.button`
|
const EmergencyResetButton = styled.button`
|
||||||
width: 100vmax;
|
width: 100vmax;
|
||||||
height: 100vmin;
|
height: 100vmin;
|
||||||
@@ -54,14 +48,15 @@ const EmergencyResetButton = styled.button`
|
|||||||
const App = () => {
|
const App = () => {
|
||||||
const analytics = useAnalytics();
|
const analytics = useAnalytics();
|
||||||
const savedGameSettings = localStorage.getItem('initialGameSettings');
|
const savedGameSettings = localStorage.getItem('initialGameSettings');
|
||||||
const saveShowPlay = localStorage.getItem('showPlay');
|
const savedShowPlay = localStorage.getItem('showPlay');
|
||||||
|
|
||||||
const { isSupported, release, released, request, type } = useWakeLock();
|
const { isSupported, release, released, request, type } = useWakeLock();
|
||||||
const [initialGameSettings, setInitialGameSettings] =
|
const [initialGameSettings, setInitialGameSettings] =
|
||||||
useState<InitialSettings | null>(
|
useState<InitialSettings | null>(
|
||||||
savedGameSettings ? JSON.parse(savedGameSettings) : null
|
savedGameSettings ? JSON.parse(savedGameSettings) : null
|
||||||
);
|
);
|
||||||
const [showPlay, setShowPlay] = useState<boolean>(
|
const [showPlay, setShowPlay] = useState<boolean>(
|
||||||
saveShowPlay ? saveShowPlay === 'true' : false
|
savedShowPlay ? savedShowPlay === 'true' : false
|
||||||
);
|
);
|
||||||
|
|
||||||
const isActive = released === undefined ? false : !released;
|
const isActive = released === undefined ? false : !released;
|
||||||
@@ -81,6 +76,14 @@ const App = () => {
|
|||||||
);
|
);
|
||||||
}, [initialGameSettings]);
|
}, [initialGameSettings]);
|
||||||
|
|
||||||
|
const removeLocalStorage = async () => {
|
||||||
|
localStorage.removeItem('initialGameSettings');
|
||||||
|
localStorage.removeItem('players');
|
||||||
|
localStorage.removeItem('playing');
|
||||||
|
localStorage.removeItem('showPlay');
|
||||||
|
setShowPlay(localStorage.getItem('showPlay') === 'true' ?? false);
|
||||||
|
};
|
||||||
|
|
||||||
const goToStart = async () => {
|
const goToStart = async () => {
|
||||||
// this function is broken for the moment, need to set players object
|
// this function is broken for the moment, need to set players object
|
||||||
const currentPlayers = localStorage.getItem('players');
|
const currentPlayers = localStorage.getItem('players');
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const StartButtonFooter = styled.div`
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 1rem;
|
bottom: 1rem;
|
||||||
translate: -50%, -50%;
|
translate: -50%, -50%;
|
||||||
|
z-index: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ToggleButtonsWrapper = styled.div`
|
const ToggleButtonsWrapper = styled.div`
|
||||||
@@ -162,7 +163,7 @@ const Start = ({
|
|||||||
setPlayers(createInitialPlayers(initialGameSettings));
|
setPlayers(createInitialPlayers(initialGameSettings));
|
||||||
setShowPlay(true);
|
setShowPlay(true);
|
||||||
localStorage.setItem('playing', 'false');
|
localStorage.setItem('playing', 'false');
|
||||||
//Todo maybe showPlay is redundant?
|
// todo maybe showPlay is redundant?
|
||||||
localStorage.setItem('showPlay', 'true');
|
localStorage.setItem('showPlay', 'true');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user