@abi-software/map-side-bar 2.14.2 → 2.14.3

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": "@abi-software/map-side-bar",
3
- "version": "2.14.2",
3
+ "version": "2.14.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@abi-software/gallery": "1.3.0",
47
- "@abi-software/map-utilities": "1.8.1",
47
+ "@abi-software/map-utilities": "1.8.2",
48
48
  "@abi-software/svg-sprite": "^1.0.2",
49
49
  "@element-plus/icons-vue": "^2.3.1",
50
50
  "algoliasearch": "^4.10.5",
@@ -12,21 +12,6 @@
12
12
  @click="toggleTitleExpansion"
13
13
  >
14
14
  <span>{{ capitalise(displayTitle) }}</span>
15
- <template v-if="entry.featuresAlert">
16
- <el-popover
17
- width="250"
18
- trigger="hover"
19
- :teleported="false"
20
- popper-class="popover-origin-help"
21
- >
22
- <template #reference>
23
- <el-icon class="alert"><el-icon-warn-triangle-filled /></el-icon>
24
- </template>
25
- <span style="word-break: keep-all">
26
- {{ entry.featuresAlert }}
27
- </span>
28
- </el-popover>
29
- </template>
30
15
  </div>
31
16
  <button
32
17
  v-if="showTitleToggle"
@@ -41,7 +26,19 @@
41
26
  </el-icon>
42
27
  </button>
43
28
  </div>
44
- <div class="subtitle"><strong>Id: </strong>{{ entry.featureId[0] }}</div>
29
+ <div class="subtitle">
30
+ <strong>Id: </strong>{{ entry.featureId[0] }}
31
+ <el-button
32
+ round
33
+ size="small"
34
+ class="alert-chip"
35
+ @click="showAlertMessage"
36
+ v-if="entry.featuresAlert"
37
+ >
38
+ <el-icon class="alert"><el-icon-warn-triangle-filled /></el-icon>
39
+ Notes
40
+ </el-button>
41
+ </div>
45
42
  <div v-if="hasProvenanceTaxonomyLabel" class="subtitle">
46
43
  {{ provSpeciesDescription }}
47
44
  </div>
@@ -290,6 +287,22 @@
290
287
  @trackEvent="onTrackEvent"
291
288
  />
292
289
  </div>
290
+
291
+ <div
292
+ ref="alertElement"
293
+ class="content-container content-container-alert"
294
+ v-if="entry.featuresAlert"
295
+ >
296
+ <div class="block attribute-title-container">
297
+ <span class="attribute-title">Notes</span>
298
+ </div>
299
+ <div class="block">
300
+ <div class="alert-block"
301
+ v-for="alert in entry.featuresAlert"
302
+ v-html="formatAlertText(alert)"
303
+ ></div>
304
+ </div>
305
+ </div>
293
306
  </div>
294
307
  </template>
295
308
 
@@ -785,6 +798,14 @@ export default {
785
798
  contentArray.push(contentString);
786
799
  }
787
800
 
801
+ // Alert (Notes)
802
+ if (this.entry.featuresAlert) {
803
+ const alertContent = this.entry.featuresAlert
804
+ .map((alert) => this.formatAlertText(alert))
805
+ .join('\n');
806
+ contentArray.push(`<div><strong>Notes</strong></div>\n${alertContent}`);
807
+ }
808
+
788
809
  return contentArray.join('\n\n<br>');
789
810
  },
