Allow custom kinds in filters, fix link underline

This commit is contained in:
Jon Staab 2024-08-16 08:35:48 -07:00
parent 7fc5ed4695
commit 2f56c7b95b
11 changed files with 28 additions and 11 deletions

View File

@ -33,6 +33,10 @@
const onKindsChange = kinds => onChange([FeedType.Kind, ...kinds])
const termToItem = (s: string) => parseInt(s)
const termIsValid = (s: string) => !isNaN(parseInt(s))
const helper = new KindSearch([
{label: "Note", kind: NOTE},
{label: "Profile", kind: PROFILE},
@ -61,6 +65,12 @@
</script>
<span class="staatliches text-lg">What kind of content do you want to see?</span>
<SearchSelect multiple search={helper.searchValues} value={feed.slice(1)} onChange={onKindsChange}>
<SearchSelect
multiple
search={helper.searchValues}
value={feed.slice(1)}
onChange={onKindsChange}
{termToItem}
{termIsValid}>
<div slot="item" let:item>{helper.displayValue(item)}</div>
</SearchSelect>

View File

@ -277,13 +277,13 @@
{#if showReply}
<small class="text-neutral-100">
<i class="fa fa-code-merge" />
<Anchor class="underline" on:click={goToParent}>View Parent</Anchor>
<Anchor underline on:click={goToParent}>View Parent</Anchor>
</small>
{/if}
{#if showRoot}
<small class="text-neutral-100">
<i class="fa fa-code-pull-request" />
<Anchor class="underline" on:click={goToThread}>View Thread</Anchor>
<Anchor underline on:click={goToThread}>View Thread</Anchor>
</small>
{/if}
</div>

View File

@ -22,6 +22,7 @@
{#if url.match(coracleRegexp)}
<Anchor
modal
underline
stopPropagation
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
href={url.replace(coracleRegexp, '')}>
@ -32,6 +33,7 @@
{:else if isShareableRelayUrl(url)}
<Anchor
modal
underline
stopPropagation
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
href={router.at("relays").of(url).toString()}>
@ -40,6 +42,7 @@
{:else}
<Anchor
modal
underline
stopPropagation
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
externalHref={url}

View File

@ -83,7 +83,7 @@
{#if muted}
<p class="mb-1 py-24 text-center text-neutral-600">
You have hidden this note.
<Anchor class="underline" stopPropagation on:click={unmute}>Show</Anchor>
<Anchor underline stopPropagation on:click={unmute}>Show</Anchor>
</p>
{:else}
{#if !isGroup}

View File

@ -38,7 +38,7 @@
<div class="mb-4 flex items-center gap-2 border-l-2 border-solid border-neutral-600 pl-2">
Rated
{#if href}
<Anchor modal class="underline" {href}>{display}</Anchor>
<Anchor modal underline {href}>{display}</Anchor>
{:else}
{display}
{/if}

View File

@ -5,6 +5,6 @@
export let value
</script>
<Anchor modal class="underline" href={router.at("topics").of(value).toString()}>
<Anchor modal underline href={router.at("topics").of(value).toString()}>
#{value}
</Anchor>

View File

@ -25,7 +25,7 @@
<div class="py-16 text-center">
<p class="text-xl">Don't have an account?</p>
<p>
Click <Anchor class="underline" on:click={showLogin}>here</Anchor> to join the nostr network.
Click <Anchor underline on:click={showLogin}>here</Anchor> to join the nostr network.
</p>
</div>
{/if}

View File

@ -54,7 +54,7 @@
<p>
Give people a friendly way to recognize you. We recommend you do not use your real name or
share your personal information. The future of the internet is
<Anchor class="underline" external href={pseudUrl}>pseudonymous</Anchor>.
<Anchor underline external href={pseudUrl}>pseudonymous</Anchor>.
</p>
</div>
<div class="flex w-full flex-col gap-8">
@ -69,7 +69,7 @@
<i slot="before" class="fa-solid fa-user-check" />
</Input>
<div slot="info">
Enter a <Anchor class="underline" external href={nip05Url}>NIP-05</Anchor> address to verify
Enter a <Anchor underline external href={nip05Url}>NIP-05</Anchor> address to verify
your public key.
</div>
</Field>
@ -78,7 +78,7 @@
<i slot="before" class="fa-solid fa-bolt" />
</Input>
<div slot="info">
Enter a <Anchor class="underline" external href={lud16Url}>lightning address</Anchor> to enable
Enter a <Anchor underline external href={lud16Url}>lightning address</Anchor> to enable
sending and receiving bitcoin tips.
</div>
</Field>

View File

@ -33,6 +33,7 @@
$: className = cx($$props.class, "transition-all cursor-pointer", {
underline: underline,
'!no-underline': !underline,
"opacity-50 pointer-events-none": loading || disabled,
"bg-white text-black hover:bg-white-l": button && !accent && !low,
"text-base bg-tinted-700 text-tinted-200 hover:bg-tinted-600 border border-solid border-tinted-600":

View File

@ -14,6 +14,7 @@
export let delimiters = []
export let search = null
export let termToItem = null
export let termIsValid = null
export let getKey: (x: any) => any = identity
export let displayItem = getKey
export let autofocus = false
@ -158,6 +159,7 @@
<Suggestions
bind:this={suggestions}
create={termToItem ? create : null}
{termIsValid}
{loading}
{select}
{term}

View File

@ -5,6 +5,7 @@
export let select
export let term = null
export let create = null
export let termIsValid = null
export let loading = false
export let getKey = identity
@ -41,7 +42,7 @@
<div
transition:slide|local={{duration: 100}}
class="mt-2 flex max-h-[350px] flex-col overflow-y-auto overflow-x-hidden border border-solid border-neutral-600">
{#if create && term}
{#if create && term && (!termIsValid || termIsValid(term))}
{@const i = data.length}
<button
class="flex cursor-pointer items-center gap-1 border-l-2 border-solid px-4 py-2 text-left text-neutral-100 hover:border-accent hover:bg-tinted-700"