mirror of https://github.com/hykilpikonna/AquaDX
[+] Helpful message for unsupported games
parent
ce80f65e9f
commit
37946c5aba
|
@ -26,6 +26,7 @@ export const EN_REF_USER = {
|
|||
'UserHome.B50': 'B50',
|
||||
'UserHome.AddRival': "Add to 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 = {
|
||||
|
|
|
@ -35,6 +35,7 @@ const zhUser: typeof EN_REF_USER = {
|
|||
'UserHome.B50': "B50",
|
||||
'UserHome.AddRival': "添加劲敌",
|
||||
'UserHome.RemoveRival': "移除劲敌",
|
||||
'UserHome.InvalidGame': "游戏 ${game} 还不支持网页端查看。我们目前只支持舞萌、中二、Wacca 和音击。",
|
||||
}
|
||||
|
||||
const zhWelcome: typeof EN_REF_Welcome = {
|
||||
|
|
|
@ -50,49 +50,54 @@
|
|||
let allMusics: AllMusic
|
||||
let showDetailRank = 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 => {
|
||||
if (!games[game]) {
|
||||
// Find a valid game
|
||||
const valid = Object.entries(games).filter(([g, valid]) => valid)
|
||||
if (!valid || !valid[0]) return error = t("UserHome.NoValidGame")
|
||||
window.location.href = `/u/${username}/${valid[0][0]}`
|
||||
}
|
||||
CARD.userGames(username).then(games => {
|
||||
if (!games[game]) {
|
||||
// Find a valid game
|
||||
const valid = Object.entries(games).filter(([g, valid]) => valid)
|
||||
if (!valid || !valid[0]) return error = t("UserHome.NoValidGame")
|
||||
window.location.href = `/u/${username}/${valid[0][0]}`
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
GAME.userSummary(username, game),
|
||||
GAME.trend(username, game),
|
||||
DATA.allMusic(game),
|
||||
]).then(([user, trend, music]) => {
|
||||
console.log(user)
|
||||
console.log(trend)
|
||||
console.log(games)
|
||||
Promise.all([
|
||||
GAME.userSummary(username, game),
|
||||
GAME.trend(username, game),
|
||||
DATA.allMusic(game),
|
||||
]).then(([user, trend, music]) => {
|
||||
console.log(user)
|
||||
console.log(trend)
|
||||
console.log(games)
|
||||
|
||||
// If game is wacca, divide all ratings by 10
|
||||
if (game === 'wacca') {
|
||||
user.rating /= 10
|
||||
trend.forEach(it => it.rating /= 10)
|
||||
user.recent.forEach(it => {
|
||||
it.beforeRating /= 10
|
||||
it.afterRating /= 10
|
||||
// If game is wacca, divide all ratings by 10
|
||||
if (game === 'wacca') {
|
||||
user.rating /= 10
|
||||
trend.forEach(it => it.rating /= 10)
|
||||
user.recent.forEach(it => {
|
||||
it.beforeRating /= 10
|
||||
it.afterRating /= 10
|
||||
})
|
||||
}
|
||||
|
||||
const minDate = moment().subtract(TREND_DAYS, 'days').format("YYYY-MM-DD")
|
||||
d = {user,
|
||||
trend: trend.filter(it => it.date >= minDate && it.plays != 0),
|
||||
recent: user.recent.map(it => {return {...music[it.musicId], ...it}}),
|
||||
validGames: Object.entries(GAME_TITLE).filter(g => games[g[0] as GameName])
|
||||
}
|
||||
allMusics = music
|
||||
renderCal(calElement, trend.map(it => {return {date: it.date, value: it.plays}})).then(() => {
|
||||
// Scroll to the rightmost
|
||||
calElement.scrollLeft = calElement.scrollWidth - calElement.clientWidth
|
||||
})
|
||||
}
|
||||
}).catch((e) => error = e.message);
|
||||
}).catch((e) => { error = e.message; console.error(e) } );
|
||||
}
|
||||
|
||||
const minDate = moment().subtract(TREND_DAYS, 'days').format("YYYY-MM-DD")
|
||||
d = {user,
|
||||
trend: trend.filter(it => it.date >= minDate && it.plays != 0),
|
||||
recent: user.recent.map(it => {return {...music[it.musicId], ...it}}),
|
||||
validGames: Object.entries(GAME_TITLE).filter(g => games[g[0] as GameName])
|
||||
}
|
||||
allMusics = music
|
||||
renderCal(calElement, trend.map(it => {return {date: it.date, value: it.plays}})).then(() => {
|
||||
// Scroll to the rightmost
|
||||
calElement.scrollLeft = calElement.scrollWidth - calElement.clientWidth
|
||||
})
|
||||
}).catch((e) => error = e.message);
|
||||
}).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) => {
|
||||
isLoading = true
|
||||
|
|
Loading…
Reference in New Issue