mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-08 04:05:54 -05:00
save generated maplist to localstorage
This commit is contained in:
@@ -79,6 +79,12 @@ const MapsGeneratorPage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const maplist = localStorage.getItem("maplist");
|
||||
if (!maplist) return;
|
||||
setMaplist(maplist);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!copied) return;
|
||||
|
||||
@@ -145,7 +151,7 @@ const MapsGeneratorPage = () => {
|
||||
|
||||
const stagesAlreadyPicked = new Set<string>();
|
||||
|
||||
const isSZFirst = Math.random() > 0.5;
|
||||
const isSZFirst = false;
|
||||
|
||||
return new Array(count)
|
||||
.fill(null)
|
||||
@@ -330,7 +336,11 @@ const MapsGeneratorPage = () => {
|
||||
<Stack direction={["column", "row"]} spacing={4} mb={4}>
|
||||
<Button
|
||||
leftIcon={<FiRotateCw />}
|
||||
onClick={() => setMaplist(generateMaps())}
|
||||
onClick={() => {
|
||||
const maplist = generateMaps();
|
||||
setMaplist(maplist);
|
||||
localStorage.setItem("maplist", maplist);
|
||||
}}
|
||||
>
|
||||
<Trans>Generate maps</Trans>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user