<script lang="ts">
  import type { PageProps } from './$types';
  import ListPrevNext from '$lib/ListPrevNext.svelte';
  let { data }: PageProps = $props();
</script>

<h1>Reviews</h1>

{#if data.reviews === undefined}
  Select active project

  <ul>
    {#each data.projects!!.projects as { id, title } (id)}
      <li>{title}</li>
    {/each}
  </ul>
  <ListPrevNext list={data.projects} query_offset="project_offset" />
{:else}
  <ul>
    {#each data.reviews.reviews as { id, title } (id)}
      <li>{title}</li>
    {/each}
  </ul>
  <ListPrevNext list={data.reviews} />
{/if}
