<script module lang="ts">
	import { defineMeta } from "@storybook/addon-svelte-csf";
	import IssueList from "./IssueList.svelte";
	import type { IssueSummary } from "$lib/components/repo/types";

	const make = (
		rkey: string,
		title: string,
		state: IssueSummary["state"],
		commentCount: number
	): IssueSummary => ({
		uri: `at://did:plc:3p7ejjxnufohsygt5vbyxb2i/sh.tangled.repo.issue/${rkey}`,
		rkey,
		title,
		state,
		authorHandle: "joshka.net",
		authorDid: "did:plc:3p7ejjxnufohsygt5vbyxb2i",
		createdAt: "2025-06-01T10:30:00Z",
		commentCount
	});

	const issues: IssueSummary[] = [
		make("3mrkgcxb4m422", "Add a full trending repositories view", "open", 3),
		make("3mrkgcxb4m423", "Packfile push times out over the smart protocol", "open", 0),
		make("3mrkgcxb4m424", "Dark mode contrast on the issue label panel", "closed", 7)
	];

	const { Story } = defineMeta({
		title: "Repo/Issues/IssueList",
		component: IssueList,
		tags: ["autodocs"],
		args: {
			ownerHandle: "tangled.org",
			repoName: "core",
			issues
		}
	});
</script>

<Story name="Default" />
<Story name="Empty" args={{ issues: [] }} />
