<script module lang="ts">
	import { defineMeta } from "@storybook/addon-svelte-csf";
	import StoryAuthProvider from "../../../../.storybook/StoryAuthProvider.svelte";
	import RepoHeader from "./RepoHeader.svelte";
	import type { RepoInfo } from "./types";

	const repo: RepoInfo = {
		uri: "at://did:plc:repo/sh.tangled.repo.repo/3jzrepo",
		rkey: "3jzrepo",
		name: "tangled",
		ownerDid: "did:plc:owner",
		ownerHandle: "dawn",
		repoDid: "did:plc:repo",
		knot: "knot1.tangled.sh",
		description: "social code collaboration for the at protocol",
		website: "https://tangled.org",
		topics: ["atproto", "git", "svelte"],
		defaultBranch: "main",
		source: { ownerHandle: "upstream", name: "tangled" }
	};
	const counts = { stars: 128, issues: 7, pulls: 3, forks: 12 };

	const { Story } = defineMeta({
		title: "Repo/RepoHeader",
		component: RepoHeader,
		tags: ["autodocs"]
	});
</script>

<Story name="Full metadata" asChild>
	<StoryAuthProvider>
		<RepoHeader {repo} {counts} />
	</StoryAuthProvider>
</Story>
<Story name="No description or website" asChild>
	<StoryAuthProvider>
		<RepoHeader
			repo={{ ...repo, description: undefined, website: undefined, topics: [] }}
			{counts}
		/>
	</StoryAuthProvider>
</Story>
<Story name="Not a fork" asChild>
	<StoryAuthProvider>
		<RepoHeader repo={{ ...repo, source: undefined }} {counts} />
	</StoryAuthProvider>
</Story>
