Fix description diff and collections presenters (#4240)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2023-12-22 00:05:32 +07:00
committed by GitHub
parent ba49e4d66e
commit 396160a27c
7 changed files with 40 additions and 25 deletions
@@ -32,11 +32,7 @@
let object: Doc | undefined = undefined
async function getValue (object: Doc | undefined): Promise<string | undefined> {
if (object === undefined) {
return ''
}
async function getValue (object: Doc): Promise<string | undefined> {
if (viewlet?.valueAttr) {
return (object as any)[viewlet.valueAttr]
}
@@ -60,15 +56,17 @@
</script>
{#if object}
{#await getValue(object) then value}
{#if withIcon && message.action === 'create'}
<Icon icon={IconAdd} size="x-small" />
{/if}
{#if withIcon && message.action === 'remove'}
<Icon icon={IconDelete} size="x-small" />
{/if}
{#if withIcon && message.action === 'create'}
<Icon icon={IconAdd} size="x-small" />
{/if}
{#if withIcon && message.action === 'remove'}
<Icon icon={IconDelete} size="x-small" />
{/if}
{#if value}
{#if objectPresenter && !viewlet?.valueAttr}
<Component is={objectPresenter.presenter} props={{ value: object, accent: true, shouldShowAvatar: false }} />
{:else}
{#await getValue(object) then value}
<span>
<DocNavLink
{object}
@@ -82,10 +80,8 @@
<span class="separator">,</span>
{/if}
</span>
{:else if objectPresenter && object}
<Component is={objectPresenter.presenter} props={{ value: object, accent: true, shouldShowAvatar: false }} />
{/if}
{/await}
{/await}
{/if}
{/if}
<style lang="scss">