<script lang="ts">
	import VouchCard from "../VouchCard.svelte";
	import EmptyState from "../EmptyState.svelte";
	import type { VouchData } from "../types";

	let {
		vouches,
		isSelf,
		profileHandle
	}: { vouches: VouchData[]; isSelf: boolean; profileHandle: string } = $props();

	const profileLabel = $derived(isSelf ? "you" : profileHandle);
</script>

<section>
	<h2 class="px-2 pb-4 text-base font-medium">Vouches</h2>
	{#if vouches.length === 0}
		<EmptyState message="No vouches yet." />
	{:else}
		<div class="relative ml-5 flex flex-col gap-6 border border-transparent px-4">
			<div class="absolute bottom-8 top-8 z-0 w-0.5 bg-border-default"></div>
			{#each vouches as vouch (vouch.uri)}
				<VouchCard {vouch} {profileLabel} />
			{/each}
		</div>
	{/if}
</section>
