Skip to content

Commit 8c1bb9c

Browse files
committed
Factor out SourceIcon and ValueIcon
1 parent 800226f commit 8c1bb9c

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

packages/viewer/src/components/Traits/Proof.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { Link } from '../Shared'
33
import { Table as Theorems } from '../Theorems'
4-
import Value from './Value.svelte'
4+
import ValueIcon from './ValueIcon.svelte'
55
import type { Property, Space, Theorem, Trait } from '@/models'
66
77
export let space: Space
@@ -28,7 +28,7 @@ Automatically deduced from the following:
2828
</td>
2929
<td>
3030
<Link.Trait {space} {property}>
31-
<Value value={trait.value} />
31+
<ValueIcon value={trait.value} />
3232
</Link.Trait>
3333
</td>
3434
</tr>

packages/viewer/src/components/Traits/Related.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import Fuse from 'fuse.js'
33
import { Icons, Link } from '../Shared'
4-
import { Value } from '../Traits'
4+
import { ValueIcon } from '../Traits'
55
import context from '@/context'
66
import type { Property, Space, Trait, Traits } from '@/models'
77
import FilterButtons from './FilterButtons.svelte'
@@ -93,7 +93,7 @@
9393
<tr>
9494
<td style="text-align:center">
9595
<Link.Trait {space} {property}>
96-
<Value value={trait?.value} />
96+
<ValueIcon value={trait?.value} />
9797
</Link.Trait>
9898
</td>
9999
<td style="text-align:center">
@@ -104,7 +104,7 @@
104104
</td>
105105
<td style="text-align:center">
106106
<Link.Trait {space} {property}>
107-
<Value
107+
<ValueIcon
108108
value={trait?.asserted}
109109
redundant={checkIfRedundant(space, property, $theorems, $traits)
110110
.redundant}
File renamed without changes.

packages/viewer/src/components/Traits/Table.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import type { Property, Space } from '@/models'
44
55
import { Link } from '../Shared'
6-
import Value from './Value.svelte'
7-
import Typeset from '../Shared/Typeset.svelte'
6+
import ValueIcon from './ValueIcon.svelte'
87
import Cell from '../Spaces/Cell.svelte'
98
109
export let properties: Property[]
@@ -37,7 +36,7 @@
3736
{#each properties as property (property.id)}
3837
<td>
3938
<Link.Trait {space} {property}>
40-
<Value value={$traits.find(space, property)?.value} />
39+
<ValueIcon value={$traits.find(space, property)?.value} />
4140
</Link.Trait>
4241
</td>
4342
{/each}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script lang="ts">
2+
export let value: boolean | undefined
3+
export let icon: 'check' | 'user' = 'check'
4+
export let redundant: boolean = false
5+
import { Icons } from '../Shared'
6+
</script>
7+
8+
{#if icon === 'user'}
9+
{#if value === true}
10+
<Icons.User />{#if redundant}*{/if}
11+
{:else if value === false}
12+
<Icons.Robot />
13+
{:else}<!-- value === undefined -->
14+
<Icons.Question />
15+
{/if}
16+
{:else}<!-- icon === "check" -->
17+
{#if value === true}
18+
<Icons.Check />
19+
{:else if value === false}
20+
<Icons.X />
21+
{:else}<!-- value === undefined -->
22+
<Icons.Question />
23+
{/if}
24+
{/if}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { default as Proof } from './Proof.svelte'
22
export { default as Related } from './Related.svelte'
33
export { default as Show } from './Show.svelte'
4+
export { default as SourceIcon } from './SourceIcon.svelte'
45
export { default as Table } from './Table.svelte'
5-
export { default as Value } from './Value.svelte'
6+
export { default as ValueIcon } from './ValueIcon.svelte'

0 commit comments

Comments
 (0)