|
| 1 | +<script lang="ts"> |
| 2 | + import MetaData from '$components/MetaData.svelte' |
| 3 | + import PropertyList from '$components/PropertyList.svelte' |
| 4 | + import { category_detail_level } from '$lib/states/detail_level.svelte' |
| 5 | + let { data } = $props() |
| 6 | +
|
| 7 | + let functor = $derived(data.functor) |
| 8 | +</script> |
| 9 | + |
| 10 | +<MetaData title={functor.name} description="Discover the properties of this functor" /> |
| 11 | + |
| 12 | +<h2>{functor.name}</h2> |
| 13 | + |
| 14 | +<section aria-label="main info" class="main"> |
| 15 | + <ul class="with-margins"> |
| 16 | + <li> |
| 17 | + <strong>Source:</strong> |
| 18 | + <a href="/category/{functor.source}">{functor.source_name}</a> |
| 19 | + </li> |
| 20 | + |
| 21 | + <li> |
| 22 | + <strong>Target:</strong> |
| 23 | + <a href="/category/{functor.target}">{functor.target_name}</a> |
| 24 | + </li> |
| 25 | + |
| 26 | + {#if functor.url} |
| 27 | + <li> |
| 28 | + <strong>URL:</strong> |
| 29 | + <a href={functor.url}>Link</a> |
| 30 | + </li> |
| 31 | + {/if} |
| 32 | + </ul> |
| 33 | + |
| 34 | + <p>{@html functor.description}</p> |
| 35 | +</section> |
| 36 | + |
| 37 | +<!-- TODO: remove code duplication with category detail page --> |
| 38 | +{#key functor.id} |
| 39 | + <div class="two-columns"> |
| 40 | + <section> |
| 41 | + <h3>Satisfied Properties</h3> |
| 42 | + |
| 43 | + {#if category_detail_level.value === 'all'} |
| 44 | + <PropertyList |
| 45 | + properties={data.satisfied_properties.filter((p) => !p.is_deduced)} |
| 46 | + description="Properties from the database" |
| 47 | + type="functor" |
| 48 | + /> |
| 49 | + |
| 50 | + <PropertyList |
| 51 | + properties={data.satisfied_properties.filter((p) => p.is_deduced)} |
| 52 | + description="Deduced properties" |
| 53 | + type="functor" |
| 54 | + /> |
| 55 | + {:else if category_detail_level.value === 'merged'} |
| 56 | + <PropertyList properties={data.satisfied_properties} type="functor" /> |
| 57 | + {:else if category_detail_level.value === 'basic'} |
| 58 | + <PropertyList |
| 59 | + properties={data.satisfied_properties.filter((p) => !p.is_deduced)} |
| 60 | + description="Properties from the database; further properties can be deduced." |
| 61 | + type="functor" |
| 62 | + /> |
| 63 | + {/if} |
| 64 | + </section> |
| 65 | + |
| 66 | + <section> |
| 67 | + <h3>Unsatisfied Properties</h3> |
| 68 | + |
| 69 | + {#if category_detail_level.value === 'all'} |
| 70 | + <PropertyList |
| 71 | + properties={data.unsatisfied_properties.filter((p) => !p.is_deduced)} |
| 72 | + description="Properties from the database" |
| 73 | + type="functor" |
| 74 | + /> |
| 75 | + |
| 76 | + <PropertyList |
| 77 | + properties={data.unsatisfied_properties.filter((p) => p.is_deduced)} |
| 78 | + description="Deduced properties*" |
| 79 | + type="functor" |
| 80 | + /> |
| 81 | + |
| 82 | + <p class="hint">*This also uses the deduced satisfied properties.</p> |
| 83 | + {:else if category_detail_level.value === 'merged'} |
| 84 | + <PropertyList properties={data.unsatisfied_properties} type="functor" /> |
| 85 | + {:else if category_detail_level.value === 'basic'} |
| 86 | + <PropertyList |
| 87 | + properties={data.unsatisfied_properties.filter((p) => !p.is_deduced)} |
| 88 | + description="Properties from the database; further properties can be deduced." |
| 89 | + type="functor" |
| 90 | + /> |
| 91 | + {/if} |
| 92 | + </section> |
| 93 | + </div> |
| 94 | + |
| 95 | + <section> |
| 96 | + <h3>Unknown properties</h3> |
| 97 | + |
| 98 | + <PropertyList |
| 99 | + properties={data.unknown_properties} |
| 100 | + description={data.unknown_properties.length |
| 101 | + ? "For these properties the database currently doesn't have an answer if they are satisfied or not. Please help to complete the data!" |
| 102 | + : undefined} |
| 103 | + /> |
| 104 | + </section> |
| 105 | +{/key} |
| 106 | + |
| 107 | +<style> |
| 108 | + .main { |
| 109 | + margin-top: 1.5rem; |
| 110 | + } |
| 111 | +
|
| 112 | + @media (min-width: 720px) { |
| 113 | + .two-columns { |
| 114 | + display: grid; |
| 115 | + grid-template-columns: 1fr 1fr; |
| 116 | + gap: 0.5rem; |
| 117 | + } |
| 118 | + } |
| 119 | +
|
| 120 | + ul.with-margins li + li { |
| 121 | + margin-top: 0.25rem; |
| 122 | + } |
| 123 | +</style> |
0 commit comments