<script lang="ts">
	import OverviewTab from "$lib/components/profile/tabs/OverviewTab.svelte";
	import PeopleTab from "$lib/components/profile/tabs/PeopleTab.svelte";
	import RepoListTab from "$lib/components/profile/tabs/RepoListTab.svelte";
	import StarredTab from "$lib/components/profile/tabs/StarredTab.svelte";
	import StringListTab from "$lib/components/profile/tabs/StringListTab.svelte";
	import VouchTab from "$lib/components/profile/tabs/VouchTab.svelte";

	let { data } = $props();
</script>

{#if data.tab === "overview"}
	<OverviewTab pinned={data.overview.pinned} />
{:else if data.tab === "repos"}
	{#key data.repos}
		<RepoListTab
			initial={data.repos}
			cursor={data.cursor}
			did={data.identity.did}
			handle={data.identity.handle}
		/>
	{/key}
{:else if data.tab === "starred"}
	{#key data.stars}
		<StarredTab initial={data.stars} cursor={data.cursor} did={data.identity.did} />
	{/key}
{:else if data.tab === "strings"}
	{#key data.strings}
		<StringListTab
			initial={data.strings}
			cursor={data.cursor}
			did={data.identity.did}
			handle={data.identity.handle}
		/>
	{/key}
{:else if data.tab === "followers"}
	{#key data.people}
		<PeopleTab
			initial={data.people}
			cursor={data.cursor}
			did={data.identity.did}
			direction="followers"
			title="Followers"
			emptyMessage="No followers yet."
		/>
	{/key}
{:else if data.tab === "following"}
	{#key data.people}
		<PeopleTab
			initial={data.people}
			cursor={data.cursor}
			did={data.identity.did}
			direction="following"
			title="Following"
			emptyMessage="Not following anyone yet."
		/>
	{/key}
{:else if data.tab === "vouches"}
	{#key data.vouches}
		<VouchTab
			initial={data.vouches}
			cursors={data.cursors}
			did={data.identity.did}
			isSelf={data.isSelf}
			profileHandle={data.profileHandle}
		/>
	{/key}
{/if}
