diff --git a/web/src/lib/components/timeline/Timeline.stories.svelte b/web/src/lib/components/timeline/Timeline.stories.svelte new file mode 100644 index 00000000..a2f3c6a0 --- /dev/null +++ b/web/src/lib/components/timeline/Timeline.stories.svelte @@ -0,0 +1,83 @@ + + + + {#snippet template(args)} + + + + {/snippet} + + + diff --git a/web/src/lib/components/timeline/Timeline.svelte b/web/src/lib/components/timeline/Timeline.svelte new file mode 100644 index 00000000..68288acb --- /dev/null +++ b/web/src/lib/components/timeline/Timeline.svelte @@ -0,0 +1,35 @@ + + +{#if feed.length > 0} +
+ {#each feed as item, i (item.event.uri)} + {@const event = item.event} +
+ + {#if i !== 0} + + {/if} + {#if event.$type === "sh.tangled.feed.getTimeline#repoEvent"} + + {:else if event.$type === "sh.tangled.feed.getTimeline#starEvent"} + + {:else if event.$type === "sh.tangled.feed.getTimeline#followEvent"} + + {/if} +
+ {/each} +
+{:else} + +{/if} diff --git a/web/src/routes/timeline/+page.svelte b/web/src/routes/timeline/+page.svelte index 14b9507b..a045354d 100644 --- a/web/src/routes/timeline/+page.svelte +++ b/web/src/routes/timeline/+page.svelte @@ -3,10 +3,7 @@ import GalleryVertical from "$icon/gallery-vertical"; import Button from "$lib/components/ui/Button.svelte"; import ButtonGroup from "$lib/components/ui/ButtonGroup.svelte"; - import EmptyState from "$lib/components/ui/EmptyState.svelte"; - import TimelineRepoEvent from "$lib/components/timeline/TimelineRepoEvent.svelte"; - import TimelineStarEvent from "$lib/components/timeline/TimelineStarEvent.svelte"; - import TimelineFollowEvent from "$lib/components/timeline/TimelineFollowEvent.svelte"; + import Timeline from "$lib/components/timeline/Timeline.svelte"; import type { PageData } from "./$types"; let { data }: { data: PageData } = $props(); @@ -36,18 +33,8 @@ {/if} - {#each data.feed as item (item.event.uri)} - {@const event = item.event} - {#if event.$type === "sh.tangled.feed.getTimeline#repoEvent"} - - {:else if event.$type === "sh.tangled.feed.getTimeline#starEvent"} - - {:else if event.$type === "sh.tangled.feed.getTimeline#followEvent"} - - {/if} - {:else} - - {/each} +