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