diff --git a/frontend/components/Base/Card.vue b/frontend/components/Base/Card.vue index 464066f..88fef80 100644 --- a/frontend/components/Base/Card.vue +++ b/frontend/components/Base/Card.vue @@ -1,16 +1,46 @@ + + diff --git a/frontend/components/global/DetailsSection/types.ts b/frontend/components/global/DetailsSection/types.ts index 92c6f90..74135fb 100644 --- a/frontend/components/global/DetailsSection/types.ts +++ b/frontend/components/global/DetailsSection/types.ts @@ -36,3 +36,23 @@ export type Detail = BaseDetail & { export type AnyDetail = DateDetail | CurrencyDetail | LinkDetail | MarkdownDetail | Detail; export type Details = Array; + +export function filterZeroValues(details: Details): Details { + return details.filter(detail => { + switch (detail.type) { + case "date": + return validDate(detail.text); + case "currency": + return !!detail.text; + case "link": + return !!detail.text && !!detail.href; + case undefined: + case "text": + case "markdown": + return detail.text !== null && detail.text !== "" && detail.text !== undefined; + default: + console.warn("Unknown detail type (this should never happen)", detail); + return false; + } + }); +} diff --git a/frontend/pages/item/[id]/index.vue b/frontend/pages/item/[id]/index.vue index 5794a77..e9fb281 100644 --- a/frontend/pages/item/[id]/index.vue +++ b/frontend/pages/item/[id]/index.vue @@ -1,5 +1,5 @@