@pitvox/partner-react 0.6.7 → 0.6.8
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/README.md +5 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +252 -251
- package/package.json +8 -5
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ function _r({
|
|
|
14
14
|
onMarkNotificationRead: d,
|
|
15
15
|
onMarkAllNotificationsRead: v,
|
|
16
16
|
onFetchServerPassword: l,
|
|
17
|
-
children:
|
|
17
|
+
children: m
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const g = C(() => ({
|
|
20
20
|
partnerSlug: r,
|
|
21
21
|
cdnUrl: n.replace(/\/$/, ""),
|
|
22
22
|
pitvoxUrl: s.replace(/\/$/, ""),
|
|
@@ -34,11 +34,11 @@ function _r({
|
|
|
34
34
|
} catch {
|
|
35
35
|
f = !1;
|
|
36
36
|
}
|
|
37
|
-
return f ? /* @__PURE__ */ e(Y.Provider, { value:
|
|
37
|
+
return f ? /* @__PURE__ */ e(Y.Provider, { value: g, children: m }) : (G || (G = new Me({
|
|
38
38
|
defaultOptions: {
|
|
39
39
|
queries: { staleTime: 6e4 }
|
|
40
40
|
}
|
|
41
|
-
})), /* @__PURE__ */ e(Ie, { client: G, children: /* @__PURE__ */ e(Y.Provider, { value:
|
|
41
|
+
})), /* @__PURE__ */ e(Ie, { client: G, children: /* @__PURE__ */ e(Y.Provider, { value: g, children: m }) }));
|
|
42
42
|
}
|
|
43
43
|
function k() {
|
|
44
44
|
const r = Te(Y);
|
|
@@ -54,8 +54,9 @@ async function T(r, n) {
|
|
|
54
54
|
}
|
|
55
55
|
return s.json();
|
|
56
56
|
}
|
|
57
|
-
function J(r, ...
|
|
58
|
-
|
|
57
|
+
function J(r, n, s, ...t) {
|
|
58
|
+
const a = ["leaderboards"];
|
|
59
|
+
return r && a.push(`partners/${r}`), n && a.push(n), s && a.push(`v/${s}`), [...a, ...t].join("/");
|
|
59
60
|
}
|
|
60
61
|
function Pe(r, n) {
|
|
61
62
|
return r ? `laps/partners/${r}/${n}.json` : `laps/${n}.json`;
|
|
@@ -110,7 +111,7 @@ function qr(r) {
|
|
|
110
111
|
return r == null ? "" : `${r >= 0 ? "+" : "-"}${(Math.abs(r) / 1e3).toFixed(3)}`;
|
|
111
112
|
}
|
|
112
113
|
function Ue(r, n) {
|
|
113
|
-
const { type: s, title: t, trackId: a, trackLayout: i, carId: o, game: d, data: v } = r, l = typeof v == "string" ? JSON.parse(v) : v,
|
|
114
|
+
const { type: s, title: t, trackId: a, trackLayout: i, carId: o, game: d, data: v } = r, l = typeof v == "string" ? JSON.parse(v) : v, m = a ? _(a, i, d) : null, g = o ? I(o) : null, f = [m, g].filter(Boolean).join(" — ");
|
|
114
115
|
return s === "RECORD_BEATEN" && f ? `${l != null && l.beatenBySteamId && n ? n(l.beatenBySteamId).displayName : "Someone"} beat your record on ${f}` : s === "RECORD_SET" && f ? `You set a new record on ${f}` : t || "New notification";
|
|
115
116
|
}
|
|
116
117
|
function ce(r) {
|
|
@@ -128,15 +129,15 @@ function ce(r) {
|
|
|
128
129
|
}[r] || r : "Unknown";
|
|
129
130
|
}
|
|
130
131
|
function jr(r = {}) {
|
|
131
|
-
var v, l,
|
|
132
|
-
const { cdnUrl: n, partnerSlug: s } = k(), { game: t, gameVersion: a } = r, i = J(s, "index.json"), o = R({
|
|
132
|
+
var v, l, m, g, f, u;
|
|
133
|
+
const { cdnUrl: n, partnerSlug: s } = k(), { game: t, gameVersion: a } = r, i = J(s, null, null, "index.json"), o = R({
|
|
133
134
|
queryKey: ["pitvox", "leaderboards", s, "index"],
|
|
134
135
|
queryFn: () => T(n, i),
|
|
135
136
|
staleTime: 3e4,
|
|
136
137
|
refetchInterval: 3e4
|
|
137
138
|
}), d = C(() => {
|
|
138
|
-
var
|
|
139
|
-
if (!((
|
|
139
|
+
var x;
|
|
140
|
+
if (!((x = o.data) != null && x.tracks)) return [];
|
|
140
141
|
let b = o.data.tracks;
|
|
141
142
|
return t && (b = b.filter((p) => p.game === t)), a && (b = b.filter((p) => p.gameVersion === a)), b.map((p) => ({
|
|
142
143
|
id: p.trackId,
|
|
@@ -160,65 +161,65 @@ function jr(r = {}) {
|
|
|
160
161
|
...o,
|
|
161
162
|
data: d,
|
|
162
163
|
partner: ((l = o.data) == null ? void 0 : l.partner) || null,
|
|
163
|
-
generatedAt: (
|
|
164
|
-
totalLaps: ((
|
|
164
|
+
generatedAt: (m = o.data) == null ? void 0 : m.generatedAt,
|
|
165
|
+
totalLaps: ((g = o.data) == null ? void 0 : g.totalLaps) || 0,
|
|
165
166
|
totalUsers: ((f = o.data) == null ? void 0 : f.totalUsers) || 0,
|
|
166
|
-
versions: ((
|
|
167
|
+
versions: ((u = o.data) == null ? void 0 : u.versions) || {}
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
170
|
function Ee(r, n, s = {}) {
|
|
170
|
-
const { cdnUrl: t, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s, v = n || "default", l =
|
|
171
|
-
queryKey: ["pitvox", "leaderboards", a, "track", r, v, d],
|
|
172
|
-
queryFn: () => T(t,
|
|
171
|
+
const { cdnUrl: t, partnerSlug: a } = k(), { carId: i, game: o, gameVersion: d } = s, v = n || "default", l = J(a, o, d, `tracks/${r}/${v}.json`), { data: m, isLoading: g, error: f } = R({
|
|
172
|
+
queryKey: ["pitvox", "leaderboards", a, "track", r, v, o, d],
|
|
173
|
+
queryFn: () => T(t, l),
|
|
173
174
|
enabled: !!r,
|
|
174
175
|
staleTime: 3e4,
|
|
175
176
|
refetchInterval: 3e4
|
|
176
177
|
});
|
|
177
178
|
return { data: C(() => {
|
|
178
|
-
if (!(
|
|
179
|
-
let
|
|
180
|
-
if (o && (
|
|
181
|
-
const
|
|
182
|
-
for (const
|
|
183
|
-
const
|
|
184
|
-
|
|
179
|
+
if (!(m != null && m.entries)) return [];
|
|
180
|
+
let b = m.entries;
|
|
181
|
+
if (o && (b = b.filter((x) => x.game === o)), !i) {
|
|
182
|
+
const x = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
183
|
+
for (const N of b) {
|
|
184
|
+
const h = N.steamId || N.userId;
|
|
185
|
+
p.has(N.carId) || p.set(N.carId, /* @__PURE__ */ new Set()), p.get(N.carId).add(h), (!x.has(N.carId) || N.lapTimeMs < x.get(N.carId).lapTimeMs) && x.set(N.carId, N);
|
|
185
186
|
}
|
|
186
|
-
return Array.from(
|
|
187
|
-
var
|
|
188
|
-
return { ...
|
|
189
|
-
}).sort((
|
|
187
|
+
return Array.from(x.values()).map((N) => {
|
|
188
|
+
var h;
|
|
189
|
+
return { ...N, driverCount: ((h = p.get(N.carId)) == null ? void 0 : h.size) || 0 };
|
|
190
|
+
}).sort((N, h) => N.lapTimeMs - h.lapTimeMs);
|
|
190
191
|
}
|
|
191
|
-
return
|
|
192
|
-
}, [
|
|
192
|
+
return b.filter((x) => x.carId === i).sort((x, p) => x.lapTimeMs - p.lapTimeMs);
|
|
193
|
+
}, [m == null ? void 0 : m.entries, i, o]), isLoading: g, error: f };
|
|
193
194
|
}
|
|
194
195
|
function Fe(r, n, s, t, a = {}) {
|
|
195
|
-
var b,
|
|
196
|
-
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: v, gameVersion: l } = a,
|
|
196
|
+
var b, x;
|
|
197
|
+
const { cdnUrl: i, partnerSlug: o } = k(), { showInvalid: d = !1, game: v, gameVersion: l } = a, m = Pe(o, r), g = R({
|
|
197
198
|
queryKey: ["pitvox", "laps", o, r],
|
|
198
|
-
queryFn: () => T(i,
|
|
199
|
+
queryFn: () => T(i, m),
|
|
199
200
|
enabled: !!r,
|
|
200
201
|
staleTime: 3e4,
|
|
201
202
|
refetchInterval: 3e4
|
|
202
203
|
}), f = C(() => {
|
|
203
204
|
var p;
|
|
204
|
-
return (p =
|
|
205
|
+
return (p = g.data) != null && p.laps ? g.data.laps.filter((N) => {
|
|
205
206
|
if (N.trackId !== n) return !1;
|
|
206
207
|
if (s) {
|
|
207
208
|
if (N.trackLayout !== s) return !1;
|
|
208
209
|
} else if (N.trackLayout && N.trackLayout !== "default") return !1;
|
|
209
210
|
return !(N.carId !== t || v && N.game !== v || l && N.gameVersion !== l || !d && !N.isValid);
|
|
210
|
-
}).sort((N,
|
|
211
|
-
}, [(b =
|
|
211
|
+
}).sort((N, h) => N.lapTimeMs - h.lapTimeMs) : [];
|
|
212
|
+
}, [(b = g.data) == null ? void 0 : b.laps, n, s, t, v, l, d]), u = C(() => {
|
|
212
213
|
const p = f.filter((w) => w.isValid && w.sector1Ms && w.sector2Ms && w.sector3Ms);
|
|
213
214
|
if (p.length < 2) return null;
|
|
214
|
-
const N = Math.min(...p.map((w) => w.sector1Ms)),
|
|
215
|
-
return L >= $ ? null : { lapTimeMs: L, sector1Ms: N, sector2Ms:
|
|
215
|
+
const N = Math.min(...p.map((w) => w.sector1Ms)), h = Math.min(...p.map((w) => w.sector2Ms)), y = Math.min(...p.map((w) => w.sector3Ms)), L = N + h + y, $ = Math.min(...p.map((w) => w.lapTimeMs));
|
|
216
|
+
return L >= $ ? null : { lapTimeMs: L, sector1Ms: N, sector2Ms: h, sector3Ms: y };
|
|
216
217
|
}, [f]);
|
|
217
218
|
return {
|
|
218
|
-
...
|
|
219
|
+
...g,
|
|
219
220
|
data: f,
|
|
220
|
-
driverName: ((
|
|
221
|
-
theoreticalBest:
|
|
221
|
+
driverName: ((x = g.data) == null ? void 0 : x.driverName) || "Driver",
|
|
222
|
+
theoreticalBest: u
|
|
222
223
|
};
|
|
223
224
|
}
|
|
224
225
|
function le() {
|
|
@@ -239,8 +240,8 @@ function le() {
|
|
|
239
240
|
}
|
|
240
241
|
function Vr() {
|
|
241
242
|
const { cdnUrl: r } = k(), { data: n } = R({
|
|
242
|
-
queryKey: ["pitvox", "cars", "
|
|
243
|
-
queryFn: () => T(r, "cars/
|
|
243
|
+
queryKey: ["pitvox", "cars", "evo"],
|
|
244
|
+
queryFn: () => T(r, "cars/evo.json"),
|
|
244
245
|
staleTime: 5 * 6e4,
|
|
245
246
|
gcTime: 30 * 6e4
|
|
246
247
|
});
|
|
@@ -366,8 +367,8 @@ function ue(r) {
|
|
|
366
367
|
a.setQueriesData(
|
|
367
368
|
{ queryKey: ["pitvox", "competition", s, r, "entrylist"] },
|
|
368
369
|
(l) => {
|
|
369
|
-
var
|
|
370
|
-
return l ? ((
|
|
370
|
+
var g;
|
|
371
|
+
return l ? ((g = l.drivers) == null ? void 0 : g.some((f) => f.steamId === o)) ? l : { ...l, drivers: [...l.drivers || [], v] } : { drivers: [v] };
|
|
371
372
|
}
|
|
372
373
|
);
|
|
373
374
|
}
|
|
@@ -559,26 +560,26 @@ function Oe() {
|
|
|
559
560
|
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" }) });
|
|
560
561
|
}
|
|
561
562
|
function Or({ tracks: r, isLoading: n, carMetadata: s, getUserDisplay: t, onTrackSelect: a, tags: i, onTagChange: o }) {
|
|
562
|
-
const [d, v] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: l, toggle:
|
|
563
|
+
const [d, v] = W({ key: "record.timestamp", dir: "desc" }), { activeTags: l, toggle: m, clear: g } = xe(i, o), f = C(() => {
|
|
563
564
|
var p;
|
|
564
565
|
if (!((p = s == null ? void 0 : s.tags) != null && p.length)) return [];
|
|
565
|
-
const
|
|
566
|
+
const x = /* @__PURE__ */ new Set();
|
|
566
567
|
for (const N of r || [])
|
|
567
|
-
N.recordByTag && Object.keys(N.recordByTag).forEach((
|
|
568
|
-
return s.tags.filter((N) =>
|
|
569
|
-
}, [r, s]),
|
|
570
|
-
var
|
|
571
|
-
if (!
|
|
568
|
+
N.recordByTag && Object.keys(N.recordByTag).forEach((h) => x.add(h));
|
|
569
|
+
return s.tags.filter((N) => x.has(N));
|
|
570
|
+
}, [r, s]), u = C(() => r ? l.size === 0 ? r : r.map((x) => {
|
|
571
|
+
var h, y;
|
|
572
|
+
if (!x.recordByTag) return null;
|
|
572
573
|
let p = null;
|
|
573
574
|
const N = /* @__PURE__ */ new Set();
|
|
574
|
-
for (const L of Object.values(
|
|
575
|
+
for (const L of Object.values(x.recordByTag)) {
|
|
575
576
|
if (N.has(L.carId)) continue;
|
|
576
577
|
N.add(L.carId);
|
|
577
|
-
const $ = ((y = (
|
|
578
|
+
const $ = ((y = (h = s == null ? void 0 : s.cars) == null ? void 0 : h[L.carId]) == null ? void 0 : y.tags) || ["sports_car"];
|
|
578
579
|
he($, l) && (!p || L.lapTimeMs < p.lapTimeMs) && (p = L);
|
|
579
580
|
}
|
|
580
581
|
return p ? {
|
|
581
|
-
...
|
|
582
|
+
...x,
|
|
582
583
|
record: {
|
|
583
584
|
visibleId: p.steamId || p.identifier,
|
|
584
585
|
carId: p.carId,
|
|
@@ -587,25 +588,25 @@ function Or({ tracks: r, isLoading: n, carMetadata: s, getUserDisplay: t, onTrac
|
|
|
587
588
|
timestamp: p.recordedAt
|
|
588
589
|
}
|
|
589
590
|
} : null;
|
|
590
|
-
}).filter(Boolean) : [], [r, l, s]), b = C(() => O(
|
|
591
|
-
var N,
|
|
591
|
+
}).filter(Boolean) : [], [r, l, s]), b = C(() => O(u, d, (x, p) => {
|
|
592
|
+
var N, h;
|
|
592
593
|
switch (p) {
|
|
593
594
|
case "displayName":
|
|
594
|
-
return
|
|
595
|
+
return x.displayName;
|
|
595
596
|
case "record.lapTimeMs":
|
|
596
|
-
return (N =
|
|
597
|
+
return (N = x.record) == null ? void 0 : N.lapTimeMs;
|
|
597
598
|
case "driverCount":
|
|
598
|
-
return
|
|
599
|
+
return x.driverCount || 0;
|
|
599
600
|
case "carCount":
|
|
600
|
-
return
|
|
601
|
+
return x.carCount || 0;
|
|
601
602
|
case "record.timestamp":
|
|
602
603
|
default:
|
|
603
|
-
return (
|
|
604
|
+
return (h = x.record) != null && h.timestamp ? new Date(x.record.timestamp).getTime() : 0;
|
|
604
605
|
}
|
|
605
|
-
}), [
|
|
606
|
+
}), [u, d]);
|
|
606
607
|
return n ? /* @__PURE__ */ e(V, {}) : r != null && r.length ? /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
607
608
|
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e("h2", { className: "pvx-card-title", children: "Track Records" }) }),
|
|
608
|
-
/* @__PURE__ */ e(fe, { availableTags: f, activeTags: l, onToggle:
|
|
609
|
+
/* @__PURE__ */ e(fe, { availableTags: f, activeTags: l, onToggle: m, onClear: g }),
|
|
609
610
|
/* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
610
611
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
611
612
|
/* @__PURE__ */ e(S, { label: "Track", sortKey: "displayName", config: d, onSort: v }),
|
|
@@ -616,96 +617,96 @@ function Or({ tracks: r, isLoading: n, carMetadata: s, getUserDisplay: t, onTrac
|
|
|
616
617
|
/* @__PURE__ */ e(S, { label: "Cars", sortKey: "carCount", config: d, onSort: v, className: "pvx-hidden-below-lg" }),
|
|
617
618
|
/* @__PURE__ */ e(S, { label: "Date", sortKey: "record.timestamp", config: d, onSort: v, className: "pvx-hidden-below-xl" })
|
|
618
619
|
] }) }),
|
|
619
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: b.map((
|
|
620
|
-
var p, N,
|
|
620
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: b.map((x) => {
|
|
621
|
+
var p, N, h;
|
|
621
622
|
return /* @__PURE__ */ c(
|
|
622
623
|
"tr",
|
|
623
624
|
{
|
|
624
625
|
className: "pvx-row pvx-row--clickable",
|
|
625
|
-
onClick: () => a(
|
|
626
|
+
onClick: () => a(x.id, x.layout),
|
|
626
627
|
children: [
|
|
627
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children:
|
|
628
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: (p =
|
|
629
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N =
|
|
630
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children:
|
|
631
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
632
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
633
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (
|
|
628
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: x.displayName }),
|
|
629
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: (p = x.record) != null && p.visibleId ? /* @__PURE__ */ e(z, { userId: x.record.visibleId, getUserDisplay: t }) : "-" }),
|
|
630
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-hidden-below-lg", children: ((N = x.record) == null ? void 0 : N.carDisplayName) || "-" }),
|
|
631
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: x.record ? P(x.record.lapTimeMs) : "-" }),
|
|
632
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: x.driverCount || "-" }),
|
|
633
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: x.carCount || "-" }),
|
|
634
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: (h = x.record) != null && h.timestamp ? q(x.record.timestamp) : "-" })
|
|
634
635
|
]
|
|
635
636
|
},
|
|
636
|
-
`${
|
|
637
|
+
`${x.id}|${x.layout || ""}`
|
|
637
638
|
);
|
|
638
639
|
}) })
|
|
639
640
|
] }) })
|
|
640
641
|
] }) : /* @__PURE__ */ e(j, { message: "No lap times recorded yet." });
|
|
641
642
|
}
|
|
642
643
|
function zr({ entries: r, isLoading: n, track: s, carMetadata: t, getUserDisplay: a, onCarSelect: i, onNavigate: o, tags: d, onTagChange: v }) {
|
|
643
|
-
const [l,
|
|
644
|
+
const [l, m] = W({ key: "lapTimeMs", dir: "asc" }), { activeTags: g, toggle: f, clear: u } = xe(d, v), b = C(() => {
|
|
644
645
|
var y, L, $;
|
|
645
646
|
if (!r || !((y = t == null ? void 0 : t.tags) != null && y.length)) return [];
|
|
646
|
-
const
|
|
647
|
+
const h = /* @__PURE__ */ new Set();
|
|
647
648
|
for (const w of r)
|
|
648
|
-
((($ = (L = t.cars) == null ? void 0 : L[w.carId]) == null ? void 0 : $.tags) || ["sports_car"]).forEach((U) =>
|
|
649
|
-
return t.tags.filter((w) =>
|
|
650
|
-
}, [r, t]),
|
|
649
|
+
((($ = (L = t.cars) == null ? void 0 : L[w.carId]) == null ? void 0 : $.tags) || ["sports_car"]).forEach((U) => h.add(U));
|
|
650
|
+
return t.tags.filter((w) => h.has(w));
|
|
651
|
+
}, [r, t]), x = C(() => r ? g.size === 0 ? r : r.filter((h) => {
|
|
651
652
|
var L, $;
|
|
652
|
-
const y = (($ = (L = t == null ? void 0 : t.cars) == null ? void 0 : L[
|
|
653
|
-
return he(y,
|
|
654
|
-
}) : [], [r,
|
|
653
|
+
const y = (($ = (L = t == null ? void 0 : t.cars) == null ? void 0 : L[h.carId]) == null ? void 0 : $.tags) || ["sports_car"];
|
|
654
|
+
return he(y, g);
|
|
655
|
+
}) : [], [r, g, t]), p = C(() => O(x, l, (h, y) => {
|
|
655
656
|
switch (y) {
|
|
656
657
|
case "carId":
|
|
657
|
-
return I(
|
|
658
|
+
return I(h.carId);
|
|
658
659
|
case "driverCount":
|
|
659
|
-
return
|
|
660
|
+
return h.driverCount || 0;
|
|
660
661
|
case "lapTimeMs":
|
|
661
662
|
default:
|
|
662
|
-
return
|
|
663
|
+
return h.lapTimeMs;
|
|
663
664
|
}
|
|
664
|
-
}), [
|
|
665
|
+
}), [x, l]), N = [
|
|
665
666
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
666
667
|
{ key: "track", label: s.displayName }
|
|
667
668
|
];
|
|
668
669
|
return n ? /* @__PURE__ */ e(V, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
669
670
|
/* @__PURE__ */ e("div", { className: "pvx-card-header", children: /* @__PURE__ */ e(ne, { segments: N }) }),
|
|
670
|
-
/* @__PURE__ */ e(fe, { availableTags: b, activeTags:
|
|
671
|
+
/* @__PURE__ */ e(fe, { availableTags: b, activeTags: g, onToggle: f, onClear: u }),
|
|
671
672
|
r != null && r.length ? /* @__PURE__ */ e("div", { className: "pvx-table-scroll", children: /* @__PURE__ */ c("table", { className: "pvx-table", children: [
|
|
672
673
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { className: "pvx-thead-row", children: [
|
|
673
674
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-th--narrow", children: "#" }),
|
|
674
|
-
/* @__PURE__ */ e(S, { label: "Car", sortKey: "carId", config: l, onSort:
|
|
675
|
+
/* @__PURE__ */ e(S, { label: "Car", sortKey: "carId", config: l, onSort: m }),
|
|
675
676
|
/* @__PURE__ */ e("th", { className: "pvx-th", children: "Record Holder" }),
|
|
676
|
-
/* @__PURE__ */ e(S, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort:
|
|
677
|
-
/* @__PURE__ */ e(S, { label: "Drivers", sortKey: "driverCount", config: l, onSort:
|
|
677
|
+
/* @__PURE__ */ e(S, { label: "Lap Time", sortKey: "lapTimeMs", config: l, onSort: m }),
|
|
678
|
+
/* @__PURE__ */ e(S, { label: "Drivers", sortKey: "driverCount", config: l, onSort: m, className: "pvx-hidden-below-md" }),
|
|
678
679
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Date" })
|
|
679
680
|
] }) }),
|
|
680
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: p.map((
|
|
681
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: p.map((h, y) => /* @__PURE__ */ c(
|
|
681
682
|
"tr",
|
|
682
683
|
{
|
|
683
684
|
className: "pvx-row pvx-row--clickable",
|
|
684
|
-
onClick: () => i(
|
|
685
|
+
onClick: () => i(h.carId),
|
|
685
686
|
children: [
|
|
686
687
|
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: y + 1, podium: !0 }) }),
|
|
687
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(
|
|
688
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(z, { userId:
|
|
689
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: P(
|
|
690
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children:
|
|
691
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children:
|
|
688
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: I(h.carId) }),
|
|
689
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(z, { userId: h.steamId || h.userId, getUserDisplay: a }) }),
|
|
690
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: P(h.lapTimeMs) }),
|
|
691
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-md", children: h.driverCount || "-" }),
|
|
692
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-lg", children: h.recordedAt ? q(h.recordedAt) : "-" })
|
|
692
693
|
]
|
|
693
694
|
},
|
|
694
|
-
|
|
695
|
+
h.carId
|
|
695
696
|
)) })
|
|
696
697
|
] }) }) : /* @__PURE__ */ e(j, { message: "No lap times for this track yet." })
|
|
697
698
|
] });
|
|
698
699
|
}
|
|
699
700
|
function Gr({ entries: r, isLoading: n, track: s, carId: t, getUserDisplay: a, onDriverSelect: i, onNavigate: o, highlightId: d }) {
|
|
700
|
-
const [v, l] = W({ key: "lapTimeMs", dir: "asc" }),
|
|
701
|
+
const [v, l] = W({ key: "lapTimeMs", dir: "asc" }), m = C(() => ge(r), [r]), g = C(() => O(r || [], v, (u, b) => {
|
|
701
702
|
switch (b) {
|
|
702
703
|
case "userId":
|
|
703
|
-
return a(
|
|
704
|
+
return a(u.steamId || u.userId).displayName;
|
|
704
705
|
case "lapCount":
|
|
705
|
-
return
|
|
706
|
+
return u.lapCount || 0;
|
|
706
707
|
case "lapTimeMs":
|
|
707
708
|
default:
|
|
708
|
-
return
|
|
709
|
+
return u.lapTimeMs;
|
|
709
710
|
}
|
|
710
711
|
}), [r, v, a]), f = [
|
|
711
712
|
{ key: "tracks", label: "Tracks", onClick: () => o("tracks") },
|
|
@@ -727,24 +728,24 @@ function Gr({ entries: r, isLoading: n, track: s, carId: t, getUserDisplay: a, o
|
|
|
727
728
|
/* @__PURE__ */ e(S, { label: "Laps", sortKey: "lapCount", config: v, onSort: l, className: "pvx-hidden-below-lg" }),
|
|
728
729
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
729
730
|
] }) }),
|
|
730
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children:
|
|
731
|
-
const
|
|
731
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: g.map((u, b) => {
|
|
732
|
+
const x = b + 1, p = u.steamId || u.userId, N = m && u.sector1Ms === m.s1, h = m && u.sector2Ms === m.s2, y = m && u.sector3Ms === m.s3;
|
|
732
733
|
return /* @__PURE__ */ c(
|
|
733
734
|
"tr",
|
|
734
735
|
{
|
|
735
|
-
className: `pvx-row pvx-row--clickable ${d && p === d ? "pvx-row--highlight" :
|
|
736
|
+
className: `pvx-row pvx-row--clickable ${d && p === d ? "pvx-row--highlight" : x <= 3 ? "pvx-row--podium" : ""}`,
|
|
736
737
|
onClick: () => i(p),
|
|
737
738
|
children: [
|
|
738
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank:
|
|
739
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e(re, { rank: x, podium: !0 }) }),
|
|
739
740
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary", children: /* @__PURE__ */ e(z, { userId: p, getUserDisplay: a }) }),
|
|
740
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: P(
|
|
741
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${N ? "pvx-td--best-sector" : ""}`, children: D(
|
|
742
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${
|
|
743
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: D(
|
|
744
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ce(
|
|
745
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children:
|
|
746
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
747
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children:
|
|
741
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: P(u.lapTimeMs) }),
|
|
742
|
+
/* @__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) }),
|
|
743
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${h ? "pvx-td--best-sector" : ""}`, children: D(u.sector2Ms) }),
|
|
744
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${y ? "pvx-td--best-sector" : ""}`, children: D(u.sector3Ms) }),
|
|
745
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ce(u.tyreCompound), children: u.tyreCompound || "-" }),
|
|
746
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-xl", children: u.startingFuelL ? `${u.startingFuelL}L` : "-" }),
|
|
747
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: u.lapCount || "-" }),
|
|
748
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: u.recordedAt ? q(u.recordedAt) : "-" })
|
|
748
749
|
]
|
|
749
750
|
},
|
|
750
751
|
p
|
|
@@ -754,14 +755,14 @@ function Gr({ entries: r, isLoading: n, track: s, carId: t, getUserDisplay: a, o
|
|
|
754
755
|
] });
|
|
755
756
|
}
|
|
756
757
|
function Qr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvalid: i, getUserDisplay: o, onToggleInvalid: d, onNavigate: v }) {
|
|
757
|
-
const { data: l, driverName:
|
|
758
|
-
const
|
|
759
|
-
return
|
|
758
|
+
const { data: l, driverName: m, theoreticalBest: g, isLoading: f } = Fe(r, n.id, n.layout, s, { showInvalid: i, game: t, gameVersion: a }), { displayName: u, avatarUrl: b } = o(r, m), x = C(() => ge(l, !0), [l]), p = C(() => {
|
|
759
|
+
const h = (l == null ? void 0 : l.filter((y) => y.isValid)) || [];
|
|
760
|
+
return h.length ? Math.min(...h.map((y) => y.lapTimeMs)) : null;
|
|
760
761
|
}, [l]), N = [
|
|
761
762
|
{ key: "tracks", label: "Tracks", onClick: () => v("tracks") },
|
|
762
763
|
{ key: "track", label: n.displayName, onClick: () => v("track") },
|
|
763
764
|
{ key: "car", label: I(s), onClick: () => v("car") },
|
|
764
|
-
{ key: "driver", label:
|
|
765
|
+
{ key: "driver", label: u }
|
|
765
766
|
];
|
|
766
767
|
return f ? /* @__PURE__ */ e(V, {}) : /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
767
768
|
/* @__PURE__ */ c("div", { className: "pvx-card-header pvx-card-header--split", children: [
|
|
@@ -782,16 +783,16 @@ function Qr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvali
|
|
|
782
783
|
/* @__PURE__ */ e("span", { children: "Show invalid laps" })
|
|
783
784
|
] })
|
|
784
785
|
] }),
|
|
785
|
-
|
|
786
|
+
g && /* @__PURE__ */ c("div", { className: "pvx-theoretical-best", children: [
|
|
786
787
|
/* @__PURE__ */ e("span", { className: "pvx-theoretical-best-label", children: "Theoretical Best:" }),
|
|
787
|
-
/* @__PURE__ */ e("span", { className: "pvx-theoretical-best-time", children: P(
|
|
788
|
+
/* @__PURE__ */ e("span", { className: "pvx-theoretical-best-time", children: P(g.lapTimeMs) }),
|
|
788
789
|
/* @__PURE__ */ c("span", { className: "pvx-theoretical-best-sectors", children: [
|
|
789
790
|
"(",
|
|
790
|
-
D(
|
|
791
|
+
D(g.sector1Ms),
|
|
791
792
|
" + ",
|
|
792
|
-
D(
|
|
793
|
+
D(g.sector2Ms),
|
|
793
794
|
" + ",
|
|
794
|
-
D(
|
|
795
|
+
D(g.sector3Ms),
|
|
795
796
|
")"
|
|
796
797
|
] })
|
|
797
798
|
] }),
|
|
@@ -808,28 +809,28 @@ function Qr({ userId: r, track: n, carId: s, game: t, gameVersion: a, showInvali
|
|
|
808
809
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-lg", children: "Fuel" }),
|
|
809
810
|
/* @__PURE__ */ e("th", { className: "pvx-th pvx-hidden-below-xl", children: "Date" })
|
|
810
811
|
] }) }),
|
|
811
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: l.map((
|
|
812
|
-
const L =
|
|
812
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: l.map((h, y) => {
|
|
813
|
+
const L = h.isValid && h.lapTimeMs === p, $ = x && h.isValid && h.sector1Ms === x.s1, w = x && h.isValid && h.sector2Ms === x.s2, te = x && h.isValid && h.sector3Ms === x.s3;
|
|
813
814
|
let U = "pvx-row";
|
|
814
|
-
return
|
|
815
|
+
return h.isValid || (U += " pvx-row--invalid"), L && (U += " pvx-row--personal-best"), /* @__PURE__ */ c("tr", { className: U, children: [
|
|
815
816
|
/* @__PURE__ */ e("td", { className: "pvx-td", children: /* @__PURE__ */ e("span", { className: `pvx-rank ${L ? "pvx-rank--gold" : ""}`, children: y + 1 }) }),
|
|
816
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children:
|
|
817
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: P(
|
|
818
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(
|
|
819
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: D(
|
|
820
|
-
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${te ? "pvx-td--best-sector" : ""}`, children: D(
|
|
821
|
-
/* @__PURE__ */ e("td", { className: "pvx-td", title:
|
|
822
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ce(
|
|
823
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children:
|
|
824
|
-
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: q(
|
|
825
|
-
] },
|
|
817
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-md", children: h.lapNumber || "-" }),
|
|
818
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--primary pvx-td--mono", children: P(h.lapTimeMs) }),
|
|
819
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${$ ? "pvx-td--best-sector" : ""}`, children: D(h.sector1Ms) }),
|
|
820
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${w ? "pvx-td--best-sector" : ""}`, children: D(h.sector2Ms) }),
|
|
821
|
+
/* @__PURE__ */ e("td", { className: `pvx-td pvx-td--mono pvx-td--sector pvx-hidden-below-sm ${te ? "pvx-td--best-sector" : ""}`, children: D(h.sector3Ms) }),
|
|
822
|
+
/* @__PURE__ */ e("td", { className: "pvx-td", title: h.isValid ? void 0 : h.invalidReason || "Invalid", children: h.isValid ? /* @__PURE__ */ e(We, {}) : /* @__PURE__ */ e(Oe, {}) }),
|
|
823
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", title: ce(h.tyreCompound), children: h.tyreCompound || "-" }),
|
|
824
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-lg", children: h.startingFuelL ? `${h.startingFuelL}L` : "-" }),
|
|
825
|
+
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--muted pvx-hidden-below-xl", children: q(h.timestamp) })
|
|
826
|
+
] }, h.id);
|
|
826
827
|
}) })
|
|
827
828
|
] }) }) : /* @__PURE__ */ e(j, { message: i ? "No laps recorded for this combination." : 'No valid laps. Try enabling "Show invalid laps".' })
|
|
828
829
|
] });
|
|
829
830
|
}
|
|
830
831
|
function Yr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion: a, onComboSelect: i }) {
|
|
831
|
-
const [o, d] = W({ key: "rank", dir: "asc" }), [v, l] = M(null),
|
|
832
|
-
switch (
|
|
832
|
+
const [o, d] = W({ key: "rank", dir: "asc" }), [v, l] = M(null), m = C(() => r ? O(r, o, (f, u) => {
|
|
833
|
+
switch (u) {
|
|
833
834
|
case "rating":
|
|
834
835
|
return f.rating;
|
|
835
836
|
case "comboCount":
|
|
@@ -844,7 +845,7 @@ function Yr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion:
|
|
|
844
845
|
if (n) return /* @__PURE__ */ e(V, {});
|
|
845
846
|
if (!(r != null && r.length))
|
|
846
847
|
return /* @__PURE__ */ e("div", { className: "pvx-card", children: /* @__PURE__ */ e(j, { message: "Not enough data for rankings yet." }) });
|
|
847
|
-
const
|
|
848
|
+
const g = 5;
|
|
848
849
|
return /* @__PURE__ */ c("div", { className: "pvx-card", children: [
|
|
849
850
|
/* @__PURE__ */ c("div", { className: "pvx-card-header pvx-rankings-header", children: [
|
|
850
851
|
/* @__PURE__ */ e("h2", { className: "pvx-card-title", children: "Driver Rankings" }),
|
|
@@ -869,16 +870,16 @@ function Yr({ drivers: r, isLoading: n, getUserDisplay: s, game: t, gameVersion:
|
|
|
869
870
|
/* @__PURE__ */ e(S, { label: "Cars", sortKey: "distinctCars", config: o, onSort: d, className: "pvx-hidden-below-sm" }),
|
|
870
871
|
/* @__PURE__ */ e(S, { label: "Combos", sortKey: "comboCount", config: o, onSort: d, className: "pvx-hidden-below-sm" })
|
|
871
872
|
] }) }),
|
|
872
|
-
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children:
|
|
873
|
-
const
|
|
873
|
+
/* @__PURE__ */ e("tbody", { className: "pvx-tbody", children: m.map((f) => {
|
|
874
|
+
const u = v === f.identifier;
|
|
874
875
|
return /* @__PURE__ */ e(
|
|
875
876
|
ze,
|
|
876
877
|
{
|
|
877
878
|
driver: f,
|
|
878
879
|
getUserDisplay: s,
|
|
879
|
-
isExpanded:
|
|
880
|
-
onToggle: () => l(
|
|
881
|
-
colCount:
|
|
880
|
+
isExpanded: u,
|
|
881
|
+
onToggle: () => l(u ? null : f.identifier),
|
|
882
|
+
colCount: g,
|
|
882
883
|
game: t,
|
|
883
884
|
gameVersion: a,
|
|
884
885
|
onComboSelect: i
|
|
@@ -909,8 +910,8 @@ function ze({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
|
|
|
909
910
|
]
|
|
910
911
|
}
|
|
911
912
|
),
|
|
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((l,
|
|
913
|
-
const
|
|
913
|
+
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((l, m) => {
|
|
914
|
+
const g = l.layout ? `${l.trackId}|${l.layout}` : l.trackId, f = d ? () => d({ track: g, car: l.carId, highlight: v, game: i, gameVersion: o }) : void 0;
|
|
914
915
|
return /* @__PURE__ */ c(
|
|
915
916
|
"div",
|
|
916
917
|
{
|
|
@@ -938,7 +939,7 @@ function ze({ driver: r, getUserDisplay: n, isExpanded: s, onToggle: t, colCount
|
|
|
938
939
|
] })
|
|
939
940
|
]
|
|
940
941
|
},
|
|
941
|
-
|
|
942
|
+
m
|
|
942
943
|
);
|
|
943
944
|
}) }) }) })
|
|
944
945
|
] });
|
|
@@ -1033,8 +1034,8 @@ function Jr({ competitions: r, isLoading: n, onSelect: s, onRegister: t, classNa
|
|
|
1033
1034
|
return n ? /* @__PURE__ */ e(A, { message: "Loading competitions..." }) : r != null && r.length ? /* @__PURE__ */ e("div", { className: `pvx-comp-grid ${a || ""}`, children: r.map((i) => /* @__PURE__ */ e(er, { comp: i, onSelect: s, onRegister: t || s }, i.id)) }) : /* @__PURE__ */ e(B, { message: "No competitions available." });
|
|
1034
1035
|
}
|
|
1035
1036
|
function er({ comp: r, onSelect: n, onRegister: s }) {
|
|
1036
|
-
var
|
|
1037
|
-
const { cdnUrl: t } = k(), a = r.posterCdnPath ? `${t}/${r.posterCdnPath}` : null, i = r.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, v = d && o >= d, l = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(),
|
|
1037
|
+
var x, p, N;
|
|
1038
|
+
const { cdnUrl: t } = k(), a = r.posterCdnPath ? `${t}/${r.posterCdnPath}` : null, i = r.registration, o = (i == null ? void 0 : i.currentCount) || 0, d = i == null ? void 0 : i.maxParticipants, v = d && o >= d, l = (i == null ? void 0 : i.deadline) && new Date(i.deadline) < /* @__PURE__ */ new Date(), m = (i == null ? void 0 : i.isOpen) && !l && !v, g = /* @__PURE__ */ new Date(), f = (x = r.rounds) == null ? void 0 : x.find((h) => h.startTime && new Date(h.startTime) >= g), u = ((p = r.rounds) == null ? void 0 : p.length) || 0, b = ((N = r.rounds) == null ? void 0 : N.filter((h) => h.isFinalized).length) || 0;
|
|
1038
1039
|
return /* @__PURE__ */ c(
|
|
1039
1040
|
"div",
|
|
1040
1041
|
{
|
|
@@ -1042,8 +1043,8 @@ function er({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
1042
1043
|
onClick: () => n(r.id),
|
|
1043
1044
|
role: "button",
|
|
1044
1045
|
tabIndex: 0,
|
|
1045
|
-
onKeyDown: (
|
|
1046
|
-
(
|
|
1046
|
+
onKeyDown: (h) => {
|
|
1047
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), n(r.id));
|
|
1047
1048
|
},
|
|
1048
1049
|
children: [
|
|
1049
1050
|
/* @__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(nr, {}) }) }),
|
|
@@ -1053,9 +1054,9 @@ function er({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
1053
1054
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-pills", children: [
|
|
1054
1055
|
/* @__PURE__ */ e(Je, { type: r.type }),
|
|
1055
1056
|
r.game && /* @__PURE__ */ e(Q, { children: r.game.toUpperCase() }),
|
|
1056
|
-
r.formatDescription && r.formatDescription.split(", ").map((
|
|
1057
|
+
r.formatDescription && r.formatDescription.split(", ").map((h, y) => /* @__PURE__ */ e(Q, { variant: "format", children: h }, y))
|
|
1057
1058
|
] }),
|
|
1058
|
-
r.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: r.carsDescription.split(", ").map((
|
|
1059
|
+
r.carsDescription && /* @__PURE__ */ e("div", { className: "pvx-comp-card-pills", children: r.carsDescription.split(", ").map((h, y) => /* @__PURE__ */ e(Q, { children: h }, y)) }),
|
|
1059
1060
|
/* @__PURE__ */ c("div", { className: "pvx-comp-card-schedule", children: [
|
|
1060
1061
|
f ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1061
1062
|
/* @__PURE__ */ e("span", { className: "pvx-comp-card-schedule-label", children: "Next:" }),
|
|
@@ -1066,23 +1067,23 @@ function er({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
1066
1067
|
f.track || "TBD",
|
|
1067
1068
|
" — ",
|
|
1068
1069
|
Ze(f.startTime)
|
|
1069
|
-
] }) :
|
|
1070
|
+
] }) : u > 0 ? /* @__PURE__ */ c("span", { className: "pvx-comp-card-schedule-next", children: [
|
|
1070
1071
|
b,
|
|
1071
1072
|
"/",
|
|
1072
|
-
|
|
1073
|
+
u,
|
|
1073
1074
|
" rounds completed"
|
|
1074
1075
|
] }) : null,
|
|
1075
|
-
|
|
1076
|
-
|
|
1076
|
+
u > 0 && /* @__PURE__ */ c("span", { className: "pvx-comp-card-round-count", children: [
|
|
1077
|
+
u,
|
|
1077
1078
|
" round",
|
|
1078
|
-
|
|
1079
|
+
u !== 1 ? "s" : ""
|
|
1079
1080
|
] })
|
|
1080
1081
|
] }),
|
|
1081
1082
|
i && /* @__PURE__ */ e(
|
|
1082
1083
|
rr,
|
|
1083
1084
|
{
|
|
1084
1085
|
competitionId: r.id,
|
|
1085
|
-
regOpen:
|
|
1086
|
+
regOpen: m,
|
|
1086
1087
|
isFull: v,
|
|
1087
1088
|
deadlinePassed: l,
|
|
1088
1089
|
regCount: o,
|
|
@@ -1096,7 +1097,7 @@ function er({ comp: r, onSelect: n, onRegister: s }) {
|
|
|
1096
1097
|
);
|
|
1097
1098
|
}
|
|
1098
1099
|
function rr({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCount: a, regMax: i, onRegister: o }) {
|
|
1099
|
-
const { isPowerMode: d } = X(), v = ee(r), { data: l } = Z(r),
|
|
1100
|
+
const { isPowerMode: d } = X(), v = ee(r), { data: l } = Z(r), m = (l == null ? void 0 : l.isRegistered) || !1, g = i ? a / i * 100 : 0, f = g >= 100 ? "full" : g >= 75 ? "warning" : "ok";
|
|
1100
1101
|
return /* @__PURE__ */ c("div", { className: "pvx-comp-card-reg", children: [
|
|
1101
1102
|
/* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-info", children: /* @__PURE__ */ c("span", { className: `pvx-reg-capacity pvx-reg-capacity--${f}`, children: [
|
|
1102
1103
|
a,
|
|
@@ -1104,12 +1105,12 @@ function rr({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCou
|
|
|
1104
1105
|
i || "∞",
|
|
1105
1106
|
" drivers"
|
|
1106
1107
|
] }) }),
|
|
1107
|
-
/* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-action", children:
|
|
1108
|
+
/* @__PURE__ */ e("div", { className: "pvx-comp-card-reg-action", children: m ? /* @__PURE__ */ e(
|
|
1108
1109
|
"button",
|
|
1109
1110
|
{
|
|
1110
1111
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--registered",
|
|
1111
|
-
onClick: (
|
|
1112
|
-
|
|
1112
|
+
onClick: (u) => {
|
|
1113
|
+
u.stopPropagation(), o(r);
|
|
1113
1114
|
},
|
|
1114
1115
|
children: "✓ Registered"
|
|
1115
1116
|
}
|
|
@@ -1117,8 +1118,8 @@ function rr({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCou
|
|
|
1117
1118
|
"button",
|
|
1118
1119
|
{
|
|
1119
1120
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1120
|
-
onClick: (
|
|
1121
|
-
|
|
1121
|
+
onClick: (u) => {
|
|
1122
|
+
u.stopPropagation(), o(r);
|
|
1122
1123
|
},
|
|
1123
1124
|
children: "Register"
|
|
1124
1125
|
}
|
|
@@ -1129,7 +1130,7 @@ function rr({ competitionId: r, regOpen: n, isFull: s, deadlinePassed: t, regCou
|
|
|
1129
1130
|
target: "_blank",
|
|
1130
1131
|
rel: "noopener noreferrer",
|
|
1131
1132
|
className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--open",
|
|
1132
|
-
onClick: (
|
|
1133
|
+
onClick: (u) => u.stopPropagation(),
|
|
1133
1134
|
children: "Register"
|
|
1134
1135
|
}
|
|
1135
1136
|
) : /* @__PURE__ */ e("span", { className: "pvx-comp-card-reg-btn pvx-comp-card-reg-btn--closed", children: s ? "Full" : "Closed" }) })
|
|
@@ -1210,17 +1211,17 @@ function sr({ driver: r, finalizedRounds: n }) {
|
|
|
1210
1211
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-hidden-below-sm", children: i || "-" }),
|
|
1211
1212
|
/* @__PURE__ */ e("td", { className: "pvx-td pvx-td--center pvx-standings-total", children: r.totalPoints }),
|
|
1212
1213
|
n.map((l) => {
|
|
1213
|
-
const
|
|
1214
|
+
const m = t.get(l.roundNumber), g = m == null ? void 0 : m.dropped;
|
|
1214
1215
|
return /* @__PURE__ */ e(
|
|
1215
1216
|
"td",
|
|
1216
1217
|
{
|
|
1217
|
-
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!
|
|
1218
|
-
children:
|
|
1218
|
+
className: `pvx-td pvx-td--center pvx-hidden-below-md ${!g && (m == null ? void 0 : m.position) === 1 ? "pvx-standings-cell--p1" : !g && (m == null ? void 0 : m.position) === 2 ? "pvx-standings-cell--p2" : !g && (m == null ? void 0 : m.position) === 3 ? "pvx-standings-cell--p3" : ""}`,
|
|
1219
|
+
children: m ? /* @__PURE__ */ c("div", { className: `pvx-standings-round-cell ${g ? "pvx-standings-round-cell--dropped" : ""}`, children: [
|
|
1219
1220
|
/* @__PURE__ */ c("span", { className: "pvx-standings-round-pos", children: [
|
|
1220
1221
|
"P",
|
|
1221
|
-
|
|
1222
|
+
m.position
|
|
1222
1223
|
] }),
|
|
1223
|
-
/* @__PURE__ */ e("span", { className: "pvx-standings-round-pts", children:
|
|
1224
|
+
/* @__PURE__ */ e("span", { className: "pvx-standings-round-pts", children: m.points })
|
|
1224
1225
|
] }) : /* @__PURE__ */ e("span", { className: "pvx-td--muted", children: "-" })
|
|
1225
1226
|
},
|
|
1226
1227
|
l.roundNumber
|
|
@@ -1235,7 +1236,7 @@ function Zr({ competitionId: r, roundNumber: n, className: s }) {
|
|
|
1235
1236
|
return /* @__PURE__ */ e(A, { message: "Loading results..." });
|
|
1236
1237
|
if (!t)
|
|
1237
1238
|
return /* @__PURE__ */ e(B, { message: "No results for this round." });
|
|
1238
|
-
const o = (t.sessions || []).find((l) => l.type === "RACE"), d = (v = o == null ? void 0 : o.results) == null ? void 0 : v.filter((l) => l.position <= 3).sort((l,
|
|
1239
|
+
const o = (t.sessions || []).find((l) => l.type === "RACE"), d = (v = o == null ? void 0 : o.results) == null ? void 0 : v.filter((l) => l.position <= 3).sort((l, m) => l.position - m.position);
|
|
1239
1240
|
return /* @__PURE__ */ c("div", { className: `pvx-round-results ${s || ""}`, children: [
|
|
1240
1241
|
/* @__PURE__ */ c("div", { className: "pvx-round-results-header", children: [
|
|
1241
1242
|
/* @__PURE__ */ c("div", { children: [
|
|
@@ -1366,7 +1367,7 @@ function Xr({ competitionId: r, className: n }) {
|
|
|
1366
1367
|
return /* @__PURE__ */ e(A, { message: "Loading drivers..." });
|
|
1367
1368
|
const o = (t == null ? void 0 : t.drivers) || (t == null ? void 0 : t.entries) || [];
|
|
1368
1369
|
return o.length ? /* @__PURE__ */ e("div", { className: `pvx-entry-grid ${n || ""}`, children: o.map((d) => {
|
|
1369
|
-
var l,
|
|
1370
|
+
var l, m;
|
|
1370
1371
|
const v = i && d.steamId === i;
|
|
1371
1372
|
return /* @__PURE__ */ c("div", { className: `pvx-entry-card ${v ? "pvx-entry-card--you" : ""}`, children: [
|
|
1372
1373
|
d.avatarUrl ? /* @__PURE__ */ e(
|
|
@@ -1376,7 +1377,7 @@ function Xr({ competitionId: r, className: n }) {
|
|
|
1376
1377
|
alt: "",
|
|
1377
1378
|
className: "pvx-entry-avatar"
|
|
1378
1379
|
}
|
|
1379
|
-
) : /* @__PURE__ */ e("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((
|
|
1380
|
+
) : /* @__PURE__ */ e("div", { className: "pvx-entry-avatar pvx-entry-avatar--placeholder", children: ((m = (l = d.displayName) == null ? void 0 : l.charAt(0)) == null ? void 0 : m.toUpperCase()) || "?" }),
|
|
1380
1381
|
/* @__PURE__ */ c("span", { className: "pvx-entry-name", children: [
|
|
1381
1382
|
d.displayName,
|
|
1382
1383
|
v && /* @__PURE__ */ e("span", { className: "pvx-entry-you", children: " (you)" })
|
|
@@ -1390,18 +1391,18 @@ function en({
|
|
|
1390
1391
|
className: s,
|
|
1391
1392
|
children: t
|
|
1392
1393
|
}) {
|
|
1393
|
-
const { data: a, isLoading: i } = Z(r), { isPowerMode: o } = X(), d = ee(r), v = ue(r), l = me(r),
|
|
1394
|
+
const { data: a, isLoading: i } = Z(r), { isPowerMode: o } = X(), d = ee(r), v = ue(r), l = me(r), m = (a == null ? void 0 : a.isRegistered) || !1, g = i || v.isPending || l.isPending, f = v.error || l.error || null, u = () => {
|
|
1394
1395
|
o && v.mutate(n || {});
|
|
1395
1396
|
}, b = () => {
|
|
1396
1397
|
o && l.mutate();
|
|
1397
1398
|
};
|
|
1398
|
-
return typeof t == "function" ? t({ isRegistered:
|
|
1399
|
+
return typeof t == "function" ? t({ isRegistered: m, isLoading: g, register: u, withdraw: b, error: f, isPowerMode: o, registrationUrl: d }) : o ? /* @__PURE__ */ e(
|
|
1399
1400
|
"button",
|
|
1400
1401
|
{
|
|
1401
1402
|
className: `pvx-comp-register-btn ${s || ""}`,
|
|
1402
|
-
onClick:
|
|
1403
|
-
disabled:
|
|
1404
|
-
children:
|
|
1403
|
+
onClick: m ? b : u,
|
|
1404
|
+
disabled: g,
|
|
1405
|
+
children: g ? "Loading..." : m ? "Withdraw" : "Register"
|
|
1405
1406
|
}
|
|
1406
1407
|
) : /* @__PURE__ */ e(
|
|
1407
1408
|
"a",
|
|
@@ -1410,48 +1411,48 @@ function en({
|
|
|
1410
1411
|
target: "_blank",
|
|
1411
1412
|
rel: "noopener noreferrer",
|
|
1412
1413
|
className: `pvx-comp-register-link ${s || ""}`,
|
|
1413
|
-
children:
|
|
1414
|
+
children: m ? "View Registration" : "Register on PitVox"
|
|
1414
1415
|
}
|
|
1415
1416
|
);
|
|
1416
1417
|
}
|
|
1417
1418
|
function rn({ competitionId: r, registration: n, onWithdrawSuccess: s, className: t }) {
|
|
1418
|
-
const { getSteamId: a } = k(), { isPowerMode: i } = X(), o = ee(r), { data: d, isLoading: v } = Z(r), { data: l, isLoading:
|
|
1419
|
-
return v ||
|
|
1419
|
+
const { getSteamId: a } = k(), { isPowerMode: i } = X(), o = ee(r), { data: d, isLoading: v } = Z(r), { data: l, isLoading: m } = pe(r), g = ue(r), f = me(r), u = a(), b = (d == null ? void 0 : d.isRegistered) || !1, x = (l == null ? void 0 : l.drivers) || (l == null ? void 0 : l.entries) || [], p = n || {}, N = x.length || p.currentCount || 0, h = p.maxParticipants && N >= p.maxParticipants, y = p.deadline && new Date(p.deadline) < /* @__PURE__ */ new Date(), L = p.isOpen && !y && !h;
|
|
1420
|
+
return v || m ? /* @__PURE__ */ e(A, { message: "Loading registration..." }) : b ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e(
|
|
1420
1421
|
lr,
|
|
1421
1422
|
{
|
|
1422
1423
|
competitionId: r,
|
|
1423
|
-
drivers:
|
|
1424
|
-
steamId:
|
|
1424
|
+
drivers: x,
|
|
1425
|
+
steamId: u,
|
|
1425
1426
|
isPowerMode: i,
|
|
1426
1427
|
registrationUrl: o,
|
|
1427
1428
|
withdrawMutation: f,
|
|
1428
1429
|
onWithdrawSuccess: s,
|
|
1429
1430
|
registration: p
|
|
1430
1431
|
}
|
|
1431
|
-
) }) : L ?
|
|
1432
|
+
) }) : L ? u ? i ? /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e(
|
|
1432
1433
|
cr,
|
|
1433
1434
|
{
|
|
1434
1435
|
competitionId: r,
|
|
1435
|
-
registerMutation:
|
|
1436
|
+
registerMutation: g,
|
|
1436
1437
|
registration: p
|
|
1437
1438
|
}
|
|
1438
1439
|
) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) : /* @__PURE__ */ e("div", { className: `pvx-reg-panel ${t || ""}`, children: i ? /* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: "Sign in to register for this competition." }) : /* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: /* @__PURE__ */ e("a", { href: o, target: "_blank", rel: "noopener noreferrer", className: "pvx-comp-register-link", children: "Register on PitVox" }) }) }) : /* @__PURE__ */ c("div", { className: `pvx-reg-panel ${t || ""}`, children: [
|
|
1439
|
-
/* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children:
|
|
1440
|
-
|
|
1440
|
+
/* @__PURE__ */ e("div", { className: "pvx-reg-status-msg", children: h ? "Registration is full." : y ? "Registration deadline has passed." : "Registration is closed." }),
|
|
1441
|
+
x.length > 0 && /* @__PURE__ */ e(we, { drivers: x, steamId: u })
|
|
1441
1442
|
] });
|
|
1442
1443
|
}
|
|
1443
1444
|
function cr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
1444
|
-
const [t, a] = M(""), [i, o] = M("intermediate"), [d, v] = M(""), l = (
|
|
1445
|
-
|
|
1445
|
+
const [t, a] = M(""), [i, o] = M("intermediate"), [d, v] = M(""), l = (u) => {
|
|
1446
|
+
u.preventDefault(), n.mutate({
|
|
1446
1447
|
discordUsername: t || void 0,
|
|
1447
1448
|
experience: i,
|
|
1448
1449
|
comments: d || void 0
|
|
1449
1450
|
});
|
|
1450
|
-
},
|
|
1451
|
+
}, m = s || {}, g = m.currentCount || 0, f = m.maxParticipants;
|
|
1451
1452
|
return /* @__PURE__ */ c("form", { className: "pvx-reg-form", onSubmit: l, children: [
|
|
1452
1453
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1453
1454
|
/* @__PURE__ */ e("h3", { className: "pvx-reg-form-title", children: "Register" }),
|
|
1454
|
-
f && /* @__PURE__ */ e(Ce, { count:
|
|
1455
|
+
f && /* @__PURE__ */ e(Ce, { count: g, max: f })
|
|
1455
1456
|
] }),
|
|
1456
1457
|
n.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: n.error.message || "Registration failed" }),
|
|
1457
1458
|
/* @__PURE__ */ c("div", { className: "pvx-reg-field", children: [
|
|
@@ -1467,7 +1468,7 @@ function cr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1467
1468
|
className: "pvx-reg-input",
|
|
1468
1469
|
placeholder: "e.g. username",
|
|
1469
1470
|
value: t,
|
|
1470
|
-
onChange: (
|
|
1471
|
+
onChange: (u) => a(u.target.value)
|
|
1471
1472
|
}
|
|
1472
1473
|
)
|
|
1473
1474
|
] }),
|
|
@@ -1479,7 +1480,7 @@ function cr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1479
1480
|
id: `pvx-exp-${r}`,
|
|
1480
1481
|
className: "pvx-reg-select",
|
|
1481
1482
|
value: i,
|
|
1482
|
-
onChange: (
|
|
1483
|
+
onChange: (u) => o(u.target.value),
|
|
1483
1484
|
children: [
|
|
1484
1485
|
/* @__PURE__ */ e("option", { value: "beginner", children: "Beginner" }),
|
|
1485
1486
|
/* @__PURE__ */ e("option", { value: "intermediate", children: "Intermediate" }),
|
|
@@ -1501,7 +1502,7 @@ function cr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1501
1502
|
rows: 3,
|
|
1502
1503
|
placeholder: "Anything the organisers should know?",
|
|
1503
1504
|
value: d,
|
|
1504
|
-
onChange: (
|
|
1505
|
+
onChange: (u) => v(u.target.value)
|
|
1505
1506
|
}
|
|
1506
1507
|
)
|
|
1507
1508
|
] }),
|
|
@@ -1517,17 +1518,17 @@ function cr({ competitionId: r, registerMutation: n, registration: s }) {
|
|
|
1517
1518
|
] });
|
|
1518
1519
|
}
|
|
1519
1520
|
function lr({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registrationUrl: a, withdrawMutation: i, onWithdrawSuccess: o, registration: d }) {
|
|
1520
|
-
const [v, l] = M(!1),
|
|
1521
|
+
const [v, l] = M(!1), m = () => {
|
|
1521
1522
|
i.mutate(void 0, {
|
|
1522
1523
|
onSuccess: () => {
|
|
1523
1524
|
l(!1), o && o();
|
|
1524
1525
|
}
|
|
1525
1526
|
});
|
|
1526
|
-
},
|
|
1527
|
+
}, g = d || {}, f = n.length || g.currentCount || 0, u = g.maxParticipants;
|
|
1527
1528
|
return /* @__PURE__ */ c(E, { children: [
|
|
1528
1529
|
/* @__PURE__ */ c("div", { className: "pvx-reg-form-header", children: [
|
|
1529
1530
|
/* @__PURE__ */ e("h3", { className: "pvx-reg-form-title", children: "Registered Drivers" }),
|
|
1530
|
-
|
|
1531
|
+
u && /* @__PURE__ */ e(Ce, { count: f, max: u })
|
|
1531
1532
|
] }),
|
|
1532
1533
|
/* @__PURE__ */ e(we, { drivers: n, steamId: s }),
|
|
1533
1534
|
i.error && /* @__PURE__ */ e("div", { className: "pvx-reg-error", children: i.error.message || "Withdrawal failed" }),
|
|
@@ -1548,7 +1549,7 @@ function lr({ competitionId: r, drivers: n, steamId: s, isPowerMode: t, registra
|
|
|
1548
1549
|
{
|
|
1549
1550
|
type: "button",
|
|
1550
1551
|
className: "pvx-reg-danger-btn",
|
|
1551
|
-
onClick:
|
|
1552
|
+
onClick: m,
|
|
1552
1553
|
disabled: i.isPending,
|
|
1553
1554
|
children: i.isPending ? "Unregistering..." : "Yes, Unregister"
|
|
1554
1555
|
}
|
|
@@ -1613,14 +1614,14 @@ function nn({ competitionId: r, className: n }) {
|
|
|
1613
1614
|
), { data: d = [], isLoading: v } = je(
|
|
1614
1615
|
r,
|
|
1615
1616
|
o
|
|
1616
|
-
), l = a ? "standings" : o.length > 0 ? `round-${o[o.length - 1]}` : null, [
|
|
1617
|
+
), l = a ? "standings" : o.length > 0 ? `round-${o[o.length - 1]}` : null, [m, g] = M(null), f = m || l;
|
|
1617
1618
|
if (t || v)
|
|
1618
1619
|
return /* @__PURE__ */ e(A, { message: "Loading results..." });
|
|
1619
1620
|
if (!s)
|
|
1620
1621
|
return /* @__PURE__ */ e(B, { message: "Competition not found." });
|
|
1621
1622
|
if (!i.length)
|
|
1622
1623
|
return /* @__PURE__ */ e(B, { message: "No results available yet. Results will appear here once rounds are finalised." });
|
|
1623
|
-
const
|
|
1624
|
+
const u = new Map(d.map((p) => [`round-${p.roundNumber}`, p])), b = [];
|
|
1624
1625
|
a && b.push({ id: "standings", label: "Standings" });
|
|
1625
1626
|
for (const p of i)
|
|
1626
1627
|
b.push({
|
|
@@ -1628,13 +1629,13 @@ function nn({ competitionId: r, className: n }) {
|
|
|
1628
1629
|
label: `R${p.roundNumber}`,
|
|
1629
1630
|
track: null
|
|
1630
1631
|
});
|
|
1631
|
-
const
|
|
1632
|
+
const x = u.get(f);
|
|
1632
1633
|
return /* @__PURE__ */ c("div", { className: n || "", children: [
|
|
1633
1634
|
/* @__PURE__ */ e("div", { className: "pvx-results-tabs", children: b.map((p) => /* @__PURE__ */ c(
|
|
1634
1635
|
"button",
|
|
1635
1636
|
{
|
|
1636
1637
|
className: `pvx-results-tab ${f === p.id ? "pvx-results-tab--active" : ""}`,
|
|
1637
|
-
onClick: () =>
|
|
1638
|
+
onClick: () => g(p.id),
|
|
1638
1639
|
title: p.track || void 0,
|
|
1639
1640
|
children: [
|
|
1640
1641
|
/* @__PURE__ */ e("span", { className: "pvx-results-tab-label", children: p.label }),
|
|
@@ -1643,7 +1644,7 @@ function nn({ competitionId: r, className: n }) {
|
|
|
1643
1644
|
},
|
|
1644
1645
|
p.id
|
|
1645
1646
|
)) }),
|
|
1646
|
-
f === "standings" ? /* @__PURE__ */ e(tr, { competitionId: r }) :
|
|
1647
|
+
f === "standings" ? /* @__PURE__ */ e(tr, { competitionId: r }) : x ? /* @__PURE__ */ e(dr, { round: x }) : /* @__PURE__ */ e(B, { message: "No results for this round." })
|
|
1647
1648
|
] });
|
|
1648
1649
|
}
|
|
1649
1650
|
function dr({ round: r }) {
|
|
@@ -1698,13 +1699,13 @@ function pr(r) {
|
|
|
1698
1699
|
};
|
|
1699
1700
|
}
|
|
1700
1701
|
function Le(r = {}) {
|
|
1701
|
-
const { cdnUrl: n, partnerSlug: s } = k(), {
|
|
1702
|
+
const { cdnUrl: n, partnerSlug: s } = k(), { game: t, gameVersion: a, enabled: i = !0 } = r, o = J(s, t, a, "ratings.json");
|
|
1702
1703
|
return R({
|
|
1703
|
-
queryKey: ["pitvox", "ratings", s, t || null],
|
|
1704
|
+
queryKey: ["pitvox", "ratings", s, t || null, a || null],
|
|
1704
1705
|
queryFn: () => T(n, o),
|
|
1705
1706
|
staleTime: 3e4,
|
|
1706
1707
|
refetchInterval: 3e4,
|
|
1707
|
-
enabled:
|
|
1708
|
+
enabled: i
|
|
1708
1709
|
});
|
|
1709
1710
|
}
|
|
1710
1711
|
function ur(r) {
|
|
@@ -1740,55 +1741,55 @@ function mr() {
|
|
|
1740
1741
|
const { cdnUrl: r, partnerSlug: n, getSteamId: s, onFetchServerPassword: t } = k(), a = s(), { data: i, isLoading: o } = R({
|
|
1741
1742
|
queryKey: ["pitvox", "competitions", n],
|
|
1742
1743
|
queryFn: async () => {
|
|
1743
|
-
const
|
|
1744
|
-
return
|
|
1744
|
+
const u = await T(r, "competitions/index.json");
|
|
1745
|
+
return u != null && u.competitions ? u.competitions.filter((b) => b.partnerSlug === n) : [];
|
|
1745
1746
|
},
|
|
1746
1747
|
staleTime: 6e4
|
|
1747
|
-
}), d = (i == null ? void 0 : i.map((
|
|
1748
|
-
queries: d.map((
|
|
1749
|
-
queryKey: ["pitvox", "competition", n,
|
|
1750
|
-
queryFn: () => T(r, `competitions/${n}/${
|
|
1748
|
+
}), d = (i == null ? void 0 : i.map((u) => u.id)) || [], v = se({
|
|
1749
|
+
queries: d.map((u) => ({
|
|
1750
|
+
queryKey: ["pitvox", "competition", n, u, "entrylist"],
|
|
1751
|
+
queryFn: () => T(r, `competitions/${n}/${u}/entrylist.json`),
|
|
1751
1752
|
enabled: !!a && d.length > 0,
|
|
1752
1753
|
staleTime: 6e4
|
|
1753
1754
|
}))
|
|
1754
|
-
}), l = v.some((
|
|
1755
|
-
var
|
|
1755
|
+
}), l = v.some((u) => u.isLoading), m = C(() => {
|
|
1756
|
+
var x, p;
|
|
1756
1757
|
if (!i || !a || l) return [];
|
|
1757
|
-
const
|
|
1758
|
+
const u = /* @__PURE__ */ new Date(), b = [];
|
|
1758
1759
|
for (let N = 0; N < i.length; N++) {
|
|
1759
|
-
const
|
|
1760
|
+
const h = i[N], y = (x = v[N]) == null ? void 0 : x.data;
|
|
1760
1761
|
if (!((p = y == null ? void 0 : y.drivers) == null ? void 0 : p.some((w) => w.steamId === a))) continue;
|
|
1761
|
-
const $ =
|
|
1762
|
+
const $ = h.rounds || [];
|
|
1762
1763
|
for (const w of $)
|
|
1763
|
-
w.isFinalized || !w.startTime || new Date(w.startTime) <=
|
|
1764
|
-
competitionId:
|
|
1765
|
-
competitionName:
|
|
1764
|
+
w.isFinalized || !w.startTime || new Date(w.startTime) <= u || b.push({
|
|
1765
|
+
competitionId: h.id,
|
|
1766
|
+
competitionName: h.name,
|
|
1766
1767
|
roundNumber: w.roundNumber,
|
|
1767
1768
|
track: w.track || "TBD",
|
|
1768
1769
|
startTime: w.startTime
|
|
1769
1770
|
});
|
|
1770
1771
|
}
|
|
1771
|
-
return b.sort((N,
|
|
1772
|
-
}, [i, a, l, v]),
|
|
1773
|
-
queries:
|
|
1774
|
-
queryKey: ["pitvox", "serverInfo",
|
|
1775
|
-
queryFn: () => t(
|
|
1776
|
-
enabled: !!t &&
|
|
1772
|
+
return b.sort((N, h) => new Date(N.startTime) - new Date(h.startTime)), b.length > 0 && (b[0].isNext = !0), b;
|
|
1773
|
+
}, [i, a, l, v]), g = se({
|
|
1774
|
+
queries: m.map((u) => ({
|
|
1775
|
+
queryKey: ["pitvox", "serverInfo", u.competitionId, u.roundNumber],
|
|
1776
|
+
queryFn: () => t(u.competitionId, u.roundNumber),
|
|
1777
|
+
enabled: !!t && m.length > 0,
|
|
1777
1778
|
staleTime: 5 * 6e4,
|
|
1778
1779
|
// 5 minutes
|
|
1779
1780
|
retry: !1
|
|
1780
1781
|
}))
|
|
1781
1782
|
});
|
|
1782
1783
|
return {
|
|
1783
|
-
data: C(() =>
|
|
1784
|
+
data: C(() => m.length ? t ? m.map((u, b) => {
|
|
1784
1785
|
var p;
|
|
1785
|
-
const
|
|
1786
|
-
return
|
|
1787
|
-
...
|
|
1788
|
-
serverAddress:
|
|
1789
|
-
serverPassword:
|
|
1790
|
-
} :
|
|
1791
|
-
}) :
|
|
1786
|
+
const x = (p = g[b]) == null ? void 0 : p.data;
|
|
1787
|
+
return x != null && x.success ? {
|
|
1788
|
+
...u,
|
|
1789
|
+
serverAddress: x.serverAddress || null,
|
|
1790
|
+
serverPassword: x.serverPassword || null
|
|
1791
|
+
} : u;
|
|
1792
|
+
}) : m : [], [m, t, g]),
|
|
1792
1793
|
isLoading: o || !!a && l
|
|
1793
1794
|
};
|
|
1794
1795
|
}
|
|
@@ -1900,28 +1901,28 @@ function ie({ icon: r, value: n, label: s, items: t, labelKey: a, countKey: i })
|
|
|
1900
1901
|
const [o, d] = M(!1), v = Se(null);
|
|
1901
1902
|
$e(() => {
|
|
1902
1903
|
if (!o) return;
|
|
1903
|
-
function
|
|
1904
|
-
v.current && !v.current.contains(
|
|
1904
|
+
function m(g) {
|
|
1905
|
+
v.current && !v.current.contains(g.target) && d(!1);
|
|
1905
1906
|
}
|
|
1906
|
-
return document.addEventListener("mousedown",
|
|
1907
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
1907
1908
|
}, [o]);
|
|
1908
|
-
const l = t != null && t.length ? t.slice().sort((
|
|
1909
|
+
const l = t != null && t.length ? t.slice().sort((m, g) => g[i] - m[i]) : null;
|
|
1909
1910
|
return /* @__PURE__ */ c(
|
|
1910
1911
|
"div",
|
|
1911
1912
|
{
|
|
1912
1913
|
ref: v,
|
|
1913
1914
|
className: `pvx-dash-stat-card ${l ? "pvx-dash-stat-card--clickable" : ""}`,
|
|
1914
|
-
onClick: l ? () => d((
|
|
1915
|
+
onClick: l ? () => d((m) => !m) : void 0,
|
|
1915
1916
|
children: [
|
|
1916
1917
|
r,
|
|
1917
1918
|
/* @__PURE__ */ c("div", { className: "pvx-dash-stat-content", children: [
|
|
1918
1919
|
/* @__PURE__ */ e("span", { className: "pvx-dash-stat-value", children: n }),
|
|
1919
1920
|
/* @__PURE__ */ e("span", { className: "pvx-dash-stat-label", children: s })
|
|
1920
1921
|
] }),
|
|
1921
|
-
l && /* @__PURE__ */ e("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: l.map((
|
|
1922
|
-
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children:
|
|
1923
|
-
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children:
|
|
1924
|
-
] },
|
|
1922
|
+
l && /* @__PURE__ */ e("div", { className: `pvx-dash-tooltip pvx-dash-tooltip--scrollable ${o ? "pvx-dash-tooltip--open" : ""}`, children: l.map((m, g) => /* @__PURE__ */ c("div", { className: "pvx-dash-tooltip-row", children: [
|
|
1923
|
+
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-label", children: m[a] }),
|
|
1924
|
+
/* @__PURE__ */ e("span", { className: "pvx-dash-tooltip-value", children: m[i] })
|
|
1925
|
+
] }, g)) })
|
|
1925
1926
|
]
|
|
1926
1927
|
}
|
|
1927
1928
|
);
|
|
@@ -2217,7 +2218,7 @@ function Ar() {
|
|
|
2217
2218
|
] });
|
|
2218
2219
|
}
|
|
2219
2220
|
function an({ steamId: r, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
2220
|
-
const { data: a, isLoading: i, error: o } = pr(r), { data: d, isLoading: v } = ur(r), { data: l, isLoading:
|
|
2221
|
+
const { data: a, isLoading: i, error: o } = pr(r), { data: d, isLoading: v } = ur(r), { data: l, isLoading: m } = mr(), g = vr(), { data: f, isLoading: u } = hr({ limit: 10 }), b = xr(), x = gr();
|
|
2221
2222
|
return i || v ? /* @__PURE__ */ e("div", { className: "pvx-loading", children: "Loading dashboard..." }) : o ? /* @__PURE__ */ e("div", { className: "pvx-empty", children: "Failed to load dashboard data." }) : a ? /* @__PURE__ */ c("div", { className: `pvx-dash ${t}`, children: [
|
|
2222
2223
|
/* @__PURE__ */ e(
|
|
2223
2224
|
fr,
|
|
@@ -2228,17 +2229,17 @@ function an({ steamId: r, avatarUrl: n, memberSince: s, className: t = "" }) {
|
|
|
2228
2229
|
}
|
|
2229
2230
|
),
|
|
2230
2231
|
/* @__PURE__ */ e(kr, { stats: a, rating: d }),
|
|
2231
|
-
r && /* @__PURE__ */ e(Cr, { events: l, isLoading:
|
|
2232
|
-
/* @__PURE__ */ c("div", { className: `pvx-dash-row ${
|
|
2232
|
+
r && /* @__PURE__ */ e(Cr, { events: l, isLoading: m }),
|
|
2233
|
+
/* @__PURE__ */ c("div", { className: `pvx-dash-row ${g ? "pvx-dash-row--2col" : ""}`, children: [
|
|
2233
2234
|
/* @__PURE__ */ e(wr, { records: a.currentRecords }),
|
|
2234
|
-
|
|
2235
|
+
g && /* @__PURE__ */ e(
|
|
2235
2236
|
Dr,
|
|
2236
2237
|
{
|
|
2237
2238
|
notifications: f == null ? void 0 : f.notifications,
|
|
2238
2239
|
unreadCount: (f == null ? void 0 : f.unreadCount) || 0,
|
|
2239
2240
|
onMarkRead: (p) => b.mutate(p),
|
|
2240
|
-
onMarkAllRead: () =>
|
|
2241
|
-
isLoading:
|
|
2241
|
+
onMarkAllRead: () => x.mutate(),
|
|
2242
|
+
isLoading: u
|
|
2242
2243
|
}
|
|
2243
2244
|
)
|
|
2244
2245
|
] })
|