diff --git a/AquaNet/src/components/UserBox.svelte b/AquaNet/src/components/UserBox.svelte index 389850cd..3ef53c1a 100644 --- a/AquaNet/src/components/UserBox.svelte +++ b/AquaNet/src/components/UserBox.svelte @@ -8,7 +8,6 @@ import { USER, USERBOX } from "../libs/sdk"; import { t, ts } from "../libs/i18n"; import { DATA_HOST, HAS_USERBOX_ASSETS } from "../libs/config"; - import { FADE_IN, FADE_OUT } from "../libs/config"; import { fade, slide } from "svelte/transition"; import StatusOverlays from "./StatusOverlays.svelte"; import Icon from "@iconify/svelte"; @@ -19,9 +18,6 @@ let submitting = ""; let changed: string[] = []; - let tab = 0; - const tabs = ["chusan", "ongeki", "maimai"]; - // Things that can be changed in the userbox const userBoxFields = [ { @@ -149,9 +145,9 @@ const currentValues = await USERBOX.getProfile().catch((e) => { loading = false; error = t("userbox.error.noprofile") - }); + }) - if(!currentValues) return; + if (!currentValues) return values = { nameplate: currentValues.nameplateId, @@ -174,7 +170,7 @@ return }); - if(!itemLabels) return; + if (!itemLabels) return; await Promise.all( userBoxItems.map(async (kind) => { @@ -300,176 +296,138 @@ {#if !loading && !error} -
- - {#if tab === 0} -
-
- {#each userBoxFields as { key, label, kind }, i (key)} -
- -
- - {#if changed.includes(key)} - - {/if} -
-
- {/each} -
- {#if HAS_USERBOX_ASSETS} -
-

{t("userbox.preview.ui")}

- - {#if values.frame} - Preview - {/if} - -
- - {#if values.mapicon} -
- Preview -
+ submit(generateBodyFromKind(key, newValue)); + }} + > + {#if submitting === key} + + {:else} + {t("settings.profile.save")} {/if} + + {/if} +
+
+ {/each} +
+ {#if HAS_USERBOX_ASSETS} +
+

{t("userbox.preview.ui")}

+ + {#if values.frame} + Preview + {/if} - - {#if values.voice} -
- Preview -
- {/if} -
+
+ + {#if values.mapicon} +
+ Preview +
+ {/if} -

{t("userbox.preview.nameplate")}

- - {#if values.nameplate} -
- Preview -

- {availableOptions.trophy.find((x) => x.id === values.trophy) - ?.label} -

-
-

- {user.displayName} -

-
-
- {/if} - -

{t("userbox.preview.avatar")}

-
-
- Preview -
-
- Preview -
-
- Preview -
-
- Preview -
-
- Preview -
-
- Preview -
-
- Preview -
-
+ + {#if values.voice} +
+ Preview
{/if}
- {:else} -
-

WIP

+ +

{t("userbox.preview.nameplate")}

+ + {#if values.nameplate} +
+ Preview +

+ {availableOptions.trophy.find((x) => x.id === values.trophy) + ?.label} +

+
+

+ {user.displayName} +

+
+
+ {/if} + +

{t("userbox.preview.avatar")}

+
+
+ Preview +
+
+ Preview +
+
+ Preview +
+
+ Preview +
+
+ Preview +
+
+ Preview +
+
+ Preview +
- {/if} -
+
+ {/if} {/if} diff --git a/AquaNet/src/libs/sdk.ts b/AquaNet/src/libs/sdk.ts index b1b647fd..0e8825db 100644 --- a/AquaNet/src/libs/sdk.ts +++ b/AquaNet/src/libs/sdk.ts @@ -266,7 +266,9 @@ export const USERBOX = { get('/api/v2/game/chu3/user-box', {}), getUnlockedItems: (itemId: UserBoxItemKind): Promise<{ itemKind: number, itemId: number, stock: number, isValid: boolean }[]> => get(`/api/v2/game/chu3/user-box-item-by-kind`,{ itemId }), - getItemLabels: () => get(`/api/v2/game/chu3/user-box-all-items`, {}), + getItemLabels: () => get(`/api/v2/game/chu3/user-box-all-items`, {}).then(it => + Object.fromEntries(Object.entries(it).map(([key, value]) => + [key, Object.fromEntries((value as any[]).map(it => [it.id, it.name]))]))), setUserBox: (d: { field: string, value: number | string }) => post(`/api/v2/game/chu3/user-detail-set`, d), }