@necrolab/dashboard 0.4.214 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@necrolab/dashboard",
3
- "version": "0.4.214",
3
+ "version": "0.4.215",
4
4
  "scripts": {
5
5
  "build": "npx workbox-cli generateSW workbox-config.js && vite build",
6
6
  "dev": "vite",
@@ -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
  }
@@ -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;