@pitvox/partner-react 0.5.14 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +747 -717
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import { jsx as e, jsxs as l, Fragment as A } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useQueryClient as U, QueryClient as
|
|
4
|
-
const Y =
|
|
2
|
+
import { createContext as we, useMemo as w, useContext as Ce, useState as M, useCallback as K, useRef as Le, useEffect as Re } from "react";
|
|
3
|
+
import { useQueryClient as U, QueryClient as Te, QueryClientProvider as Se, useQuery as C, useMutation as H, useQueries as te } from "@tanstack/react-query";
|
|
4
|
+
const Y = we(null), $e = "https://cdn.pitvox.com", Me = "https://pitvox.com";
|
|
5
5
|
let z = null;
|
|
6
|
-
function
|
|
7
|
-
partnerSlug: r,
|
|
8
|
-
cdnUrl: n =
|
|
9
|
-
pitvoxUrl: s =
|
|
6
|
+
function Ur({
|
|
7
|
+
partnerSlug: r = null,
|
|
8
|
+
cdnUrl: n = $e,
|
|
9
|
+
pitvoxUrl: s = Me,
|
|
10
10
|
getSteamId: t,
|
|
11
|
-
onRegister:
|
|
12
|
-
onWithdraw:
|
|
11
|
+
onRegister: a,
|
|
12
|
+
onWithdraw: i,
|
|
13
13
|
onFetchNotifications: o,
|
|
14
14
|
onMarkNotificationRead: d,
|
|
15
|
-
onMarkAllNotificationsRead:
|
|
15
|
+
onMarkAllNotificationsRead: u,
|
|
16
16
|
onFetchServerPassword: c,
|
|
17
17
|
children: v
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const x = w(() => ({
|
|
20
20
|
partnerSlug: r,
|
|
21
21
|
cdnUrl: n.replace(/\/$/, ""),
|
|
22
22
|
pitvoxUrl: s.replace(/\/$/, ""),
|
|
23
23
|
getSteamId: t || (() => null),
|
|
24
|
-
onRegister:
|
|
25
|
-
onWithdraw:
|
|
24
|
+
onRegister: a || null,
|
|
25
|
+
onWithdraw: i || null,
|
|
26
26
|
onFetchNotifications: o || null,
|
|
27
27
|
onMarkNotificationRead: d || null,
|
|
28
|
-
onMarkAllNotificationsRead:
|
|
28
|
+
onMarkAllNotificationsRead: u || null,
|
|
29
29
|
onFetchServerPassword: c || null
|
|
30
|
-
}), [r, n, s, t,
|
|
31
|
-
let
|
|
30
|
+
}), [r, n, s, t, a, i, o, d, u, c]);
|
|
31
|
+
let N = !1;
|
|
32
32
|
try {
|
|
33
|
-
U(),
|
|
33
|
+
U(), N = !0;
|
|
34
34
|
} catch {
|
|
35
|
-
|
|
35
|
+
N = !1;
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return N ? /* @__PURE__ */ e(Y.Provider, { value: x, children: v }) : (z || (z = new Te({
|
|
38
38
|
defaultOptions: {
|
|
39
39
|
queries: { staleTime: 6e4 }
|
|
40
40
|
}
|
|
41
|
-
})), /* @__PURE__ */ e(
|
|
41
|
+
})), /* @__PURE__ */ e(Se, { client: z, children: /* @__PURE__ */ e(Y.Provider, { value: x, children: v }) }));
|
|
42
42
|
}
|
|
43
43
|
function k() {
|
|
44
|
-
const r =
|
|
44
|
+
const r = Ce(Y);
|
|
45
45
|
if (!r)
|
|
46
46
|
throw new Error("usePitVox must be used within a <PitVoxPartnerProvider>");
|
|
47
47
|
return r;
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function R(r, n) {
|
|
50
50
|
const s = await fetch(`${r}/${n}`);
|
|
51
51
|
if (!s.ok) {
|
|
52
52
|
if (s.status === 404 || s.status === 403) return null;
|
|
@@ -54,10 +54,19 @@ async function T(r, n) {
|
|
|
54
54
|
}
|
|
55
55
|
return s.json();
|
|
56
56
|
}
|
|
57
|
+
function J(r, ...n) {
|
|
58
|
+
return [r ? `leaderboards/partners/${r}` : "leaderboards", ...n].join("/");
|
|
59
|
+
}
|
|
60
|
+
function Ie(r, n) {
|
|
61
|
+
return r ? `laps/partners/${r}/${n}.json` : `laps/${n}.json`;
|
|
62
|
+
}
|
|
63
|
+
function De(r) {
|
|
64
|
+
return r ? `recent-laps/partners/${r}.json` : "recent-laps.json";
|
|
65
|
+
}
|
|
57
66
|
function B(r) {
|
|
58
67
|
if (!r && r !== 0) return "-";
|
|
59
|
-
const n = Math.floor(r / 1e3), s = Math.floor(n / 60), t = n % 60,
|
|
60
|
-
return `${s}:${String(t).padStart(2, "0")}.${String(
|
|
68
|
+
const n = Math.floor(r / 1e3), s = Math.floor(n / 60), t = n % 60, a = r % 1e3;
|
|
69
|
+
return `${s}:${String(t).padStart(2, "0")}.${String(a).padStart(3, "0")}`;
|
|
61
70
|
}
|
|
62
71
|
function D(r) {
|
|
63
72
|
return !r && r !== 0 ? "-" : (r / 1e3).toFixed(3);
|
|
@@ -68,10 +77,11 @@ function I(r) {
|
|
|
68
77
|
return n.startsWith("ks_") && (n = n.slice(3)), n.split("_").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(" ");
|
|
69
78
|
}
|
|
70
79
|
function E(r, n, s) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
if (!r) return "";
|
|
81
|
+
const t = r.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" "), a = s === "acc" || !s && (n == null ? void 0 : n.toLowerCase()) === "track config";
|
|
82
|
+
if (!n || n === "default" || a) return t;
|
|
83
|
+
const i = n.split("_").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
|
|
84
|
+
return `${t} ${i}`;
|
|
75
85
|
}
|
|
76
86
|
function F(r) {
|
|
77
87
|
if (!r) return "-";
|
|
@@ -85,25 +95,25 @@ function F(r) {
|
|
|
85
95
|
return "-";
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
|
-
function
|
|
98
|
+
function ie(r) {
|
|
89
99
|
if (!r) return "";
|
|
90
100
|
const n = Date.now() - new Date(r).getTime(), s = Math.floor(n / 1e3);
|
|
91
101
|
if (s < 60) return "Just now";
|
|
92
102
|
const t = Math.floor(s / 60);
|
|
93
103
|
if (t < 60) return `${t}m ago`;
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
return
|
|
104
|
+
const a = Math.floor(t / 60);
|
|
105
|
+
if (a < 24) return `${a}h ago`;
|
|
106
|
+
const i = Math.floor(a / 24);
|
|
107
|
+
return i < 30 ? `${i}d ago` : F(r);
|
|
98
108
|
}
|
|
99
|
-
function
|
|
109
|
+
function Er(r) {
|
|
100
110
|
return r == null ? "" : `${r >= 0 ? "+" : "-"}${(Math.abs(r) / 1e3).toFixed(3)}`;
|
|
101
111
|
}
|
|
102
|
-
function
|
|
103
|
-
const { type: s, title: t, trackId:
|
|
104
|
-
return s === "RECORD_BEATEN" &&
|
|
112
|
+
function Be(r, n) {
|
|
113
|
+
const { type: s, title: t, trackId: a, trackLayout: i, carId: o, game: d, data: u } = r, c = typeof u == "string" ? JSON.parse(u) : u, v = a ? E(a, i, d) : null, x = o ? I(o) : null, N = [v, x].filter(Boolean).join(" — ");
|
|
114
|
+
return s === "RECORD_BEATEN" && N ? `${c != null && c.beatenBySteamId && n ? n(c.beatenBySteamId).displayName : "Someone"} beat your record on ${N}` : s === "RECORD_SET" && N ? `You set a new record on ${N}` : t || "New notification";
|
|
105
115
|
}
|
|
106
|
-
function
|
|
116
|
+
function oe(r) {
|
|
107
117
|
return r ? {
|
|
108
118
|
E: "Eco",
|
|
109
119
|
RD: "Road",
|
|
@@ -117,114 +127,114 @@ function ie(r) {
|
|
|
117
127
|
S: "Soft"
|
|
118
128
|
}[r] || r : "Unknown";
|
|
119
129
|
}
|
|
120
|
-
function
|
|
121
|
-
var
|
|
122
|
-
const { cdnUrl: n, partnerSlug: s } = k(), { game: t, gameVersion:
|
|
130
|
+
function Fr(r = {}) {
|
|
131
|
+
var u, c, v, x, N, p;
|
|
132
|
+
const { cdnUrl: n, partnerSlug: s } = k(), { game: t, gameVersion: a } = r, i = J(s, "index.json"), o = C({
|
|
123
133
|
queryKey: ["pitvox", "leaderboards", s, "index"],
|
|
124
|
-
queryFn: () =>
|
|
134
|
+
queryFn: () => R(n, i),
|
|
125
135
|
staleTime: 3e4,
|
|
126
136
|
refetchInterval: 3e4
|
|
127
|
-
}),
|
|
128
|
-
var
|
|
129
|
-
if (!((
|
|
130
|
-
let
|
|
131
|
-
return t && (
|
|
132
|
-
id:
|
|
133
|
-
layout:
|
|
134
|
-
game:
|
|
135
|
-
gameVersion:
|
|
136
|
-
displayName: E(
|
|
137
|
-
driverCount:
|
|
138
|
-
carCount:
|
|
139
|
-
record:
|
|
140
|
-
visibleId:
|
|
141
|
-
carId:
|
|
142
|
-
carDisplayName: I(
|
|
143
|
-
lapTimeMs:
|
|
144
|
-
timestamp:
|
|
137
|
+
}), d = w(() => {
|
|
138
|
+
var g;
|
|
139
|
+
if (!((g = o.data) != null && g.tracks)) return [];
|
|
140
|
+
let b = o.data.tracks;
|
|
141
|
+
return t && (b = b.filter((m) => m.game === t)), a && (b = b.filter((m) => m.gameVersion === a)), b.map((m) => ({
|
|
142
|
+
id: m.trackId,
|
|
143
|
+
layout: m.layout,
|
|
144
|
+
game: m.game,
|
|
145
|
+
gameVersion: m.gameVersion,
|
|
146
|
+
displayName: E(m.trackId, m.layout, m.game),
|
|
147
|
+
driverCount: m.driverCount || 0,
|
|
148
|
+
carCount: m.carCount || 0,
|
|
149
|
+
record: m.recordHolder ? {
|
|
150
|
+
visibleId: m.recordHolder.steamId || m.recordHolder.userId,
|
|
151
|
+
carId: m.recordHolder.carId,
|
|
152
|
+
carDisplayName: I(m.recordHolder.carId),
|
|
153
|
+
lapTimeMs: m.recordHolder.lapTimeMs,
|
|
154
|
+
timestamp: m.recordHolder.recordedAt
|
|
145
155
|
} : null,
|
|
146
|
-
recordByTag:
|
|
156
|
+
recordByTag: m.recordByTag || null
|
|
147
157
|
}));
|
|
148
|
-
}, [(
|
|
158
|
+
}, [(u = o.data) == null ? void 0 : u.tracks, t, a]);
|
|
149
159
|
return {
|
|
150
|
-
...
|
|
151
|
-
data:
|
|
152
|
-
partner: ((
|
|
153
|
-
generatedAt: (
|
|
154
|
-
totalLaps: ((
|
|
155
|
-
totalUsers: ((
|
|
156
|
-
versions: ((
|
|
160
|
+
...o,
|
|
161
|
+
data: d,
|
|
162
|
+
partner: ((c = o.data) == null ? void 0 : c.partner) || null,
|
|
163
|
+
generatedAt: (v = o.data) == null ? void 0 : v.generatedAt,
|
|
164
|
+
totalLaps: ((x = o.data) == null ? void 0 : x.totalLaps) || 0,
|
|
165
|
+
totalUsers: ((N = o.data) == null ? void 0 : N.totalUsers) || 0,
|
|
166
|
+
versions: ((p = o.data) == null ? void 0 : p.versions) || {}
|
|
157
167
|
};
|
|
158
168
|
}
|
|
159
|
-
function
|
|
160
|
-
const { cdnUrl: t, partnerSlug:
|
|
161
|
-
queryKey: ["pitvox", "leaderboards",
|
|
162
|
-
queryFn: () =>
|
|
169
|
+
function Pe(r, n, s = {}) {
|
|
170
|
+
const { cdnUrl: t, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s, u = n || "default", c = d ? `v/${d}/` : "", v = J(a, `${c}tracks/${r}/${u}.json`), { data: x, isLoading: N, error: p } = C({
|
|
171
|
+
queryKey: ["pitvox", "leaderboards", a, "track", r, u, d],
|
|
172
|
+
queryFn: () => R(t, v),
|
|
163
173
|
enabled: !!r,
|
|
164
174
|
staleTime: 3e4,
|
|
165
175
|
refetchInterval: 3e4
|
|
166
176
|
});
|
|
167
177
|
return { data: w(() => {
|
|
168
|
-
if (!(
|
|
169
|
-
let
|
|
170
|
-
if (o && (
|
|
171
|
-
const
|
|
172
|
-
for (const h of
|
|
173
|
-
const
|
|
174
|
-
|
|
178
|
+
if (!(x != null && x.entries)) return [];
|
|
179
|
+
let g = x.entries;
|
|
180
|
+
if (o && (g = g.filter((m) => m.game === o)), !i) {
|
|
181
|
+
const m = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
182
|
+
for (const h of g) {
|
|
183
|
+
const y = h.steamId || h.userId;
|
|
184
|
+
f.has(h.carId) || f.set(h.carId, /* @__PURE__ */ new Set()), f.get(h.carId).add(y), (!m.has(h.carId) || h.lapTimeMs < m.get(h.carId).lapTimeMs) && m.set(h.carId, h);
|
|
175
185
|
}
|
|
176
|
-
return Array.from(
|
|
177
|
-
var
|
|
178
|
-
return { ...h, driverCount: ((
|
|
179
|
-
}).sort((h,
|
|
186
|
+
return Array.from(m.values()).map((h) => {
|
|
187
|
+
var y;
|
|
188
|
+
return { ...h, driverCount: ((y = f.get(h.carId)) == null ? void 0 : y.size) || 0 };
|
|
189
|
+
}).sort((h, y) => h.lapTimeMs - y.lapTimeMs);
|
|
180
190
|
}
|
|
181
|
-
return
|
|
182
|
-
}, [
|
|
191
|
+
return g.filter((m) => m.carId === i).sort((m, f) => m.lapTimeMs - f.lapTimeMs);
|
|
192
|
+
}, [x == null ? void 0 : x.entries, i, o]), isLoading: N, error: p };
|
|
183
193
|
}
|
|
184
|
-
function
|
|
185
|
-
var
|
|
186
|
-
const { cdnUrl:
|
|
194
|
+
function Ae(r, n, s, t, a = {}) {
|
|
195
|
+
var p, b;
|
|
196
|
+
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: u, gameVersion: c } = a, v = Ie(o, r), x = C({
|
|
187
197
|
queryKey: ["pitvox", "laps", o, r],
|
|
188
|
-
queryFn: () =>
|
|
198
|
+
queryFn: () => R(i, v),
|
|
189
199
|
enabled: !!r,
|
|
190
200
|
staleTime: 3e4,
|
|
191
201
|
refetchInterval: 3e4
|
|
192
|
-
}),
|
|
193
|
-
var
|
|
194
|
-
return (
|
|
195
|
-
if (
|
|
202
|
+
}), N = w(() => {
|
|
203
|
+
var g;
|
|
204
|
+
return (g = x.data) != null && g.laps ? x.data.laps.filter((m) => {
|
|
205
|
+
if (m.trackId !== n) return !1;
|
|
196
206
|
if (s) {
|
|
197
|
-
if (
|
|
198
|
-
} else if (
|
|
199
|
-
return !(
|
|
200
|
-
}).sort((
|
|
201
|
-
}, [(
|
|
207
|
+
if (m.trackLayout !== s) return !1;
|
|
208
|
+
} else if (m.trackLayout && m.trackLayout !== "default") return !1;
|
|
209
|
+
return !(m.carId !== t || u && m.game !== u || c && m.gameVersion !== c || !d && !m.isValid);
|
|
210
|
+
}).sort((m, f) => m.lapTimeMs - f.lapTimeMs) : [];
|
|
211
|
+
}, [(p = x.data) == null ? void 0 : p.laps, n, s, t, u, c, d]);
|
|
202
212
|
return {
|
|
203
|
-
...
|
|
204
|
-
data:
|
|
205
|
-
driverName: ((
|
|
213
|
+
...x,
|
|
214
|
+
data: N,
|
|
215
|
+
driverName: ((b = x.data) == null ? void 0 : b.driverName) || "Driver"
|
|
206
216
|
};
|
|
207
217
|
}
|
|
208
|
-
function
|
|
209
|
-
const { cdnUrl: r } = k(), { data: n } =
|
|
218
|
+
function ce() {
|
|
219
|
+
const { cdnUrl: r } = k(), { data: n } = C({
|
|
210
220
|
queryKey: ["pitvox", "users", "index"],
|
|
211
|
-
queryFn: () =>
|
|
221
|
+
queryFn: () => R(r, "users/index.json"),
|
|
212
222
|
staleTime: 5 * 6e4,
|
|
213
223
|
gcTime: 30 * 6e4
|
|
214
224
|
}), s = (n == null ? void 0 : n.users) || {};
|
|
215
|
-
return (t,
|
|
216
|
-
const
|
|
225
|
+
return (t, a) => {
|
|
226
|
+
const i = s[t];
|
|
217
227
|
return {
|
|
218
|
-
displayName: (
|
|
219
|
-
avatarUrl: (
|
|
220
|
-
affiliations: (
|
|
228
|
+
displayName: (i == null ? void 0 : i.displayName) || a || t || "Unknown",
|
|
229
|
+
avatarUrl: (i == null ? void 0 : i.avatarUrl) || null,
|
|
230
|
+
affiliations: (i == null ? void 0 : i.affiliations) || []
|
|
221
231
|
};
|
|
222
232
|
};
|
|
223
233
|
}
|
|
224
|
-
function
|
|
225
|
-
const { cdnUrl: r } = k(), { data: n } =
|
|
234
|
+
function _r() {
|
|
235
|
+
const { cdnUrl: r } = k(), { data: n } = C({
|
|
226
236
|
queryKey: ["pitvox", "cars", "index"],
|
|
227
|
-
queryFn: () =>
|
|
237
|
+
queryFn: () => R(r, "cars/index.json"),
|
|
228
238
|
staleTime: 5 * 6e4,
|
|
229
239
|
gcTime: 30 * 6e4
|
|
230
240
|
});
|
|
@@ -233,86 +243,101 @@ function Ur() {
|
|
|
233
243
|
cars: (n == null ? void 0 : n.cars) || {}
|
|
234
244
|
};
|
|
235
245
|
}
|
|
236
|
-
function
|
|
237
|
-
|
|
246
|
+
function qr() {
|
|
247
|
+
var a, i;
|
|
248
|
+
const { cdnUrl: r, partnerSlug: n } = k(), s = De(n), t = C({
|
|
249
|
+
queryKey: ["pitvox", "recentLaps", n],
|
|
250
|
+
queryFn: () => R(r, s),
|
|
251
|
+
staleTime: 3e4,
|
|
252
|
+
refetchInterval: 3e4,
|
|
253
|
+
gcTime: 10 * 6e4
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
groups: ((a = t.data) == null ? void 0 : a.groups) || [],
|
|
257
|
+
generatedAt: ((i = t.data) == null ? void 0 : i.generatedAt) || null,
|
|
258
|
+
isLoading: t.isLoading
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function jr(r, n) {
|
|
262
|
+
return Pe(r, null, { carId: n });
|
|
238
263
|
}
|
|
239
|
-
function
|
|
264
|
+
function Vr() {
|
|
240
265
|
const { cdnUrl: r, partnerSlug: n } = k();
|
|
241
|
-
return
|
|
266
|
+
return C({
|
|
242
267
|
queryKey: ["pitvox", "competitions", n],
|
|
243
268
|
queryFn: async () => {
|
|
244
|
-
const s = await
|
|
245
|
-
return s != null && s.competitions ? s.competitions.filter((t) => t.partnerSlug === n) : [];
|
|
269
|
+
const s = await R(r, "competitions/index.json");
|
|
270
|
+
return s != null && s.competitions ? n ? s.competitions.filter((t) => t.partnerSlug === n) : s.competitions : [];
|
|
246
271
|
},
|
|
247
272
|
staleTime: 6e4
|
|
248
273
|
});
|
|
249
274
|
}
|
|
250
|
-
function
|
|
251
|
-
const
|
|
252
|
-
return
|
|
253
|
-
queryKey: ["pitvox", "competition",
|
|
254
|
-
queryFn: () =>
|
|
255
|
-
enabled: !!r,
|
|
275
|
+
function Ue(r, n = {}) {
|
|
276
|
+
const s = k(), t = n.partnerSlug || s.partnerSlug;
|
|
277
|
+
return C({
|
|
278
|
+
queryKey: ["pitvox", "competition", t, r, "config"],
|
|
279
|
+
queryFn: () => R(s.cdnUrl, `competitions/${t}/${r}/config.json`),
|
|
280
|
+
enabled: !!t && !!r,
|
|
256
281
|
staleTime: 6e4
|
|
257
282
|
});
|
|
258
283
|
}
|
|
259
|
-
function
|
|
260
|
-
const
|
|
261
|
-
return
|
|
262
|
-
queryKey: ["pitvox", "competition",
|
|
263
|
-
queryFn: () =>
|
|
264
|
-
enabled: !!r,
|
|
284
|
+
function Ee(r, n = {}) {
|
|
285
|
+
const s = k(), t = n.partnerSlug || s.partnerSlug;
|
|
286
|
+
return C({
|
|
287
|
+
queryKey: ["pitvox", "competition", t, r, "standings"],
|
|
288
|
+
queryFn: () => R(s.cdnUrl, `competitions/${t}/${r}/standings.json`),
|
|
289
|
+
enabled: !!t && !!r,
|
|
265
290
|
staleTime: 6e4
|
|
266
291
|
});
|
|
267
292
|
}
|
|
268
|
-
function
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
queryKey: ["pitvox", "competition",
|
|
272
|
-
queryFn: () =>
|
|
273
|
-
enabled: !!r && n != null,
|
|
293
|
+
function Fe(r, n, s = {}) {
|
|
294
|
+
const t = k(), a = s.partnerSlug || t.partnerSlug;
|
|
295
|
+
return C({
|
|
296
|
+
queryKey: ["pitvox", "competition", a, r, "round", n],
|
|
297
|
+
queryFn: () => R(t.cdnUrl, `competitions/${a}/${r}/rounds/${n}.json`),
|
|
298
|
+
enabled: !!a && !!r && n != null,
|
|
274
299
|
staleTime: 6e4
|
|
275
300
|
});
|
|
276
301
|
}
|
|
277
|
-
function
|
|
278
|
-
const
|
|
279
|
-
return
|
|
280
|
-
queryKey: ["pitvox", "competition",
|
|
302
|
+
function Kr(r, n = [], s = {}) {
|
|
303
|
+
const t = k(), a = s.partnerSlug || t.partnerSlug;
|
|
304
|
+
return C({
|
|
305
|
+
queryKey: ["pitvox", "competition", a, r, "allRounds", n],
|
|
281
306
|
queryFn: async () => (await Promise.all(
|
|
282
307
|
n.map(
|
|
283
|
-
(
|
|
308
|
+
(o) => R(t.cdnUrl, `competitions/${a}/${r}/rounds/${o}.json`).catch(() => null)
|
|
284
309
|
)
|
|
285
310
|
)).filter(Boolean),
|
|
286
|
-
enabled: !!r && n.length > 0,
|
|
311
|
+
enabled: !!a && !!r && n.length > 0,
|
|
287
312
|
staleTime: 6e4
|
|
288
313
|
});
|
|
289
314
|
}
|
|
290
|
-
function
|
|
291
|
-
const
|
|
292
|
-
return
|
|
293
|
-
queryKey: ["pitvox", "competition",
|
|
294
|
-
queryFn: () =>
|
|
295
|
-
enabled: !!r,
|
|
315
|
+
function le(r, n = {}) {
|
|
316
|
+
const s = k(), t = n.partnerSlug || s.partnerSlug;
|
|
317
|
+
return C({
|
|
318
|
+
queryKey: ["pitvox", "competition", t, r, "entrylist"],
|
|
319
|
+
queryFn: () => R(s.cdnUrl, `competitions/${t}/${r}/entrylist.json`),
|
|
320
|
+
enabled: !!t && !!r,
|
|
296
321
|
staleTime: 6e4
|
|
297
322
|
});
|
|
298
323
|
}
|
|
299
|
-
function
|
|
300
|
-
const { cdnUrl: n, partnerSlug: s, getSteamId: t } = k(),
|
|
301
|
-
return
|
|
302
|
-
queryKey: ["pitvox", "registration", s, r,
|
|
324
|
+
function Z(r) {
|
|
325
|
+
const { cdnUrl: n, partnerSlug: s, getSteamId: t } = k(), a = t();
|
|
326
|
+
return C({
|
|
327
|
+
queryKey: ["pitvox", "registration", s, r, a],
|
|
303
328
|
queryFn: async () => {
|
|
304
|
-
var
|
|
305
|
-
const
|
|
306
|
-
if (!
|
|
307
|
-
const o = await
|
|
308
|
-
return { isRegistered: !!
|
|
329
|
+
var u;
|
|
330
|
+
const i = await fetch(`${n}/competitions/${s}/${r}/entrylist.json`);
|
|
331
|
+
if (!i.ok) return { isRegistered: !1, entryList: null };
|
|
332
|
+
const o = await i.json();
|
|
333
|
+
return { isRegistered: !!a && ((u = o.drivers) == null ? void 0 : u.some((c) => c.steamId === a)), entryList: o };
|
|
309
334
|
},
|
|
310
335
|
enabled: !!r,
|
|
311
336
|
staleTime: 6e4
|
|
312
337
|
});
|
|
313
338
|
}
|
|
314
|
-
function
|
|
315
|
-
const { onRegister: n, partnerSlug: s, getSteamId: t } = k(),
|
|
339
|
+
function de(r) {
|
|
340
|
+
const { onRegister: n, partnerSlug: s, getSteamId: t } = k(), a = U(), i = ce();
|
|
316
341
|
return H({
|
|
317
342
|
mutationFn: (o) => {
|
|
318
343
|
if (!n)
|
|
@@ -323,59 +348,59 @@ function le(r) {
|
|
|
323
348
|
},
|
|
324
349
|
onSuccess: () => {
|
|
325
350
|
const o = t();
|
|
326
|
-
if (
|
|
351
|
+
if (a.setQueriesData(
|
|
327
352
|
{ queryKey: ["pitvox", "registration", s, r] },
|
|
328
353
|
(d) => d ? { ...d, isRegistered: !0 } : { isRegistered: !0, entryList: null }
|
|
329
354
|
), o) {
|
|
330
|
-
const d =
|
|
355
|
+
const d = i(o), u = {
|
|
331
356
|
steamId: o,
|
|
332
357
|
displayName: d.displayName,
|
|
333
358
|
avatarUrl: d.avatarUrl
|
|
334
359
|
};
|
|
335
|
-
|
|
360
|
+
a.setQueriesData(
|
|
336
361
|
{ queryKey: ["pitvox", "competition", s, r, "entrylist"] },
|
|
337
362
|
(c) => {
|
|
338
|
-
var
|
|
339
|
-
return c ? ((
|
|
363
|
+
var x;
|
|
364
|
+
return c ? ((x = c.drivers) == null ? void 0 : x.some((N) => N.steamId === o)) ? c : { ...c, drivers: [...c.drivers || [], u] } : { drivers: [u] };
|
|
340
365
|
}
|
|
341
366
|
);
|
|
342
367
|
}
|
|
343
368
|
}
|
|
344
369
|
});
|
|
345
370
|
}
|
|
346
|
-
function
|
|
347
|
-
const { onWithdraw: n, partnerSlug: s, getSteamId: t } = k(),
|
|
371
|
+
function pe(r) {
|
|
372
|
+
const { onWithdraw: n, partnerSlug: s, getSteamId: t } = k(), a = U();
|
|
348
373
|
return H({
|
|
349
|
-
mutationFn: (
|
|
374
|
+
mutationFn: (i) => {
|
|
350
375
|
if (!n)
|
|
351
376
|
throw new Error(
|
|
352
377
|
"No onWithdraw callback provided to PitVoxPartnerProvider. Provide onWithdraw for in-app withdrawal, or use useRegistrationUrl() to link to pitvox.com."
|
|
353
378
|
);
|
|
354
|
-
const o =
|
|
379
|
+
const o = i || t();
|
|
355
380
|
if (!o) throw new Error("No Steam ID available");
|
|
356
381
|
return n(r, o);
|
|
357
382
|
},
|
|
358
383
|
onSuccess: () => {
|
|
359
|
-
const
|
|
360
|
-
|
|
384
|
+
const i = t();
|
|
385
|
+
a.setQueriesData(
|
|
361
386
|
{ queryKey: ["pitvox", "registration", s, r] },
|
|
362
387
|
(o) => o ? { ...o, isRegistered: !1 } : { isRegistered: !1, entryList: null }
|
|
363
|
-
),
|
|
388
|
+
), i && a.setQueriesData(
|
|
364
389
|
{ queryKey: ["pitvox", "competition", s, r, "entrylist"] },
|
|
365
|
-
(o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !==
|
|
390
|
+
(o) => o != null && o.drivers ? { ...o, drivers: o.drivers.filter((d) => d.steamId !== i) } : o
|
|
366
391
|
);
|
|
367
392
|
}
|
|
368
393
|
});
|
|
369
394
|
}
|
|
370
|
-
function
|
|
395
|
+
function X() {
|
|
371
396
|
const { onRegister: r, onWithdraw: n } = k(), s = !!(r && n);
|
|
372
397
|
return { isPowerMode: s, isBasicMode: !s };
|
|
373
398
|
}
|
|
374
|
-
function
|
|
399
|
+
function ee(r) {
|
|
375
400
|
const { pitvoxUrl: n, partnerSlug: s } = k();
|
|
376
401
|
return `${n}/p/${s}/competitions/${r}/register`;
|
|
377
402
|
}
|
|
378
|
-
const
|
|
403
|
+
const _e = {
|
|
379
404
|
formula: "Formula",
|
|
380
405
|
gt3: "GT3",
|
|
381
406
|
gt2: "GT2",
|
|
@@ -395,55 +420,55 @@ const Ue = {
|
|
|
395
420
|
"2000s": "2000s",
|
|
396
421
|
"2010s": "2010s",
|
|
397
422
|
"2020s": "2020s"
|
|
398
|
-
},
|
|
423
|
+
}, ue = [
|
|
399
424
|
{ id: "class", tags: ["formula", "gt3", "gt2", "gt4", "cup", "prototype", "rally"] },
|
|
400
425
|
{ id: "tier", tags: ["hypercar", "supercar", "sports_car", "hot_hatch", "lightweight"] },
|
|
401
426
|
{ id: "era", tags: ["1960s", "1970s", "1980s", "1990s", "2000s", "2010s", "2020s"] }
|
|
402
427
|
];
|
|
403
|
-
function
|
|
404
|
-
for (const n of
|
|
428
|
+
function qe(r) {
|
|
429
|
+
for (const n of ue)
|
|
405
430
|
if (n.tags.includes(r)) return n.id;
|
|
406
431
|
return "other";
|
|
407
432
|
}
|
|
408
|
-
function
|
|
433
|
+
function me(r, n) {
|
|
409
434
|
if (n.size === 0) return !0;
|
|
410
435
|
const s = {};
|
|
411
436
|
for (const t of n) {
|
|
412
|
-
const
|
|
413
|
-
s[
|
|
437
|
+
const a = qe(t);
|
|
438
|
+
s[a] || (s[a] = []), s[a].push(t);
|
|
414
439
|
}
|
|
415
440
|
for (const t of Object.values(s))
|
|
416
|
-
if (!t.some((
|
|
441
|
+
if (!t.some((a) => r.includes(a))) return !1;
|
|
417
442
|
return !0;
|
|
418
443
|
}
|
|
419
|
-
function
|
|
420
|
-
const [s, t] = M(/* @__PURE__ */ new Set()),
|
|
421
|
-
const c = new Set(
|
|
422
|
-
c.has(
|
|
423
|
-
}, [
|
|
424
|
-
|
|
425
|
-
}, [
|
|
426
|
-
return { activeTags:
|
|
444
|
+
function ve(r, n) {
|
|
445
|
+
const [s, t] = M(/* @__PURE__ */ new Set()), a = r !== void 0, i = a ? r : s, o = K((u) => {
|
|
446
|
+
const c = new Set(i);
|
|
447
|
+
c.has(u) ? c.delete(u) : c.add(u), a && n ? n(c) : t(c);
|
|
448
|
+
}, [i, a, n]), d = K(() => {
|
|
449
|
+
a && n ? n(/* @__PURE__ */ new Set()) : t(/* @__PURE__ */ new Set());
|
|
450
|
+
}, [a, n]);
|
|
451
|
+
return { activeTags: i, toggle: o, clear: d };
|
|
427
452
|
}
|
|
428
453
|
function W(r) {
|
|
429
|
-
const [n, s] = M(r), t = K((
|
|
454
|
+
const [n, s] = M(r), t = K((a) => {
|
|
430
455
|
s(
|
|
431
|
-
(
|
|
456
|
+
(i) => i.key === a ? { key: a, dir: i.dir === "asc" ? "desc" : "asc" } : { key: a, dir: a.includes("timestamp") || a.includes("Date") ? "desc" : "asc" }
|
|
432
457
|
);
|
|
433
458
|
}, []);
|
|
434
459
|
return [n, t];
|
|
435
460
|
}
|
|
436
461
|
function O(r, n, s) {
|
|
437
|
-
return [...r].sort((t,
|
|
438
|
-
const
|
|
439
|
-
if (
|
|
440
|
-
if (
|
|
462
|
+
return [...r].sort((t, a) => {
|
|
463
|
+
const i = s(t, n.key), o = s(a, n.key);
|
|
464
|
+
if (i == null && o == null) return 0;
|
|
465
|
+
if (i == null) return 1;
|
|
441
466
|
if (o == null) return -1;
|
|
442
|
-
const d = typeof
|
|
467
|
+
const d = typeof i == "string" ? i.localeCompare(o) : i - o;
|
|
443
468
|
return n.dir === "desc" ? -d : d;
|
|
444
469
|
});
|
|
445
470
|
}
|
|
446
|
-
function
|
|
471
|
+
function he(r, n = !1) {
|
|
447
472
|
const s = n ? r == null ? void 0 : r.filter((t) => t.isValid) : r;
|
|
448
473
|
return s != null && s.length ? {
|
|
449
474
|
s1: Math.min(...s.map((t) => t.sector1Ms).filter(Boolean)),
|
|
@@ -451,18 +476,18 @@ function ve(r, n = !1) {
|
|
|
451
476
|
s3: Math.min(...s.map((t) => t.sector3Ms).filter(Boolean))
|
|
452
477
|
} : null;
|
|
453
478
|
}
|
|
454
|
-
function
|
|
479
|
+
function je({ active: r, dir: n }) {
|
|
455
480
|
return r ? n === "asc" ? /* @__PURE__ */ e("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) }) : /* @__PURE__ */ e("svg", { className: "pvx-sort-icon", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) }) : /* @__PURE__ */ e("svg", { className: "pvx-sort-icon pvx-sort-icon--inactive", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 9l4-4 4 4M16 15l-4 4-4-4" }) });
|
|
456
481
|
}
|
|
457
|
-
function
|
|
482
|
+
function T({ label: r, sortKey: n, config: s, onSort: t, className: a = "" }) {
|
|
458
483
|
return /* @__PURE__ */ e(
|
|
459
484
|
"th",
|
|
460
485
|
{
|
|
461
|
-
className: `pvx-th pvx-th--sortable ${
|
|
486
|
+
className: `pvx-th pvx-th--sortable ${a}`,
|
|
462
487
|
onClick: () => t(n),
|
|
463
488
|
children: /* @__PURE__ */ l("span", { className: "pvx-th-inner", children: [
|
|
464
489
|
r,
|
|
465
|
-
/* @__PURE__ */ e(
|
|
490
|
+
/* @__PURE__ */ e(je, { active: s.key === n, dir: s.dir })
|
|
466
491
|
] })
|
|
467
492
|
}
|
|
468
493
|
);
|
|
@@ -474,12 +499,12 @@ function G({ userId: r, getUserDisplay: n }) {
|
|
|
474
499
|
/* @__PURE__ */ e("span", { className: "pvx-driver-name", children: s })
|
|
475
500
|
] });
|
|
476
501
|
}
|
|
477
|
-
function
|
|
502
|
+
function re({ rank: r, podium: n = !1 }) {
|
|
478
503
|
return /* @__PURE__ */ e("span", { className: n ? r === 1 ? "pvx-rank pvx-rank--gold" : r === 2 ? "pvx-rank pvx-rank--silver" : r === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank" : "pvx-rank", children: r });
|
|
479
504
|
}
|
|
480
|
-
function
|
|
505
|
+
function xe({ availableTags: r, activeTags: n, onToggle: s, onClear: t }) {
|
|
481
506
|
if (!r || r.length < 2) return null;
|
|
482
|
-
const
|
|
507
|
+
const a = ue.map((i) => ({ id: i.id, tags: i.tags.filter((o) => r.includes(o)) })).filter((i) => i.tags.length > 0);
|
|
483
508
|
return /* @__PURE__ */ l("div", { className: "pvx-tag-bar", children: [
|
|
484
509
|
/* @__PURE__ */ e(
|
|
485
510
|
"button",
|
|
@@ -489,21 +514,21 @@ function he({ availableTags: r, activeTags: n, onToggle: s, onClear: t }) {
|
|
|
489
514
|
children: "All"
|
|
490
515
|
}
|
|
491
516
|
),
|
|
492
|
-
|
|
517
|
+
a.map((i, o) => /* @__PURE__ */ l("span", { className: "contents", children: [
|
|
493
518
|
o > 0 && /* @__PURE__ */ e("span", { className: "pvx-tag-separator" }),
|
|
494
|
-
|
|
519
|
+
i.tags.map((d) => /* @__PURE__ */ e(
|
|
495
520
|
"button",
|
|
496
521
|
{
|
|
497
522
|
onClick: () => s(d),
|
|
498
523
|
className: `pvx-tag ${n.has(d) ? "pvx-tag--active" : ""}`,
|
|
499
|
-
children:
|
|
524
|
+
children: _e[d] || d
|
|
500
525
|
},
|
|
501
526
|
d
|
|
502
527
|
))
|
|
503
|
-
] },
|
|
528
|
+
] }, i.id))
|
|
504
529
|
] });
|
|
505
530
|
}
|
|
506
|
-
function
|
|
531
|
+
function ne({ segments: r }) {
|
|
507
532
|
return /* @__PURE__ */ e("nav", { className: "pvx-breadcrumb", "aria-label": "Breadcrumb", children: /* @__PURE__ */ e("ol", { className: "pvx-breadcrumb-list", children: r.map((n, s) => {
|
|
508
533
|
const t = s === r.length - 1;
|
|
509
534
|
return /* @__PURE__ */ l("li", { className: "pvx-breadcrumb-item", children: [
|
|
@@ -521,221 +546,221 @@ function _({ message: r }) {
|
|
|
521
546
|
function q() {
|
|
522
547
|
return /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading..." });
|
|
523
548
|
}
|
|
524
|
-
function
|
|
549
|
+
function Ve() {
|
|
525
550
|
return /* @__PURE__ */ e("svg", { className: "pvx-icon pvx-icon--valid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) });
|
|
526
551
|
}
|
|
527
|
-
function
|
|
552
|
+
function Ke() {
|
|
528
553
|
return /* @__PURE__ */ e("svg", { className: "pvx-icon pvx-icon--invalid", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) });
|
|
529
554
|
}
|
|
530
|
-
function
|
|
531
|
-
const [d,
|
|
532
|
-
var
|
|
533
|
-
if (!((
|
|
534
|
-
const
|
|
535
|
-
for (const
|
|
536
|
-
|
|
537
|
-
return s.tags.filter((
|
|
538
|
-
}, [r, s]), p = w(() => r ? c.size === 0 ? r : r.map((
|
|
539
|
-
var
|
|
540
|
-
if (!
|
|
541
|
-
let
|
|
542
|
-
const
|
|
543
|
-
for (const
|
|
544
|
-
if (
|
|
545
|
-
|
|
546
|
-
const $ = ((y = (
|
|
547
|
-
|
|
555
|
+
function Hr({ tracks: r, isLoading: n, carMetadata: s, getUserDisplay: t, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
556
|
+
const [d, u] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: c, toggle: v, clear: x } = ve(i, o), N = w(() => {
|
|
557
|
+
var m;
|
|
558
|
+
if (!((m = s == null ? void 0 : s.tags) != null && m.length)) return [];
|
|
559
|
+
const g = /* @__PURE__ */ new Set();
|
|
560
|
+
for (const f of r || [])
|
|
561
|
+
f.recordByTag && Object.keys(f.recordByTag).forEach((h) => g.add(h));
|
|
562
|
+
return s.tags.filter((f) => g.has(f));
|
|
563
|
+
}, [r, s]), p = w(() => r ? c.size === 0 ? r : r.map((g) => {
|
|
564
|
+
var h, y;
|
|
565
|
+
if (!g.recordByTag) return null;
|
|
566
|
+
let m = null;
|
|
567
|
+
const f = /* @__PURE__ */ new Set();
|
|
568
|
+
for (const L of Object.values(g.recordByTag)) {
|
|
569
|
+
if (f.has(L.carId)) continue;
|
|
570
|
+
f.add(L.carId);
|
|
571
|
+
const $ = ((y = (h = s == null ? void 0 : s.cars) == null ? void 0 : h[L.carId]) == null ? void 0 : y.tags) || ["sports_car"];
|
|
572
|
+
me($, c) && (!m || L.lapTimeMs < m.lapTimeMs) && (m = L);
|
|
548
573
|
}
|
|
549
|
-
return
|
|
550
|
-
...
|
|
574
|
+
return m ? {
|
|
575
|
+
...g,
|
|
551
576
|
record: {
|
|
552
|
-
visibleId:
|
|
553
|
-
carId:
|
|
554
|
-
carDisplayName: I(
|
|
555
|
-
lapTimeMs:
|
|
556
|
-
timestamp:
|
|
577
|
+
visibleId: m.steamId || m.identifier,
|
|
578
|
+
carId: m.carId,
|
|
579
|
+
carDisplayName: I(m.carId),
|
|
580
|
+
lapTimeMs: m.lapTimeMs,
|
|
581
|
+
timestamp: m.recordedAt
|
|
557
582
|
}
|
|
558
583
|
} : null;
|
|
559
|
-
}).filter(Boolean) : [], [r, c, s]), b = w(() => O(p, d, (
|
|
560
|
-
var
|
|
561
|
-
switch (
|
|
584
|
+
}).filter(Boolean) : [], [r, c, s]), b = w(() => O(p, d, (g, m) => {
|
|
585
|
+
var f, h;
|
|
586
|
+
switch (m) {
|
|
562
587
|
case "displayName":
|
|
563
|
-
return
|
|
588
|
+
return g.displayName;
|
|
564
589
|
case "record.lapTimeMs":
|
|
565
|
-
return (
|
|
590
|
+
return (f = g.record) == null ? void 0 : f.lapTimeMs;
|
|
566
591
|
case "driverCount":
|
|
567
|
-
return
|
|
592
|
+
return g.driverCount || 0;
|
|
568
593
|
case "carCount":
|
|
569
|
-
return
|
|
594
|
+
return g.carCount || 0;
|
|
570
595
|
case "record.timestamp":
|
|
571
596
|
default:
|
|
572
|
-
return (
|
|
597
|
+
return (h = g.record) != null && h.timestamp ? new Date(g.record.timestamp).getTime() : 0;
|
|
573
598
|
}
|
|
574
599
|
}), [p, d]);
|
|
575
600
|
return n ? /* @__PURE__ */ e(q, {}) : r != null && r.length ? /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
576
601
|
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
577
|
-
/* @__PURE__ */ e(
|
|
602
|
+
/* @__PURE__ */ e(xe, { availableTags: N, activeTags: c, onToggle: v, onClear: x }),
|
|
578
603
|
/* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
579
604
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
580
|
-
/* @__PURE__ */ e(
|
|
605
|
+
/* @__PURE__ */ e(T, { label: "Track", sortKey: "displayName", config: d, onSort: u }),
|
|
581
606
|
/* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
|
|
582
607
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Car" }),
|
|
583
|
-
/* @__PURE__ */ e(
|
|
584
|
-
/* @__PURE__ */ e(
|
|
585
|
-
/* @__PURE__ */ e(
|
|
586
|
-
/* @__PURE__ */ e(
|
|
608
|
+
/* @__PURE__ */ e(T, { label: "Lap Time", sortKey: "record.lapTimeMs", config: d, onSort: u }),
|
|
609
|
+
/* @__PURE__ */ e(T, { label: "Drivers", sortKey: "driverCount", config: d, onSort: u, className: "pvx-hidden-below-md" }),
|
|
610
|
+
/* @__PURE__ */ e(T, { label: "Cars", sortKey: "carCount", config: d, onSort: u, className: "pvx-hidden-below-lg" }),
|
|
611
|
+
/* @__PURE__ */ e(T, { label: "Date", sortKey: "record.timestamp", config: d, onSort: u, className: "pvx-hidden-below-xl" })
|
|
587
612
|
] }) }),
|
|
588
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: b.map((
|
|
589
|
-
var
|
|
613
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: b.map((g) => {
|
|
614
|
+
var m, f, h;
|
|
590
615
|
return /* @__PURE__ */ l(
|
|
591
616
|
"tr",
|
|
592
617
|
{
|
|
593
618
|
className: "pvx-row pvx-row--clickable",
|
|
594
|
-
onClick: () =>
|
|
619
|
+
onClick: () => a(g.id, g.layout),
|
|
595
620
|
children: [
|
|
596
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children:
|
|
597
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: (
|
|
598
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((
|
|
599
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children:
|
|
600
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
601
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
602
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (
|
|
621
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: g.displayName }),
|
|
622
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: (m = g.record) != null && m.visibleId ? /* @__PURE__ */ e(G, { userId: g.record.visibleId, getUserDisplay: t }) : "-" }),
|
|
623
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((f = g.record) == null ? void 0 : f.carDisplayName) || "-" }),
|
|
624
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: g.record ? B(g.record.lapTimeMs) : "-" }),
|
|
625
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: g.driverCount || "-" }),
|
|
626
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: g.carCount || "-" }),
|
|
627
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (h = g.record) != null && h.timestamp ? F(g.record.timestamp) : "-" })
|
|
603
628
|
]
|
|
604
629
|
},
|
|
605
|
-
`${
|
|
630
|
+
`${g.id}|${g.layout || ""}`
|
|
606
631
|
);
|
|
607
632
|
}) })
|
|
608
633
|
] }) })
|
|
609
634
|
] }) : /* @__PURE__ */ e(_, { message: "No lap times recorded yet." });
|
|
610
635
|
}
|
|
611
|
-
function
|
|
612
|
-
const [c, v] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags:
|
|
613
|
-
var y,
|
|
636
|
+
function Wr({ entries: r, isLoading: n, track: s, carMetadata: t, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: u }) {
|
|
637
|
+
const [c, v] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: x, toggle: N, clear: p } = ve(d, u), b = w(() => {
|
|
638
|
+
var y, L, $;
|
|
614
639
|
if (!r || !((y = t == null ? void 0 : t.tags) != null && y.length)) return [];
|
|
615
|
-
const
|
|
640
|
+
const h = /* @__PURE__ */ new Set();
|
|
616
641
|
for (const S of r)
|
|
617
|
-
((($ = (
|
|
618
|
-
return t.tags.filter((S) =>
|
|
619
|
-
}, [r, t]),
|
|
620
|
-
var
|
|
621
|
-
const y = (($ = (
|
|
622
|
-
return
|
|
623
|
-
}) : [], [r,
|
|
642
|
+
((($ = (L = t.cars) == null ? void 0 : L[S.carId]) == null ? void 0 : $.tags) || ["sports_car"]).forEach((ke) => h.add(ke));
|
|
643
|
+
return t.tags.filter((S) => h.has(S));
|
|
644
|
+
}, [r, t]), g = w(() => r ? x.size === 0 ? r : r.filter((h) => {
|
|
645
|
+
var L, $;
|
|
646
|
+
const y = (($ = (L = t == null ? void 0 : t.cars) == null ? void 0 : L[h.carId]) == null ? void 0 : $.tags) || ["sports_car"];
|
|
647
|
+
return me(y, x);
|
|
648
|
+
}) : [], [r, x, t]), m = w(() => O(g, c, (h, y) => {
|
|
624
649
|
switch (y) {
|
|
625
650
|
case "carId":
|
|
626
|
-
return I(
|
|
651
|
+
return I(h.carId);
|
|
627
652
|
case "driverCount":
|
|
628
|
-
return
|
|
653
|
+
return h.driverCount || 0;
|
|
629
654
|
case "lapTimeMs":
|
|
630
655
|
default:
|
|
631
|
-
return
|
|
656
|
+
return h.lapTimeMs;
|
|
632
657
|
}
|
|
633
|
-
}), [
|
|
658
|
+
}), [g, c]), f = [
|
|
634
659
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
635
660
|
{ key: "track", label: s.displayName }
|
|
636
661
|
];
|
|
637
662
|
return n ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
638
|
-
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(
|
|
639
|
-
/* @__PURE__ */ e(
|
|
663
|
+
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ne, { segments: f }) }),
|
|
664
|
+
/* @__PURE__ */ e(xe, { availableTags: b, activeTags: x, onToggle: N, onClear: p }),
|
|
640
665
|
r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
641
666
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
642
667
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
643
|
-
/* @__PURE__ */ e(
|
|
668
|
+
/* @__PURE__ */ e(T, { label: "Car", sortKey: "carId", config: c, onSort: v }),
|
|
644
669
|
/* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
|
|
645
|
-
/* @__PURE__ */ e(
|
|
646
|
-
/* @__PURE__ */ e(
|
|
670
|
+
/* @__PURE__ */ e(T, { label: "Lap Time", sortKey: "lapTimeMs", config: c, onSort: v }),
|
|
671
|
+
/* @__PURE__ */ e(T, { label: "Drivers", sortKey: "driverCount", config: c, onSort: v, className: "pvx-hidden-below-md" }),
|
|
647
672
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
648
673
|
] }) }),
|
|
649
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children:
|
|
674
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: m.map((h, y) => /* @__PURE__ */ l(
|
|
650
675
|
"tr",
|
|
651
676
|
{
|
|
652
677
|
className: "pvx-row pvx-row--clickable",
|
|
653
|
-
onClick: () =>
|
|
678
|
+
onClick: () => i(h.carId),
|
|
654
679
|
children: [
|
|
655
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(
|
|
656
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(
|
|
657
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(G, { userId:
|
|
658
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(
|
|
659
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
660
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children:
|
|
680
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: y + 1, podium: !0 }) }),
|
|
681
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(h.carId) }),
|
|
682
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(G, { userId: h.steamId || h.userId, getUserDisplay: a }) }),
|
|
683
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(h.lapTimeMs) }),
|
|
684
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: h.driverCount || "-" }),
|
|
685
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: h.recordedAt ? F(h.recordedAt) : "-" })
|
|
661
686
|
]
|
|
662
687
|
},
|
|
663
|
-
|
|
688
|
+
h.carId
|
|
664
689
|
)) })
|
|
665
690
|
] }) }) : /* @__PURE__ */ e(_, { message: "No lap times for this track yet." })
|
|
666
691
|
] });
|
|
667
692
|
}
|
|
668
|
-
function
|
|
669
|
-
const [
|
|
693
|
+
function Or({ entries: r, isLoading: n, track: s, carId: t, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
|
|
694
|
+
const [u, c] = W({ key: "lapTimeMs", dir: "asc" }), v = w(() => he(r), [r]), x = w(() => O(r || [], u, (p, b) => {
|
|
670
695
|
switch (b) {
|
|
671
696
|
case "userId":
|
|
672
|
-
return
|
|
697
|
+
return a(p.steamId || p.userId).displayName;
|
|
673
698
|
case "lapCount":
|
|
674
699
|
return p.lapCount || 0;
|
|
675
700
|
case "lapTimeMs":
|
|
676
701
|
default:
|
|
677
702
|
return p.lapTimeMs;
|
|
678
703
|
}
|
|
679
|
-
}), [r,
|
|
704
|
+
}), [r, u, a]), N = [
|
|
680
705
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
681
706
|
{ key: "track", label: s.displayName, onClick: () => o("track") },
|
|
682
707
|
{ key: "car", label: I(t) }
|
|
683
708
|
];
|
|
684
709
|
return n ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
685
|
-
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(
|
|
710
|
+
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ne, { segments: N }) }),
|
|
686
711
|
r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
687
712
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
688
713
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
689
|
-
/* @__PURE__ */ e(
|
|
690
|
-
/* @__PURE__ */ e(
|
|
714
|
+
/* @__PURE__ */ e(T, { label: "Driver", sortKey: "userId", config: u, onSort: c }),
|
|
715
|
+
/* @__PURE__ */ e(T, { label: "Lap Time", sortKey: "lapTimeMs", config: u, onSort: c }),
|
|
691
716
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S1" }),
|
|
692
717
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S2" }),
|
|
693
718
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-sm", children: "S3" }),
|
|
694
719
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Tyre" }),
|
|
695
720
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Fuel" }),
|
|
696
|
-
/* @__PURE__ */ e(
|
|
721
|
+
/* @__PURE__ */ e(T, { label: "Laps", sortKey: "lapCount", config: u, onSort: c, className: "pvx-hidden-below-lg" }),
|
|
697
722
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
698
723
|
] }) }),
|
|
699
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children:
|
|
700
|
-
const
|
|
724
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: x.map((p, b) => {
|
|
725
|
+
const g = b + 1, m = p.steamId || p.userId, f = v && p.sector1Ms === v.s1, h = v && p.sector2Ms === v.s2, y = v && p.sector3Ms === v.s3;
|
|
701
726
|
return /* @__PURE__ */ l(
|
|
702
727
|
"tr",
|
|
703
728
|
{
|
|
704
|
-
className: `pvx-row pvx-row--clickable ${d &&
|
|
705
|
-
onClick: () =>
|
|
729
|
+
className: `pvx-row pvx-row--clickable ${d && m === d ? "pvx-row--highlight" : g <= 3 ? "pvx-row--podium" : ""}`,
|
|
730
|
+
onClick: () => i(m),
|
|
706
731
|
children: [
|
|
707
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(
|
|
708
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId:
|
|
732
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: g, podium: !0 }) }),
|
|
733
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId: m, getUserDisplay: a }) }),
|
|
709
734
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(p.lapTimeMs) }),
|
|
710
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
711
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
735
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${f ? "pvx-td--best-sector" : ""}`, children: D(p.sector1Ms) }),
|
|
736
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: D(p.sector2Ms) }),
|
|
712
737
|
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: D(p.sector3Ms) }),
|
|
713
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
738
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: oe(p.tyreCompound), children: p.tyreCompound || "-" }),
|
|
714
739
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: p.startingFuelL ? `${p.startingFuelL}L` : "-" }),
|
|
715
740
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: p.lapCount || "-" }),
|
|
716
741
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: p.recordedAt ? F(p.recordedAt) : "-" })
|
|
717
742
|
]
|
|
718
743
|
},
|
|
719
|
-
|
|
744
|
+
m
|
|
720
745
|
);
|
|
721
746
|
}) })
|
|
722
747
|
] }) }) : /* @__PURE__ */ e(_, { message: "No lap times for this car yet." })
|
|
723
748
|
] });
|
|
724
749
|
}
|
|
725
|
-
function
|
|
726
|
-
const { data: c, driverName: v, isLoading:
|
|
727
|
-
const
|
|
728
|
-
return
|
|
729
|
-
}, [c]),
|
|
730
|
-
{ key: "tracks", label: "Tracks", onClick: () =>
|
|
731
|
-
{ key: "track", label: n.displayName, onClick: () =>
|
|
732
|
-
{ key: "car", label: I(s), onClick: () =>
|
|
733
|
-
{ key: "driver", label:
|
|
750
|
+
function Gr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: u }) {
|
|
751
|
+
const { data: c, driverName: v, isLoading: x } = Ae(r, n.id, n.layout, s, { showInvalid: i, game: t, gameVersion: a }), { displayName: N, avatarUrl: p } = o(r, v), b = w(() => he(c, !0), [c]), g = w(() => {
|
|
752
|
+
const f = (c == null ? void 0 : c.filter((h) => h.isValid)) || [];
|
|
753
|
+
return f.length ? Math.min(...f.map((h) => h.lapTimeMs)) : null;
|
|
754
|
+
}, [c]), m = [
|
|
755
|
+
{ key: "tracks", label: "Tracks", onClick: () => u("tracks") },
|
|
756
|
+
{ key: "track", label: n.displayName, onClick: () => u("track") },
|
|
757
|
+
{ key: "car", label: I(s), onClick: () => u("car") },
|
|
758
|
+
{ key: "driver", label: N }
|
|
734
759
|
];
|
|
735
|
-
return
|
|
760
|
+
return x ? /* @__PURE__ */ e(q, {}) : /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
736
761
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
737
762
|
/* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
738
|
-
/* @__PURE__ */ e(
|
|
763
|
+
/* @__PURE__ */ e(ne, { segments: m }),
|
|
739
764
|
p ? /* @__PURE__ */ e("img", { src: p, alt: "", className: "pvx-driver-avatar pvx-driver-avatar--lg" }) : /* @__PURE__ */ e("span", { className: "pvx-driver-avatar pvx-driver-avatar--lg pvx-driver-avatar--placeholder" })
|
|
740
765
|
] }),
|
|
741
766
|
/* @__PURE__ */ l("label", { className: "pvx-checkbox-label", children: [
|
|
@@ -743,7 +768,7 @@ function Kr({ userId: r, track: n, carId: s, game: t, gameVersion: i, showInvali
|
|
|
743
768
|
"input",
|
|
744
769
|
{
|
|
745
770
|
type: "checkbox",
|
|
746
|
-
checked:
|
|
771
|
+
checked: i,
|
|
747
772
|
onChange: d,
|
|
748
773
|
className: "pvx-checkbox"
|
|
749
774
|
}
|
|
@@ -764,43 +789,43 @@ function Kr({ userId: r, track: n, carId: s, game: t, gameVersion: i, showInvali
|
|
|
764
789
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
765
790
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
766
791
|
] }) }),
|
|
767
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: c.map((
|
|
768
|
-
const y =
|
|
792
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: c.map((f, h) => {
|
|
793
|
+
const y = f.isValid && f.lapTimeMs === g, L = b && f.isValid && f.sector1Ms === b.s1, $ = b && f.isValid && f.sector2Ms === b.s2, S = b && f.isValid && f.sector3Ms === b.s3;
|
|
769
794
|
let V = "pvx-row";
|
|
770
|
-
return
|
|
771
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e("span", { className: `pvx-rank ${y ? "pvx-rank--gold" : ""}`, children:
|
|
772
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children:
|
|
773
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(
|
|
774
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
775
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(
|
|
776
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${S ? "pvx-td--best-sector" : ""}`, children: D(
|
|
777
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", title:
|
|
778
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title:
|
|
779
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
780
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: F(
|
|
781
|
-
] },
|
|
795
|
+
return f.isValid || (V += " pvx-row--invalid"), y && (V += " pvx-row--personal-best"), /* @__PURE__ */ l("tr", { className: V, children: [
|
|
796
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e("span", { className: `pvx-rank ${y ? "pvx-rank--gold" : ""}`, children: h + 1 }) }),
|
|
797
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: f.lapNumber || "-" }),
|
|
798
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: B(f.lapTimeMs) }),
|
|
799
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${L ? "pvx-td--best-sector" : ""}`, children: D(f.sector1Ms) }),
|
|
800
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(f.sector2Ms) }),
|
|
801
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${S ? "pvx-td--best-sector" : ""}`, children: D(f.sector3Ms) }),
|
|
802
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", title: f.isValid ? void 0 : f.invalidReason || "Invalid", children: f.isValid ? /* @__PURE__ */ e(Ve, {}) : /* @__PURE__ */ e(Ke, {}) }),
|
|
803
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: oe(f.tyreCompound), children: f.tyreCompound || "-" }),
|
|
804
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: f.startingFuelL ? `${f.startingFuelL}L` : "-" }),
|
|
805
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: F(f.timestamp) })
|
|
806
|
+
] }, f.id);
|
|
782
807
|
}) })
|
|
783
|
-
] }) }) : /* @__PURE__ */ e(_, { message:
|
|
808
|
+
] }) }) : /* @__PURE__ */ e(_, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
784
809
|
] });
|
|
785
810
|
}
|
|
786
|
-
function
|
|
787
|
-
const [o, d] = W({ key: "rank", dir: "asc" }), [
|
|
811
|
+
function zr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion: a, onComboSelect: i }) {
|
|
812
|
+
const [o, d] = W({ key: "rank", dir: "asc" }), [u, c] = M(null), v = w(() => r ? O(r, o, (N, p) => {
|
|
788
813
|
switch (p) {
|
|
789
814
|
case "rating":
|
|
790
|
-
return
|
|
815
|
+
return N.rating;
|
|
791
816
|
case "comboCount":
|
|
792
|
-
return
|
|
817
|
+
return N.comboCount || 0;
|
|
793
818
|
case "distinctCars":
|
|
794
|
-
return
|
|
819
|
+
return N.distinctCars || 0;
|
|
795
820
|
case "rank":
|
|
796
821
|
default:
|
|
797
|
-
return
|
|
822
|
+
return N.rank;
|
|
798
823
|
}
|
|
799
824
|
}) : [], [r, o]);
|
|
800
825
|
if (n) return /* @__PURE__ */ e(q, {});
|
|
801
826
|
if (!(r != null && r.length))
|
|
802
827
|
return /* @__PURE__ */ e("div", { className: "pvx-card", children: /* @__PURE__ */ e(_, { message: "Not enough data for rankings yet." }) });
|
|
803
|
-
const
|
|
828
|
+
const x = 5;
|
|
804
829
|
return /* @__PURE__ */ l("div", { className: "pvx-card", children: [
|
|
805
830
|
/* @__PURE__ */ l("div", { className: "pvx-card-header pvx-rankings-header", children: [
|
|
806
831
|
/* @__PURE__ */ e("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
|
|
@@ -819,34 +844,34 @@ function Hr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion:
|
|
|
819
844
|
] }),
|
|
820
845
|
/* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
821
846
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
822
|
-
/* @__PURE__ */ e(
|
|
847
|
+
/* @__PURE__ */ e(T, { label: "#", sortKey: "rank", config: o, onSort: d, className: "pvx-th--narrow" }),
|
|
823
848
|
/* @__PURE__ */ e("th", { className: "pvx-th", children: "Driver" }),
|
|
824
|
-
/* @__PURE__ */ e(
|
|
825
|
-
/* @__PURE__ */ e(
|
|
826
|
-
/* @__PURE__ */ e(
|
|
849
|
+
/* @__PURE__ */ e(T, { label: "Rating", sortKey: "rating", config: o, onSort: d }),
|
|
850
|
+
/* @__PURE__ */ e(T, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
851
|
+
/* @__PURE__ */ e(T, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
|
|
827
852
|
] }) }),
|
|
828
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: v.map((
|
|
829
|
-
const p =
|
|
853
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: v.map((N) => {
|
|
854
|
+
const p = u === N.identifier;
|
|
830
855
|
return /* @__PURE__ */ e(
|
|
831
|
-
|
|
856
|
+
He,
|
|
832
857
|
{
|
|
833
|
-
driver:
|
|
858
|
+
driver: N,
|
|
834
859
|
getUserDisplay: s,
|
|
835
860
|
isExpanded: p,
|
|
836
|
-
onToggle: () => c(p ? null :
|
|
837
|
-
colCount:
|
|
861
|
+
onToggle: () => c(p ? null : N.identifier),
|
|
862
|
+
colCount: x,
|
|
838
863
|
game: t,
|
|
839
|
-
gameVersion:
|
|
840
|
-
onComboSelect:
|
|
864
|
+
gameVersion: a,
|
|
865
|
+
onComboSelect: i
|
|
841
866
|
},
|
|
842
|
-
|
|
867
|
+
N.identifier
|
|
843
868
|
);
|
|
844
869
|
}) })
|
|
845
870
|
] }) })
|
|
846
871
|
] });
|
|
847
872
|
}
|
|
848
|
-
function
|
|
849
|
-
const
|
|
873
|
+
function He({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount: a, game: i, gameVersion: o, onComboSelect: d }) {
|
|
874
|
+
const u = r.identifier;
|
|
850
875
|
return /* @__PURE__ */ l(A, { children: [
|
|
851
876
|
/* @__PURE__ */ l(
|
|
852
877
|
"tr",
|
|
@@ -854,8 +879,8 @@ function je({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
|
|
|
854
879
|
className: `pvx-row pvx-row--clickable ${r.rank <= 3 ? "pvx-row--podium" : ""}`,
|
|
855
880
|
onClick: t,
|
|
856
881
|
children: [
|
|
857
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(
|
|
858
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId:
|
|
882
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: r.rank, podium: !0 }) }),
|
|
883
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(G, { userId: u, getUserDisplay: n }) }),
|
|
859
884
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: r.rating.toFixed(1) }),
|
|
860
885
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: r.distinctCars || "-" }),
|
|
861
886
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: /* @__PURE__ */ l("span", { className: "pvx-rankings-combo-count", children: [
|
|
@@ -865,17 +890,17 @@ function je({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
|
|
|
865
890
|
]
|
|
866
891
|
}
|
|
867
892
|
),
|
|
868
|
-
s && r.combos && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan:
|
|
869
|
-
const
|
|
893
|
+
s && r.combos && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: a, className: "pvx-rankings-combos-cell", children: /* @__PURE__ */ e("div", { className: "pvx-rankings-combos", children: r.combos.map((c, v) => {
|
|
894
|
+
const x = c.layout ? `${c.trackId}|${c.layout}` : c.trackId, N = d ? () => d({ track: x, car: c.carId, highlight: u, game: i, gameVersion: o }) : void 0;
|
|
870
895
|
return /* @__PURE__ */ l(
|
|
871
896
|
"div",
|
|
872
897
|
{
|
|
873
|
-
className: `pvx-rankings-combo ${
|
|
874
|
-
onClick:
|
|
875
|
-
role:
|
|
898
|
+
className: `pvx-rankings-combo ${N ? "pvx-rankings-combo--clickable" : ""}`,
|
|
899
|
+
onClick: N,
|
|
900
|
+
role: N ? "button" : void 0,
|
|
876
901
|
children: [
|
|
877
902
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-info", children: [
|
|
878
|
-
/* @__PURE__ */ e("p", { className: "pvx-rankings-combo-track", children: E(c.trackId, c.layout,
|
|
903
|
+
/* @__PURE__ */ e("p", { className: "pvx-rankings-combo-track", children: E(c.trackId, c.layout, i) }),
|
|
879
904
|
/* @__PURE__ */ e("p", { className: "pvx-rankings-combo-car", children: I(c.carId) })
|
|
880
905
|
] }),
|
|
881
906
|
/* @__PURE__ */ l("div", { className: "pvx-rankings-combo-stats", children: [
|
|
@@ -899,7 +924,7 @@ function je({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
|
|
|
899
924
|
}) }) }) })
|
|
900
925
|
] });
|
|
901
926
|
}
|
|
902
|
-
const
|
|
927
|
+
const We = {
|
|
903
928
|
GBR: "🇬🇧",
|
|
904
929
|
DEU: "🇩🇪",
|
|
905
930
|
NLD: "🇳🇱",
|
|
@@ -930,52 +955,52 @@ const Ve = {
|
|
|
930
955
|
RUS: "🇷🇺",
|
|
931
956
|
TUR: "🇹🇷",
|
|
932
957
|
KOR: "🇰🇷"
|
|
933
|
-
},
|
|
958
|
+
}, Oe = ["🥇", "🥈", "🥉"], Ge = {
|
|
934
959
|
championship: "Championship",
|
|
935
960
|
series: "Series",
|
|
936
961
|
event: "Event"
|
|
937
|
-
},
|
|
938
|
-
function
|
|
962
|
+
}, se = ["PRACTICE", "QUALIFYING", "RACE"];
|
|
963
|
+
function ge({ position: r }) {
|
|
939
964
|
return /* @__PURE__ */ e("span", { className: r === 1 ? "pvx-rank pvx-rank--gold" : r === 2 ? "pvx-rank pvx-rank--silver" : r === 3 ? "pvx-rank pvx-rank--bronze" : "pvx-rank", children: r });
|
|
940
965
|
}
|
|
941
|
-
function
|
|
942
|
-
const n = r &&
|
|
966
|
+
function fe({ nation: r }) {
|
|
967
|
+
const n = r && We[r];
|
|
943
968
|
return n ? /* @__PURE__ */ e("span", { className: "pvx-nation-flag", title: r, children: n }) : null;
|
|
944
969
|
}
|
|
945
|
-
function
|
|
970
|
+
function ze({ sessions: r, activeSession: n, onSelect: s }) {
|
|
946
971
|
if (!r || r.length <= 1) return null;
|
|
947
972
|
const t = [...r].sort(
|
|
948
|
-
(
|
|
973
|
+
(a, i) => se.indexOf(a.type) - se.indexOf(i.type)
|
|
949
974
|
);
|
|
950
|
-
return /* @__PURE__ */ e("div", { className: "pvx-session-tabs", children: t.map((
|
|
975
|
+
return /* @__PURE__ */ e("div", { className: "pvx-session-tabs", children: t.map((a) => /* @__PURE__ */ e(
|
|
951
976
|
"button",
|
|
952
977
|
{
|
|
953
|
-
onClick: () => s(
|
|
954
|
-
className: `pvx-session-tab ${n ===
|
|
955
|
-
children:
|
|
978
|
+
onClick: () => s(a.type),
|
|
979
|
+
className: `pvx-session-tab ${n === a.type ? "pvx-session-tab--active" : ""}`,
|
|
980
|
+
children: a.type
|
|
956
981
|
},
|
|
957
|
-
|
|
982
|
+
a.type
|
|
958
983
|
)) });
|
|
959
984
|
}
|
|
960
|
-
function
|
|
961
|
-
return /* @__PURE__ */ e("span", { className: `pvx-comp-badge pvx-comp-badge--${r}`, children:
|
|
985
|
+
function Qe({ type: r }) {
|
|
986
|
+
return /* @__PURE__ */ e("span", { className: `pvx-comp-badge pvx-comp-badge--${r}`, children: Ge[r] || r });
|
|
962
987
|
}
|
|
963
988
|
function Q({ children: r, variant: n = "default" }) {
|
|
964
989
|
return /* @__PURE__ */ e("span", { className: `pvx-info-pill ${n !== "default" ? `pvx-info-pill--${n}` : ""}`, children: r });
|
|
965
990
|
}
|
|
966
|
-
function
|
|
991
|
+
function Ye(r) {
|
|
967
992
|
if (!r) return "TBD";
|
|
968
993
|
const n = new Date(r);
|
|
969
994
|
if (isNaN(n)) return "TBD";
|
|
970
995
|
const s = n.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short" }), t = n.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
971
996
|
return `${s} • ${t}`;
|
|
972
997
|
}
|
|
973
|
-
function
|
|
998
|
+
function Je(r) {
|
|
974
999
|
return r.reduce((n, s) => {
|
|
975
1000
|
var t;
|
|
976
|
-
return (t = s.splits) != null && t.length ? n ? n.map((
|
|
977
|
-
const o = s.splits[
|
|
978
|
-
return o && o <
|
|
1001
|
+
return (t = s.splits) != null && t.length ? n ? n.map((a, i) => {
|
|
1002
|
+
const o = s.splits[i];
|
|
1003
|
+
return o && o < a ? o : a;
|
|
979
1004
|
}) : [...s.splits] : n;
|
|
980
1005
|
}, null);
|
|
981
1006
|
}
|
|
@@ -985,12 +1010,12 @@ function j({ message: r = "Loading..." }) {
|
|
|
985
1010
|
function P({ message: r = "No data available." }) {
|
|
986
1011
|
return /* @__PURE__ */ e("div", { className: "pvx-empty", children: /* @__PURE__ */ e("p", { children: r }) });
|
|
987
1012
|
}
|
|
988
|
-
function
|
|
989
|
-
return n ? /* @__PURE__ */ e(j, { message: "Loading competitions..." }) : r != null && r.length ? /* @__PURE__ */ e("div", { className: `pvx-comp-grid ${
|
|
1013
|
+
function Qr({ competitions: r, isLoading: n, onSelect: s, onRegister: t, className: a }) {
|
|
1014
|
+
return n ? /* @__PURE__ */ e(j, { message: "Loading competitions..." }) : r != null && r.length ? /* @__PURE__ */ e("div", { className: `pvx-comp-grid ${a || ""}`, children: r.map((i) => /* @__PURE__ */ e(Ze, { comp: i, onSelect: s, onRegister: t || s }, i.id)) }) : /* @__PURE__ */ e(P, { message: "No competitions available." });
|
|
990
1015
|
}
|
|
991
|
-
function
|
|
992
|
-
var
|
|
993
|
-
const { cdnUrl: t } = k(),
|
|
1016
|
+
function Ze({ comp: r, onSelect: n, onRegister: s }) {
|
|
1017
|
+
var g, m, f;
|
|
1018
|
+
const { cdnUrl: t } = k(), a = r.posterCdnPath ? `${t}/${r.posterCdnPath}` : null, i = r.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, u = d && o >= d, c = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), v = (i == null ? void 0 : i.isOpen) && !c && !u, x = /* @__PURE__ */ new Date(), N = (g = r.rounds) == null ? void 0 : g.find((h) => h.startTime && new Date(h.startTime) >= x), p = ((m = r.rounds) == null ? void 0 : m.length) || 0, b = ((f = r.rounds) == null ? void 0 : f.filter((h) => h.isFinalized).length) || 0;
|
|
994
1019
|
return /* @__PURE__ */ l(
|
|
995
1020
|
"div",
|
|
996
1021
|
{
|
|
@@ -998,30 +1023,30 @@ function Qe({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
998
1023
|
onClick: () => n(r.id),
|
|
999
1024
|
role: "button",
|
|
1000
1025
|
tabIndex: 0,
|
|
1001
|
-
onKeyDown: (
|
|
1002
|
-
(
|
|
1026
|
+
onKeyDown: (h) => {
|
|
1027
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), n(r.id));
|
|
1003
1028
|
},
|
|
1004
1029
|
children: [
|
|
1005
|
-
/* @__PURE__ */ e("div", { className: "pvx-comp-card-poster", children:
|
|
1030
|
+
/* @__PURE__ */ e("div", { className: "pvx-comp-card-poster", children: a ? /* @__PURE__ */ e("img", { src: a, alt: r.name, className: "pvx-comp-card-poster-img" }) : /* @__PURE__ */ e("div", { className: "pvx-comp-card-poster-placeholder", children: /* @__PURE__ */ e(er, {}) }) }),
|
|
1006
1031
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-body", children: [
|
|
1007
1032
|
/* @__PURE__ */ e("h3", { className: "pvx-comp-card-title", children: r.name }),
|
|
1008
1033
|
r.description && /* @__PURE__ */ e("p", { className: "pvx-comp-card-desc", children: r.description }),
|
|
1009
1034
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-pills", children: [
|
|
1010
|
-
/* @__PURE__ */ e(
|
|
1035
|
+
/* @__PURE__ */ e(Qe, { type: r.type }),
|
|
1011
1036
|
r.game && /* @__PURE__ */ e(Q, { children: r.game.toUpperCase() }),
|
|
1012
|
-
r.formatDescription && r.formatDescription.split(", ").map((
|
|
1037
|
+
r.formatDescription && r.formatDescription.split(", ").map((h, y) => /* @__PURE__ */ e(Q, { variant: "format", children: h }, y))
|
|
1013
1038
|
] }),
|
|
1014
|
-
r.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: r.carsDescription.split(", ").map((
|
|
1039
|
+
r.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: r.carsDescription.split(", ").map((h, y) => /* @__PURE__ */ e(Q, { children: h }, y)) }),
|
|
1015
1040
|
/* @__PURE__ */ l("div", { className: "pvx-comp-card-schedule", children: [
|
|
1016
|
-
|
|
1041
|
+
N ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1017
1042
|
/* @__PURE__ */ e("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
|
|
1018
1043
|
" ",
|
|
1019
1044
|
"R",
|
|
1020
|
-
|
|
1045
|
+
N.roundNumber,
|
|
1021
1046
|
" ",
|
|
1022
|
-
|
|
1047
|
+
N.track || "TBD",
|
|
1023
1048
|
" — ",
|
|
1024
|
-
|
|
1049
|
+
Ye(N.startTime)
|
|
1025
1050
|
] }) : p > 0 ? /* @__PURE__ */ l("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1026
1051
|
b,
|
|
1027
1052
|
"/",
|
|
@@ -1034,12 +1059,12 @@ function Qe({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
1034
1059
|
p !== 1 ? "s" : ""
|
|
1035
1060
|
] })
|
|
1036
1061
|
] }),
|
|
1037
|
-
|
|
1038
|
-
|
|
1062
|
+
i && /* @__PURE__ */ e(
|
|
1063
|
+
Xe,
|
|
1039
1064
|
{
|
|
1040
1065
|
competitionId: r.id,
|
|
1041
1066
|
regOpen: v,
|
|
1042
|
-
isFull:
|
|
1067
|
+
isFull: u,
|
|
1043
1068
|
deadlinePassed: c,
|
|
1044
1069
|
regCount: o,
|
|
1045
1070
|
regMax: d,
|
|
@@ -1051,13 +1076,13 @@ function Qe({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
1051
1076
|
}
|
|
1052
1077
|
);
|
|
1053
1078
|
}
|
|
1054
|
-
function
|
|
1055
|
-
const { isPowerMode: d } =
|
|
1079
|
+
function Xe({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCount: a, regMax: i, onRegister: o }) {
|
|
1080
|
+
const { isPowerMode: d } = X(), u = ee(r), { data: c } = Z(r), v = (c == null ? void 0 : c.isRegistered) || !1, x = i ? a / i * 100 : 0, N = x >= 100 ? "full" : x >= 75 ? "warning" : "ok";
|
|
1056
1081
|
return /* @__PURE__ */ l("div", { className: "pvx-comp-card-reg", children: [
|
|
1057
|
-
/* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${
|
|
1058
|
-
|
|
1082
|
+
/* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${N}`, children: [
|
|
1083
|
+
a,
|
|
1059
1084
|
"/",
|
|
1060
|
-
|
|
1085
|
+
i || "∞",
|
|
1061
1086
|
" drivers"
|
|
1062
1087
|
] }) }),
|
|
1063
1088
|
/* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-action", children: v ? /* @__PURE__ */ e(
|
|
@@ -1081,7 +1106,7 @@ function Ye({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCou
|
|
|
1081
1106
|
) : /* @__PURE__ */ e(
|
|
1082
1107
|
"a",
|
|
1083
1108
|
{
|
|
1084
|
-
href:
|
|
1109
|
+
href: u,
|
|
1085
1110
|
target: "_blank",
|
|
1086
1111
|
rel: "noopener noreferrer",
|
|
1087
1112
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
@@ -1091,7 +1116,7 @@ function Ye({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCou
|
|
|
1091
1116
|
) : /* @__PURE__ */ e("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
|
|
1092
1117
|
] });
|
|
1093
1118
|
}
|
|
1094
|
-
function
|
|
1119
|
+
function er() {
|
|
1095
1120
|
return /* @__PURE__ */ l("svg", { className: "pvx-comp-trophy-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1096
1121
|
/* @__PURE__ */ e("path", { d: "M6 9H4.5a2.5 2.5 0 0 1 0-5H6" }),
|
|
1097
1122
|
/* @__PURE__ */ e("path", { d: "M18 9h1.5a2.5 2.5 0 0 0 0-5H18" }),
|
|
@@ -1101,14 +1126,14 @@ function Je() {
|
|
|
1101
1126
|
/* @__PURE__ */ e("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
1102
1127
|
] });
|
|
1103
1128
|
}
|
|
1104
|
-
function
|
|
1105
|
-
var d,
|
|
1106
|
-
const { data: s, isLoading: t } =
|
|
1107
|
-
if (t ||
|
|
1129
|
+
function Yr({ competitionId: r, className: n }) {
|
|
1130
|
+
var d, u;
|
|
1131
|
+
const { data: s, isLoading: t } = Ee(r), { data: a, isLoading: i } = Ue(r);
|
|
1132
|
+
if (t || i)
|
|
1108
1133
|
return /* @__PURE__ */ e(j, { message: "Loading standings..." });
|
|
1109
1134
|
if (!((d = s == null ? void 0 : s.standings) != null && d.length))
|
|
1110
1135
|
return /* @__PURE__ */ e(P, { message: "No standings data yet. Results will appear once rounds are finalised." });
|
|
1111
|
-
const o = ((
|
|
1136
|
+
const o = ((u = a == null ? void 0 : a.rounds) == null ? void 0 : u.filter((c) => c.isFinalized)) || [];
|
|
1112
1137
|
return /* @__PURE__ */ l("div", { className: `pvx-card ${n || ""}`, children: [
|
|
1113
1138
|
/* @__PURE__ */ e("div", { className: "pvx-card-header--split", children: /* @__PURE__ */ l("div", { className: "pvx-card-header-left", children: [
|
|
1114
1139
|
/* @__PURE__ */ e("h3", { className: "pvx-card-title", children: "Championship Standings" }),
|
|
@@ -1141,7 +1166,7 @@ function Or({ competitionId: r, className: n }) {
|
|
|
1141
1166
|
))
|
|
1142
1167
|
] }) }),
|
|
1143
1168
|
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: s.standings.map((c) => /* @__PURE__ */ e(
|
|
1144
|
-
|
|
1169
|
+
rr,
|
|
1145
1170
|
{
|
|
1146
1171
|
driver: c,
|
|
1147
1172
|
finalizedRounds: o
|
|
@@ -1151,27 +1176,27 @@ function Or({ competitionId: r, className: n }) {
|
|
|
1151
1176
|
] }) })
|
|
1152
1177
|
] });
|
|
1153
1178
|
}
|
|
1154
|
-
function
|
|
1155
|
-
var o, d,
|
|
1179
|
+
function rr({ driver: r, finalizedRounds: n }) {
|
|
1180
|
+
var o, d, u;
|
|
1156
1181
|
const s = r.position <= 3, t = new Map(
|
|
1157
1182
|
((o = r.roundResults) == null ? void 0 : o.map((c) => [c.roundNumber, c])) || []
|
|
1158
|
-
),
|
|
1183
|
+
), a = ((d = r.roundResults) == null ? void 0 : d.filter((c) => c.position === 1).length) || 0, i = ((u = r.roundResults) == null ? void 0 : u.filter((c) => c.position <= 3).length) || 0;
|
|
1159
1184
|
return /* @__PURE__ */ l("tr", { className: `pvx-row ${s ? "pvx-row--podium" : ""}`, children: [
|
|
1160
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(
|
|
1185
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(ge, { position: r.position }) }),
|
|
1161
1186
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1162
|
-
/* @__PURE__ */ e(
|
|
1187
|
+
/* @__PURE__ */ e(fe, { nation: r.nation }),
|
|
1163
1188
|
r.driverName
|
|
1164
1189
|
] }),
|
|
1165
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1166
1190
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: a || "-" }),
|
|
1191
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1167
1192
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: r.totalPoints }),
|
|
1168
1193
|
n.map((c) => {
|
|
1169
|
-
const v = t.get(c.roundNumber),
|
|
1194
|
+
const v = t.get(c.roundNumber), x = v == null ? void 0 : v.dropped;
|
|
1170
1195
|
return /* @__PURE__ */ e(
|
|
1171
1196
|
"td",
|
|
1172
1197
|
{
|
|
1173
|
-
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!
|
|
1174
|
-
children: v ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${
|
|
1198
|
+
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!x && (v == null ? void 0 : v.position) <= 3 ? "pvx-standings-cell--podium" : ""}`,
|
|
1199
|
+
children: v ? /* @__PURE__ */ l("div", { className: `pvx-standings-round-cell ${x ? "pvx-standings-round-cell--dropped" : ""}`, children: [
|
|
1175
1200
|
/* @__PURE__ */ l("span", { className: "pvx-standings-round-pos", children: [
|
|
1176
1201
|
"P",
|
|
1177
1202
|
v.position
|
|
@@ -1184,14 +1209,14 @@ function Ze({ driver: r, finalizedRounds: n }) {
|
|
|
1184
1209
|
})
|
|
1185
1210
|
] });
|
|
1186
1211
|
}
|
|
1187
|
-
function
|
|
1188
|
-
var
|
|
1189
|
-
const { data: t, isLoading:
|
|
1190
|
-
if (
|
|
1212
|
+
function Jr({ competitionId: r, roundNumber: n, className: s }) {
|
|
1213
|
+
var u;
|
|
1214
|
+
const { data: t, isLoading: a } = Fe(r, n);
|
|
1215
|
+
if (a)
|
|
1191
1216
|
return /* @__PURE__ */ e(j, { message: "Loading results..." });
|
|
1192
1217
|
if (!t)
|
|
1193
1218
|
return /* @__PURE__ */ e(P, { message: "No results for this round." });
|
|
1194
|
-
const o = (t.sessions || []).find((c) => c.type === "RACE"), d = (
|
|
1219
|
+
const o = (t.sessions || []).find((c) => c.type === "RACE"), d = (u = o == null ? void 0 : o.results) == null ? void 0 : u.filter((c) => c.position <= 3).sort((c, v) => c.position - v.position);
|
|
1195
1220
|
return /* @__PURE__ */ l("div", { className: `pvx-round-results ${s || ""}`, children: [
|
|
1196
1221
|
/* @__PURE__ */ l("div", { className: "pvx-round-results-header", children: [
|
|
1197
1222
|
/* @__PURE__ */ l("div", { children: [
|
|
@@ -1207,37 +1232,37 @@ function Gr({ competitionId: r, roundNumber: n, className: s }) {
|
|
|
1207
1232
|
}) })
|
|
1208
1233
|
] }),
|
|
1209
1234
|
(d == null ? void 0 : d.length) > 0 && /* @__PURE__ */ e("div", { className: "pvx-round-podium-summary", children: d.map((c) => /* @__PURE__ */ l("span", { className: "pvx-round-podium-item", children: [
|
|
1210
|
-
/* @__PURE__ */ e("span", { children:
|
|
1235
|
+
/* @__PURE__ */ e("span", { children: Oe[c.position - 1] }),
|
|
1211
1236
|
/* @__PURE__ */ e("span", { children: c.driverName })
|
|
1212
1237
|
] }, c.driverId)) })
|
|
1213
1238
|
] }),
|
|
1214
|
-
/* @__PURE__ */ e(
|
|
1239
|
+
/* @__PURE__ */ e(nr, { round: t })
|
|
1215
1240
|
] });
|
|
1216
1241
|
}
|
|
1217
|
-
function
|
|
1218
|
-
var d,
|
|
1219
|
-
const [s, t] = M(null),
|
|
1220
|
-
if (!
|
|
1242
|
+
function nr({ round: r, className: n }) {
|
|
1243
|
+
var d, u;
|
|
1244
|
+
const [s, t] = M(null), a = (r == null ? void 0 : r.sessions) || [];
|
|
1245
|
+
if (!a.length)
|
|
1221
1246
|
return /* @__PURE__ */ e(P, { message: "No session data for this round." });
|
|
1222
|
-
const
|
|
1247
|
+
const i = s || ((d = a.find((c) => c.type === "RACE")) == null ? void 0 : d.type) || ((u = a[0]) == null ? void 0 : u.type), o = a.find((c) => c.type === i) || a[0];
|
|
1223
1248
|
return /* @__PURE__ */ l("div", { className: n || "", children: [
|
|
1224
1249
|
/* @__PURE__ */ e(
|
|
1225
|
-
|
|
1250
|
+
ze,
|
|
1226
1251
|
{
|
|
1227
|
-
sessions:
|
|
1228
|
-
activeSession:
|
|
1252
|
+
sessions: a,
|
|
1253
|
+
activeSession: i,
|
|
1229
1254
|
onSelect: t
|
|
1230
1255
|
}
|
|
1231
1256
|
),
|
|
1232
|
-
/* @__PURE__ */ e(
|
|
1257
|
+
/* @__PURE__ */ e(tr, { session: o })
|
|
1233
1258
|
] });
|
|
1234
1259
|
}
|
|
1235
|
-
function
|
|
1260
|
+
function tr({ session: r }) {
|
|
1236
1261
|
var t;
|
|
1237
1262
|
const n = r.type === "RACE";
|
|
1238
1263
|
if (!((t = r.results) != null && t.length))
|
|
1239
1264
|
return /* @__PURE__ */ e(P, { message: `No results for ${r.type}.` });
|
|
1240
|
-
const s =
|
|
1265
|
+
const s = Je(r.results);
|
|
1241
1266
|
return /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ l("table", { className: "pvx-table", children: [
|
|
1242
1267
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { className: "pvx-thead-row", children: [
|
|
1243
1268
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "Pos" }),
|
|
@@ -1250,24 +1275,24 @@ function er({ session: r }) {
|
|
|
1250
1275
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-th--center", children: "Points" })
|
|
1251
1276
|
] })
|
|
1252
1277
|
] }) }),
|
|
1253
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: r.results.map((
|
|
1254
|
-
|
|
1278
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: r.results.map((a, i) => /* @__PURE__ */ e(
|
|
1279
|
+
sr,
|
|
1255
1280
|
{
|
|
1256
|
-
result:
|
|
1281
|
+
result: a,
|
|
1257
1282
|
isRace: n,
|
|
1258
1283
|
fastestSplits: s,
|
|
1259
|
-
rowIndex:
|
|
1284
|
+
rowIndex: i
|
|
1260
1285
|
},
|
|
1261
|
-
|
|
1286
|
+
a.driverId || i
|
|
1262
1287
|
)) })
|
|
1263
1288
|
] }) });
|
|
1264
1289
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const
|
|
1267
|
-
return /* @__PURE__ */ l("tr", { className: `pvx-row ${
|
|
1268
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(
|
|
1290
|
+
function sr({ result: r, isRace: n, fastestSplits: s, rowIndex: t }) {
|
|
1291
|
+
const a = r.position <= 3;
|
|
1292
|
+
return /* @__PURE__ */ l("tr", { className: `pvx-row ${a ? "pvx-row--podium" : ""}`, children: [
|
|
1293
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(ge, { position: r.position }) }),
|
|
1269
1294
|
/* @__PURE__ */ l("td", { className: "pvx-td pvx-td--primary", children: [
|
|
1270
|
-
/* @__PURE__ */ e(
|
|
1295
|
+
/* @__PURE__ */ e(fe, { nation: r.nation }),
|
|
1271
1296
|
r.driverName,
|
|
1272
1297
|
r.carNumber != null && /* @__PURE__ */ l("span", { className: "pvx-car-number", children: [
|
|
1273
1298
|
"#",
|
|
@@ -1277,7 +1302,7 @@ function rr({ result: r, isRace: n, fastestSplits: s, rowIndex: t }) {
|
|
|
1277
1302
|
] }),
|
|
1278
1303
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-sm", children: I(r.carId) }),
|
|
1279
1304
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--mono", children: /* @__PURE__ */ e(
|
|
1280
|
-
|
|
1305
|
+
ar,
|
|
1281
1306
|
{
|
|
1282
1307
|
bestLap: r.bestLapFormatted,
|
|
1283
1308
|
hasBestLap: r.hasBestLap,
|
|
@@ -1301,30 +1326,30 @@ function rr({ result: r, isRace: n, fastestSplits: s, rowIndex: t }) {
|
|
|
1301
1326
|
] })
|
|
1302
1327
|
] });
|
|
1303
1328
|
}
|
|
1304
|
-
function
|
|
1329
|
+
function ar({ bestLap: r, hasBestLap: n, splits: s, fastestSplits: t, showAbove: a }) {
|
|
1305
1330
|
return r ? /* @__PURE__ */ l("span", { className: `pvx-best-lap-cell ${n ? "pvx-best-lap-cell--fastest" : ""}`, children: [
|
|
1306
1331
|
/* @__PURE__ */ e("span", { className: "pvx-best-lap-time", children: r }),
|
|
1307
|
-
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ e("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ e("span", { className: `pvx-splits-tooltip ${
|
|
1308
|
-
const d = t &&
|
|
1332
|
+
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ e("span", { className: "pvx-splits-tooltip-anchor", children: /* @__PURE__ */ e("span", { className: `pvx-splits-tooltip ${a ? "" : "pvx-splits-tooltip--above"}`, children: s.map((i, o) => {
|
|
1333
|
+
const d = t && i === t[o];
|
|
1309
1334
|
return /* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-row", children: [
|
|
1310
1335
|
/* @__PURE__ */ l("span", { className: "pvx-splits-tooltip-label", children: [
|
|
1311
1336
|
"S",
|
|
1312
1337
|
o + 1
|
|
1313
1338
|
] }),
|
|
1314
|
-
/* @__PURE__ */ e("span", { className: d ? "pvx-splits-tooltip-best" : "", children:
|
|
1339
|
+
/* @__PURE__ */ e("span", { className: d ? "pvx-splits-tooltip-best" : "", children: i })
|
|
1315
1340
|
] }, o);
|
|
1316
1341
|
}) }) })
|
|
1317
1342
|
] }) : /* @__PURE__ */ e("span", { className: "pvx-td--muted", children: "-" });
|
|
1318
1343
|
}
|
|
1319
|
-
function
|
|
1320
|
-
const { getSteamId: s } = k(), { data: t, isLoading:
|
|
1321
|
-
if (
|
|
1344
|
+
function Zr({ competitionId: r, className: n }) {
|
|
1345
|
+
const { getSteamId: s } = k(), { data: t, isLoading: a } = le(r), i = s();
|
|
1346
|
+
if (a)
|
|
1322
1347
|
return /* @__PURE__ */ e(j, { message: "Loading drivers..." });
|
|
1323
1348
|
const o = (t == null ? void 0 : t.drivers) || (t == null ? void 0 : t.entries) || [];
|
|
1324
1349
|
return o.length ? /* @__PURE__ */ e("div", { className: `pvx-entry-grid ${n || ""}`, children: o.map((d) => {
|
|
1325
1350
|
var c, v;
|
|
1326
|
-
const
|
|
1327
|
-
return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${
|
|
1351
|
+
const u = i && d.steamId === i;
|
|
1352
|
+
return /* @__PURE__ */ l("div", { className: `pvx-entry-card ${u ? "pvx-entry-card--you" : ""}`, children: [
|
|
1328
1353
|
d.avatarUrl ? /* @__PURE__ */ e(
|
|
1329
1354
|
"img",
|
|
1330
1355
|
{
|
|
@@ -1335,29 +1360,29 @@ function zr({ competitionId: r, className: n }) {
|
|
|
1335
1360
|
) : /* @__PURE__ */ e("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((v = (c = d.displayName) == null ? void 0 : c.charAt(0)) == null ? void 0 : v.toUpperCase()) || "?" }),
|
|
1336
1361
|
/* @__PURE__ */ l("span", { className: "pvx-entry-name", children: [
|
|
1337
1362
|
d.displayName,
|
|
1338
|
-
|
|
1363
|
+
u && /* @__PURE__ */ e("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1339
1364
|
] })
|
|
1340
1365
|
] }, d.steamId || d.driverId);
|
|
1341
1366
|
}) }) : /* @__PURE__ */ e(P, { message: "No drivers registered yet." });
|
|
1342
1367
|
}
|
|
1343
|
-
function
|
|
1368
|
+
function Xr({
|
|
1344
1369
|
competitionId: r,
|
|
1345
1370
|
driverData: n,
|
|
1346
1371
|
className: s,
|
|
1347
1372
|
children: t
|
|
1348
1373
|
}) {
|
|
1349
|
-
const { data:
|
|
1350
|
-
o &&
|
|
1374
|
+
const { data: a, isLoading: i } = Z(r), { isPowerMode: o } = X(), d = ee(r), u = de(r), c = pe(r), v = (a == null ? void 0 : a.isRegistered) || !1, x = i || u.isPending || c.isPending, N = u.error || c.error || null, p = () => {
|
|
1375
|
+
o && u.mutate(n || {});
|
|
1351
1376
|
}, b = () => {
|
|
1352
1377
|
o && c.mutate();
|
|
1353
1378
|
};
|
|
1354
|
-
return typeof t == "function" ? t({ isRegistered: v, isLoading:
|
|
1379
|
+
return typeof t == "function" ? t({ isRegistered: v, isLoading: x, register: p, withdraw: b, error: N, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ e(
|
|
1355
1380
|
"button",
|
|
1356
1381
|
{
|
|
1357
1382
|
className: `pvx-comp-register-btn ${s || ""}`,
|
|
1358
1383
|
onClick: v ? b : p,
|
|
1359
|
-
disabled:
|
|
1360
|
-
children:
|
|
1384
|
+
disabled: x,
|
|
1385
|
+
children: x ? "Loading..." : v ? "Withdraw" : "Register"
|
|
1361
1386
|
}
|
|
1362
1387
|
) : /* @__PURE__ */ e(
|
|
1363
1388
|
"a",
|
|
@@ -1370,44 +1395,44 @@ function Qr({
|
|
|
1370
1395
|
}
|
|
1371
1396
|
);
|
|
1372
1397
|
}
|
|
1373
|
-
function
|
|
1374
|
-
const { getSteamId:
|
|
1375
|
-
return
|
|
1376
|
-
|
|
1398
|
+
function en({ competitionId: r, registration: n, onWithdrawSuccess: s, className: t }) {
|
|
1399
|
+
const { getSteamId: a } = k(), { isPowerMode: i } = X(), o = ee(r), { data: d, isLoading: u } = Z(r), { data: c, isLoading: v } = le(r), x = de(r), N = pe(r), p = a(), b = (d == null ? void 0 : d.isRegistered) || !1, g = (c == null ? void 0 : c.drivers) || (c == null ? void 0 : c.entries) || [], m = n || {}, f = g.length || m.currentCount || 0, h = m.maxParticipants && f >= m.maxParticipants, y = m.deadline && new Date(m.deadline) < /* @__PURE__ */ new Date(), L = m.isOpen && !y && !h;
|
|
1400
|
+
return u || v ? /* @__PURE__ */ e(j, { message: "Loading registration..." }) : b ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e(
|
|
1401
|
+
or,
|
|
1377
1402
|
{
|
|
1378
1403
|
competitionId: r,
|
|
1379
|
-
drivers:
|
|
1404
|
+
drivers: g,
|
|
1380
1405
|
steamId: p,
|
|
1381
|
-
isPowerMode:
|
|
1406
|
+
isPowerMode: i,
|
|
1382
1407
|
registrationUrl: o,
|
|
1383
|
-
withdrawMutation:
|
|
1408
|
+
withdrawMutation: N,
|
|
1384
1409
|
onWithdrawSuccess: s,
|
|
1385
|
-
registration:
|
|
1410
|
+
registration: m
|
|
1386
1411
|
}
|
|
1387
|
-
) }) :
|
|
1388
|
-
|
|
1412
|
+
) }) : L ? p ? i ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e(
|
|
1413
|
+
ir,
|
|
1389
1414
|
{
|
|
1390
1415
|
competitionId: r,
|
|
1391
|
-
registerMutation:
|
|
1392
|
-
registration:
|
|
1416
|
+
registerMutation: x,
|
|
1417
|
+
registration: m
|
|
1393
1418
|
}
|
|
1394
|
-
) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children:
|
|
1395
|
-
/* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children:
|
|
1396
|
-
|
|
1419
|
+
) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: i ? /* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ l("div", { className: `pvx-reg-panel ${t || ""}`, children: [
|
|
1420
|
+
/* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: h ? "Registration is full." : y ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1421
|
+
g.length > 0 && /* @__PURE__ */ e(Ne, { drivers: g, steamId: p })
|
|
1397
1422
|
] });
|
|
1398
1423
|
}
|
|
1399
|
-
function
|
|
1400
|
-
const [t,
|
|
1424
|
+
function ir({ competitionId: r, registerMutation: n, registration: s }) {
|
|
1425
|
+
const [t, a] = M(""), [i, o] = M("intermediate"), [d, u] = M(""), c = (p) => {
|
|
1401
1426
|
p.preventDefault(), n.mutate({
|
|
1402
1427
|
discordUsername: t || void 0,
|
|
1403
|
-
experience:
|
|
1428
|
+
experience: i,
|
|
1404
1429
|
comments: d || void 0
|
|
1405
1430
|
});
|
|
1406
|
-
}, v = s || {},
|
|
1431
|
+
}, v = s || {}, x = v.currentCount || 0, N = v.maxParticipants;
|
|
1407
1432
|
return /* @__PURE__ */ l("form", { className: "pvx-reg-form", onSubmit: c, children: [
|
|
1408
1433
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1409
1434
|
/* @__PURE__ */ e("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1410
|
-
|
|
1435
|
+
N && /* @__PURE__ */ e(be, { count: x, max: N })
|
|
1411
1436
|
] }),
|
|
1412
1437
|
n.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: n.error.message || "Registration failed" }),
|
|
1413
1438
|
/* @__PURE__ */ l("div", { className: "pvx-reg-field", children: [
|
|
@@ -1423,7 +1448,7 @@ function tr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1423
1448
|
className: "pvx-reg-input",
|
|
1424
1449
|
placeholder: "e.g. username",
|
|
1425
1450
|
value: t,
|
|
1426
|
-
onChange: (p) =>
|
|
1451
|
+
onChange: (p) => a(p.target.value)
|
|
1427
1452
|
}
|
|
1428
1453
|
)
|
|
1429
1454
|
] }),
|
|
@@ -1434,7 +1459,7 @@ function tr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1434
1459
|
{
|
|
1435
1460
|
id: `pvx-exp-${r}`,
|
|
1436
1461
|
className: "pvx-reg-select",
|
|
1437
|
-
value:
|
|
1462
|
+
value: i,
|
|
1438
1463
|
onChange: (p) => o(p.target.value),
|
|
1439
1464
|
children: [
|
|
1440
1465
|
/* @__PURE__ */ e("option", { value: "beginner", children: "Beginner" }),
|
|
@@ -1457,7 +1482,7 @@ function tr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1457
1482
|
rows: 3,
|
|
1458
1483
|
placeholder: "Anything the organisers should know?",
|
|
1459
1484
|
value: d,
|
|
1460
|
-
onChange: (p) =>
|
|
1485
|
+
onChange: (p) => u(p.target.value)
|
|
1461
1486
|
}
|
|
1462
1487
|
)
|
|
1463
1488
|
] }),
|
|
@@ -1472,22 +1497,22 @@ function tr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1472
1497
|
) })
|
|
1473
1498
|
] });
|
|
1474
1499
|
}
|
|
1475
|
-
function
|
|
1476
|
-
const [
|
|
1477
|
-
|
|
1500
|
+
function or({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1501
|
+
const [u, c] = M(!1), v = () => {
|
|
1502
|
+
i.mutate(void 0, {
|
|
1478
1503
|
onSuccess: () => {
|
|
1479
1504
|
c(!1), o && o();
|
|
1480
1505
|
}
|
|
1481
1506
|
});
|
|
1482
|
-
},
|
|
1507
|
+
}, x = d || {}, N = n.length || x.currentCount || 0, p = x.maxParticipants;
|
|
1483
1508
|
return /* @__PURE__ */ l(A, { children: [
|
|
1484
1509
|
/* @__PURE__ */ l("div", { className: "pvx-reg-form-header", children: [
|
|
1485
1510
|
/* @__PURE__ */ e("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1486
|
-
p && /* @__PURE__ */ e(
|
|
1511
|
+
p && /* @__PURE__ */ e(be, { count: N, max: p })
|
|
1487
1512
|
] }),
|
|
1488
|
-
/* @__PURE__ */ e(
|
|
1489
|
-
|
|
1490
|
-
t ? /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children:
|
|
1513
|
+
/* @__PURE__ */ e(Ne, { drivers: n, steamId: s }),
|
|
1514
|
+
i.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
1515
|
+
t ? /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children: u ? /* @__PURE__ */ l("div", { className: "pvx-reg-confirm", children: [
|
|
1491
1516
|
/* @__PURE__ */ e("p", { className: "pvx-reg-confirm-text", children: "Are you sure you want to unregister?" }),
|
|
1492
1517
|
/* @__PURE__ */ l("div", { className: "pvx-reg-confirm-actions", children: [
|
|
1493
1518
|
/* @__PURE__ */ e(
|
|
@@ -1505,8 +1530,8 @@ function sr({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registra
|
|
|
1505
1530
|
type: "button",
|
|
1506
1531
|
className: "pvx-reg-danger-btn",
|
|
1507
1532
|
onClick: v,
|
|
1508
|
-
disabled:
|
|
1509
|
-
children:
|
|
1533
|
+
disabled: i.isPending,
|
|
1534
|
+
children: i.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
1510
1535
|
}
|
|
1511
1536
|
)
|
|
1512
1537
|
] })
|
|
@@ -1518,28 +1543,28 @@ function sr({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registra
|
|
|
1518
1543
|
onClick: () => c(!0),
|
|
1519
1544
|
children: "Unregister"
|
|
1520
1545
|
}
|
|
1521
|
-
) }) : /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ e("a", { href:
|
|
1546
|
+
) }) : /* @__PURE__ */ e("div", { className: "pvx-reg-actions", children: /* @__PURE__ */ e("a", { href: a, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Manage on PitVox" }) })
|
|
1522
1547
|
] });
|
|
1523
1548
|
}
|
|
1524
|
-
function
|
|
1549
|
+
function Ne({ drivers: r, steamId: n }) {
|
|
1525
1550
|
if (!r.length)
|
|
1526
1551
|
return /* @__PURE__ */ e("div", { className: "pvx-reg-no-drivers", children: "No drivers registered yet." });
|
|
1527
|
-
const s = [...r].sort((t,
|
|
1528
|
-
const
|
|
1529
|
-
return
|
|
1552
|
+
const s = [...r].sort((t, a) => {
|
|
1553
|
+
const i = n && t.steamId === n ? -1 : 0, o = n && a.steamId === n ? -1 : 0;
|
|
1554
|
+
return i - o;
|
|
1530
1555
|
});
|
|
1531
1556
|
return /* @__PURE__ */ e("div", { className: "pvx-reg-driver-list", children: s.map((t) => {
|
|
1532
|
-
var
|
|
1533
|
-
const
|
|
1557
|
+
var i, o;
|
|
1558
|
+
const a = n && t.steamId === n;
|
|
1534
1559
|
return /* @__PURE__ */ l(
|
|
1535
1560
|
"div",
|
|
1536
1561
|
{
|
|
1537
|
-
className: `pvx-reg-driver-row ${
|
|
1562
|
+
className: `pvx-reg-driver-row ${a ? "pvx-reg-driver-row--you" : ""}`,
|
|
1538
1563
|
children: [
|
|
1539
|
-
t.avatarUrl ? /* @__PURE__ */ e("img", { src: t.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ e("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (
|
|
1564
|
+
t.avatarUrl ? /* @__PURE__ */ e("img", { src: t.avatarUrl, alt: "", className: "pvx-reg-driver-avatar" }) : /* @__PURE__ */ e("div", { className: "pvx-reg-driver-avatar pvx-reg-driver-avatar--placeholder", children: ((o = (i = t.displayName) == null ? void 0 : i.charAt(0)) == null ? void 0 : o.toUpperCase()) || "?" }),
|
|
1540
1565
|
/* @__PURE__ */ l("span", { className: "pvx-reg-driver-name", children: [
|
|
1541
1566
|
t.displayName,
|
|
1542
|
-
|
|
1567
|
+
a && /* @__PURE__ */ e("span", { className: "pvx-entry-you", children: " (you)" })
|
|
1543
1568
|
] })
|
|
1544
1569
|
]
|
|
1545
1570
|
},
|
|
@@ -1547,7 +1572,7 @@ function fe({ drivers: r, steamId: n }) {
|
|
|
1547
1572
|
);
|
|
1548
1573
|
}) });
|
|
1549
1574
|
}
|
|
1550
|
-
function
|
|
1575
|
+
function be({ count: r, max: n }) {
|
|
1551
1576
|
const s = n ? r / n * 100 : 0, t = s >= 100 ? "full" : s >= 75 ? "warning" : "ok";
|
|
1552
1577
|
return /* @__PURE__ */ l("span", { className: `pvx-reg-capacity pvx-reg-capacity--${t}`, children: [
|
|
1553
1578
|
r,
|
|
@@ -1556,10 +1581,10 @@ function Ne({ count: r, max: n }) {
|
|
|
1556
1581
|
" drivers"
|
|
1557
1582
|
] });
|
|
1558
1583
|
}
|
|
1559
|
-
function
|
|
1560
|
-
const { cdnUrl: n } = k(), s =
|
|
1584
|
+
function cr(r) {
|
|
1585
|
+
const { cdnUrl: n } = k(), s = C({
|
|
1561
1586
|
queryKey: ["pitvox", "laps", "global", r],
|
|
1562
|
-
queryFn: () =>
|
|
1587
|
+
queryFn: () => R(n, `laps/${r}.json`),
|
|
1563
1588
|
enabled: !!r,
|
|
1564
1589
|
staleTime: 3e4,
|
|
1565
1590
|
refetchInterval: 3e4
|
|
@@ -1582,22 +1607,22 @@ function ar(r) {
|
|
|
1582
1607
|
} : null
|
|
1583
1608
|
};
|
|
1584
1609
|
}
|
|
1585
|
-
function
|
|
1586
|
-
const { cdnUrl: n, partnerSlug: s } = k(), { gameVersion: t, enabled:
|
|
1587
|
-
return
|
|
1610
|
+
function ye(r = {}) {
|
|
1611
|
+
const { cdnUrl: n, partnerSlug: s } = k(), { gameVersion: t, enabled: a = !0 } = r, i = t ? `v/${t}/` : "", o = J(s, `${i}ratings.json`);
|
|
1612
|
+
return C({
|
|
1588
1613
|
queryKey: ["pitvox", "ratings", s, t || null],
|
|
1589
|
-
queryFn: () =>
|
|
1614
|
+
queryFn: () => R(n, o),
|
|
1590
1615
|
staleTime: 3e4,
|
|
1591
1616
|
refetchInterval: 3e4,
|
|
1592
|
-
enabled:
|
|
1617
|
+
enabled: a
|
|
1593
1618
|
});
|
|
1594
1619
|
}
|
|
1595
|
-
function
|
|
1620
|
+
function lr(r) {
|
|
1596
1621
|
var t;
|
|
1597
|
-
const n =
|
|
1598
|
-
var
|
|
1599
|
-
return !((
|
|
1600
|
-
(
|
|
1622
|
+
const n = ye(), s = w(() => {
|
|
1623
|
+
var a;
|
|
1624
|
+
return !((a = n.data) != null && a.drivers) || !r ? null : n.data.drivers.find(
|
|
1625
|
+
(i) => i.identifier === r
|
|
1601
1626
|
) || null;
|
|
1602
1627
|
}, [(t = n.data) == null ? void 0 : t.drivers, r]);
|
|
1603
1628
|
return {
|
|
@@ -1613,48 +1638,48 @@ function ir(r) {
|
|
|
1613
1638
|
} : null
|
|
1614
1639
|
};
|
|
1615
1640
|
}
|
|
1616
|
-
function
|
|
1617
|
-
const n =
|
|
1641
|
+
function rn(r = {}) {
|
|
1642
|
+
const n = ye(r);
|
|
1618
1643
|
return {
|
|
1619
1644
|
data: n.data || null,
|
|
1620
1645
|
isLoading: n.isLoading,
|
|
1621
1646
|
error: n.error
|
|
1622
1647
|
};
|
|
1623
1648
|
}
|
|
1624
|
-
function
|
|
1625
|
-
const { cdnUrl: r, partnerSlug: n, getSteamId: s, onFetchServerPassword: t } = k(),
|
|
1649
|
+
function dr() {
|
|
1650
|
+
const { cdnUrl: r, partnerSlug: n, getSteamId: s, onFetchServerPassword: t } = k(), a = s(), { data: i, isLoading: o } = C({
|
|
1626
1651
|
queryKey: ["pitvox", "competitions", n],
|
|
1627
1652
|
queryFn: async () => {
|
|
1628
|
-
const p = await
|
|
1653
|
+
const p = await R(r, "competitions/index.json");
|
|
1629
1654
|
return p != null && p.competitions ? p.competitions.filter((b) => b.partnerSlug === n) : [];
|
|
1630
1655
|
},
|
|
1631
1656
|
staleTime: 6e4
|
|
1632
|
-
}), d = (
|
|
1657
|
+
}), d = (i == null ? void 0 : i.map((p) => p.id)) || [], u = te({
|
|
1633
1658
|
queries: d.map((p) => ({
|
|
1634
1659
|
queryKey: ["pitvox", "competition", n, p, "entrylist"],
|
|
1635
|
-
queryFn: () =>
|
|
1636
|
-
enabled: !!
|
|
1660
|
+
queryFn: () => R(r, `competitions/${n}/${p}/entrylist.json`),
|
|
1661
|
+
enabled: !!a && d.length > 0,
|
|
1637
1662
|
staleTime: 6e4
|
|
1638
1663
|
}))
|
|
1639
|
-
}), c =
|
|
1640
|
-
var
|
|
1641
|
-
if (!
|
|
1664
|
+
}), c = u.some((p) => p.isLoading), v = w(() => {
|
|
1665
|
+
var g, m;
|
|
1666
|
+
if (!i || !a || c) return [];
|
|
1642
1667
|
const p = /* @__PURE__ */ new Date(), b = [];
|
|
1643
|
-
for (let
|
|
1644
|
-
const
|
|
1645
|
-
if (!((
|
|
1646
|
-
const $ =
|
|
1668
|
+
for (let f = 0; f < i.length; f++) {
|
|
1669
|
+
const h = i[f], y = (g = u[f]) == null ? void 0 : g.data;
|
|
1670
|
+
if (!((m = y == null ? void 0 : y.drivers) == null ? void 0 : m.some((S) => S.steamId === a))) continue;
|
|
1671
|
+
const $ = h.rounds || [];
|
|
1647
1672
|
for (const S of $)
|
|
1648
1673
|
S.isFinalized || !S.startTime || new Date(S.startTime) <= p || b.push({
|
|
1649
|
-
competitionId:
|
|
1650
|
-
competitionName:
|
|
1674
|
+
competitionId: h.id,
|
|
1675
|
+
competitionName: h.name,
|
|
1651
1676
|
roundNumber: S.roundNumber,
|
|
1652
1677
|
track: S.track || "TBD",
|
|
1653
1678
|
startTime: S.startTime
|
|
1654
1679
|
});
|
|
1655
1680
|
}
|
|
1656
|
-
return b.sort((
|
|
1657
|
-
}, [
|
|
1681
|
+
return b.sort((f, h) => new Date(f.startTime) - new Date(h.startTime)), b.length > 0 && (b[0].isNext = !0), b;
|
|
1682
|
+
}, [i, a, c, u]), x = te({
|
|
1658
1683
|
queries: v.map((p) => ({
|
|
1659
1684
|
queryKey: ["pitvox", "serverInfo", p.competitionId, p.roundNumber],
|
|
1660
1685
|
queryFn: () => t(p.competitionId, p.roundNumber),
|
|
@@ -1666,43 +1691,43 @@ function or() {
|
|
|
1666
1691
|
});
|
|
1667
1692
|
return {
|
|
1668
1693
|
data: w(() => v.length ? t ? v.map((p, b) => {
|
|
1669
|
-
var
|
|
1670
|
-
const
|
|
1671
|
-
return
|
|
1694
|
+
var m;
|
|
1695
|
+
const g = (m = x[b]) == null ? void 0 : m.data;
|
|
1696
|
+
return g != null && g.success ? {
|
|
1672
1697
|
...p,
|
|
1673
|
-
serverAddress:
|
|
1674
|
-
serverPassword:
|
|
1698
|
+
serverAddress: g.serverAddress || null,
|
|
1699
|
+
serverPassword: g.serverPassword || null
|
|
1675
1700
|
} : p;
|
|
1676
|
-
}) : v : [], [v, t,
|
|
1677
|
-
isLoading: o || !!
|
|
1701
|
+
}) : v : [], [v, t, x]),
|
|
1702
|
+
isLoading: o || !!a && c
|
|
1678
1703
|
};
|
|
1679
1704
|
}
|
|
1680
|
-
function
|
|
1705
|
+
function pr() {
|
|
1681
1706
|
const { onFetchNotifications: r } = k();
|
|
1682
1707
|
return !!r;
|
|
1683
1708
|
}
|
|
1684
|
-
function
|
|
1685
|
-
const { onFetchNotifications: n, partnerSlug: s } = k(), { limit: t = 20, unreadOnly:
|
|
1686
|
-
return
|
|
1687
|
-
queryKey: ["pitvox", "notifications", s, { limit: t, unreadOnly:
|
|
1688
|
-
queryFn: () => n({ limit: t, unreadOnly:
|
|
1709
|
+
function ur(r = {}) {
|
|
1710
|
+
const { onFetchNotifications: n, partnerSlug: s } = k(), { limit: t = 20, unreadOnly: a = !1 } = r;
|
|
1711
|
+
return C({
|
|
1712
|
+
queryKey: ["pitvox", "notifications", s, { limit: t, unreadOnly: a }],
|
|
1713
|
+
queryFn: () => n({ limit: t, unreadOnly: a }),
|
|
1689
1714
|
enabled: !!n,
|
|
1690
1715
|
staleTime: 3e4,
|
|
1691
1716
|
refetchInterval: 3e4
|
|
1692
1717
|
});
|
|
1693
1718
|
}
|
|
1694
|
-
function
|
|
1695
|
-
const { onFetchNotifications: r, partnerSlug: n } = k(), { data: s, isLoading: t } =
|
|
1719
|
+
function nn() {
|
|
1720
|
+
const { onFetchNotifications: r, partnerSlug: n } = k(), { data: s, isLoading: t } = C({
|
|
1696
1721
|
queryKey: ["pitvox", "notifications", n, { limit: 1, unreadOnly: !1 }],
|
|
1697
1722
|
queryFn: () => r({ limit: 1 }),
|
|
1698
1723
|
enabled: !!r,
|
|
1699
1724
|
staleTime: 3e4,
|
|
1700
1725
|
refetchInterval: 3e4,
|
|
1701
|
-
select: (
|
|
1726
|
+
select: (a) => (a == null ? void 0 : a.unreadCount) ?? 0
|
|
1702
1727
|
});
|
|
1703
1728
|
return { count: s ?? 0, isLoading: t };
|
|
1704
1729
|
}
|
|
1705
|
-
function
|
|
1730
|
+
function mr() {
|
|
1706
1731
|
const { onMarkNotificationRead: r, partnerSlug: n } = k(), s = U();
|
|
1707
1732
|
return H({
|
|
1708
1733
|
mutationFn: (t) => {
|
|
@@ -1710,21 +1735,21 @@ function dr() {
|
|
|
1710
1735
|
throw new Error("No onMarkNotificationRead callback provided to PitVoxPartnerProvider.");
|
|
1711
1736
|
return r(t);
|
|
1712
1737
|
},
|
|
1713
|
-
onSuccess: (t,
|
|
1738
|
+
onSuccess: (t, a) => {
|
|
1714
1739
|
s.setQueriesData(
|
|
1715
1740
|
{ queryKey: ["pitvox", "notifications", n] },
|
|
1716
|
-
(
|
|
1717
|
-
...
|
|
1718
|
-
unreadCount: Math.max(0, (
|
|
1719
|
-
notifications:
|
|
1720
|
-
(o) => o.id ===
|
|
1741
|
+
(i) => i != null && i.notifications ? {
|
|
1742
|
+
...i,
|
|
1743
|
+
unreadCount: Math.max(0, (i.unreadCount || 0) - 1),
|
|
1744
|
+
notifications: i.notifications.map(
|
|
1745
|
+
(o) => o.id === a ? { ...o, isRead: !0, readAt: (/* @__PURE__ */ new Date()).toISOString() } : o
|
|
1721
1746
|
)
|
|
1722
|
-
} :
|
|
1747
|
+
} : i
|
|
1723
1748
|
);
|
|
1724
1749
|
}
|
|
1725
1750
|
});
|
|
1726
1751
|
}
|
|
1727
|
-
function
|
|
1752
|
+
function vr() {
|
|
1728
1753
|
const { onMarkAllNotificationsRead: r, partnerSlug: n } = k(), s = U();
|
|
1729
1754
|
return H({
|
|
1730
1755
|
mutationFn: () => {
|
|
@@ -1738,30 +1763,30 @@ function pr() {
|
|
|
1738
1763
|
(t) => t != null && t.notifications ? {
|
|
1739
1764
|
...t,
|
|
1740
1765
|
unreadCount: 0,
|
|
1741
|
-
notifications: t.notifications.map((
|
|
1742
|
-
...
|
|
1766
|
+
notifications: t.notifications.map((a) => ({
|
|
1767
|
+
...a,
|
|
1743
1768
|
isRead: !0,
|
|
1744
|
-
readAt:
|
|
1769
|
+
readAt: a.readAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1745
1770
|
}))
|
|
1746
1771
|
} : t
|
|
1747
1772
|
);
|
|
1748
1773
|
}
|
|
1749
1774
|
});
|
|
1750
1775
|
}
|
|
1751
|
-
function
|
|
1752
|
-
const
|
|
1776
|
+
function hr({ driverName: r, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
1777
|
+
const a = s ? new Date(s).toLocaleDateString("en-GB", { day: "2-digit", month: "2-digit", year: "numeric" }) : null;
|
|
1753
1778
|
return /* @__PURE__ */ l("div", { className: `pvx-card pvx-dash-profile ${t}`, children: [
|
|
1754
1779
|
n ? /* @__PURE__ */ e("img", { src: n, alt: "", className: "pvx-dash-profile-avatar" }) : /* @__PURE__ */ e("div", { className: "pvx-dash-profile-avatar pvx-dash-profile-avatar--placeholder", children: (r || "?")[0].toUpperCase() }),
|
|
1755
1780
|
/* @__PURE__ */ l("div", { className: "pvx-dash-profile-info", children: [
|
|
1756
1781
|
/* @__PURE__ */ e("h2", { className: "pvx-dash-profile-name", children: r }),
|
|
1757
|
-
|
|
1782
|
+
a && /* @__PURE__ */ l("p", { className: "pvx-dash-profile-since", children: [
|
|
1758
1783
|
"Racing since ",
|
|
1759
|
-
|
|
1784
|
+
a
|
|
1760
1785
|
] })
|
|
1761
1786
|
] })
|
|
1762
1787
|
] });
|
|
1763
1788
|
}
|
|
1764
|
-
function
|
|
1789
|
+
function xr() {
|
|
1765
1790
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1766
1791
|
/* @__PURE__ */ e("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
1767
1792
|
/* @__PURE__ */ e("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
@@ -1769,7 +1794,7 @@ function mr() {
|
|
|
1769
1794
|
/* @__PURE__ */ e("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
1770
1795
|
] });
|
|
1771
1796
|
}
|
|
1772
|
-
function
|
|
1797
|
+
function gr() {
|
|
1773
1798
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1774
1799
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1775
1800
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "2" }),
|
|
@@ -1778,23 +1803,23 @@ function vr() {
|
|
|
1778
1803
|
/* @__PURE__ */ e("path", { d: "M13.5 12.5l4 2.5" })
|
|
1779
1804
|
] });
|
|
1780
1805
|
}
|
|
1781
|
-
function
|
|
1806
|
+
function fr() {
|
|
1782
1807
|
return /* @__PURE__ */ e("svg", { className: "pvx-dash-stat-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
|
|
1783
1808
|
}
|
|
1784
|
-
function
|
|
1785
|
-
const [o, d] = M(!1),
|
|
1786
|
-
|
|
1809
|
+
function ae({ icon: r, value: n, label: s, items: t, labelKey: a, countKey: i }) {
|
|
1810
|
+
const [o, d] = M(!1), u = Le(null);
|
|
1811
|
+
Re(() => {
|
|
1787
1812
|
if (!o) return;
|
|
1788
|
-
function v(
|
|
1789
|
-
|
|
1813
|
+
function v(x) {
|
|
1814
|
+
u.current && !u.current.contains(x.target) && d(!1);
|
|
1790
1815
|
}
|
|
1791
1816
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
1792
1817
|
}, [o]);
|
|
1793
|
-
const c = t != null && t.length ? t.slice().sort((v,
|
|
1818
|
+
const c = t != null && t.length ? t.slice().sort((v, x) => x[i] - v[i]) : null;
|
|
1794
1819
|
return /* @__PURE__ */ l(
|
|
1795
1820
|
"div",
|
|
1796
1821
|
{
|
|
1797
|
-
ref:
|
|
1822
|
+
ref: u,
|
|
1798
1823
|
className: `pvx-dash-stat-card ${c ? "pvx-dash-stat-card--clickable" : ""}`,
|
|
1799
1824
|
onClick: c ? () => d((v) => !v) : void 0,
|
|
1800
1825
|
children: [
|
|
@@ -1803,28 +1828,28 @@ function se({ icon: r, value: n, label: s, items: t, labelKey: i, countKey: a })
|
|
|
1803
1828
|
/* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: n }),
|
|
1804
1829
|
/* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: s })
|
|
1805
1830
|
] }),
|
|
1806
|
-
c && /* @__PURE__ */ e("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((v,
|
|
1807
|
-
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children: v[
|
|
1808
|
-
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children: v[
|
|
1809
|
-
] },
|
|
1831
|
+
c && /* @__PURE__ */ e("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: c.map((v, x) => /* @__PURE__ */ l("div", { className: "pvx-dash-tooltip-row", children: [
|
|
1832
|
+
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children: v[a] }),
|
|
1833
|
+
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children: v[i] })
|
|
1834
|
+
] }, x)) })
|
|
1810
1835
|
]
|
|
1811
1836
|
}
|
|
1812
1837
|
);
|
|
1813
1838
|
}
|
|
1814
|
-
function
|
|
1839
|
+
function Nr({ stats: r, rating: n, className: s = "" }) {
|
|
1815
1840
|
if (!r) return null;
|
|
1816
|
-
const t = r.trackBreakdown.map((
|
|
1817
|
-
name: E(
|
|
1818
|
-
lapCount:
|
|
1819
|
-
})),
|
|
1820
|
-
name: I(
|
|
1821
|
-
lapCount:
|
|
1841
|
+
const t = r.trackBreakdown.map((i) => ({
|
|
1842
|
+
name: E(i.trackId, i.layout),
|
|
1843
|
+
lapCount: i.lapCount
|
|
1844
|
+
})), a = r.carBreakdown.map((i) => ({
|
|
1845
|
+
name: I(i.carId),
|
|
1846
|
+
lapCount: i.lapCount
|
|
1822
1847
|
}));
|
|
1823
1848
|
return /* @__PURE__ */ l("div", { className: `pvx-dash-stats ${s}`, children: [
|
|
1824
1849
|
/* @__PURE__ */ e(
|
|
1825
|
-
|
|
1850
|
+
ae,
|
|
1826
1851
|
{
|
|
1827
|
-
icon: /* @__PURE__ */ e(
|
|
1852
|
+
icon: /* @__PURE__ */ e(xr, {}),
|
|
1828
1853
|
value: r.lapCount.toLocaleString(),
|
|
1829
1854
|
label: "Total Laps",
|
|
1830
1855
|
items: t,
|
|
@@ -1833,18 +1858,18 @@ function xr({ stats: r, rating: n, className: s = "" }) {
|
|
|
1833
1858
|
}
|
|
1834
1859
|
),
|
|
1835
1860
|
/* @__PURE__ */ e(
|
|
1836
|
-
|
|
1861
|
+
ae,
|
|
1837
1862
|
{
|
|
1838
|
-
icon: /* @__PURE__ */ e(
|
|
1863
|
+
icon: /* @__PURE__ */ e(gr, {}),
|
|
1839
1864
|
value: r.carBreakdown.length,
|
|
1840
1865
|
label: "Cars Used",
|
|
1841
|
-
items:
|
|
1866
|
+
items: a,
|
|
1842
1867
|
labelKey: "name",
|
|
1843
1868
|
countKey: "lapCount"
|
|
1844
1869
|
}
|
|
1845
1870
|
),
|
|
1846
1871
|
n && /* @__PURE__ */ l("div", { className: "pvx-dash-stat-card pvx-dash-stat-card--rating", children: [
|
|
1847
|
-
/* @__PURE__ */ e(
|
|
1872
|
+
/* @__PURE__ */ e(fr, {}),
|
|
1848
1873
|
/* @__PURE__ */ l("div", { className: "pvx-dash-stat-content", children: [
|
|
1849
1874
|
/* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: n.rating.toFixed(1) }),
|
|
1850
1875
|
/* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: "Driver Rating" }),
|
|
@@ -1858,10 +1883,10 @@ function xr({ stats: r, rating: n, className: s = "" }) {
|
|
|
1858
1883
|
] })
|
|
1859
1884
|
] });
|
|
1860
1885
|
}
|
|
1861
|
-
function
|
|
1862
|
-
const s = w(() => r != null && r.length ? r.slice().sort((t,
|
|
1863
|
-
const
|
|
1864
|
-
return (
|
|
1886
|
+
function br({ records: r, className: n = "" }) {
|
|
1887
|
+
const s = w(() => r != null && r.length ? r.slice().sort((t, a) => {
|
|
1888
|
+
const i = t.recordedAt ? new Date(t.recordedAt).getTime() : 0;
|
|
1889
|
+
return (a.recordedAt ? new Date(a.recordedAt).getTime() : 0) - i;
|
|
1865
1890
|
}) : [], [r]);
|
|
1866
1891
|
return s.length ? /* @__PURE__ */ l("div", { className: `pvx-card ${n}`, children: [
|
|
1867
1892
|
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
@@ -1880,7 +1905,7 @@ function gr({ records: r, className: n = "" }) {
|
|
|
1880
1905
|
")"
|
|
1881
1906
|
] })
|
|
1882
1907
|
] }) }),
|
|
1883
|
-
/* @__PURE__ */ e("div", { className: "pvx-dash-records-list", children: s.map((t,
|
|
1908
|
+
/* @__PURE__ */ e("div", { className: "pvx-dash-records-list", children: s.map((t, a) => /* @__PURE__ */ l("div", { className: "pvx-dash-record-row", children: [
|
|
1884
1909
|
/* @__PURE__ */ l("div", { className: "pvx-dash-record-info", children: [
|
|
1885
1910
|
/* @__PURE__ */ e("span", { className: "pvx-dash-record-track", children: E(t.trackId, t.layout, t.game) }),
|
|
1886
1911
|
/* @__PURE__ */ e("span", { className: "pvx-dash-record-car", children: I(t.carId) })
|
|
@@ -1892,18 +1917,18 @@ function gr({ records: r, className: n = "" }) {
|
|
|
1892
1917
|
t.gameVersion ? ` ${t.gameVersion}` : ""
|
|
1893
1918
|
] })
|
|
1894
1919
|
] })
|
|
1895
|
-
] },
|
|
1920
|
+
] }, a)) })
|
|
1896
1921
|
] }) : null;
|
|
1897
1922
|
}
|
|
1898
|
-
function
|
|
1923
|
+
function yr({ events: r, isLoading: n, className: s, limit: t = 3 }) {
|
|
1899
1924
|
if (n)
|
|
1900
1925
|
return /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading upcoming events..." });
|
|
1901
1926
|
if (!(r != null && r.length))
|
|
1902
1927
|
return null;
|
|
1903
|
-
const
|
|
1928
|
+
const a = t ? r.slice(0, t) : r, i = r.length - a.length;
|
|
1904
1929
|
return /* @__PURE__ */ l("div", { className: `pvx-card ${s || ""}`, children: [
|
|
1905
1930
|
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
1906
|
-
/* @__PURE__ */ e(
|
|
1931
|
+
/* @__PURE__ */ e(Cr, {}),
|
|
1907
1932
|
"Upcoming Events",
|
|
1908
1933
|
/* @__PURE__ */ l("span", { className: "pvx-dash-records-count", children: [
|
|
1909
1934
|
"(",
|
|
@@ -1912,7 +1937,7 @@ function fr({ events: r, isLoading: n, className: s, limit: t = 3 }) {
|
|
|
1912
1937
|
] })
|
|
1913
1938
|
] }) }),
|
|
1914
1939
|
/* @__PURE__ */ l("div", { className: "pvx-upcoming-list", children: [
|
|
1915
|
-
|
|
1940
|
+
a.map((o) => /* @__PURE__ */ l(
|
|
1916
1941
|
"div",
|
|
1917
1942
|
{
|
|
1918
1943
|
className: `pvx-upcoming-item ${o.isNext ? "pvx-upcoming-item--next" : ""}`,
|
|
@@ -1926,7 +1951,7 @@ function fr({ events: r, isLoading: n, className: s, limit: t = 3 }) {
|
|
|
1926
1951
|
o.track
|
|
1927
1952
|
] }),
|
|
1928
1953
|
o.serverPassword && /* @__PURE__ */ e(
|
|
1929
|
-
|
|
1954
|
+
kr,
|
|
1930
1955
|
{
|
|
1931
1956
|
password: o.serverPassword,
|
|
1932
1957
|
address: o.serverAddress
|
|
@@ -1939,24 +1964,24 @@ function fr({ events: r, isLoading: n, className: s, limit: t = 3 }) {
|
|
|
1939
1964
|
month: "short",
|
|
1940
1965
|
year: "numeric"
|
|
1941
1966
|
}) }),
|
|
1942
|
-
/* @__PURE__ */ e("span", { className: "pvx-upcoming-relative", children:
|
|
1967
|
+
/* @__PURE__ */ e("span", { className: "pvx-upcoming-relative", children: wr(o.startTime) }),
|
|
1943
1968
|
o.isNext && /* @__PURE__ */ e("span", { className: "pvx-upcoming-badge", children: "Next" })
|
|
1944
1969
|
] })
|
|
1945
1970
|
]
|
|
1946
1971
|
},
|
|
1947
1972
|
`${o.competitionId}-${o.roundNumber}`
|
|
1948
1973
|
)),
|
|
1949
|
-
|
|
1974
|
+
i > 0 && /* @__PURE__ */ l("div", { className: "pvx-upcoming-remaining", children: [
|
|
1950
1975
|
"+",
|
|
1951
|
-
|
|
1976
|
+
i,
|
|
1952
1977
|
" more event",
|
|
1953
|
-
|
|
1978
|
+
i !== 1 ? "s" : ""
|
|
1954
1979
|
] })
|
|
1955
1980
|
] })
|
|
1956
1981
|
] });
|
|
1957
1982
|
}
|
|
1958
|
-
function
|
|
1959
|
-
const [s, t] = M(!1), [
|
|
1983
|
+
function kr({ password: r, address: n }) {
|
|
1984
|
+
const [s, t] = M(!1), [a, i] = M(!1), o = n ? r ? `join:${n}|${r}` : `join:${n}` : null, d = K(async () => {
|
|
1960
1985
|
if (o)
|
|
1961
1986
|
try {
|
|
1962
1987
|
await navigator.clipboard.writeText(o), t(!0), setTimeout(() => t(!1), 2e3);
|
|
@@ -1971,7 +1996,7 @@ function Nr({ password: r, address: n }) {
|
|
|
1971
1996
|
onClick: d,
|
|
1972
1997
|
title: "Copy join string to clipboard",
|
|
1973
1998
|
children: [
|
|
1974
|
-
/* @__PURE__ */ e(
|
|
1999
|
+
/* @__PURE__ */ e(Rr, {}),
|
|
1975
2000
|
" ",
|
|
1976
2001
|
s ? "Copied!" : "Join"
|
|
1977
2002
|
]
|
|
@@ -1982,20 +2007,20 @@ function Nr({ password: r, address: n }) {
|
|
|
1982
2007
|
"span",
|
|
1983
2008
|
{
|
|
1984
2009
|
className: "pvx-server-detail pvx-server-detail--clickable",
|
|
1985
|
-
onClick: () =>
|
|
1986
|
-
title:
|
|
1987
|
-
children:
|
|
2010
|
+
onClick: () => i((u) => !u),
|
|
2011
|
+
title: a ? "Hide password" : "Reveal password",
|
|
2012
|
+
children: a ? /* @__PURE__ */ e(Sr, {}) : /* @__PURE__ */ e(Tr, {})
|
|
1988
2013
|
}
|
|
1989
2014
|
),
|
|
1990
|
-
|
|
1991
|
-
/* @__PURE__ */ e(
|
|
2015
|
+
a && /* @__PURE__ */ l("span", { className: "pvx-server-detail", children: [
|
|
2016
|
+
/* @__PURE__ */ e(Lr, {}),
|
|
1992
2017
|
" ",
|
|
1993
2018
|
r
|
|
1994
2019
|
] })
|
|
1995
2020
|
] })
|
|
1996
2021
|
] });
|
|
1997
2022
|
}
|
|
1998
|
-
function
|
|
2023
|
+
function wr(r) {
|
|
1999
2024
|
const n = new Date(r).getTime() - Date.now();
|
|
2000
2025
|
if (n <= 0) return "Now";
|
|
2001
2026
|
const s = Math.floor(n / (1e3 * 60 * 60));
|
|
@@ -2005,54 +2030,54 @@ function br(r) {
|
|
|
2005
2030
|
if (t === 1) return "Tomorrow";
|
|
2006
2031
|
if (t < 7) return `in ${t} days`;
|
|
2007
2032
|
if (t < 30) {
|
|
2008
|
-
const
|
|
2009
|
-
return `in ${
|
|
2033
|
+
const a = Math.floor(t / 7);
|
|
2034
|
+
return `in ${a} week${a !== 1 ? "s" : ""}`;
|
|
2010
2035
|
}
|
|
2011
|
-
return
|
|
2036
|
+
return ie(r);
|
|
2012
2037
|
}
|
|
2013
|
-
function
|
|
2038
|
+
function Cr() {
|
|
2014
2039
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2015
2040
|
/* @__PURE__ */ e("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
2016
2041
|
/* @__PURE__ */ e("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
2017
2042
|
] });
|
|
2018
2043
|
}
|
|
2019
|
-
function
|
|
2044
|
+
function Lr() {
|
|
2020
2045
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2021
2046
|
/* @__PURE__ */ e("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
|
|
2022
2047
|
/* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
2023
2048
|
] });
|
|
2024
2049
|
}
|
|
2025
|
-
function
|
|
2050
|
+
function Rr() {
|
|
2026
2051
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2027
2052
|
/* @__PURE__ */ e("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2028
2053
|
/* @__PURE__ */ e("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2029
2054
|
] });
|
|
2030
2055
|
}
|
|
2031
|
-
function
|
|
2056
|
+
function Tr() {
|
|
2032
2057
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2033
2058
|
/* @__PURE__ */ e("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
2034
2059
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" })
|
|
2035
2060
|
] });
|
|
2036
2061
|
}
|
|
2037
|
-
function
|
|
2062
|
+
function Sr() {
|
|
2038
2063
|
return /* @__PURE__ */ l("svg", { className: "pvx-server-icon pvx-server-icon--action", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2039
2064
|
/* @__PURE__ */ e("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
2040
2065
|
/* @__PURE__ */ e("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2041
2066
|
] });
|
|
2042
2067
|
}
|
|
2043
|
-
function
|
|
2044
|
-
const o =
|
|
2045
|
-
return
|
|
2068
|
+
function $r({ notifications: r, unreadCount: n = 0, onMarkRead: s, onMarkAllRead: t, isLoading: a, className: i }) {
|
|
2069
|
+
const o = ce();
|
|
2070
|
+
return a ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading notifications..." }) : /* @__PURE__ */ l("div", { className: `pvx-card ${i || ""}`, children: [
|
|
2046
2071
|
/* @__PURE__ */ l("div", { className: "pvx-card-header", children: [
|
|
2047
2072
|
/* @__PURE__ */ l("h3", { className: "pvx-card-title", children: [
|
|
2048
|
-
/* @__PURE__ */ e(
|
|
2073
|
+
/* @__PURE__ */ e(Dr, {}),
|
|
2049
2074
|
"Notifications",
|
|
2050
2075
|
n > 0 && /* @__PURE__ */ e("span", { className: "pvx-notif-badge", children: n > 99 ? "99+" : n })
|
|
2051
2076
|
] }),
|
|
2052
2077
|
n > 0 && t && /* @__PURE__ */ e("button", { className: "pvx-notif-mark-all", onClick: t, children: "Mark all read" })
|
|
2053
2078
|
] }),
|
|
2054
2079
|
r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-notif-list", children: r.map((d) => /* @__PURE__ */ e(
|
|
2055
|
-
|
|
2080
|
+
Mr,
|
|
2056
2081
|
{
|
|
2057
2082
|
notification: d,
|
|
2058
2083
|
getUserDisplay: o,
|
|
@@ -2062,7 +2087,7 @@ function Rr({ notifications: r, unreadCount: n = 0, onMarkRead: s, onMarkAllRead
|
|
|
2062
2087
|
)) }) : /* @__PURE__ */ e("div", { className: "pvx-notif-empty", children: "No notifications" })
|
|
2063
2088
|
] });
|
|
2064
2089
|
}
|
|
2065
|
-
function
|
|
2090
|
+
function Mr({ notification: r, getUserDisplay: n, onMarkRead: s }) {
|
|
2066
2091
|
const t = () => {
|
|
2067
2092
|
!r.isRead && s && s(r.id);
|
|
2068
2093
|
};
|
|
@@ -2072,17 +2097,17 @@ function Tr({ notification: r, getUserDisplay: n, onMarkRead: s }) {
|
|
|
2072
2097
|
className: `pvx-notif-item ${r.isRead ? "" : "pvx-notif-item--unread"}`,
|
|
2073
2098
|
onClick: t,
|
|
2074
2099
|
children: [
|
|
2075
|
-
/* @__PURE__ */ e(
|
|
2100
|
+
/* @__PURE__ */ e(Ir, { type: r.type }),
|
|
2076
2101
|
/* @__PURE__ */ l("div", { className: "pvx-notif-content", children: [
|
|
2077
|
-
/* @__PURE__ */ e("span", { className: "pvx-notif-message", children:
|
|
2078
|
-
/* @__PURE__ */ e("span", { className: "pvx-notif-time", children:
|
|
2102
|
+
/* @__PURE__ */ e("span", { className: "pvx-notif-message", children: Be(r, n) }),
|
|
2103
|
+
/* @__PURE__ */ e("span", { className: "pvx-notif-time", children: ie(r.createdAt) })
|
|
2079
2104
|
] }),
|
|
2080
2105
|
!r.isRead && /* @__PURE__ */ e("span", { className: "pvx-notif-dot" })
|
|
2081
2106
|
]
|
|
2082
2107
|
}
|
|
2083
2108
|
);
|
|
2084
2109
|
}
|
|
2085
|
-
function
|
|
2110
|
+
function Ir({ type: r }) {
|
|
2086
2111
|
return r === "RECORD_BEATEN" ? /* @__PURE__ */ e("span", { className: "pvx-notif-icon pvx-notif-icon--beaten", children: /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "m7 7 10 10M17 7v10H7" }) }) }) : r === "ADMIN_MESSAGE" ? /* @__PURE__ */ e("span", { className: "pvx-notif-icon pvx-notif-icon--admin", children: /* @__PURE__ */ l("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2087
2112
|
/* @__PURE__ */ e("path", { d: "m3 11 18-5v12L3 13v-2z" }),
|
|
2088
2113
|
/* @__PURE__ */ e("path", { d: "M11.6 16.8a3 3 0 1 1-5.8-1.6" })
|
|
@@ -2095,34 +2120,34 @@ function Sr({ type: r }) {
|
|
|
2095
2120
|
/* @__PURE__ */ e("path", { d: "M18 2H6v7a6 6 0 0 0 12 0V2Z" })
|
|
2096
2121
|
] }) });
|
|
2097
2122
|
}
|
|
2098
|
-
function
|
|
2123
|
+
function Dr() {
|
|
2099
2124
|
return /* @__PURE__ */ l("svg", { className: "pvx-dash-records-icon", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2100
2125
|
/* @__PURE__ */ e("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
2101
2126
|
/* @__PURE__ */ e("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
2102
2127
|
] });
|
|
2103
2128
|
}
|
|
2104
|
-
function
|
|
2105
|
-
const { data:
|
|
2106
|
-
return
|
|
2129
|
+
function tn({ steamId: r, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
2130
|
+
const { data: a, isLoading: i, error: o } = cr(r), { data: d, isLoading: u } = lr(r), { data: c, isLoading: v } = dr(), x = pr(), { data: N, isLoading: p } = ur({ limit: 10 }), b = mr(), g = vr();
|
|
2131
|
+
return i || u ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ e("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ l("div", { className: `pvx-dash ${t}`, children: [
|
|
2107
2132
|
/* @__PURE__ */ e(
|
|
2108
|
-
|
|
2133
|
+
hr,
|
|
2109
2134
|
{
|
|
2110
|
-
driverName:
|
|
2135
|
+
driverName: a.driverName,
|
|
2111
2136
|
avatarUrl: n,
|
|
2112
2137
|
memberSince: s
|
|
2113
2138
|
}
|
|
2114
2139
|
),
|
|
2115
|
-
/* @__PURE__ */ e(
|
|
2116
|
-
r && /* @__PURE__ */ e(
|
|
2117
|
-
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${
|
|
2118
|
-
/* @__PURE__ */ e(
|
|
2119
|
-
|
|
2120
|
-
|
|
2140
|
+
/* @__PURE__ */ e(Nr, { stats: a, rating: d }),
|
|
2141
|
+
r && /* @__PURE__ */ e(yr, { events: c, isLoading: v }),
|
|
2142
|
+
/* @__PURE__ */ l("div", { className: `pvx-dash-row ${x ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2143
|
+
/* @__PURE__ */ e(br, { records: a.currentRecords }),
|
|
2144
|
+
x && /* @__PURE__ */ e(
|
|
2145
|
+
$r,
|
|
2121
2146
|
{
|
|
2122
|
-
notifications:
|
|
2123
|
-
unreadCount: (
|
|
2124
|
-
onMarkRead: (
|
|
2125
|
-
onMarkAllRead: () =>
|
|
2147
|
+
notifications: N == null ? void 0 : N.notifications,
|
|
2148
|
+
unreadCount: (N == null ? void 0 : N.unreadCount) || 0,
|
|
2149
|
+
onMarkRead: (m) => b.mutate(m),
|
|
2150
|
+
onMarkAllRead: () => g.mutate(),
|
|
2126
2151
|
isLoading: p
|
|
2127
2152
|
}
|
|
2128
2153
|
)
|
|
@@ -2130,65 +2155,70 @@ function Xr({ steamId: r, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
|
2130
2155
|
] }) : /* @__PURE__ */ e("div", { className: "pvx-empty", children: "No data available yet. Start driving to see your stats!" });
|
|
2131
2156
|
}
|
|
2132
2157
|
export {
|
|
2133
|
-
|
|
2158
|
+
Wr as CarsTable,
|
|
2134
2159
|
P as CompEmptyState,
|
|
2135
2160
|
j as CompLoadingState,
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2161
|
+
Ze as CompetitionCard,
|
|
2162
|
+
Qr as CompetitionCards,
|
|
2163
|
+
tn as DriverDashboard,
|
|
2164
|
+
hr as DriverProfile,
|
|
2165
|
+
Or as DriversTable,
|
|
2166
|
+
Zr as EntryList,
|
|
2142
2167
|
Q as InfoPill,
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2168
|
+
Gr as LapHistoryTable,
|
|
2169
|
+
$r as NotificationsCard,
|
|
2170
|
+
Oe as PODIUM_MEDALS,
|
|
2171
|
+
Ur as PitVoxPartnerProvider,
|
|
2172
|
+
zr as RankingsTable,
|
|
2173
|
+
br as RecordsTable,
|
|
2174
|
+
Xr as RegisterButton,
|
|
2175
|
+
en as RegistrationPanel,
|
|
2176
|
+
Jr as RoundResults,
|
|
2177
|
+
nr as RoundSessionResults,
|
|
2178
|
+
Yr as StandingsTable,
|
|
2179
|
+
Nr as StatsCards,
|
|
2180
|
+
Hr as TracksTable,
|
|
2181
|
+
Qe as TypeBadge,
|
|
2182
|
+
yr as UpcomingEvents,
|
|
2183
|
+
Ie as buildLapsPath,
|
|
2184
|
+
J as buildLeaderboardPath,
|
|
2185
|
+
De as buildRecentLapsPath,
|
|
2186
|
+
R as fetchCdnJson,
|
|
2158
2187
|
I as formatCarName,
|
|
2159
2188
|
F as formatDate,
|
|
2160
|
-
|
|
2189
|
+
Er as formatDelta,
|
|
2161
2190
|
B as formatLapTime,
|
|
2162
|
-
|
|
2163
|
-
|
|
2191
|
+
Be as formatNotificationMessage,
|
|
2192
|
+
ie as formatRelativeTime,
|
|
2164
2193
|
D as formatSectorTime,
|
|
2165
2194
|
E as formatTrackName,
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2195
|
+
oe as formatTyreCompound,
|
|
2196
|
+
jr as useCarLeaderboard,
|
|
2197
|
+
_r as useCarMetadata,
|
|
2198
|
+
Kr as useCompetitionAllRounds,
|
|
2199
|
+
Ue as useCompetitionConfig,
|
|
2200
|
+
le as useCompetitionEntryList,
|
|
2201
|
+
Fe as useCompetitionRound,
|
|
2202
|
+
Ee as useCompetitionStandings,
|
|
2203
|
+
Vr as useCompetitions,
|
|
2204
|
+
Ae as useDriverLaps,
|
|
2205
|
+
lr as useDriverRating,
|
|
2206
|
+
rn as useDriverRatings,
|
|
2207
|
+
cr as useDriverStats,
|
|
2208
|
+
Fr as useLeaderboardIndex,
|
|
2209
|
+
vr as useMarkAllNotificationsRead,
|
|
2210
|
+
mr as useMarkNotificationRead,
|
|
2211
|
+
ur as useNotifications,
|
|
2212
|
+
pr as useNotificationsEnabled,
|
|
2184
2213
|
k as usePitVox,
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2214
|
+
qr as useRecentLaps,
|
|
2215
|
+
de as useRegister,
|
|
2216
|
+
X as useRegistrationMode,
|
|
2217
|
+
Z as useRegistrationStatus,
|
|
2218
|
+
ee as useRegistrationUrl,
|
|
2219
|
+
Pe as useTrackLeaderboard,
|
|
2220
|
+
nn as useUnreadCount,
|
|
2221
|
+
dr as useUpcomingEvents,
|
|
2222
|
+
ce as useUserLookup,
|
|
2223
|
+
pe as useWithdraw
|
|
2194
2224
|
};
|