Skip to content

Commit

Permalink
Merge pull request #98 from akhuoa/feature/display-of-evidence
Browse files Browse the repository at this point in the history
Refactor the display of evidence for SCKAN connectivity
  • Loading branch information
alan-wu authored Jan 7, 2025
2 parents 8390ffd + b77289e commit 2c36b8c
Show file tree
Hide file tree
Showing 7 changed files with 446 additions and 345 deletions.
579 changes: 390 additions & 189 deletions CHANGELOG.md

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abi-software/map-side-bar",
"version": "2.5.2",
"version": "2.5.3-beta.11",
"files": [
"dist/*",
"src/*",
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@abi-software/gallery": "^1.1.2",
"@abi-software/map-utilities": "^1.2.2-beta.2",
"@abi-software/map-utilities": "^1.2.2-beta.6",
"@abi-software/svg-sprite": "^1.0.1",
"@element-plus/icons-vue": "^2.3.1",
"algoliasearch": "^4.10.5",
Expand Down
1 change: 0 additions & 1 deletion src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ declare module 'vue' {
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElTag: typeof import('element-plus/es')['ElTag']
ExternalResourceCard: typeof import('./components/ExternalResourceCard.vue')['default']
ImageGallery: typeof import('./components/ImageGallery.vue')['default']
SearchFilters: typeof import('./components/SearchFilters.vue')['default']
SearchHistory: typeof import('./components/SearchHistory.vue')['default']
Expand Down
71 changes: 44 additions & 27 deletions src/components/ConnectivityInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div v-if="entry" class="main" v-loading="loading">
<!-- Connectivity Info Title -->
<div class="connectivity-info-title">
<div>
<div class="title-content">
<div class="block" v-if="entry.title">
<div class="title">
{{ capitalise(entry.title) }}
Expand Down Expand Up @@ -35,9 +35,6 @@
<div class="block" v-else>
<div class="title">{{ entry.featureId }}</div>
</div>
<div class="block" v-if="resources.length">
<external-resource-card :resources="resources"></external-resource-card>
</div>
</div>
<div class="title-buttons">
<el-popover
Expand Down Expand Up @@ -199,8 +196,8 @@
</el-button>
</div>

<div v-if="connectivityError" class="connectivity-error-container">
<div class="connectivity-error">
<div class="connectivity-error-container">
<div class="connectivity-error" v-if="connectivityError">
<strong v-if="connectivityError.errorConnectivities">
{{ connectivityError.errorConnectivities }}
</strong>
Expand All @@ -219,6 +216,10 @@
/>
</template>
</div>

<div class="content-container content-container-references" v-if="resources.length">
<external-resource-card :resources="resources" @references-loaded="onReferencesLoaded"></external-resource-card>
</div>
</div>
</template>

Expand All @@ -234,9 +235,13 @@ import {
ElContainer as Container,
ElIcon as Icon,
} from 'element-plus'
import ExternalResourceCard from './ExternalResourceCard.vue'
import EventBus from './EventBus.js'
import { CopyToClipboard, ConnectivityGraph } from '@abi-software/map-utilities';
import {
CopyToClipboard,
ConnectivityGraph,
ExternalResourceCard,
} from '@abi-software/map-utilities';
import '@abi-software/map-utilities/dist/style.css';
const titleCase = (str) => {
Expand Down Expand Up @@ -307,6 +312,7 @@ export default {
connectivityError: null,
timeoutID: undefined,
graphViewLoaded: false,
updatedCopyContent: '',
}
},
watch: {
Expand All @@ -319,9 +325,6 @@ export default {
},
},
computed: {
updatedCopyContent: function () {
return this.getUpdateCopyContent();
},
resources: function () {
let resources = [];
if (this.entry && this.entry.hyperlinks) {
Expand Down Expand Up @@ -421,7 +424,10 @@ export default {
const name = data.map(t => t.label).join(', ');
this.toggleConnectivityTooltip(name, {show: true});
},
getUpdateCopyContent: function () {
onReferencesLoaded: function (references) {
this.updatedCopyContent = this.getUpdateCopyContent(references);
},
getUpdateCopyContent: function (references) {
if (!this.entry) {
return '';
}
Expand All @@ -443,21 +449,6 @@ export default {
contentArray.push(`<div>${this.provSpeciesDescription}</div>`);
}
// PubMed URL
if (this.resources?.length) {
const pubmedContents = [];
this.resources.forEach((resource) => {
let pubmedContent = '';
if (resource.id === 'pubmed') {
pubmedContent += `<div><strong>PubMed URL:</strong></div>`;
pubmedContent += '\n';
pubmedContent += `<div><a href="${resource.url}">${resource.url}</a></div>`;
}
pubmedContents.push(pubmedContent);
});
contentArray.push(pubmedContents.join('\n\n<br>'));
}
// entry.paths
if (this.entry.paths) {
contentArray.push(`<div>${this.entry.paths}</div>`);
Expand Down Expand Up @@ -513,6 +504,17 @@ export default {
contentArray.push(transformedDestinations);
}
// References
if (references) {
let contentString = `<div><strong>References</strong></div>`;
contentString += '\n';
const contentList = references.list
.map((item) => `<li>${item}</li>`)
.join('\n');
contentString += `<ul>${contentList}</ul>`;
contentArray.push(contentString);
}
return contentArray.join('\n\n<br>');
},
toggleConnectivityTooltip: function (name, option) {
Expand Down Expand Up @@ -597,6 +599,7 @@ export default {
},
},
mounted: function () {
this.updatedCopyContent = this.getUpdateCopyContent();
EventBus.on('connectivity-graph-error', (errorInfo) => {
this.pushConnectivityError(errorInfo);
});
Expand All @@ -617,6 +620,11 @@ export default {
flex-direction: row;
justify-content: space-between;
gap: 1rem;
.title-content {
flex: 1 0 0%;
max-width: 85%;
}
}
.title {
Expand Down Expand Up @@ -922,7 +930,10 @@ export default {
.title-buttons {
display: flex;
flex: 1 0 0%;
max-width: 15%;
flex-direction: row;
justify-content: end;
gap: 0.5rem;
:deep(.copy-clipboard-button) {
Expand Down Expand Up @@ -954,12 +965,18 @@ export default {
.content-container-connectivity {
position: relative;
&:not([style*="display: none"]) ~ .content-container-references {
margin-top: -1.25rem;
}
}
.connectivity-error-container {
position: sticky;
bottom: 0.5rem;
width: 100%;
min-height: 31px; // placeholder
margin-top: -10px !important;
display: flex;
flex-direction: row;
align-items: center;
Expand Down
113 changes: 0 additions & 113 deletions src/components/ExternalResourceCard.vue

This file was deleted.

5 changes: 1 addition & 4 deletions src/exampleConnectivityInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,7 @@ export default {
"ilxtr:neuron-type-aacar-5"
],
"hyperlinks": [
{
"url": "https://pubmed.ncbi.nlm.nih.gov/?term=%2F%2Fwww.ncbi.nlm.nih.gov%2Fpubmed%2F27783854",
"id": "pubmed"
}
"https://doi.org/10.1002/cphy.c150046"
],
"provenanceTaxonomy": [
"NCBITaxon:9606",
Expand Down

0 comments on commit 2c36b8c

Please sign in to comment.