feat(race-setup): list sessions in running order and move them with up/down (1.49.0)
This commit is contained in:
1 parent
e199f3aa1a
commit
bb0fa7ede4
14 files changed
+104
-14
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { orderSessionsForRunning, moveSessionInRunningOrder } from "./event_race_logic.js";
|
||||
let activeManageTab = "setup";
|
||||
// Maps a data-target anchor id (used by the step-card overview and the race-summary
|
||||
// warning links) to the tab it now lives inside, so jumping to it also switches tabs
|
||||
@@ -117,7 +118,8 @@ export function renderEventManagerView(context) {
|
||||
}
|
||||
ensureRaceParticipantsConfigured(event);
|
||||
|
||||
const sessions = getSessionsForEvent(eventId);
|
||||
// Listed in running order; ▲▼ change it (stored on the event as sessionOrder).
|
||||
const sessions = orderSessionsForRunning(getSessionsForEvent(eventId), event.sessionOrder);
|
||||
const eventManageArea = document.getElementById("eventManageArea");
|
||||
if (!eventManageArea) {
|
||||
return;
|
||||
@@ -358,6 +360,12 @@ export function renderEventManagerView(context) {
|
||||
renderView();
|
||||
});
|
||||
|
||||
document.querySelectorAll(`[data-session-move="${s.id}"]`).forEach((button) => button.addEventListener("click", () => {
|
||||
event.sessionOrder = moveSessionInRunningOrder(sessions, event.sessionOrder, s.id, Number(button.dataset.step));
|
||||
saveState();
|
||||
refreshManager();
|
||||
}));
|
||||
|
||||
document.getElementById(`session-delete-${s.id}`)?.addEventListener("click", () => {
|
||||
state.sessions = state.sessions.filter((x) => x.id !== s.id);
|
||||
delete state.resultsBySession[s.id];
|
||||
|
||||
Reference in new issue
Block a user