Skip to content

Commit

Permalink
feat: Acknowledgements in about view (#42) (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon authored Sep 7, 2023
1 parent eb7b907 commit abd439d
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
15 changes: 13 additions & 2 deletions frontend/src/api/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,19 @@ describe('search method', () => {
})
})

it.skip('should return null if no match', () => {
const result = search('foo', 'foo37')
it('should return null if no entry', () => {
const result = search('', 'foo37')
expect(result).toBe(null)
})

it('should remove whitespace', () => {
const result = search(' HGNC:1100 ', 'ghcr37')
expect(result).toEqual({
name: 'gene',
params: {
searchTerm: 'HGNC:1100',
genomeRelease: 'ghcr37'
}
})
})
})
5 changes: 5 additions & 0 deletions frontend/src/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ export const search = (searchTerm: string, genomeRelease: string) => {
]

for (const [regexp, getRoute] of SEARCH_REGEXPS) {
// Remove trailing whitespace
searchTerm = searchTerm.trim()
if (!searchTerm) {
return null
}
if (regexp.test(searchTerm)) {
const routeLocation = getRoute()
console.log(`term ${searchTerm} matched ${regexp}, route is`, routeLocation)
Expand Down
37 changes: 37 additions & 0 deletions frontend/src/views/AboutView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
<script setup lang="ts">
import HeaderDefault from '@/components/HeaderDefault.vue'
const Acknowledgements = {
ClinVar: {
name: 'ClinVar',
url: 'https://www.ncbi.nlm.nih.gov/clinvar/',
description:
'ClinVar is a freely accessible, public archive ' +
'of reports of the relationships among human variations ' +
'and phenotypes, with supporting evidence.',
doi: 'DOI: 10.1093/nar/gkx1153'
},
Coral: {
name: 'Coral emoji',
url: 'https://openmoji.org/library/emoji-1FAB8/',
description: 'Coral emoji from OpenMoji',
doi: ''
}
}
</script>

<template>
Expand All @@ -21,6 +39,25 @@ import HeaderDefault from '@/components/HeaderDefault.vue'
</p>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<h2 class="title">Acknowledgements:</h2>
<p class="description">
<v-list lines="two">
<v-list-item v-for="ack in Object.values(Acknowledgements)" :key="ack.name">
<v-list-item-title>
<a :href="ack.url" target="_blank">{{ ack.name }}</a>
</v-list-item-title>
<v-list-item-subtitle>{{ ack.description }}</v-list-item-subtitle>
<!-- If there is a doi, then display it -->
<v-list-item-subtitle v-if="ack.doi">
<a :href="'https://doi.org/' + ack.doi" target="_blank">{{ ack.doi }}</a>
</v-list-item-subtitle>
</v-list-item>
</v-list>
</p>
</v-col>
</v-row>
</v-container>
</template>

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/views/__tests__/AboutView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,7 @@ describe('AboutView', async () => {
const mainContent = wrapper.find('.about-view')
expect(mainContent.exists()).toBe(true)
expect(mainContent.html()).toMatch('REEV: Explanation and Evaluation of Variants')
expect(mainContent.html()).toMatch('ClinVar is a freely accessible, public archive')
expect(mainContent.html()).toMatch('Coral emoji from OpenMoji')
})
})

0 comments on commit abd439d

Please sign in to comment.