Compare commits

...

3 Commits

Author SHA1 Message Date
Tomáš Mládek e06d2bccfe style(webui): add icons to Inspect sections
ci/woodpecker/push/woodpecker Pipeline was successful Details
2024-04-12 15:40:41 +02:00
Tomáš Mládek 9f61581ba7 style(webui): add icons to InspectTypeEditor 2024-04-12 15:29:32 +02:00
Tomáš Mládek bc74fbfff6 style(webui): fix key alignment in UpObject 2024-04-12 15:27:30 +02:00
7 changed files with 32 additions and 7 deletions

View File

@ -6,6 +6,7 @@
import LabelBorder from './utils/LabelBorder.svelte';
import { createEventDispatcher } from 'svelte';
import { type Address } from '@upnd/upend/types';
import Icon from '$lib/components/utils/Icon.svelte';
const dispatch = createEventDispatcher<{
highlighted: string | undefined;
add: Address;
@ -16,6 +17,7 @@
export let hide = false;
export let header = '';
export let icon: string | null = null;
export let confirmRemoveMessage: string | null = $i18n.t('Are you sure you want to remove this?');
export let emptyMessage = $i18n.t('Nothing to show.');
@ -39,7 +41,10 @@
</script>
<LabelBorder {hide}>
<span slot="header">{header}</span>
<span slot="header"
>{#if icon}<Icon plain name={icon} />
{/if}{header}</span
>
{#if adding}
<div class="selector">

View File

@ -90,14 +90,14 @@
{#if group}
{#if icon}
<div class="icon">
<Icon name={icon} />
<Icon plain name={icon} />
</div>
{/if}
<UpObject link address={group} labels={title ? [title] : undefined} />
{:else}
{#if icon}
<div class="icon">
<Icon name={icon} />
<Icon plain name={icon} />
</div>
{/if}
{title || ''}

View File

@ -22,6 +22,7 @@
import { debug } from 'debug';
import { Any } from '@upnd/upend/query';
import { isDefined } from '$lib/util/werk';
import Icon from '$lib/components/utils/Icon.svelte';
const dbg = debug('kestrel:Inspect');
const dispatch = createEventDispatcher<{
@ -443,6 +444,7 @@
{#if currentUntypedProperties.length > 0}
<EntryView
title={$i18n.t('Other Properties') || ''}
icon="shape-triangle"
widgets={attributeWidgets}
entries={currentUntypedProperties}
on:change={onChange}
@ -453,6 +455,7 @@
{#if currentUntypedLinks.length > 0}
<EntryView
title={$i18n.t('Links') || ''}
icon="right-arrow-circle"
widgets={linkWidgets}
entries={currentUntypedLinks}
on:change={onChange}
@ -463,6 +466,7 @@
{#if !correctlyTagged || !incorrectlyTagged}
<EntryView
title={`${$i18n.t('Members')}`}
icon="link"
widgets={taggedWidgets}
entries={tagged}
on:change={onChange}
@ -471,6 +475,7 @@
{:else}
<EntryView
title={`${$i18n.t('Typed Members')} (${correctlyTagged.length})`}
icon="link"
widgets={taggedWidgets}
entries={tagged.filter((e) => correctlyTagged?.includes(e.entity))}
on:change={onChange}
@ -478,6 +483,7 @@
/>
<EntryView
title={`${$i18n.t('Untyped members')} (${incorrectlyTagged.length})`}
icon="unlink"
widgets={taggedWidgets}
entries={tagged.filter((e) => incorrectlyTagged?.includes(e.entity))}
on:change={onChange}
@ -488,6 +494,7 @@
{#if currentBacklinks.length > 0}
<EntryView
title={`${$i18n.t('Referred to')} (${currentBacklinks.length})`}
icon="left-arrow-circle"
entries={currentBacklinks}
on:change={onChange}
{address}
@ -496,7 +503,10 @@
{#if $entityInfo?.t === 'Attribute'}
<LabelBorder>
<span slot="header">{$i18n.t('Used')} ({attributesUsed.length})</span>
<span slot="header">
<Icon plain name="color" />
{$i18n.t('Used')} ({attributesUsed.length})
</span>
<EntryList columns="entity,value" entries={attributesUsed} orderByValue />
</LabelBorder>
{/if}

View File

@ -39,6 +39,7 @@
<EntitySetEditor
entities={Object.keys(groups)}
header={$i18n.t('Groups') || ''}
icon="link-alt"
hide={Object.keys(groups).length === 0}
on:add={(e) => addGroup(e.detail)}
on:remove={(e) => removeGroup(e.detail)}

View File

@ -10,6 +10,8 @@
import { ATTR_OF } from '@upnd/upend/constants';
import { createEventDispatcher } from 'svelte';
import LabelBorder from './utils/LabelBorder.svelte';
import Icon from '$lib/components/utils/Icon.svelte';
const dispatch = createEventDispatcher();
export let entity: Readable<UpObject | undefined>;
@ -21,6 +23,7 @@
let types: Array<{ address: string; entry: UpEntry; required: UpEntry | undefined }> = [];
$: updateTypes($entity?.attr[`~${ATTR_OF}`] || []);
async function updateTypes(entries: UpEntry[]) {
types = [];
const query = await api.query(
@ -98,7 +101,7 @@
{#if types.length || $entity?.attr['~IN']?.length}
<LabelBorder hide={types.length === 0}>
<span slot="header">{$i18n.t('Type Attributes')}</span>
<span slot="header"><Icon plain name="list-check" /> {$i18n.t('Type Attributes')}</span>
{#if adding}
<div class="selector">
<Selector
@ -122,7 +125,11 @@
class:required={type.required}
on:click={() => setRequired(type.entry, !type.required)}
>
{type.required ? $i18n.t('Required') : $i18n.t('Optional')}
{#if type.required}
<Icon plain name="lock" /> {$i18n.t('Required')}
{:else}
<Icon plain name="lock-open" /> {$i18n.t('Optional')}
{/if}
</button>
<div class="controls">
<IconButton name="x-circle" on:click={() => remove(type.entry)} />

View File

@ -352,6 +352,7 @@
&:not(.banner) .key {
display: inline-block;
margin-left: 0.5em;
}
&.show-type .secondary,

View File

@ -6,6 +6,7 @@
import LabelBorder from './LabelBorder.svelte';
import { i18n } from '$lib/i18n';
import { format } from 'date-fns';
import Icon from '$lib/components/utils/Icon.svelte';
const dispatch = createEventDispatcher<{ change: WidgetChange }>();
export let address: string;
@ -34,7 +35,7 @@
</script>
<LabelBorder hide={!notes?.length}>
<span slot="header">Notes</span>
<span slot="header"><Icon plain name="note" /> {$i18n.t('Notes')}</span>
<div class="notes" contenteditable on:input={onInput} bind:this={contentEl}>
{#each (notes || '\n').split('\n') as line, idx}
{#if idx > 0}<br />{/if}