feat: store toggles on profiles

This commit is contained in:
2026-06-19 04:59:09 -03:00
parent f3a1813c00
commit 0a0d529816
+26 -12
View File
@@ -50,8 +50,8 @@ export default function Home() {
}, []);
/*
profile handling
*/
profile handling
*/
const handleDownload = () => {
const blob = new Blob([importText], { type: 'application/json' });
const url = URL.createObjectURL(blob);
@@ -69,13 +69,21 @@ export default function Home() {
const getExportText = () => {
return JSON.stringify(
{
unlockedCharacters: store.unlockedCharacters,
unlockedCustomizations: store.unlockedCustomizations,
unlockedDLCs: store.unlockedDLCs,
unlockedPerks: store.unlockedPerks,
items: store.items,
offerings: store.offerings,
addons: store.addons
profile: {
unlockedCharacters: store.unlockedCharacters,
unlockedCustomizations: store.unlockedCustomizations,
unlockedDLCs: store.unlockedDLCs,
unlockedPerks: store.unlockedPerks,
items: store.items,
offerings: store.offerings,
addons: store.addons
},
toggles: {
spoofItems: store.spoofItems,
spoofPerks: store.spoofPerks,
spoofCatalog: store.spoofCatalog,
spoofDLCs: store.spoofDLCs
}
},
null,
2
@@ -85,7 +93,9 @@ export default function Home() {
const handleImport = async () => {
try {
const parsed = JSON.parse(importText);
store.importProfile(parsed);
if (parsed.profile) store.importProfile(parsed.profile);
else store.importProfile(parsed);
if (parsed.toggles) store.importToggles(parsed.toggles);
} catch (e) {
console.error('Invalid JSON', e);
}
@@ -100,11 +110,15 @@ export default function Home() {
store.unlockedPerks,
store.items,
store.offerings,
store.addons
store.addons,
store.spoofItems,
store.spoofPerks,
store.spoofCatalog,
store.spoofDLCs
]);
/*
stats
stats
*/
const unlockedItems = useMemo(
() => Object.values(store.items).filter((qty) => qty > 0).length,