From 2f3baeeebdf5cdcdcef411e4ed08511f6236b2df Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Mon, 25 Nov 2024 11:14:53 -0500 Subject: [PATCH] Refactor document/Access to common component, use in Project header --- .../{documents => common}/Access.svelte | 16 +++++++++------- .../components/documents/DocumentListItem.svelte | 3 +-- src/lib/components/documents/Header.svelte | 2 +- .../__snapshots__/DocumentListItem.test.ts.snap | 1 + src/lib/components/projects/ProjectHeader.svelte | 5 +++-- 5 files changed, 15 insertions(+), 12 deletions(-) rename src/lib/components/{documents => common}/Access.svelte (81%) diff --git a/src/lib/components/documents/Access.svelte b/src/lib/components/common/Access.svelte similarity index 81% rename from src/lib/components/documents/Access.svelte rename to src/lib/components/common/Access.svelte index a8c106197..bd8f56e13 100644 --- a/src/lib/components/documents/Access.svelte +++ b/src/lib/components/common/Access.svelte @@ -22,7 +22,7 @@ }, ]; - export function getLevel(access: Access): Level | undefined { + export function getLevel(access: Access): Maybe { return levels.find((level) => level.value === access); } @@ -30,16 +30,18 @@ -
- - {$_(level.title)} -
+{#if level} +
+ + {$_(level.title)} +
+{/if}