790
811
  getConnectivityDatasets: function (label) {
@@ -911,6 +932,51 @@ export default {
911
932
  onTrackEvent: function (data) {
912
933
  EventBus.emit('trackEvent', data);
913
934
  },
935
+ showAlertMessage: function () {
936
+ // scroll to alert message
937
+ this.$nextTick(() => {
938
+ const alertElement = this.$refs.alertElement;
939
+ if (alertElement) {
940
+ alertElement.scrollIntoView({
941
+ behavior: 'smooth',
942
+ block: 'start',
943
+ inline: 'nearest',
944
+ });
945
+ }
946
+ });
947
+ },
948
+ formatAlertText: function (text) {
949
+ if (!text) return '';
950
+ const escaped = text
951
+ .replace(/&/g, '&amp;')
952
+ .replace(/</g, '&lt;')
953
+ .replace(/>/g, '&gt;');
954
+ const linkified = escaped.replace(
955
+ /(https?:\/\/[^\s"<>\[]+)/g,
956
+ (url) => {
957
+ const parts = url.match(/^(.*?)([\].,;:!?]*)$/);
958
+ const cleanUrl = parts ? parts[1] : url;
959
+ const suffix = parts ? parts[2] : '';
960
+ return `<a href="${cleanUrl}" target="_blank" rel="noopener noreferrer">${cleanUrl}</a>${suffix}`;
961
+ }
962
+ );
963
+
964
+ const normalised = linkified
965
+ .replace(/\\n/g, '\n')
966
+ .replace(/\r\n/g, '\n')
967
+ .replace(/\r/g, '\n');
968
+
969
+ return normalised
970
+ .split('\n')
971
+ .map((line) => {
972
+ const withBoldLabel = line.replace(
973
+ /^\s*([A-Za-z][^:<]{0,120}:)/,
974
+ '<strong>$1</strong>'
975
+ );
976
+ return `<div class="alert-line">${withBoldLabel}</div>`;
977
+ })
978
+ .join('\n');
979
+ },
914
980
  },
915
981
  mounted: function () {
916
982
  this.updatedCopyContent = this.getUpdateCopyContent();
@@ -1089,15 +1155,6 @@ export default {
1089
1155
  text-transform: uppercase;
1090
1156
  }
1091
1157
 
1092
- .main {
1093
- .el-button.is-round {
1094
- border-radius: 4px;
1095
- padding: 9px 20px 10px 20px;
1096
- display: flex;
1097
- height: 36px;
1098
- }
1099
- }
1100
-
1101
1158
  .button {
1102
1159
  margin-left: 0px !important;
1103
1160
  margin-top: 0px !important;
@@ -1420,10 +1477,6 @@ export default {
1420
1477
 
1421
1478
  .content-container-connectivity {
1422
1479
  position: relative;
1423
-
1424
- &:not([style*="display: none"]) ~ .content-container-references {
1425
- margin-top: -1.25rem;
1426
- }
1427
1480
  }
1428
1481
 
1429
1482
  .attribute-content {
@@ -1467,4 +1520,48 @@ export default {
1467
1520
  margin-bottom: 0.5em;
1468
1521
  }
1469
1522
  }
1523
+
1524
+ .alert-block {
1525
+ background-color: var(--el-color-warning-light-9);
1526
+ border: 1px dashed var(--el-color-warning);
1527
+ padding: 0.75rem;
1528
+ border-radius: 4px;
1529
+
1530
+ :deep(.alert-line + .alert-line) {
1531
+ margin-top: 0.5rem;
1532
+ }
1533
+
1534
+ :deep(a) {
1535
+ color: $app-primary-color;
1536
+ word-break: break-all;
1537
+
1538
+ &:hover {
1539
+ opacity: 0.8;
1540
+ }
1541
+ }
1542
+ }
1543
+
1544
+ .alert-chip {
1545
+ margin-left: 5px;
1546
+ background-color: $app-primary-color;
1547
+ border-color: $app-primary-color;
1548
+ color: #fff;
1549
+
1550
+ &:hover {
1551
+ color: #fff !important;
1552
+ background-color: #ac76c5 !important;
1553
+ border: 1px solid #ac76c5 !important;
1554
+ }
1555
+
1556
+ :deep(> span) {
1557
+ gap: 2px;
1558
+ }
1559
+
1560
+ .alert {
1561
+ width: 1rem;
1562
+ height: 1rem;
1563
+ color: inherit;
1564
+ margin: 0;
1565
+ }
1566
+ }
1470
1567
  </style>
@@ -242,6 +242,7 @@ export default {
242
242
  title: 'View Flatmap',
243
243
  type: 'Flatmap',
244
244
  discoverId: this.discoverId,
245
+ doi: this.entry.doi,
245
246
  version: this.version,
246
247
  }
247
248
  this.items['Flatmaps'].push({
@@ -328,6 +329,7 @@ export default {
328
329
  s3uri: this.entry.s3uri,
329
330
  title: 'View plot',
330
331
  type: 'Plot',
332
+ doi: this.entry.doi,
331
333
  discoverId: this.discoverId,
332
334
  version: this.version,
333
335
  }
@@ -372,6 +374,7 @@ export default {
372
374
  title: "View 3D scaffold",
373
375
  type: "Scaffold",
374
376
  discoverId: this.discoverId,
377
+ doi: this.entry.doi,
375
378
  apiLocation: this.envVars.API_LOCATION,
376
379
  version: this.version,
377
380
  banner: this.thumbnail,
@@ -442,6 +445,7 @@ export default {
442
445
  title: 'View simulation',
443
446
  type: 'Simulation',
444
447
  discoverId: this.discoverId,
448
+ doi: this.entry.doi,
445
449
  version: this.version,
446
450
  }
447
451
  this.items['Simulations'].push({