<script>
  export let id;

  import { _ } from 'svelte-i18n';

  import { getPost } from '$/stores/post';
  import PostContent from '$/components/post_content/post_content.svelte';
  import ErrorBlock from '$/components/error_block/error_block.svelte';
  import Loader from '$/components/loader/loader.svelte';

  $: store = getPost(id);
  $: post = $store.data;
</script>

{#if $store.loading}
  <Loader />
{/if}
{#if $store.error}
  <ErrorBlock message={$_('post.error.unavailable')} />
{/if}
{#if post}
  <PostContent post={post} />
{/if}
