Skip to content

Commit 0b88e9a

Browse files
committed
emphasize important properties in theorem list (need to tweak color)
1 parent a0b92c3 commit 0b88e9a

File tree

6 files changed

+30
-6
lines changed

6 files changed

+30
-6
lines changed

packages/viewer/src/components/Search/Results/Disprovable.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { Formula } from '@/components/Shared'
33
import { Table as Theorems } from '@/components/Theorems'
44
import type { Formula as F, Property, Theorem } from '@/models'
5+
import { formula as coreFormula } from '@pi-base/core'
56
67
export let formula: F<Property>
78
export let proof: Theorem[] | 'tautology'
@@ -14,5 +15,8 @@
1415
<Formula value={formula} />
1516
is impossible by
1617

17-
<Theorems theorems={proof} />
18+
<Theorems
19+
theorems={proof}
20+
emphasizedProperties={coreFormula.properties(formula)}
21+
/>
1822
{/if}

packages/viewer/src/components/Shared/Formula.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
export let value: Formula<Property>
88
export let link = true
99
export let subformula = false
10+
export let emphasizedProperties: Set<Property> = new Set()
1011
</script>
1112

12-
{#if value.kind === 'atom'}<Atom {value} {link} />{:else}<Compound
13+
{#if value.kind === 'atom'}<Atom
14+
{value}
15+
{link}
16+
{emphasizedProperties}
17+
/>{:else}<Compound
1318
{value}
1419
{link}
1520
grouped={subformula}
21+
{emphasizedProperties}
1622
/>{/if}

packages/viewer/src/components/Shared/Formula/Atom.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
77
export let value: Atom<Property>
88
export let link: boolean = true
9+
export let emphasizedProperties: Set<Property> = new Set()
10+
let emphasized = emphasizedProperties.has(value.property)
911
</script>
1012

1113
{value.value === null ? '?' : value.value ? '' : '¬'}{#if link}<Link.Property
1214
property={value.property}
15+
{emphasized}
1316
/>{:else}<Typeset body={value.property.name} />{/if}

packages/viewer/src/components/Shared/Formula/Compound.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
export let value: And<Property> | Or<Property>
99
export let link = true
1010
export let grouped = true
11+
export let emphasizedProperties: Set<Property> = new Set()
1112
1213
$: connector = value.kind === 'and' ? '' : ''
1314
</script>
@@ -16,6 +17,7 @@
1617
value={f}
1718
{link}
1819
subformula
20+
{emphasizedProperties}
1921
/>{i === value.subs.length - 1
2022
? ''
2123
: ` ${connector} `}{/each}{#if grouped}){/if}

packages/viewer/src/components/Shared/Link/Property.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
55
export let property: { id: number; name: string }
66
export let content: 'id' | 'idLong' | 'name' = 'name'
7+
export let emphasized: boolean = false
78
</script>
89

9-
<a href="/properties/{Id.format('P', property.id)}">
10+
<a href="/properties/{Id.format('P', property.id)}" class:emphasized>
1011
<slot>
1112
{#if content === 'name'}
1213
<Typeset body={property.name} />
@@ -17,3 +18,10 @@
1718
{/if}
1819
</slot>
1920
</a>
21+
22+
<style>
23+
.emphasized {
24+
font-weight: bold;
25+
color: #b032ff;
26+
}
27+
</style>

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script lang="ts">
2-
import type { Theorem } from '@/models'
2+
import type { Theorem, Property } from '@/models'
33
import { Formula, Link } from '../Shared'
44
55
export let theorems: Theorem[] = []
6+
export let emphasizedProperties: Set<Property> = new Set()
67
</script>
78

89
<table class="table">
@@ -20,10 +21,10 @@
2021
<Link.Theorem {theorem} />
2122
</td>
2223
<td>
23-
<Formula value={theorem.when} />
24+
<Formula value={theorem.when} {emphasizedProperties} />
2425
</td>
2526
<td>
26-
<Formula value={theorem.then} />
27+
<Formula value={theorem.then} {emphasizedProperties} />
2728
</td>
2829
</tr>
2930
{/each}

0 commit comments

Comments
 (0)