feat: add minimal pin renderer (#368)
Reviewed-on: https://gitea.coracle.social/coracle/flotilla/pulls/368 Co-authored-by: Aditya Chaudhary <30+useradityaa@noreply.coracle.social>
This commit is contained in:
parent
31471b50b5
commit
9d8be25bae
2 changed files with 21 additions and 1 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {ComponentProps} from "svelte"
|
import type {ComponentProps} from "svelte"
|
||||||
import {EVENT_TIME, ZAP_GOAL, THREAD, CLASSIFIED, POLL, PINBOARD} from "@welshman/util"
|
import {EVENT_TIME, ZAP_GOAL, THREAD, CLASSIFIED, POLL, PINBOARD, PIN} from "@welshman/util"
|
||||||
import NoteContentMinimalEventTime from "@app/components/NoteContentMinimalEventTime.svelte"
|
import NoteContentMinimalEventTime from "@app/components/NoteContentMinimalEventTime.svelte"
|
||||||
import NoteContentMinimalThread from "@app/components/NoteContentMinimalThread.svelte"
|
import NoteContentMinimalThread from "@app/components/NoteContentMinimalThread.svelte"
|
||||||
import NoteContentMinimalClassified from "@app/components/NoteContentMinimalClassified.svelte"
|
import NoteContentMinimalClassified from "@app/components/NoteContentMinimalClassified.svelte"
|
||||||
import NoteContentMinimalGoal from "@app/components/NoteContentMinimalGoal.svelte"
|
import NoteContentMinimalGoal from "@app/components/NoteContentMinimalGoal.svelte"
|
||||||
import NoteContentMinimalPoll from "@app/components/NoteContentMinimalPoll.svelte"
|
import NoteContentMinimalPoll from "@app/components/NoteContentMinimalPoll.svelte"
|
||||||
import NoteContentMinimalBoard from "@app/components/NoteContentMinimalBoard.svelte"
|
import NoteContentMinimalBoard from "@app/components/NoteContentMinimalBoard.svelte"
|
||||||
|
import NoteContentMinimalPin from "@app/components/NoteContentMinimalPin.svelte"
|
||||||
import ContentMinimal from "@app/components/ContentMinimal.svelte"
|
import ContentMinimal from "@app/components/ContentMinimal.svelte"
|
||||||
|
|
||||||
const props: ComponentProps<typeof ContentMinimal> = $props()
|
const props: ComponentProps<typeof ContentMinimal> = $props()
|
||||||
|
|
@ -25,6 +26,8 @@
|
||||||
<NoteContentMinimalPoll {...props} />
|
<NoteContentMinimalPoll {...props} />
|
||||||
{:else if props.event.kind === PINBOARD}
|
{:else if props.event.kind === PINBOARD}
|
||||||
<NoteContentMinimalBoard {...props} />
|
<NoteContentMinimalBoard {...props} />
|
||||||
|
{:else if props.event.kind === PIN}
|
||||||
|
<NoteContentMinimalPin {...props} />
|
||||||
{:else}
|
{:else}
|
||||||
<ContentMinimal {...props} />
|
<ContentMinimal {...props} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
||||||
17
src/app/components/NoteContentMinimalPin.svelte
Normal file
17
src/app/components/NoteContentMinimalPin.svelte
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type {ComponentProps} from "svelte"
|
||||||
|
import {Pin} from "@welshman/domain"
|
||||||
|
import ContentMinimal from "@app/components/ContentMinimal.svelte"
|
||||||
|
import {reader} from "@app/core"
|
||||||
|
|
||||||
|
const props: ComponentProps<typeof ContentMinimal> = $props()
|
||||||
|
|
||||||
|
const loadPin = reader(Pin)(props.event)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#await loadPin then pin}
|
||||||
|
<span class="text-sm">{pin.title() || "Untitled pin"}</span>
|
||||||
|
{#if pin.content()}
|
||||||
|
<span class="truncate min-w-0 block opacity-70">{pin.content()}</span>
|
||||||
|
{/if}
|
||||||
|
{/await}
|
||||||
Loading…
Reference in a new issue