Skip to content

Commit

Permalink
🍻 进行一个新赛季的快速适配
Browse files Browse the repository at this point in the history
  • Loading branch information
shoucandanghehe committed Aug 16, 2024
1 parent 0df4a79 commit f19ad41
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
Binary file added src/shared/assets/images/ranks/x+.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/shared/schemas/rank.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from 'zod'

const ValidRank = z.union([
z.literal('x+'),
z.literal('x'),
z.literal('u'),
z.literal('ss'),
Expand All @@ -26,4 +27,4 @@ type ValidRank = z.infer<typeof ValidRank>;
type Rank = z.infer<typeof Rank>;

export default Rank
export { Rank, ValidRank }
export { Rank, ValidRank }
4 changes: 2 additions & 2 deletions src/v1/components/tests/tetrio_info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const test = () => {
})()
readonly tetra_league = new (class {
readonly rank = prompt('用户段位 (d, d+, c-, c, c+, b-, b, b+, a-, a, a+, s-, s, s+, ss, u, x)', 'u')
readonly rank = prompt('用户段位 (d, d+, c-, c, c+, b-, b, b+, a-, a, a+, s-, s, s+, ss, u, x)', 'x+')
readonly tr = tr
Expand Down Expand Up @@ -181,4 +181,4 @@ const test = () => {

<template>
<button @click="test">测试 {{ path }}</button>
</template>
</template>
7 changes: 6 additions & 1 deletion src/v1/pages/tetrio/info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ const data = Data.parse(JSON.parse(document.querySelector<HTMLTemplateElement>('
inject(THEME_KEY, 'dark')
const rankImage = asyncComputed(async () => {
if (data.tetra_league.rank === 'x+') {
return await import(`@/shared/assets/images/ranks/${data.tetra_league.rank}.png?url`).then((module) => {
return module.default
})
}
return await import(`@/shared/assets/images/ranks/${data.tetra_league.rank}.svg?url`).then((module) => {
return module.default
})
Expand Down Expand Up @@ -439,4 +444,4 @@ const radar_chart_data = [
}
}
}
</style>
</style>
6 changes: 5 additions & 1 deletion src/v1/pages/tetrio/rank.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const colorMappings: Record<
readonly text: string;
}
> = {
'x+': {
background: 'radial-gradient(95.42% 572.5% at 4.58% 17.5%, #D946EF 0%, #F5CFFE 100%)',
text: '#8E23B4CC'
},
x: {
background: 'radial-gradient(95.42% 572.5% at 4.58% 17.5%, #D946EF 0%, #F5CFFE 100%)',
text: '#8E23B4CC'
Expand Down Expand Up @@ -211,4 +215,4 @@ const rankImageMap = asyncComputed(async () => {
@apply flex flex-col justify-center items-center;
}
}
</style>
</style>
1 change: 1 addition & 0 deletions src/v2/types/tetrio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface User {
| 'ss'
| 'u'
| 'x'
| 'x+'
| 'z';
readonly bestrank: Exclude<User['league']['rank'], 'z'>;

Expand Down

0 comments on commit f19ad41

Please sign in to comment.