From 8b7f883588a4f516c267b58c4bb9ce36becdcd56 Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Fri, 2 Aug 2024 17:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=AE=8C=E6=88=90=E9=80=82?= =?UTF-8?q?=E9=85=8D=20=E5=A4=A7=E6=A6=82=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/schemas/rank.ts | 9 +- src/v1/components/info/chart/tr-chart.vue | 188 +++++----- src/v1/components/tests/tetrio_info.vue | 339 ++++++++---------- src/v1/components/tests/tetrio_rank.vue | 88 ++--- src/v1/pages/binding.vue | 3 +- src/v1/pages/tetrio/info.vue | 102 +++--- src/v1/pages/tetrio/rank.vue | 193 +++++----- src/v1/pages/top/info.vue | 21 +- src/v1/pages/tos/info.vue | 62 ++-- src/v2/components/tests/tetrio_rank.vue | 122 +++---- .../components/tests/tetrio_rank_detail.vue | 36 +- src/v2/components/tests/tetrio_record_40l.vue | 129 ++++--- .../components/tests/tetrio_record_blitz.vue | 136 +++---- src/v2/pages/tetrio/rank/_info.vue | 20 +- src/v2/pages/tetrio/rank/detail/index.vue | 155 ++++---- src/v2/pages/tetrio/rank/index.vue | 86 ++--- src/v2/pages/tetrio/record/40l/_result.vue | 23 +- src/v2/pages/tetrio/record/40l/index.vue | 170 ++++----- src/v2/pages/tetrio/record/blitz/_result.vue | 25 +- src/v2/pages/tetrio/record/blitz/index.vue | 172 ++++----- src/v2/pages/tetrio/record/schemas/data.ts | 20 ++ .../pages/tetrio/record/schemas/statistic.ts | 45 +++ src/v2/pages/tetrio/record/schemas/type.ts | 7 + src/v2/pages/tetrio/tetra_league/index.vue | 117 +++--- src/v2/pages/tetrio/user/info/_40l.vue | 17 +- src/v2/pages/tetrio/user/info/_blitz.vue | 19 +- src/v2/pages/tetrio/user/info/_detail.vue | 38 +- .../user/info/_tetra-league-history-chart.vue | 52 +-- src/v2/pages/tetrio/user/info/index.vue | 327 ++++++++++------- src/v2/pages/tetrio/user/list/index.vue | 133 ++++--- src/v2/types/data.d.ts | 8 +- src/v2/types/tetrio.d.ts | 218 ++++++----- src/v2/types/utils.d.ts | 1 - 33 files changed, 1581 insertions(+), 1500 deletions(-) create mode 100644 src/v2/pages/tetrio/record/schemas/data.ts create mode 100644 src/v2/pages/tetrio/record/schemas/statistic.ts create mode 100644 src/v2/pages/tetrio/record/schemas/type.ts delete mode 100644 src/v2/types/utils.d.ts diff --git a/src/schemas/rank.ts b/src/schemas/rank.ts index 7ff4c5e..bc6f77a 100644 --- a/src/schemas/rank.ts +++ b/src/schemas/rank.ts @@ -1,6 +1,6 @@ import { z } from "zod"; -const Rank = z.union([ +const ValidRank = z.union([ z.literal("x"), z.literal("u"), z.literal("ss"), @@ -18,7 +18,12 @@ const Rank = z.union([ z.literal("c-"), z.literal("d+"), z.literal("d"), - z.literal("z"), ]); +const Rank = z.union([ValidRank, z.literal("z")]); + +type ValidRank = z.infer; +type Rank = z.infer; + export default Rank; +export { Rank, ValidRank }; diff --git a/src/v1/components/info/chart/tr-chart.vue b/src/v1/components/info/chart/tr-chart.vue index 02e022e..5dee128 100644 --- a/src/v1/components/info/chart/tr-chart.vue +++ b/src/v1/components/info/chart/tr-chart.vue @@ -1,163 +1,157 @@ \ No newline at end of file + diff --git a/src/v1/components/tests/tetrio_info.vue b/src/v1/components/tests/tetrio_info.vue index feb3856..36055da 100644 --- a/src/v1/components/tests/tetrio_info.vue +++ b/src/v1/components/tests/tetrio_info.vue @@ -1,217 +1,184 @@ \ No newline at end of file + diff --git a/src/v1/components/tests/tetrio_rank.vue b/src/v1/components/tests/tetrio_rank.vue index 03e5b7b..cd6e6dc 100644 --- a/src/v1/components/tests/tetrio_rank.vue +++ b/src/v1/components/tests/tetrio_rank.vue @@ -1,104 +1,104 @@ \ No newline at end of file + diff --git a/src/v1/pages/binding.vue b/src/v1/pages/binding.vue index 32c7ff0..6f71978 100644 --- a/src/v1/pages/binding.vue +++ b/src/v1/pages/binding.vue @@ -16,7 +16,8 @@ const Data = z bot: User, command: z.string(), }) - .strict(); + .strict() + .readonly(); \ No newline at end of file + diff --git a/src/v1/pages/top/info.vue b/src/v1/pages/top/info.vue index a971f8d..6ce9ef4 100644 --- a/src/v1/pages/top/info.vue +++ b/src/v1/pages/top/info.vue @@ -10,14 +10,19 @@ const DetailData = z.object({ apl: z.number(), }); -const Data = z.object({ - user: z.object({ - avatar: Avatar, - name: z.string(), - }), - today: DetailData, - history: DetailData, -}); +const Data = z + .object({ + user: z.object({ + avatar: Avatar, + name: z.string(), + }), + today: DetailData, + history: DetailData, + }) + .strict() + .readonly(); + +export type Data = z.infer; \ No newline at end of file + diff --git a/src/v2/components/tests/tetrio_rank_detail.vue b/src/v2/components/tests/tetrio_rank_detail.vue index 193bbfd..2890805 100644 --- a/src/v2/components/tests/tetrio_rank_detail.vue +++ b/src/v2/components/tests/tetrio_rank_detail.vue @@ -1,11 +1,11 @@ \ No newline at end of file + diff --git a/src/v2/components/tests/tetrio_record_40l.vue b/src/v2/components/tests/tetrio_record_40l.vue index 179c4f8..969b254 100644 --- a/src/v2/components/tests/tetrio_record_40l.vue +++ b/src/v2/components/tests/tetrio_record_40l.vue @@ -1,107 +1,120 @@ \ No newline at end of file + diff --git a/src/v2/components/tests/tetrio_record_blitz.vue b/src/v2/components/tests/tetrio_record_blitz.vue index be3f0d0..298d628 100644 --- a/src/v2/components/tests/tetrio_record_blitz.vue +++ b/src/v2/components/tests/tetrio_record_blitz.vue @@ -1,112 +1,128 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/rank/_info.vue b/src/v2/pages/tetrio/rank/_info.vue index ea5ac12..cffc88b 100644 --- a/src/v2/pages/tetrio/rank/_info.vue +++ b/src/v2/pages/tetrio/rank/_info.vue @@ -1,23 +1,23 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/rank/detail/index.vue b/src/v2/pages/tetrio/rank/detail/index.vue index ba08285..09330c9 100644 --- a/src/v2/pages/tetrio/rank/detail/index.vue +++ b/src/v2/pages/tetrio/rank/detail/index.vue @@ -1,68 +1,48 @@ \ No newline at end of file +@import "@/v2/styles/main"; + diff --git a/src/v2/pages/tetrio/rank/index.vue b/src/v2/pages/tetrio/rank/index.vue index 9d91b0f..7c4ee4c 100644 --- a/src/v2/pages/tetrio/rank/index.vue +++ b/src/v2/pages/tetrio/rank/index.vue @@ -1,69 +1,73 @@ \ No newline at end of file +@import "@/v2/styles/main"; + diff --git a/src/v2/pages/tetrio/record/40l/_result.vue b/src/v2/pages/tetrio/record/40l/_result.vue index 0be6ef0..8695052 100644 --- a/src/v2/pages/tetrio/record/40l/_result.vue +++ b/src/v2/pages/tetrio/record/40l/_result.vue @@ -1,17 +1,16 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/record/40l/index.vue b/src/v2/pages/tetrio/record/40l/index.vue index f5ff55f..9f572dd 100644 --- a/src/v2/pages/tetrio/record/40l/index.vue +++ b/src/v2/pages/tetrio/record/40l/index.vue @@ -1,161 +1,115 @@ \ No newline at end of file +@import "@/v2/styles/main"; + diff --git a/src/v2/pages/tetrio/record/blitz/_result.vue b/src/v2/pages/tetrio/record/blitz/_result.vue index 4406696..9f7d048 100644 --- a/src/v2/pages/tetrio/record/blitz/_result.vue +++ b/src/v2/pages/tetrio/record/blitz/_result.vue @@ -1,17 +1,16 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/record/blitz/index.vue b/src/v2/pages/tetrio/record/blitz/index.vue index 90100d2..3194a06 100644 --- a/src/v2/pages/tetrio/record/blitz/index.vue +++ b/src/v2/pages/tetrio/record/blitz/index.vue @@ -1,150 +1,108 @@ \ No newline at end of file +@import "@/v2/styles/main"; + diff --git a/src/v2/pages/tetrio/record/schemas/data.ts b/src/v2/pages/tetrio/record/schemas/data.ts new file mode 100644 index 0000000..e368d15 --- /dev/null +++ b/src/v2/pages/tetrio/record/schemas/data.ts @@ -0,0 +1,20 @@ +import User from "@/schemas/user"; +import { z } from "zod"; +import Statistic from "./statistic"; +import Type from "./type"; + +const Data = z.object({ + type: z.nativeEnum(Type).nullable(), + + user: User.extend({ id: z.string() }).omit({ avatar: true }), + time: z.string(), + replay_id: z.string(), + rank: z.number().nullable(), + personal_rank: z.number().nullable(), + + statistic: Statistic, + + play_at: z.coerce.date(), +}); + +export default Data; diff --git a/src/v2/pages/tetrio/record/schemas/statistic.ts b/src/v2/pages/tetrio/record/schemas/statistic.ts new file mode 100644 index 0000000..c35ab54 --- /dev/null +++ b/src/v2/pages/tetrio/record/schemas/statistic.ts @@ -0,0 +1,45 @@ +import { z } from "zod"; + +const Statistic = z.object({ + keys: z.number(), + kpp: z.number(), + kps: z.number(), + + max: z.object({ + combo: z.number(), + btb: z.number(), + }), + + pieces: z.number(), + pps: z.number(), + lines: z.number(), + lpm: z.number(), + holds: z.number().nullable(), + score: z.number(), + + single: z.number(), + double: z.number(), + triple: z.number(), + quad: z.number(), + + tspins: z.object({ + total: z.number(), + single: z.number(), + double: z.number(), + triple: z.number(), + + mini: z.object({ + total: z.number(), + single: z.number(), + double: z.number(), + }), + }), + all_clear: z.number(), + + finesse: z.object({ + faults: z.number(), + accuracy: z.number(), + }), +}); + +export default Statistic; diff --git a/src/v2/pages/tetrio/record/schemas/type.ts b/src/v2/pages/tetrio/record/schemas/type.ts new file mode 100644 index 0000000..1ae2197 --- /dev/null +++ b/src/v2/pages/tetrio/record/schemas/type.ts @@ -0,0 +1,7 @@ +enum Type { + BEST = "best", + PERSONAL_BEST = "personal_best", + RECENT = "recent", + DISPUTED = "disputed", +} +export default Type; diff --git a/src/v2/pages/tetrio/tetra_league/index.vue b/src/v2/pages/tetrio/tetra_league/index.vue index 2670c46..7db2604 100644 --- a/src/v2/pages/tetrio/tetra_league/index.vue +++ b/src/v2/pages/tetrio/tetra_league/index.vue @@ -1,82 +1,79 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/user/info/_40l.vue b/src/v2/pages/tetrio/user/info/_40l.vue index 530c9bc..8613634 100644 --- a/src/v2/pages/tetrio/user/info/_40l.vue +++ b/src/v2/pages/tetrio/user/info/_40l.vue @@ -1,12 +1,11 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/user/info/_blitz.vue b/src/v2/pages/tetrio/user/info/_blitz.vue index 39beffe..42c3b68 100644 --- a/src/v2/pages/tetrio/user/info/_blitz.vue +++ b/src/v2/pages/tetrio/user/info/_blitz.vue @@ -1,12 +1,11 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/user/info/_detail.vue b/src/v2/pages/tetrio/user/info/_detail.vue index 4db8c4d..7e05257 100644 --- a/src/v2/pages/tetrio/user/info/_detail.vue +++ b/src/v2/pages/tetrio/user/info/_detail.vue @@ -1,17 +1,16 @@ - \ No newline at end of file + diff --git a/src/v2/pages/tetrio/user/info/_tetra-league-history-chart.vue b/src/v2/pages/tetrio/user/info/_tetra-league-history-chart.vue index f4b2bc3..c645335 100644 --- a/src/v2/pages/tetrio/user/info/_tetra-league-history-chart.vue +++ b/src/v2/pages/tetrio/user/info/_tetra-league-history-chart.vue @@ -1,64 +1,64 @@ \ No newline at end of file + diff --git a/src/v2/pages/tetrio/user/info/index.vue b/src/v2/pages/tetrio/user/info/index.vue index 3f76aad..4aa98d8 100644 --- a/src/v2/pages/tetrio/user/info/index.vue +++ b/src/v2/pages/tetrio/user/info/index.vue @@ -1,165 +1,210 @@