<script lang="ts">
import Spacer from '$lib/Layout/Spacer.svelte';
export let type = 'Media';
export let loginSessionError = true;
export let contact = true;
export let list = true;
export let card = false;
export let might = true;
</script>

<div class:card>
  {#if list}
    <ul>
      <li>
        <p>
          {type} could not be loaded. You{might ? ' might' : ''} have been rate-limited. {#if !might}
            Try again in one minute.
          {/if}
        </p>

        {#if loginSessionError}
          <p>
            Your login session may have expired. Try logging out and logging back in, or try again
            in a few minutes.
          </p>
        {/if}

        <slot />

        {#if contact}
          <Spacer />

          If the problem persists, please contact
          <a href="https://anilist.co/user/fuwn" target="_blank">@fuwn</a> on AniList.
        {/if}
      </li>
    </ul>
  {:else}
    <p>
      {type} could not be loaded. You{might ? ' might' : ''} have been rate-limited. {#if !might}
        Try again in one minute.
      {/if}
    </p>

    {#if loginSessionError}
      <p>
        Your login session may have expired. Try logging out and logging back in, or try again in a
        few minutes.
      </p>
    {/if}

    <slot />

    {#if contact}
      <Spacer />

      If the problem persists, please contact
      <a href="https://anilist.co/user/fuwn" target="_blank">@fuwn</a> on AniList.
    {/if}
  {/if}
</div>
