Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 28 additions & 51 deletions src/components/PropertyAssignmentList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
PropertyShort,
StructureType
} from '$lib/commons/types'
import { assignment_level } from '$lib/states/assignment_level.svelte'
import { pluralize } from '$shared/utils'

type Props = {
Expand Down Expand Up @@ -37,61 +36,39 @@
<section>
<h3 class="sticky-heading">Satisfied Properties</h3>

{#if assignment_level.value === 'all'}
<p class="hint">Assigned properties</p>
<PropertyList
properties={satisfied_properties.filter((p) => !p.is_deduced)}
{type}
no_bullets={true}
/>

<p class="hint">Deduced properties</p>
<PropertyList
properties={satisfied_properties.filter((p) => p.is_deduced)}
{type}
no_bullets={true}
/>
{:else if assignment_level.value === 'merged'}
<PropertyList properties={satisfied_properties} {type} no_bullets={true} />
{:else if assignment_level.value === 'basic'}
<p class="hint">Assigned properties; further properties can be deduced.</p>
<PropertyList
properties={satisfied_properties.filter((p) => !p.is_deduced)}
{type}
no_bullets={true}
/>
{/if}
<p class="hint">Assigned properties</p>
<PropertyList
properties={satisfied_properties.filter((p) => !p.is_deduced)}
{type}
no_bullets={true}
/>

<p class="hint">Deduced properties</p>
<PropertyList
properties={satisfied_properties.filter((p) => p.is_deduced)}
{type}
no_bullets={true}
/>
</section>

<section>
<h3 class="sticky-heading">Unsatisfied Properties</h3>

{#if assignment_level.value === 'all'}
<p class="hint">Assigned properties</p>
<PropertyList
properties={unsatisfied_properties.filter((p) => !p.is_deduced)}
{type}
no_bullets={true}
/>

<p class="hint">Deduced properties*</p>
<PropertyList
properties={unsatisfied_properties.filter((p) => p.is_deduced)}
{type}
no_bullets={true}
/>

<p class="hint">*This also uses the deduced satisfied properties.</p>
{:else if assignment_level.value === 'merged'}
<PropertyList properties={unsatisfied_properties} {type} no_bullets={true} />
{:else if assignment_level.value === 'basic'}
<p class="hint">Assigned properties; further properties can be deduced.</p>
<PropertyList
properties={unsatisfied_properties.filter((p) => !p.is_deduced)}
{type}
no_bullets={true}
/>
{/if}
<p class="hint">Assigned properties</p>
<PropertyList
properties={unsatisfied_properties.filter((p) => !p.is_deduced)}
{type}
no_bullets={true}
/>

<p class="hint">Deduced properties*</p>
<PropertyList
properties={unsatisfied_properties.filter((p) => p.is_deduced)}
{type}
no_bullets={true}
/>

<p class="hint">*This also uses the deduced satisfied properties.</p>
</section>
</div>

Expand Down
33 changes: 0 additions & 33 deletions src/lib/states/assignment_level.svelte.ts

This file was deleted.

50 changes: 0 additions & 50 deletions src/routes/settings/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
<script lang="ts">
import { faCheckCircle } from '@fortawesome/free-solid-svg-icons'
import Fa from 'svelte-fa'

import Chip from '$components/Chip.svelte'
import ChipGroup from '$components/ChipGroup.svelte'
import {
assignment_level,
ASSIGNMENT_LEVELS,
update_assignment_level
} from '$lib/states/assignment_level.svelte'
import { theme, THEMES, update_theme } from '$lib/states/theme.svelte'
import MetaData from '$components/MetaData.svelte'
import { set_tracking, tracking } from '$lib/states/tracking.svelte'
import { PUBLIC_ADMIN_URL } from '$env/static/public'

$effect(() => update_theme(theme.value))
$effect(() => update_assignment_level(assignment_level.value))
$effect(() => set_tracking(tracking.allow))

async function record_assignment_level_update() {
await fetch(`${PUBLIC_ADMIN_URL}/api/user_action`, {
method: 'POST',
body: JSON.stringify({
action: 'update_assignment_level',
value: assignment_level.value
}),
headers: { 'Content-Type': 'application/json' }
})
}
</script>

<MetaData title="Settings" description="Customize the appearance of CatDat" />
Expand Down Expand Up @@ -60,37 +41,6 @@
</ChipGroup>
</section>

<section>
<h3>Assignment Level</h3>

<ChipGroup>
{#each Object.keys(ASSIGNMENT_LEVELS) as level}
{@const selected = assignment_level.value === level}
<label class:selected>
<input
class="visually-hidden"
type="radio"
name="assignment-level"
value={level}
bind:group={assignment_level.value}
onchange={record_assignment_level_update}
/>
<Chip>
{level}
{#if selected}
&nbsp;
<Fa icon={faCheckCircle} />
{/if}
</Chip>
</label>
{/each}
</ChipGroup>

<p class="hint" aria-live="polite">
{ASSIGNMENT_LEVELS[assignment_level.value]}
</p>
</section>

<section>
<h3>Track visits</h3>
<p class="hint">
Expand Down