Skip to content

Commit

Permalink
fix trait#show page reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdabbs committed Dec 10, 2023
1 parent 57d30ee commit d5e6a69
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 64 deletions.
60 changes: 0 additions & 60 deletions packages/viewer/src/components/Traits/Show.svelte

This file was deleted.

2 changes: 1 addition & 1 deletion packages/viewer/src/components/Traits/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as Proof } from './Proof.svelte'
export { default as Related } from './Related.svelte'
export { default as Show } from './Show.svelte'
export { default as Table } from './Table.svelte'
export { default as Value } from './Value.svelte'
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
<script lang="ts">
import { page } from '$app/stores'
import { Show } from '@/components/Traits'
import {
Icons,
Link,
References,
Title,
Typeset
} from '@/components/Shared'
import { Proof } from '@/components/Traits'
import type { PageData } from './$types'
export let data: PageData
</script>

<Show spaceId={$page.params.id} propertyId={$page.params.propertyId} />
<Title title={`${data.space.name}: ${data.property.name}`} />

<h1>
{#if data.proof}
<Icons.Robot />
{/if}
<Link.Space space={data.space} />
is
{data.trait.value ? '' : 'not'}
<Link.Property property={data.property} />
</h1>

{#if data.proof}
<Proof space={data.space} {...data.proof} />
{:else if data.meta}
<section class="description">
<Typeset body={data.meta.description} />
</section>
<h3>References</h3>
<References references={data.meta.refs} />
{/if}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { get } from 'svelte/store'
import { error } from '@sveltejs/kit'

import type { PageLoad } from './$types'

export const load: PageLoad = async function ({ params: { id: spaceId, propertyId }, parent }) {
const { load, spaces, properties, theorems, traits, checked } = await parent()

return load(
traits,
ts => ts.lookup({
spaceId,
propertyId,
spaces: get(spaces),
properties: get(properties),
theorems: get(theorems),
}),
checked(spaceId)
).catch(() => {
throw(error(404, `Trait not found ${spaceId} / ${propertyId}`))
})
}

0 comments on commit d5e6a69

Please sign in to comment.