<script lang="ts">
import Checkout from "layout/checkout/Checkout.svelte";
import { user } from "lib/UserStore";
import LoginRegister from "login/LoginRegister.svelte";
import Euro from "util/Euro.svelte";
</script>

{#if $user !== null}
	<div class="page_content">
		<section>
			{#if $user.subscription.type === "patreon"}
				<p>
					You already have a Patreon subscription active. You cannot use
					Prepaid while that subscription is active.
				</p>
			{:else if $user.subscription.type === "prepaid"}
				<p>
					You already have a Prepaid subscription active. Your account
					balance is <Euro amount={$user.balance_micro_eur}/>. Use
					the form below to top up your balance.
				</p>
				<Checkout/>
			{:else}
				<p>
					Pick one of the subscription plans above to upgrade your
					account to premium.
				</p>
			{/if}
		</section>
	</div>
{:else}
	<LoginRegister/>
{/if}
