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 handleDownload = () => {
const blob = new Blob([importText], { type: 'application/json' }); const blob = new Blob([importText], { type: 'application/json' });
const url = URL.createObjectURL(blob); const url = URL.createObjectURL(blob);
@@ -69,13 +69,21 @@ export default function Home() {
const getExportText = () => { const getExportText = () => {
return JSON.stringify( return JSON.stringify(
{ {
unlockedCharacters: store.unlockedCharacters, profile: {
unlockedCustomizations: store.unlockedCustomizations, unlockedCharacters: store.unlockedCharacters,
unlockedDLCs: store.unlockedDLCs, unlockedCustomizations: store.unlockedCustomizations,
unlockedPerks: store.unlockedPerks, unlockedDLCs: store.unlockedDLCs,
items: store.items, unlockedPerks: store.unlockedPerks,
offerings: store.offerings, items: store.items,
addons: store.addons offerings: store.offerings,
addons: store.addons
},
toggles: {
spoofItems: store.spoofItems,
spoofPerks: store.spoofPerks,
spoofCatalog: store.spoofCatalog,
spoofDLCs: store.spoofDLCs
}
}, },
null, null,
2 2
@@ -85,7 +93,9 @@ export default function Home() {
const handleImport = async () => { const handleImport = async () => {
try { try {
const parsed = JSON.parse(importText); 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) { } catch (e) {
console.error('Invalid JSON', e); console.error('Invalid JSON', e);
} }
@@ -100,11 +110,15 @@ export default function Home() {
store.unlockedPerks, store.unlockedPerks,
store.items, store.items,
store.offerings, store.offerings,
store.addons store.addons,
store.spoofItems,
store.spoofPerks,
store.spoofCatalog,
store.spoofDLCs
]); ]);
/* /*
stats stats
*/ */
const unlockedItems = useMemo( const unlockedItems = useMemo(
() => Object.values(store.items).filter((qty) => qty > 0).length, () => Object.values(store.items).filter((qty) => qty > 0).length,