From 8fd580aa446a148bd9ac701a136df580c1da0bcf Mon Sep 17 00:00:00 2001 From: Futa Ikeda Date: Wed, 23 Aug 2023 10:36:22 -0400 Subject: [PATCH] Add Withdrawn label to withdrawn things --- app/models/search-result.ts | 4 ++++ .../addon/components/search-result-card/styles.scss | 9 +++++++++ .../addon/components/search-result-card/template.hbs | 3 +++ translations/en-us.yml | 1 + 4 files changed, 17 insertions(+) diff --git a/app/models/search-result.ts b/app/models/search-result.ts index 1fd8387acf..d3a5fa9412 100644 --- a/app/models/search-result.ts +++ b/app/models/search-result.ts @@ -275,6 +275,10 @@ export default class SearchResultModel extends Model { get registrationTemplate() { return this.resourceMetadata.conformsTo?.[0]?.title?.[0]?.['@value']; } + + get isWithdrawn() { + return this.resourceMetadata.dateWithdrawn || this.resourceMetadata['https://osf.io/vocab/2022/withdrawal']; + } } declare module 'ember-data/types/registries/model' { diff --git a/lib/osf-components/addon/components/search-result-card/styles.scss b/lib/osf-components/addon/components/search-result-card/styles.scss index fadaeecfed..23d83d4093 100644 --- a/lib/osf-components/addon/components/search-result-card/styles.scss +++ b/lib/osf-components/addon/components/search-result-card/styles.scss @@ -33,3 +33,12 @@ .orcid-logo { color: #a6ce39; } + +.withdrawn-label { + background-color: $color-bg-gray-darker; + color: $color-text-white; + border-radius: 0.25em; + padding: 0.2em 0.6em 0.3em; + font-size: 75%; + font-weight: bold; +} diff --git a/lib/osf-components/addon/components/search-result-card/template.hbs b/lib/osf-components/addon/components/search-result-card/template.hbs index 96197ba111..b530e417ce 100644 --- a/lib/osf-components/addon/components/search-result-card/template.hbs +++ b/lib/osf-components/addon/components/search-result-card/template.hbs @@ -22,6 +22,9 @@

{{@result.displayTitle}} + {{#if @result.isWithdrawn}} + {{t 'osf-components.search-result-card.withdrawn'}} + {{/if}} {{#if @result.orcids}} {{#each @result.orcids as |item|}}