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