diff --git a/AquaNet/bun.lockb b/AquaNet/bun.lockb index 5211cc15..79a22916 100644 Binary files a/AquaNet/bun.lockb and b/AquaNet/bun.lockb differ diff --git a/AquaNet/src/App.svelte b/AquaNet/src/App.svelte index 36abe15a..0d51d2d2 100644 --- a/AquaNet/src/App.svelte +++ b/AquaNet/src/App.svelte @@ -4,9 +4,10 @@ import UserHome from "./pages/UserHome.svelte"; import Home from "./pages/Home.svelte"; import Ranking from "./pages/Ranking.svelte"; - import { USER } from "./libs/sdk"; + import { CARD, USER } from "./libs/sdk"; import type { AquaNetUser } from "./libs/generalTypes"; import Settings from "./pages/User/Settings.svelte"; + import MaiPhoto from "./pages/MaiPhoto.svelte"; import { pfp, tooltip } from "./libs/ui" import { ANNOUNCEMENT } from "./libs/config"; import { t } from "./libs/i18n"; @@ -25,9 +26,18 @@ export let url = ""; let me: AquaNetUser + let playedMai = false - if (USER.isLoggedIn()) USER.me().then(m => me = m).catch(e => console.error(e)) + if (USER.isLoggedIn()) + { + USER.me().then(m => { + me = m + CARD.userGames(me.username).then(game => { + playedMai = !!game.mai2 + }) + }).catch(e => console.error(e)) + } let path = window.location.pathname; @@ -44,11 +54,14 @@ {/if} {t('navigation.home').toLowerCase()} -
alert("Coming soon™")} on:keydown={e => e.key === "Enter" && alert("Coming soon™")} - role="button" tabindex="0">{t('navigation.maps').toLowerCase()}
+ {t('navigation.rankings').toLowerCase()} + {#if playedMai} + photo + {/if} {#if me} - + profile {/if} @@ -62,6 +75,7 @@ + + + + + +{#if confirm} +
+
+

{confirm.title}

+ {confirm.message} + +
+ {#if confirm.cancel} + + + {/if} + +
+
+
+{/if} + +{#if error} + +{/if} + +{#if loading && !error} + +{/if} + + diff --git a/AquaNet/src/components/settings/GeneralGameSettings.svelte b/AquaNet/src/components/settings/GeneralGameSettings.svelte index 6fbbb64a..07146fd1 100644 --- a/AquaNet/src/components/settings/GeneralGameSettings.svelte +++ b/AquaNet/src/components/settings/GeneralGameSettings.svelte @@ -9,9 +9,9 @@
-

+

{ts("settings.gameNotice")} -

+
@@ -59,14 +59,4 @@ > input flex: 1 - - .warning - background: #aa555510 - padding: 10px - border-left: solid 2px vars.$c-error - - &::before - color: vars.$c-error - font-weight: bold - content: "!" diff --git a/AquaNet/src/components/ui/Error.svelte b/AquaNet/src/components/ui/Error.svelte new file mode 100644 index 00000000..a3caf0d6 --- /dev/null +++ b/AquaNet/src/components/ui/Error.svelte @@ -0,0 +1,30 @@ + + +
+
+

{t('status.error')}

+ {t('status.error.hint')}{t('status.error.hint.link')} + {t('status.detail', { detail: error })} + +
+ +
+
+
+ + diff --git a/AquaNet/src/components/ui/Loading.svelte b/AquaNet/src/components/ui/Loading.svelte new file mode 100644 index 00000000..32d9328a --- /dev/null +++ b/AquaNet/src/components/ui/Loading.svelte @@ -0,0 +1,30 @@ + + +
+ + LOADING +
+ + diff --git a/AquaNet/src/libs/i18n/en_ref.ts b/AquaNet/src/libs/i18n/en_ref.ts index 1e3de49c..3c0cc05e 100644 --- a/AquaNet/src/libs/i18n/en_ref.ts +++ b/AquaNet/src/libs/i18n/en_ref.ts @@ -229,7 +229,15 @@ export const EN_REF_USERBOX = { 'userbox.new.error.invalidUrl': 'The URL you inputted is invalid.' } +export const EN_REF_MAI_PHOTO = { + 'maiphoto.title': 'Mai Memorial Photo Gallery', + 'maiphoto.url_warning': 'Note: If you want to share a photo with your friend, please save the photo. Do not copy image URL because the URL contains sensitive information.', + 'maiphoto.none': 'No photo found. You can upload photo by clicking upload at the end of each game session.', +} + export const EN_REF = { ...EN_REF_USER, ...EN_REF_Welcome, ...EN_REF_GENERAL, - ...EN_REF_LEADERBOARD, ...EN_REF_HOME, ...EN_REF_SETTINGS, ...EN_REF_USERBOX } + ...EN_REF_LEADERBOARD, ...EN_REF_HOME, ...EN_REF_SETTINGS, ...EN_REF_USERBOX, + ...EN_REF_MAI_PHOTO +} export type LocalizedMessages = typeof EN_REF diff --git a/AquaNet/src/libs/i18n/zh.ts b/AquaNet/src/libs/i18n/zh.ts index 591f6b35..08bcd4b1 100644 --- a/AquaNet/src/libs/i18n/zh.ts +++ b/AquaNet/src/libs/i18n/zh.ts @@ -2,6 +2,7 @@ import { EN_REF_GENERAL, EN_REF_HOME, EN_REF_LEADERBOARD, + EN_REF_MAI_PHOTO, EN_REF_SETTINGS, EN_REF_USER, EN_REF_USERBOX, @@ -234,6 +235,11 @@ export const zhUserbox: typeof EN_REF_USERBOX = { 'userbox.new.error.invalidUrl': '输入的 URL 无效。' }; +export const zhMaiPhoto: typeof EN_REF_MAI_PHOTO = { + 'maiphoto.title': 'Mai 纪念照片库', + 'maiphoto.url_warning': '注意:如果想与朋友分享图片的话,请先保存照片再发出去。不要复制图片 URL,因为 URL 中包含 AquaDX 账号信息。', + 'maiphoto.none': '还没有图片哦~ 可以在每次游戏结束的时候点击上传来上传照片。', +} export const ZH = { ...zhUser, ...zhWelcome, ...zhGeneral, - ...zhLeaderboard, ...zhHome, ...zhSettings, ...zhUserbox } + ...zhLeaderboard, ...zhHome, ...zhSettings, ...zhUserbox, ...zhMaiPhoto } diff --git a/AquaNet/src/libs/sdk.ts b/AquaNet/src/libs/sdk.ts index 9761e99e..8b71ef23 100644 --- a/AquaNet/src/libs/sdk.ts +++ b/AquaNet/src/libs/sdk.ts @@ -284,6 +284,8 @@ export const CARD = { export const GAME = { trend: (username: string, game: GameName): Promise => post(`/api/v2/game/${game}/trend`, { username }), + photos: (): Promise => + post(`/api/v2/game/mai2/my-photo`, { }), userSummary: (username: string, game: GameName): Promise => post(`/api/v2/game/${game}/user-summary`, { username }), ranking: (game: GameName): Promise => diff --git a/AquaNet/src/pages/MaiPhoto.svelte b/AquaNet/src/pages/MaiPhoto.svelte new file mode 100644 index 00000000..8b9eb9ad --- /dev/null +++ b/AquaNet/src/pages/MaiPhoto.svelte @@ -0,0 +1,57 @@ + + +
+
+

{t("maiphoto.title")}

+
+ + {#await GAME.photos()} + + {:then photos} + {#if photos.length === 0} +
{t('maiphoto.none')}
+ {:else} +
{t('maiphoto.url_warning')}
+ {/if} +
+ {#each photos as photo} +
+ Memorial +
+ {/each} +
+ {:catch error} + + {/await} +
+ +