Skip to content

Commit

Permalink
tests if content loaded before displaying page
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDiakite committed Aug 12, 2024
1 parent e4a7f50 commit f82c2ae
Showing 1 changed file with 37 additions and 39 deletions.
76 changes: 37 additions & 39 deletions src/routes/[resources=resources]/[slug]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
<script lang="ts">
import { t, dateToLocalizedString } from '$lib/i18n/i18n.js';
import Tree from '$lib/components/Tree.svelte';
import { page } from '$app/stores';
import { resources, screenType } from '$lib/stores';
const content = $resources;
const post = content.find((p) => p.meta.slug === $page.params.slug)!;
import { resources } from '$lib/stores';
const smallScreen = $screenType === 'mobile' || $screenType === 'tablet-vertical';
const post = $resources.find((p) => p.meta.slug === $page.params.slug)!;
</script>

<aside class="aside-blog">
<p class="project-description">{post.meta.description}</p>
<div>
<div class="meta">
<span class="attr">{$t('resources.dateCreated')}</span>
<p>{$dateToLocalizedString(post.meta.dateCreated)}</p>
{#if post}
<aside class="aside-blog">
<p class="project-description">{post.meta.description}</p>
<div>
<div class="meta">
<span class="attr">{$t('resources.dateCreated')}</span>
<p>{$dateToLocalizedString(post.meta.dateCreated)}</p>
</div>
<div class="meta">
<span class="attr">{$t('resources.dateUpdated')}</span>
<p>{$dateToLocalizedString(post.meta.dateUpdated)}</p>
</div>
<div class="meta">
<span class="attr">{$t('resources.contributors')}</span>
<ul>
{#each post.meta.contributors as c}
<li>{c}</li>
{/each}
</ul>
</div>
</div>
<div class="meta">
<span class="attr">{$t('resources.dateUpdated')}</span>
<p>{$dateToLocalizedString(post.meta.dateUpdated)}</p>

<div class="tree-container">
<Tree />
</div>
<div class="meta">
<span class="attr">{$t('resources.contributors')}</span>
<ul>
{#each post.meta.contributors as c}
<li>{c}</li>
{/each}
</ul>
</aside>

<article>
<header>
<h1>
{post.meta.title}
</h1>
</header>
<div class="text-body">
{@html post.html}
</div>
</div>

<div class="tree-container">
<Tree />
</div>
</aside>

<article>
<header>
<h1>
{post.meta.title}
</h1>
</header>
<div class="text-body">
{@html post.html}
</div>
</article>
</article>
{/if}

<style>
article,
Expand Down

0 comments on commit f82c2ae

Please sign in to comment.