[+] Helpful message for unsupported games

matching
Azalea 2024-12-25 16:31:01 -05:00
parent ce80f65e9f
commit 37946c5aba
3 changed files with 44 additions and 37 deletions

View File

@ -26,6 +26,7 @@ export const EN_REF_USER = {
'UserHome.B50': 'B50', 'UserHome.B50': 'B50',
'UserHome.AddRival': "Add to Rival", 'UserHome.AddRival': "Add to Rival",
'UserHome.RemoveRival': "Remove from Rival", 'UserHome.RemoveRival': "Remove from Rival",
'UserHome.InvalidGame': "Game ${game} is not supported on the web UI yet. We only support maimai, chunithm, wacca, and ongeki for now.",
} }
export const EN_REF_Welcome = { export const EN_REF_Welcome = {

View File

@ -35,6 +35,7 @@ const zhUser: typeof EN_REF_USER = {
'UserHome.B50': "B50", 'UserHome.B50': "B50",
'UserHome.AddRival': "添加劲敌", 'UserHome.AddRival': "添加劲敌",
'UserHome.RemoveRival': "移除劲敌", 'UserHome.RemoveRival': "移除劲敌",
'UserHome.InvalidGame': "游戏 ${game} 还不支持网页端查看。我们目前只支持舞萌、中二、Wacca 和音击。",
} }
const zhWelcome: typeof EN_REF_Welcome = { const zhWelcome: typeof EN_REF_Welcome = {

View File

@ -50,8 +50,9 @@
let allMusics: AllMusic let allMusics: AllMusic
let showDetailRank = false let showDetailRank = false
let isLoading = false let isLoading = false
USER.isLoggedIn() && USER.me().then(u => me = u)
function init() {
USER.isLoggedIn() && USER.me().then(u => me = u)
CARD.userGames(username).then(games => { CARD.userGames(username).then(games => {
if (!games[game]) { if (!games[game]) {
@ -93,6 +94,10 @@
}) })
}).catch((e) => error = e.message); }).catch((e) => error = e.message);
}).catch((e) => { error = e.message; console.error(e) } ); }).catch((e) => { error = e.message; console.error(e) } );
}
if (Object.keys(GAME_TITLE).includes(game)) init()
else error = t("UserHome.InvalidGame", {game})
const setRival = (isAdd: boolean) => { const setRival = (isAdd: boolean) => {
isLoading = true isLoading = true