iticket-seatingplan-dev 1.1.5 → 1.1.7

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.
@@ -42,6 +42,7 @@ const SeatingPlan = _ref => {
42
42
  const [processing, setProcessing] = (0, _react.useState)(false);
43
43
  const [bookedSeats, setBookedSeats] = (0, _react.useState)([]);
44
44
  const [chosenSeat, setChosenSeat] = (0, _react.useState)(null);
45
+ const [area, setArea] = (0, _react.useState)(null);
45
46
  const statusColors = {
46
47
  unknown: '#95a5a6',
47
48
  available: '#00E640',
@@ -235,12 +236,12 @@ const SeatingPlan = _ref => {
235
236
  paName: s.priceAgeName
236
237
  })));
237
238
  img.onload = () => {
239
+ setPosition([img.height * 0.005, img.width * 0.005]);
238
240
  setHeight(img.height * 0.5);
239
241
  setWidth(img.width * 0.5);
240
- setPosition([img.height * 0.005, img.width * 0.005]);
241
242
  setSeats(data);
242
243
  };
243
- map && map.target.setView([height * 0.015, width * 0.015], 5);
244
+ map && area === areaId && map.target.setView([height * 0.015, width * 0.015], 6);
244
245
  setIsReloading(false);
245
246
  }).catch(error => {
246
247
  console.log(error);
@@ -255,10 +256,12 @@ const SeatingPlan = _ref => {
255
256
  });
256
257
  };
257
258
  (0, _react.useEffect)(() => {
258
- if (!position && !error) {
259
+ if (!error && areaId !== area) {
260
+ setArea(areaId);
259
261
  initialFetch();
262
+ setPosition(null);
260
263
  }
261
- }, [position]);
264
+ }, [areaId]);
262
265
  (0, _react.useEffect)(() => {
263
266
  if (bookedSeats && position && chosenSeat) {
264
267
  const event = {
@@ -285,7 +288,7 @@ const SeatingPlan = _ref => {
285
288
  }
286
289
  }, error ? /*#__PURE__*/_react.default.createElement("div", {
287
290
  className: "loading"
288
- }, /*#__PURE__*/_react.default.createElement("h1", null, "OOPS!"), /*#__PURE__*/_react.default.createElement("div", null, error.response.data.message)) : position ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.MapContainer, {
291
+ }, /*#__PURE__*/_react.default.createElement("h1", null, "OOPS!"), /*#__PURE__*/_react.default.createElement("div", null, error.response.data.message)) : position && area === areaId ? /*#__PURE__*/_react.default.createElement(_reactLeaflet.MapContainer, {
289
292
  whenReady: setMap,
290
293
  center: [height * 0.015, width * 0.015],
291
294
  zoom: 6,
@@ -296,6 +299,69 @@ const SeatingPlan = _ref => {
296
299
  height: '100%'
297
300
  }
298
301
  }, /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
302
+ position: "bottomright"
303
+ }, /*#__PURE__*/_react.default.createElement("div", {
304
+ className: "legendBox"
305
+ }, /*#__PURE__*/_react.default.createElement("p", {
306
+ className: "legendHeader"
307
+ }, "LEGEND:"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
308
+ style: {
309
+ display: 'inline-flex'
310
+ }
311
+ }, /*#__PURE__*/_react.default.createElement("div", {
312
+ style: {
313
+ width: '1rem',
314
+ height: '1rem',
315
+ borderRadius: '100%',
316
+ background: '#00E640'
317
+ }
318
+ }), /*#__PURE__*/_react.default.createElement("p", {
319
+ style: {
320
+ margin: '0 0.5rem'
321
+ }
322
+ }, "available"))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
323
+ style: {
324
+ display: 'inline-flex'
325
+ }
326
+ }, /*#__PURE__*/_react.default.createElement("div", {
327
+ style: {
328
+ width: '1rem',
329
+ height: '1rem',
330
+ borderRadius: '100%',
331
+ background: '#95a5a6'
332
+ }
333
+ }), /*#__PURE__*/_react.default.createElement("p", {
334
+ style: {
335
+ margin: '0 0.5rem'
336
+ }
337
+ }, "sold"))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
338
+ style: {
339
+ display: 'inline-flex'
340
+ }
341
+ }, /*#__PURE__*/_react.default.createElement("div", {
342
+ style: {
343
+ width: '1rem',
344
+ height: '1rem',
345
+ borderRadius: '100%',
346
+ background: '#e74c3c'
347
+ }
348
+ }), /*#__PURE__*/_react.default.createElement("p", {
349
+ style: {
350
+ margin: '0 0.5rem'
351
+ }
352
+ }, "in cart"))), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
353
+ style: {
354
+ display: 'inline-flex'
355
+ }
356
+ }, /*#__PURE__*/_react.default.createElement("img", {
357
+ src: wheelchairSeat,
358
+ width: 15,
359
+ height: 15
360
+ }), /*#__PURE__*/_react.default.createElement("p", {
361
+ style: {
362
+ margin: '0 0.5rem'
363
+ }
364
+ }, "wheelchair"))))), /*#__PURE__*/_react.default.createElement(_reactLeafletCustomControl.default, {
299
365
  position: "topleft"
300
366
  }, /*#__PURE__*/_react.default.createElement("div", {
301
367
  style: {
@@ -306,7 +372,7 @@ const SeatingPlan = _ref => {
306
372
  }
307
373
  }, /*#__PURE__*/_react.default.createElement("button", {
308
374
  title: "Re-centre Seating Plan",
309
- onClick: () => map.target.setView([height * 0.015, width * 0.015], 5),
375
+ onClick: () => map.target.setView([height * 0.015, width * 0.015], 6),
310
376
  className: "leaflet-control-zoom-in",
311
377
  style: {
312
378
  border: 'none',
@@ -7,6 +7,20 @@
7
7
  -moz-osx-font-smoothing: grayscale;
8
8
  } */
9
9
 
10
+
11
+
12
+ .legendBox {
13
+ background: rgba(0, 0, 0, 0.03);
14
+ padding: 0.5rem 1rem;
15
+ border-radius: 3px;
16
+ text-align: left;
17
+ }
18
+
19
+ .legendHeader {
20
+ font-weight: bold;
21
+ }
22
+
23
+
10
24
  .rotate {
11
25
  animation: rotation 2s infinite linear;
12
26
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "iticket-seatingplan-dev",
3
3
  "description": "Seating plan with FLEXi pricing",
4
4
  "author": "gedwyne",
5
- "version": "1.1.5",
5
+ "version": "1.1.7",
6
6
  "private": false,
7
7
  "keywords": [
8
8
  "iticket",