Skip to content

Commit 5185d79

Browse files
feat(frontend): add main release page, fix broken animation, better code
1 parent dc57b29 commit 5185d79

File tree

12 files changed

+461
-13
lines changed

12 files changed

+461
-13
lines changed

src/lib/components/renderers/ListElementRenderer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<Button
5757
href={ghLinkToHref(allLinks[0] ?? "")}
5858
variant="link"
59-
class="ml-2 !inline-flex h-auto p-0 transition-[transform,_opacity] duration-300 group-hover:translate-x-0 group-hover:opacity-100 md:ml-4 md:-translate-x-2 md:opacity-0 lg:mr-8"
59+
class="ml-2 !inline-flex h-auto p-0 transition-[translate,_opacity] duration-300 group-hover:translate-x-0 group-hover:opacity-100 md:ml-4 md:-translate-x-2 md:opacity-0 lg:mr-8"
6060
>
6161
Open details
6262
<ArrowRight class="ml-2 size-4" />
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import type { WithElementRef } from "bits-ui";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
import { cn } from "$lib/utils.js";
5+
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
children,
10+
...restProps
11+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
12+
</script>
13+
14+
<div bind:this={ref} class={cn("p-6", className)} {...restProps}>
15+
{@render children?.()}
16+
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import type { WithElementRef } from "bits-ui";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
import { cn } from "$lib/utils.js";
5+
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
children,
10+
...restProps
11+
}: WithElementRef<HTMLAttributes<HTMLParagraphElement>> = $props();
12+
</script>
13+
14+
<p bind:this={ref} class={cn("text-muted-foreground text-sm", className)} {...restProps}>
15+
{@render children?.()}
16+
</p>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import type { WithElementRef } from "bits-ui";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
import { cn } from "$lib/utils.js";
5+
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
children,
10+
...restProps
11+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
12+
</script>
13+
14+
<div bind:this={ref} class={cn("flex items-center p-6 pt-0", className)} {...restProps}>
15+
{@render children?.()}
16+
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import type { WithElementRef } from "bits-ui";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
import { cn } from "$lib/utils.js";
5+
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
children,
10+
...restProps
11+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
12+
</script>
13+
14+
<div bind:this={ref} class={cn("flex flex-col space-y-1.5 p-6 pb-0", className)} {...restProps}>
15+
{@render children?.()}
16+
</div>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<script lang="ts">
2+
import type { WithElementRef } from "bits-ui";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
import { cn } from "$lib/utils.js";
5+
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
level = 3,
10+
children,
11+
...restProps
12+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
13+
level?: 1 | 2 | 3 | 4 | 5 | 6;
14+
} = $props();
15+
</script>
16+
17+
<div
18+
role="heading"
19+
aria-level={level}
20+
bind:this={ref}
21+
class={cn("text-2xl font-semibold leading-none tracking-tight", className)}
22+
{...restProps}
23+
>
24+
{@render children?.()}
25+
</div>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script lang="ts">
2+
import type { WithElementRef } from "bits-ui";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
import { cn } from "$lib/utils.js";
5+
6+
let {
7+
ref = $bindable(null),
8+
class: className,
9+
children,
10+
...restProps
11+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
12+
</script>
13+
14+
<div
15+
bind:this={ref}
16+
class={cn("bg-card text-card-foreground rounded-lg border shadow-sm", className)}
17+
{...restProps}
18+
>
19+
{@render children?.()}
20+
</div>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Root from "./card.svelte";
2+
import Content from "./card-content.svelte";
3+
import Description from "./card-description.svelte";
4+
import Footer from "./card-footer.svelte";
5+
import Header from "./card-header.svelte";
6+
import Title from "./card-title.svelte";
7+
8+
export {
9+
Root,
10+
Content,
11+
Description,
12+
Footer,
13+
Header,
14+
Title,
15+
//
16+
Root as Card,
17+
Content as CardContent,
18+
Description as CardDescription,
19+
Footer as CardFooter,
20+
Header as CardHeader,
21+
Title as CardTitle,
22+
};

src/routes/+layout.server.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ export async function load() {
55

66
return {
77
// The displayable data, available to load from clients
8-
displayablePackages: categorizedPackages
9-
.map(res => ({
10-
...res,
11-
packages: res.packages.map(
8+
displayablePackages: categorizedPackages.map(res => ({
9+
...res,
10+
packages: res.packages
11+
.map(
1212
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1313
({ dataFilter, metadataFromTag, changelogContentsReplacer, ...rest }) => rest
1414
)
15-
}))
16-
// Sort the packages by name
17-
.map(res => ({
18-
...res,
19-
packages: res.packages.toSorted((a, b) => a.packageName.localeCompare(b.packageName))
20-
}))
15+
.toSorted((a, b) => a.packageName.localeCompare(b.packageName))
16+
}))
2117
};
2218
}
Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,47 @@
11
<script lang="ts">
2+
import { LoaderCircle } from "@lucide/svelte";
3+
import ReleaseCard from "./ReleaseCard.svelte";
4+
import SidePanel from "./SidePanel.svelte";
5+
import * as Accordion from "$lib/components/ui/accordion";
6+
27
let { data } = $props();
38
</script>
49

5-
{#await data.releases then release}
6-
{JSON.stringify(release, null, 2)}
10+
{#await data.releases}
11+
<span class="inline-flex items-center justify-center">
12+
<LoaderCircle class="mr-2 size-4 animate-spin" />
13+
Loading...
14+
</span>
15+
{:then releases}
16+
<div class="my-8">
17+
<h1 class="text-5xl font-semibold text-primary">{data.currentPackage.packageName}</h1>
18+
<h2 class="text-xl text-muted-foreground">
19+
{data.currentPackage.owner}/{data.currentPackage.repoName}
20+
</h2>
21+
</div>
22+
<div class="flex gap-8">
23+
<Accordion.Root
24+
type="multiple"
25+
value={releases
26+
// Only expand releases that are less than a week old
27+
.filter(({ created_at }) => {
28+
return new Date(created_at).getTime() > new Date().getTime() - 1000 * 60 * 60 * 24 * 7;
29+
})
30+
.map(({ id }) => id.toString())}
31+
class="w-full"
32+
>
33+
{#each releases as release (release.id)}
34+
<ReleaseCard
35+
packageName={data.currentPackage.packageName}
36+
repo={{ owner: data.currentPackage.owner, name: data.currentPackage.repoName }}
37+
{release}
38+
/>
39+
{/each}
40+
</Accordion.Root>
41+
<SidePanel
42+
packageName={data.currentPackage.packageName}
43+
allPackages={data.displayablePackages}
44+
class="h-fit w-2/5"
45+
/>
46+
</div>
747
{/await}

0 commit comments

Comments
 (0)