From 18f59f80fa2e3cce30ec00a664e57445bdff9474 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Tue, 1 Sep 2026 11:21:20 +0100 Subject: [PATCH] web/components: add skeleton to trending loader Signed-off-by: oppiliappan --- web/src/fixtures/timeline.ts | 11 +++ ...dingreposlist--skeleton-fixture.bones.json | 88 +++++++++++++++++++ .../timeline/Timeline.stories.svelte | 14 ++- .../components/timeline/TimelineView.svelte | 7 +- .../components/timeline/TrendingRepos.svelte | 44 +--------- .../timeline/TrendingReposList.stories.svelte | 18 ++++ .../timeline/TrendingReposList.svelte | 46 ++++++++++ .../timeline/TrendingSkeleton.svelte | 12 +++ 8 files changed, 197 insertions(+), 43 deletions(-) create mode 100644 web/src/lib/bones/timeline-trendingreposlist--skeleton-fixture.bones.json create mode 100644 web/src/lib/components/timeline/TrendingReposList.stories.svelte create mode 100644 web/src/lib/components/timeline/TrendingReposList.svelte create mode 100644 web/src/lib/components/timeline/TrendingSkeleton.svelte diff --git a/web/src/fixtures/timeline.ts b/web/src/fixtures/timeline.ts index 0c4bd159d..a2e77e4d6 100644 --- a/web/src/fixtures/timeline.ts +++ b/web/src/fixtures/timeline.ts @@ -88,3 +88,14 @@ export const trending: RepoCardData[] = [ stars: 9 } ]; + +// the trending rail always shows a fixed 5 rows, so the skeleton fixture +// needs a full 5 items (with descriptions) to capture that exact height +export const trendingSkeleton: RepoCardData[] = Array.from({ length: 5 }, (_, i) => ({ + name: trending[i % trending.length]!.name, + repoDid: trending[i % trending.length]!.repoDid, + ownerHandle: trending[i % trending.length]!.ownerHandle, + description: trending[i % trending.length]!.description ?? "A tiny CI runner.", + createdAt: trending[i % trending.length]!.createdAt, + stars: trending[i % trending.length]!.stars +})); diff --git a/web/src/lib/bones/timeline-trendingreposlist--skeleton-fixture.bones.json b/web/src/lib/bones/timeline-trendingreposlist--skeleton-fixture.bones.json new file mode 100644 index 000000000..a72b7d83f --- /dev/null +++ b/web/src/lib/bones/timeline-trendingreposlist--skeleton-fixture.bones.json @@ -0,0 +1,88 @@ +{ + "breakpoints": { + "375": { + "width": 343, + "height": 300, + "bones": [ + [13.9942, 13, 6.9971, 14, 4], + [25.656, 12, 38.3236, 16, 4], + [25.656, 30, 55.7434, 14, 4], + [13.9942, 73, 6.9971, 14, 4], + [25.656, 72, 38.3236, 16, 4], + [25.656, 90, 55.7434, 14, 4], + [13.9942, 133, 6.9971, 14, 4], + [25.656, 132, 38.3236, 16, 4], + [25.656, 150, 55.7434, 14, 4], + [13.9942, 193, 6.9971, 14, 4], + [25.656, 192, 38.3236, 16, 4], + [25.656, 210, 55.7434, 14, 4], + [13.9942, 253, 6.9971, 14, 4], + [25.656, 252, 38.3236, 16, 4], + [25.656, 270, 55.7434, 14, 4] + ] + }, + "768": { + "width": 736, + "height": 300, + "bones": [ + [6.5217, 13, 3.2609, 14, 4], + [11.9565, 12, 47.2283, 16, 4], + [11.9565, 30, 68.6957, 14, 4], + [6.5217, 73, 3.2609, 14, 4], + [11.9565, 72, 47.2283, 16, 4], + [11.9565, 90, 68.6957, 14, 4], + [6.5217, 133, 3.2609, 14, 4], + [11.9565, 132, 47.2283, 16, 4], + [11.9565, 150, 68.6957, 14, 4], + [6.5217, 193, 3.2609, 14, 4], + [11.9565, 192, 47.2283, 16, 4], + [11.9565, 210, 68.6957, 14, 4], + [6.5217, 253, 3.2609, 14, 4], + [11.9565, 252, 47.2283, 16, 4], + [11.9565, 270, 68.6957, 14, 4] + ] + }, + "1024": { + "width": 992, + "height": 300, + "bones": [ + [4.8387, 13, 2.4194, 14, 4], + [8.871, 12, 49.2339, 16, 4], + [8.871, 30, 71.6129, 14, 4], + [4.8387, 73, 2.4194, 14, 4], + [8.871, 72, 49.2339, 16, 4], + [8.871, 90, 71.6129, 14, 4], + [4.8387, 133, 2.4194, 14, 4], + [8.871, 132, 49.2339, 16, 4], + [8.871, 150, 71.6129, 14, 4], + [4.8387, 193, 2.4194, 14, 4], + [8.871, 192, 49.2339, 16, 4], + [8.871, 210, 71.6129, 14, 4], + [4.8387, 253, 2.4194, 14, 4], + [8.871, 252, 49.2339, 16, 4], + [8.871, 270, 71.6129, 14, 4] + ] + }, + "1440": { + "width": 1408, + "height": 300, + "bones": [ + [3.4091, 13, 1.7045, 14, 4], + [6.25, 12, 50.9375, 16, 4], + [6.25, 30, 74.0909, 14, 4], + [3.4091, 73, 1.7045, 14, 4], + [6.25, 72, 50.9375, 16, 4], + [6.25, 90, 74.0909, 14, 4], + [3.4091, 133, 1.7045, 14, 4], + [6.25, 132, 50.9375, 16, 4], + [6.25, 150, 74.0909, 14, 4], + [3.4091, 193, 1.7045, 14, 4], + [6.25, 192, 50.9375, 16, 4], + [6.25, 210, 74.0909, 14, 4], + [3.4091, 253, 1.7045, 14, 4], + [6.25, 252, 50.9375, 16, 4], + [6.25, 270, 74.0909, 14, 4] + ] + } + } +} diff --git a/web/src/lib/components/timeline/Timeline.stories.svelte b/web/src/lib/components/timeline/Timeline.stories.svelte index 66a6e36e5..26fef8f6c 100644 --- a/web/src/lib/components/timeline/Timeline.stories.svelte +++ b/web/src/lib/components/timeline/Timeline.stories.svelte @@ -19,4 +19,16 @@ - + + {#snippet template(args)} +
+ +
+ +
+ +
+ {/snippet} +
diff --git a/web/src/lib/components/timeline/TimelineView.svelte b/web/src/lib/components/timeline/TimelineView.svelte index 788fb9c17..ed5f39ba0 100644 --- a/web/src/lib/components/timeline/TimelineView.svelte +++ b/web/src/lib/components/timeline/TimelineView.svelte @@ -9,6 +9,7 @@ import Timeline from "./Timeline.svelte"; import TimelineSkeleton from "./TimelineSkeleton.svelte"; import TrendingRepos from "./TrendingRepos.svelte"; + import TrendingSkeleton from "./TrendingSkeleton.svelte"; import type { RepoCardData } from "$lib/components/profile/types"; import type * as ShTangledFeedGetTimeline from "$lib/api/lexicons/types/sh/tangled/feed/getTimeline"; @@ -87,7 +88,11 @@
- + {#if loading} + + {:else} + + {/if}