@necrolab/dashboard 0.4.213 → 0.4.215

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/backend/api.js CHANGED
@@ -136,7 +136,7 @@ app.ws("/api/updates", async function (ws, req) {
136
136
  pushWSUpdate({ event: "startup", message: "Starting Bot", user: currentUser.name });
137
137
  await utils.sleep(750);
138
138
 
139
- pushWSUpdate({ event: "startup", done: true, user: currentUser.name });
139
+ pushWSUpdate({ event: "startup", done: true, user: currentUser.name, version: "1.0" });
140
140
  ws.send(
141
141
  JSON.stringify([
142
142
  { event: "set-button-disabled", button: "add-tasks", value: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@necrolab/dashboard",
3
- "version": "0.4.213",
3
+ "version": "0.4.215",
4
4
  "scripts": {
5
5
  "build": "npx workbox-cli generateSW workbox-config.js && vite build",
6
6
  "dev": "vite",
@@ -49,7 +49,11 @@
49
49
  />
50
50
  </div>
51
51
  <div class="flex mt-5 justify-between flex-row items-center">
52
- <span class="text-light-400 text-sm">v{{ version }}</span>
52
+ <div>
53
+ <p class="text-light-400 text-sm">Dashboard: v{{ version }}</p>
54
+ <p class="text-light-400 text-sm">Bot: v{{ ui.botVersion }}</p>
55
+ </div>
56
+
53
57
  <div class="flex gap-5">
54
58
  <button
55
59
  class="button-default hover:opacity-70 active:opacity-50 bg-dark-400 w-24 text-xs flex items-center justify-center gap-x-2"
@@ -98,9 +98,15 @@
98
98
  <!-- <div class="w-10 h-10 rounded-full bg-light-300"></div> -->
99
99
  <img :src="ui.profile?.profilePicture" alt="" class="h-10 w-10 rounded-full" />
100
100
  </div>
101
- <span class="bg-dark-500 rounded-full text-sm shadow-lg p-2 px-3 text-light-400 mx-auto mt-6 mb-14"
102
- >v{{ version }}</span
103
- >
101
+
102
+ <div class="mx-auto mt-6 mb-14 flex gap-3">
103
+ <span class="bg-dark-500 rounded-full text-sm shadow-lg p-2 px-3 text-light-400"
104
+ >Dashboard: v{{ dashVersion }}</span
105
+ >
106
+ <span class="bg-dark-500 rounded-full text-sm shadow-lg p-2 px-3 text-light-400"
107
+ >Bot: v{{ ui.botVersion }}</span
108
+ >
109
+ </div>
104
110
  </div>
105
111
  </transition>
106
112
  </div>
@@ -175,7 +181,7 @@ window.matchMedia("(orientation: portrait)").addEventListener("change", (e) => {
175
181
  else landscapeIos.value = false;
176
182
  });
177
183
 
178
- const version = __APP_VERSION__;
184
+ const dashVersion = __APP_VERSION__;
179
185
  const ui = useUIStore();
180
186
  const menuOpen = storeToRefs(ui).menuOpen;
181
187
  const toggleMenu = () => {
@@ -8,23 +8,13 @@ const colors = {
8
8
  UNSELECTABLE: "#311432"
9
9
  };
10
10
 
11
- const BASE_CSS =
12
- `path[row]:hover {stroke: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}` +
13
- `path[generaladmission]:hover {fill: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}`;
11
+ const BASE_CSS = `path[generaladmission]:hover {fill: ${colors.HIGHLIGHT};pointer-events:all;cursor:pointer;}`;
14
12
 
15
13
  const isWheelchair = (p) => {
16
14
  if (p.row === "W" || p.sectionName === "W") return false;
17
15
  return [("W", "ADA")].some((part) => p.row !== "W" && (p.row?.includes(part) || p.sectionName?.includes(part)));
18
16
  };
19
17
 
20
- const getWheelChairRows = () => {
21
- const rows = [...document.querySelectorAll("path[row]")];
22
- return rows
23
- .map((p) => {
24
- return { row: p.attributes.row.nodeValue, sectionName: p.attributes.sectionname.nodeValue };
25
- })
26
- .filter(isWheelchair);
27
- };
28
18
  const sortAlphaNum = (a, b) => {
29
19
  var reA = /[^a-zA-Z]/g;
30
20
  var reN = /[^0-9]/g;
@@ -100,25 +90,6 @@ const cleanupFilter = (f) => {
100
90
  return ret;
101
91
  };
102
92
 
103
- const getFirstRows = (rows) => {
104
- const firstRows = {};
105
- const parsedRows = rows.map((row) => {
106
- return { sec: row.attributes.sectionname.nodeValue, row: row.attributes.row.nodeValue };
107
- });
108
- // log("getFirstRows: parsedRows=", parsedRows);
109
- parsedRows.forEach((row) => {
110
- if (!firstRows[row.sec]) firstRows[row.sec] = [];
111
- firstRows[row.sec].push(row.row);
112
- });
113
- // log("A getFirstRows: firstRows=", firstRows);
114
- Object.entries(firstRows).forEach(([sec, rows]) => {
115
- log(`sort:`, sec, rows);
116
- firstRows[sec] = rows.sort(sortAlphaNum);
117
- });
118
- // log("B getFirstRows: firstRows=", firstRows);
119
- return firstRows;
120
- };
121
-
122
93
  const getSectionNameMapping = () => {
123
94
  const sectionRealName = {};
124
95
  [...document.querySelectorAll("tspan")].forEach((t) => {
@@ -131,15 +102,6 @@ const getSectionNameMapping = () => {
131
102
  return sectionRealName;
132
103
  };
133
104
 
134
- // const getFloorSections = () => {
135
- // const tspans = [...document.querySelectorAll("tspan")];
136
- // const blacklist = ["BL", "BARSTOOLS", "BW", "NL"];
137
- // return tspans
138
- // .map((t) => t.attributes.section.nodeValue)
139
- // .filter((t) => t.match(/^[a-zA-Z]+\s?[\w\d]?$/))
140
- // .filter((name) => !blacklist.some((b) => name.includes(b)));
141
- // };
142
-
143
105
  export default class FilterBuilder {
144
106
  constructor() {
145
107
  this.filters = [];
@@ -157,7 +119,6 @@ export default class FilterBuilder {
157
119
  CATCH_ALL_GA: 1,
158
120
  NORMAL: 2,
159
121
  NORMAL_FIRSTROW: 3,
160
- GLOBAL_FIRSTROW: 4,
161
122
  CATCH_ALL_FLOOR: 5
162
123
  };
163
124
 
@@ -194,24 +155,72 @@ export default class FilterBuilder {
194
155
  if (filter.buyAny) return this.filterTypes.CATCH_ALL;
195
156
  else if (filter.floor) return this.filterTypes.CATCH_ALL_FLOOR;
196
157
  else if (filter.generalAdmission) return this.filterTypes.CATCH_ALL_GA;
197
- // else if (!!filter.section && filter.firstRow) return this.filterTypes.NORMAL_FIRSTROW;
198
- // else if (!filter.section && filter.firstRow) return this.filterTypes.GLOBAL_FIRSTROW;
199
158
  else if (filter.section) return this.filterTypes.NORMAL;
200
159
  else return this.filterTypes.INVALID;
201
160
  }
202
161
 
162
+ addRowHandlers() {
163
+ for (let i = 0; i < this.rows.length; i++) {
164
+ const row = this.rows[i];
165
+ row.onclick = () => {
166
+ const parsed = {
167
+ section: row.attributes.sectionname.nodeValue,
168
+ row: row.attributes.row.nodeValue,
169
+ id: row.attributes.id.nodeValue
170
+ };
171
+ log(`Adding filter ${parsed.section}`);
172
+ const matchingFilter = this.filters.find(
173
+ (f) =>
174
+ this.isForCurrentEvent(f) &&
175
+ f.section === parsed.section &&
176
+ (f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
177
+ );
178
+ if (matchingFilter) {
179
+ log(`Filter for ${parsed.section}/${parsed.row} already exists (${matchingFilter.id})`);
180
+ if (this.expandedFilter === matchingFilter.id) this.setExpandedFilter(null);
181
+ else this.setExpandedFilter(matchingFilter.id);
182
+ this.updateCss();
183
+ return;
184
+ }
185
+
186
+ this.addFilter({
187
+ section: parsed.section,
188
+ event: this.currentEventId
189
+ });
190
+ };
191
+
192
+ row.onmouseover = () => {
193
+ const parsed = {
194
+ section: row.attributes.sectionname.nodeValue,
195
+ row: row.attributes.row.nodeValue,
196
+ id: row.attributes.id.nodeValue
197
+ };
198
+ const matchingFilter = this.filters.find(
199
+ (f) =>
200
+ this.isForCurrentEvent(f) &&
201
+ f.section === parsed.section &&
202
+ (f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
203
+ );
204
+ if (!matchingFilter) return;
205
+ if (Array.isArray(matchingFilter.rows))
206
+ matchingFilter.rows.forEach((row) => this.highlight({ section: parsed.section, row: row }));
207
+ else this.highlight({ section: matchingFilter.section });
208
+ };
209
+ row.onmouseout = () => {
210
+ if (!this.isDragging) this.clearHighlight();
211
+ };
212
+ }
213
+ }
214
+
203
215
  reload(eventId) {
204
216
  const paths = document.querySelectorAll("path");
205
217
  this.rows = [...paths].filter((r) => r.id.startsWith("s_"));
206
218
 
207
219
  this.addLabelHandlers();
208
- this.addRowHandlers();
209
220
  this.addGAHandlers();
221
+ this.addRowHandlers();
210
222
  this.currentEventId = eventId;
211
223
 
212
- const wcRows = getWheelChairRows();
213
- log("wcRows:", wcRows);
214
- wcRows.forEach((r) => this.makeRowUnselectable(r.sectionName, r.row));
215
224
  this.updateCss();
216
225
  }
217
226
 
@@ -275,23 +284,6 @@ export default class FilterBuilder {
275
284
  this.updateCss();
276
285
  }
277
286
 
278
- selectFirstRow() {
279
- const paths = document.querySelectorAll("path");
280
- const rows = [...paths].filter((r) => r.id.startsWith("s_"));
281
- const firstRows = getFirstRows(rows);
282
-
283
- Object.entries(firstRows).forEach(([sec, rows]) => {
284
- if (this.filters.some((f) => f.section === sec && f.rows.includes(rows[0]) && this.isForCurrentEvent(f))) {
285
- log(`Filter for ${sec}/${rows[0]} already exists`);
286
- return;
287
- }
288
- if (this.isUnselectable(sec, rows[0])) return;
289
- this.addFilter({ event: this.currentEventId, section: sec, rows: [rows[0]] });
290
- });
291
-
292
- this.updateCss();
293
- }
294
-
295
287
  updateCss() {
296
288
  this.cssClasses = BASE_CSS;
297
289
  const gaSectionNameMapping = this.getSectionNameMapping();
@@ -442,62 +434,6 @@ export default class FilterBuilder {
442
434
  }
443
435
  }
444
436
 
445
- addRowHandlers() {
446
- for (let i = 0; i < this.rows.length; i++) {
447
- const row = this.rows[i];
448
- row.onclick = () => {
449
- const parsed = {
450
- section: row.attributes.sectionname.nodeValue,
451
- row: row.attributes.row.nodeValue,
452
- id: row.attributes.id.nodeValue
453
- };
454
- log(`Adding filter ${parsed.section}/${parsed.row}`);
455
- const matchingFilter = this.filters.find(
456
- (f) =>
457
- this.isForCurrentEvent(f) &&
458
- f.section === parsed.section &&
459
- (f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
460
- );
461
- if (matchingFilter) {
462
- log(`Filter for ${parsed.section}/${parsed.row} already exists (${matchingFilter.id})`);
463
- if (this.expandedFilter === matchingFilter.id) this.setExpandedFilter(null);
464
- else this.setExpandedFilter(matchingFilter.id);
465
- this.updateCss();
466
- return;
467
- }
468
-
469
- if (this.isUnselectable(parsed.section, parsed.row)) return;
470
-
471
- this.addFilter({
472
- section: parsed.section,
473
- rows: [parsed.row],
474
- event: this.currentEventId
475
- });
476
- };
477
-
478
- row.onmouseover = () => {
479
- const parsed = {
480
- section: row.attributes.sectionname.nodeValue,
481
- row: row.attributes.row.nodeValue,
482
- id: row.attributes.id.nodeValue
483
- };
484
- const matchingFilter = this.filters.find(
485
- (f) =>
486
- this.isForCurrentEvent(f) &&
487
- f.section === parsed.section &&
488
- (f.rows?.includes(parsed.row) || !Array.isArray(f.rows))
489
- );
490
- if (!matchingFilter) return;
491
- if (Array.isArray(matchingFilter.rows))
492
- matchingFilter.rows.forEach((row) => this.highlight({ section: parsed.section, row: row }));
493
- else this.highlight({ section: matchingFilter.section });
494
- };
495
- row.onmouseout = () => {
496
- if (!this.isDragging) this.clearHighlight();
497
- };
498
- }
499
- }
500
-
501
437
  deleteFilterById(id) {
502
438
  this.filters = this.filters.filter((f) => f.id !== id);
503
439
  // this.updateHooks = this.updateHooks.filter((i) => id !== i);
@@ -551,13 +487,4 @@ export default class FilterBuilder {
551
487
  clearHighlight() {
552
488
  this.temporaryCSS = "";
553
489
  }
554
-
555
- makeRowUnselectable(section, row) {
556
- log("adding unselectable:", section, row);
557
- this.unselectable.push(`${section}/${row}`);
558
- }
559
-
560
- isUnselectable(section, row) {
561
- return this.unselectable.includes(`${section}/${row}`);
562
- }
563
490
  }
@@ -7,8 +7,10 @@ export class ConnectionHandler {
7
7
  handleWebsocketMessages(msg) {
8
8
  switch (msg.event) {
9
9
  case "startup":
10
- if (msg.done) this.ui.hideSpinner();
11
- else this.ui.startSpinner(msg.message || "Starting Bot");
10
+ if (msg.done) {
11
+ this.ui.hideSpinner();
12
+ this.ui.setBotVersion(msg.version || "-");
13
+ } else this.ui.startSpinner(msg.message || "Starting Bot");
12
14
  break;
13
15
 
14
16
  case "stop-all":
package/src/stores/ui.js CHANGED
@@ -26,6 +26,8 @@ export const useUIStore = defineStore("ui", () => {
26
26
  const tasks = ref({});
27
27
 
28
28
  const showSpinner = ref(false);
29
+ const botVersion = ref("-");
30
+
29
31
  const spinnerMessage = ref("");
30
32
 
31
33
  const profile = ref({
@@ -537,6 +539,10 @@ export const useUIStore = defineStore("ui", () => {
537
539
  showSpinner.value = false;
538
540
  enableScroll();
539
541
  },
542
+ setBotVersion: (version) => {
543
+ botVersion.value = version;
544
+ },
545
+ botVersion,
540
546
 
541
547
  spinnerMessage,
542
548
  showSpinner,
@@ -48,13 +48,6 @@
48
48
  </div>
49
49
  <div class="col-span-2 mt-10">
50
50
  <div class="flex justify-between mb-2 items-center text-white">
51
- <button
52
- @click="filterBuilder.selectFirstRow"
53
- class="border-2 rounded border-dark-550 px-1 h-8 w-full min-w-14 text-gray bg-dark-500 overflow-hidden smooth-hover"
54
- >
55
- First rows
56
- </button>
57
-
58
51
  <div class="rounded flex justify-between gap-2 items-center" v-if="hasLoaded">
59
52
  <PriceSortToggle
60
53
  :current="filterBuilder.globalFilter.priceSort"
@@ -349,7 +342,6 @@ const updateShownVenue = async () => {
349
342
  return;
350
343
  }
351
344
 
352
- debugger;
353
345
  renderer = rendererFactory.createRenderer(eventId.value, "", country);
354
346
  filterBuilder.value.highlightedSeatColor = renderer.c.highlightedSeatColor;
355
347
  renderer.c.logFullError = true;