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