Fix anchor styling

This commit is contained in:
Jonathan Staab 2023-06-28 13:33:54 -07:00
parent 48dab22d9c
commit 0a15170757
31 changed files with 77 additions and 62 deletions

View File

@ -1,5 +1,13 @@
# Changelog # Changelog
# 0.2.34
- [x] Fix mentions on Safari
- [x] Fix quoted 30023 events
- [x] Fix Safari performance issues
- [x] Small note display bugfixes
- [x] Fix inability to publish on first signup
# 0.2.33 # 0.2.33
- [x] Add rendering support for kind 1985 (labels and reviews) - [x] Add rendering support for kind 1985 (labels and reviews)

View File

@ -6,7 +6,6 @@ import {
without, without,
reject, reject,
prop, prop,
find,
pipe, pipe,
assoc, assoc,
whereEq, whereEq,
@ -53,10 +52,7 @@ const relays = derived(profile, p =>
const mutes = derived(profile, prop("mutes")) as Readable<Array<[string, string]>> const mutes = derived(profile, prop("mutes")) as Readable<Array<[string, string]>>
const lists = derived(profile, prop("lists")) as Readable<Array<MyEvent>> const lists = derived(profile, prop("lists")) as Readable<Array<MyEvent>>
const canPublish = derived( const canPublish = derived([keys.pubkey], ([$pubkey]) => keys.canSign())
[keys.pubkey, relays],
([$pubkey, $relays]) => keys.canSign() && find(prop("write"), $relays)
)
// Keep a copy so we can avoid calling `get` all the time // Keep a copy so we can avoid calling `get` all the time

View File

@ -151,13 +151,13 @@
{#if findReplyId(note) && showParent} {#if findReplyId(note) && showParent}
<small class="text-gray-1"> <small class="text-gray-1">
<i class="fa fa-code-merge" /> <i class="fa fa-code-merge" />
<Anchor on:click={goToParent}>View Parent</Anchor> <Anchor class="underline" on:click={goToParent}>View Parent</Anchor>
</small> </small>
{/if} {/if}
{#if findRootId(note) && findRootId(note) !== findReplyId(note) && showParent} {#if findRootId(note) && findRootId(note) !== findReplyId(note) && showParent}
<small class="text-gray-1"> <small class="text-gray-1">
<i class="fa fa-code-pull-request" /> <i class="fa fa-code-pull-request" />
<Anchor on:click={goToRoot}>View Thread</Anchor> <Anchor class="underline" on:click={goToRoot}>View Thread</Anchor>
</small> </small>
{/if} {/if}
</div> </div>

View File

@ -4,6 +4,6 @@
export let value export let value
</script> </script>
<Anchor killEvent href={"/" + value.entity}> <Anchor class="underline" killEvent href={"/" + value.entity}>
{value.entity.slice(0, 16) + "..."} {value.entity.slice(0, 16) + "..."}
</Anchor> </Anchor>

View File

@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import {isNil} from "ramda"
import {getLabelQuality} from "src/util/nostr" import {getLabelQuality} from "src/util/nostr"
import NoteContentRating from "src/app/shared/NoteContentRating.svelte" import NoteContentRating from "src/app/shared/NoteContentRating.svelte"
import NoteContentKind1 from "src/app/shared/NoteContentKind1.svelte" import NoteContentKind1 from "src/app/shared/NoteContentKind1.svelte"
@ -9,7 +10,7 @@
</script> </script>
<div class="flex flex-col gap-2 overflow-hidden text-ellipsis"> <div class="flex flex-col gap-2 overflow-hidden text-ellipsis">
{#if rating} {#if !isNil(rating)}
<NoteContentRating {note} {rating} /> <NoteContentRating {note} {rating} />
{/if} {/if}
<NoteContentKind1 {note} {anchorId} {maxLength} {showEntire} /> <NoteContentKind1 {note} {anchorId} {maxLength} {showEntire} />

View File

@ -18,7 +18,7 @@
<Media link={annotateMedia(value.url)} onClose={close} /> <Media link={annotateMedia(value.url)} onClose={close} />
</div> </div>
{:else} {:else}
<Anchor external href={value.url}> <Anchor class="underline" external href={value.url}>
{value.url.replace(/https?:\/\/(www\.)?/, "")} {value.url.replace(/https?:\/\/(www\.)?/, "")}
</Anchor> </Anchor>
{/if} {/if}

View File

@ -9,6 +9,6 @@
const openPerson = () => modal.push({type: "person/feed", pubkey: value.pubkey}) const openPerson = () => modal.push({type: "person/feed", pubkey: value.pubkey})
</script> </script>
@<Anchor killEvent on:click={openPerson}> @<Anchor class="underline" killEvent on:click={openPerson}>
{displayPerson(getPersonWithFallback(value.pubkey))} {displayPerson(getPersonWithFallback(value.pubkey))}
</Anchor> </Anchor>

View File

@ -59,7 +59,7 @@
{#if muted} {#if muted}
<p class="mb-1 py-24 text-center text-gray-5" in:fly={{y: 20}}> <p class="mb-1 py-24 text-center text-gray-5" in:fly={{y: 20}}>
You have muted this note. You have muted this note.
<Anchor on:click={unmute}>Show</Anchor> <Anchor class="underline" on:click={unmute}>Show</Anchor>
</p> </p>
{:else} {:else}
{@const person = getPersonWithFallback(quote.pubkey)} {@const person = getPersonWithFallback(quote.pubkey)}

View File

@ -29,7 +29,7 @@
<div class="mb-4 flex items-center gap-2 border-l-2 border-solid border-gray-5 pl-2"> <div class="mb-4 flex items-center gap-2 border-l-2 border-solid border-gray-5 pl-2">
Rated Rated
{#if action} {#if action}
<Anchor on:click={action}>{display}</Anchor> <Anchor class="underline" on:click={action}>{display}</Anchor>
{:else} {:else}
{display} {display}
{/if} {/if}

View File

@ -9,4 +9,4 @@
} }
</script> </script>
<Anchor killEvent on:click={() => openTopic(value)}>#{value}</Anchor> <Anchor class="underline" killEvent on:click={() => openTopic(value)}>#{value}</Anchor>

View File

@ -19,11 +19,11 @@
<br /> <br />
{/each} {/each}
{:else if type === "link"} {:else if type === "link"}
<Anchor external href={value.url}> <Anchor class="underline" external href={value.url}>
{value.url.replace(/https?:\/\/(www\.)?/, "")} {value.url.replace(/https?:\/\/(www\.)?/, "")}
</Anchor> </Anchor>
{:else if type.startsWith("nostr:")} {:else if type.startsWith("nostr:")}
<Anchor external href={"/" + value.entity}> <Anchor class="underline" external href={"/" + value.entity}>
{#if value.pubkey} {#if value.pubkey}
{displayPerson(getPersonWithFallback(value.pubkey))} {displayPerson(getPersonWithFallback(value.pubkey))}
{:else if value.id} {:else if value.id}

View File

@ -9,7 +9,7 @@
import {getPubkeyWriteRelays, sampleRelays} from "src/agent/relays" import {getPubkeyWriteRelays, sampleRelays} from "src/agent/relays"
import user from "src/agent/user" import user from "src/agent/user"
const {petnames} = user const {petnames, canPublish} = user
export let person export let person
export let hasPetname = null export let hasPetname = null
@ -45,12 +45,15 @@
</div> </div>
{/if} {/if}
</div> </div>
{#if isFollowing} {#if $canPublish}
<Anchor theme="button-accent" stopPropagation on:click={() => removePetname(person)}> {#if isFollowing}
Following <Anchor theme="button-accent" stopPropagation on:click={() => removePetname(person)}>
</Anchor> Following
{:else} </Anchor>
<Anchor theme="button" stopPropagation on:click={() => addPetname(person)}>Follow</Anchor> {:else}
<Anchor theme="button" stopPropagation on:click={() => addPetname(person)}
>Follow</Anchor>
{/if}
{/if} {/if}
</div> </div>
<p class="overflow-hidden text-ellipsis"> <p class="overflow-hidden text-ellipsis">

View File

@ -34,7 +34,7 @@
<div class="relative flex flex-col gap-4 py-2 px-3"> <div class="relative flex flex-col gap-4 py-2 px-3">
<div class="flex justify-between gap-2"> <div class="flex justify-between gap-2">
<Anchor theme="unstyled" href={routes.person($person.pubkey)} class="flex gap-4"> <Anchor href={routes.person($person.pubkey)} class="flex gap-4">
<PersonCircle size={14} person={$person} /> <PersonCircle size={14} person={$person} />
<div class="flex flex-grow flex-col gap-2"> <div class="flex flex-grow flex-col gap-2">
<h2 class="text-lg">{displayPerson($person)}</h2> <h2 class="text-lg">{displayPerson($person)}</h2>

View File

@ -63,7 +63,7 @@
<div class="flex items-center justify-between gap-2"> <div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2 text-xl"> <div class="flex items-center gap-2 text-xl">
<i class={relay.url.startsWith("ws://") ? "fa fa-unlock" : "fa fa-lock"} /> <i class={relay.url.startsWith("ws://") ? "fa fa-unlock" : "fa fa-lock"} />
<Anchor theme="unstyled" on:click={openModal}>{displayRelay(relay)}</Anchor> <Anchor on:click={openModal}>{displayRelay(relay)}</Anchor>
{#if showStatus} {#if showStatus}
<span <span
on:mouseout={() => { on:mouseout={() => {

View File

@ -47,7 +47,7 @@
<Channel {loadMessages} {listenForMessages} {sendMessage}> <Channel {loadMessages} {listenForMessages} {sendMessage}>
<div slot="header" class="flex items-start gap-4 p-4"> <div slot="header" class="flex items-start gap-4 p-4">
<div class="flex items-center gap-4"> <div class="flex items-center gap-4">
<Anchor theme="unstyled" class="fa fa-arrow-left cursor-pointer text-2xl" href="/chat" /> <Anchor class="fa fa-arrow-left cursor-pointer text-2xl" href="/chat" />
<div <div
class="h-12 w-12 shrink-0 overflow-hidden rounded-full border border-solid border-white bg-cover bg-center" class="h-12 w-12 shrink-0 overflow-hidden rounded-full border border-solid border-white bg-cover bg-center"
style="background-image: url({$room.picture})" /> style="background-image: url({$room.picture})" />

View File

@ -57,7 +57,7 @@
<Content size="lg" class="text-center"> <Content size="lg" class="text-center">
<p class="text-xl">Don't have an account?</p> <p class="text-xl">Don't have an account?</p>
<p> <p>
Click <Anchor href="/login">here</Anchor> to join the nostr network. Click <Anchor class="underline" href="/login">here</Anchor> to join the nostr network.
</p> </p>
</Content> </Content>
{/if} {/if}

View File

@ -48,7 +48,7 @@
<strong>{meta.d}</strong> <strong>{meta.d}</strong>
<ListSummary list={e} /> <ListSummary list={e} />
</div> </div>
<Anchor on:click={() => editList(e)}>Edit</Anchor> <Anchor class="underline" on:click={() => editList(e)}>Edit</Anchor>
</div> </div>
</div> </div>
{:else} {:else}

View File

@ -46,16 +46,17 @@
<p class="text-center"> <p class="text-center">
Click below to log in or create an account. Click below to log in or create an account.
{#if !Capacitor.isNativePlatform()} {#if !Capacitor.isNativePlatform()}
If you have a <Anchor href={nip07} external>compatible browser extension</Anchor> installed, If you have a <Anchor class="underline" href={nip07} external
we will use that. >compatible browser extension</Anchor> installed, we will use that.
{/if} {/if}
</p> </p>
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
<div class="flex gap-4"> <div class="flex gap-4">
<Anchor class="w-32 text-center" type="button-accent" on:click={autoLogIn}>Log In</Anchor> <Anchor class="w-32 text-center" theme="button-accent" on:click={autoLogIn}
<Anchor class="w-32 text-center" type="button" on:click={signUp}>Sign Up</Anchor> >Log In</Anchor>
<Anchor class="w-32 text-center" theme="button" on:click={signUp}>Sign Up</Anchor>
</div> </div>
<Anchor theme="unstyled" on:click={pubkeyLogIn}> <Anchor on:click={pubkeyLogIn}>
<i class="fa fa-cogs" /> Advanced Login <i class="fa fa-cogs" /> Advanced Login
</Anchor> </Anchor>
</div> </div>

View File

@ -150,8 +150,8 @@
<div class="my-12 text-center"> <div class="my-12 text-center">
We didn't have any luck finding your profile data - you'll need to select your relays We didn't have any luck finding your profile data - you'll need to select your relays
manually to continue. You can skip this step by clicking manually to continue. You can skip this step by clicking
<Anchor href="/relays">here</Anchor>, but be aware that any new relay selections will <Anchor class="underline" href="/relays">here</Anchor>, but be aware that any new relay
replace your old ones. selections will replace your old ones.
</div> </div>
{:else if modal === "custom"} {:else if modal === "custom"}
<div class="my-12 text-center"> <div class="my-12 text-center">

View File

@ -82,7 +82,7 @@
<div class="flex w-full flex-col gap-2"> <div class="flex w-full flex-col gap-2">
<div class="flex w-full items-center justify-between"> <div class="flex w-full items-center justify-between">
<div class="flex items-center gap-4"> <div class="flex items-center gap-4">
<Anchor theme="unstyled" href={routes.person(pubkey)} class="text-lg font-bold"> <Anchor href={routes.person(pubkey)} class="text-lg font-bold">
{displayPerson($person)} {displayPerson($person)}
</Anchor> </Anchor>
</div> </div>

View File

@ -2,7 +2,7 @@
import {onMount} from "svelte" import {onMount} from "svelte"
import {first, quantify} from "hurdak/lib/hurdak" import {first, quantify} from "hurdak/lib/hurdak"
import {displayPerson} from "src/util/nostr" import {displayPerson} from "src/util/nostr"
import {routes} from 'src/app/state' import {routes} from "src/app/state"
import Content from "src/partials/Content.svelte" import Content from "src/partials/Content.svelte"
import Anchor from "src/partials/Anchor.svelte" import Anchor from "src/partials/Anchor.svelte"
import NoteContent from "src/app/shared/NoteContent.svelte" import NoteContent from "src/app/shared/NoteContent.svelte"
@ -20,10 +20,12 @@
let loading = true let loading = true
onMount(async () => { onMount(async () => {
note = first(await network.load({ note = first(
relays: sampleRelays(relays), await network.load({
filter: {kinds: [kind], pubkey, '#d': [identifier]}, relays: sampleRelays(relays),
})) filter: {kinds: [kind], pubkey, "#d": [identifier]},
})
)
loading = false loading = false
}) })
@ -32,23 +34,26 @@
<Content size="lg"> <Content size="lg">
<p> <p>
This is a kind {kind} event called "{identifier}", published by This is a kind {kind} event called "{identifier}", published by
<Anchor href={routes.person(pubkey)}>@{displayPerson(getPersonWithFallback(pubkey))}</Anchor>. <Anchor class="underline" href={routes.person(pubkey)}
>@{displayPerson(getPersonWithFallback(pubkey))}</Anchor
>.
</p> </p>
{#if note?.content} {#if note?.content}
<NoteContent showEntire {note} /> <NoteContent showEntire {note} />
{/if} {/if}
{#if note?.tags.length > 1} {#if note?.tags.length > 1}
<p>This note has {quantify(note.tags.length - 1, 'tag')}:</p> <p>This note has {quantify(note.tags.length - 1, "tag")}:</p>
<ul class="list-disc list-inside"> <ul class="list-inside list-disc">
{#each note.tags as [type, value, ...rest]} {#each note.tags as [type, value, ...rest]}
{#if type !== "d"} {#if type !== "d"}
<li> <li>
{#if type === "p"} {#if type === "p"}
<Anchor href={routes.person(value)}>@{displayPerson(getPersonWithFallback(value))}</Anchor> <Anchor class="underline" href={routes.person(value)}
>@{displayPerson(getPersonWithFallback(value))}</Anchor>
{:else if type === "e"} {:else if type === "e"}
<Anchor href={value}>Event {value}</Anchor> <Anchor class="underline" href={value}>Event {value}</Anchor>
{:else} {:else}
{type}: {value} {rest.length > 0 ? rest.join(', ') : ""} {type}: {value} {rest.length > 0 ? rest.join(", ") : ""}
{/if} {/if}
</li> </li>
{/if} {/if}

View File

@ -112,7 +112,7 @@
<i slot="before" class="fa fa-bolt" /> <i slot="before" class="fa fa-bolt" />
<span slot="after" class="-mt-1">sats</span> <span slot="after" class="-mt-1">sats</span>
</Input> </Input>
<Anchor loading={zap.loading} type="button-accent" on:click={loadZapInvoice}>Zap!</Anchor> <Anchor loading={zap.loading} theme="button-accent" on:click={loadZapInvoice}>Zap!</Anchor>
</div> </div>
{/if} {/if}
</Content> </Content>

View File

@ -38,7 +38,7 @@
your follows list at any time. your follows list at any time.
</p> </p>
<Anchor <Anchor
type="button-accent" theme="button-accent"
on:click={() => modal.replace({type: "onboarding", stage: "note"})}> on:click={() => modal.replace({type: "onboarding", stage: "note"})}>
Continue Continue
</Anchor> </Anchor>

View File

@ -11,8 +11,8 @@
<Content size="lg" class="text-center"> <Content size="lg" class="text-center">
<Heading>Create an Account</Heading> <Heading>Create an Account</Heading>
<p> <p>
New to Nostr? Click <Anchor external href={tutorialUrl}>here</Anchor> or watch the video below for New to Nostr? Click <Anchor class="underline" external href={tutorialUrl}>here</Anchor> or watch
a crash course on what it is, and how to use it. the video below for a crash course on what it is, and how to use it.
</p> </p>
<video controls src={videoUrl} class="object-contain object-center" /> <video controls src={videoUrl} class="object-contain object-center" />
<p> <p>
@ -20,7 +20,7 @@
account. account.
</p> </p>
<Anchor <Anchor
type="button-accent" theme="button-accent"
on:click={() => modal.replace({type: "onboarding", stage: "profile"})}> on:click={() => modal.replace({type: "onboarding", stage: "profile"})}>
Let's go! Let's go!
</Anchor> </Anchor>

View File

@ -31,7 +31,7 @@
<button slot="after" class="fa fa-copy cursor-pointer" on:click={copyKey} /> <button slot="after" class="fa fa-copy cursor-pointer" on:click={copyKey} />
</Input> </Input>
<Anchor <Anchor
type="button-accent" theme="button-accent"
on:click={() => modal.replace({type: "onboarding", stage: nextStage})}> on:click={() => modal.replace({type: "onboarding", stage: nextStage})}>
Got it Got it
</Anchor> </Anchor>

View File

@ -31,7 +31,7 @@
</div> </div>
<Anchor theme="button-accent" class="flex-grow text-center" on:click={onSubmit} <Anchor theme="button-accent" class="flex-grow text-center" on:click={onSubmit}
>Say Hello!</Anchor> >Say Hello!</Anchor>
<Anchor theme="unstyled" class="text-center" on:click={skip}> <Anchor class="text-center" on:click={skip}>
Skip and see your feed <i class="fa fa-arrow-right" /> Skip and see your feed <i class="fa fa-arrow-right" />
</Anchor> </Anchor>
</Content> </Content>

View File

@ -38,7 +38,7 @@
</div> </div>
</div> </div>
<Anchor <Anchor
type="button-accent" theme="button-accent"
class="text-center" class="text-center"
on:click={() => modal.replace({type: "onboarding", stage: "key"})}> on:click={() => modal.replace({type: "onboarding", stage: "key"})}>
Continue Continue

View File

@ -34,7 +34,7 @@
</p> </p>
</div> </div>
<Anchor <Anchor
type="button-accent" theme="button-accent"
class="text-center" class="text-center"
on:click={() => modal.replace({type: "onboarding", stage: "follows"})}> on:click={() => modal.replace({type: "onboarding", stage: "follows"})}>
Continue Continue

View File

@ -46,7 +46,7 @@
<div class="flex items-start justify-between gap-4"> <div class="flex items-start justify-between gap-4">
<div class="flex flex-grow flex-col gap-2"> <div class="flex flex-grow flex-col gap-2">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<Anchor theme="unstyled" href={routes.person(pubkey)}> <Anchor href={routes.person(pubkey)}>
<h1 class="text-2xl"> <h1 class="text-2xl">
{displayPerson($person)} {displayPerson($person)}
</h1> </h1>

View File

@ -43,7 +43,7 @@
<p> <p>
Give people a friendly way to recognize you. We recommend you do not use your real name or 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 share your personal information. The future of the internet is
<Anchor external href={pseudUrl}>pseudonymous</Anchor>. <Anchor class="underline" external href={pseudUrl}>pseudonymous</Anchor>.
</p> </p>
</div> </div>
<div class="flex w-full flex-col gap-8"> <div class="flex w-full flex-col gap-8">
@ -63,7 +63,8 @@
<i slot="before" class="fa-solid fa-user-check" /> <i slot="before" class="fa-solid fa-user-check" />
</Input> </Input>
<p class="text-sm text-gray-1"> <p class="text-sm text-gray-1">
Enter a <Anchor external href={nip05Url}>NIP-05</Anchor> address to verify your public key. Enter a <Anchor class="underline" external href={nip05Url}>NIP-05</Anchor> address to verify
your public key.
</p> </p>
</div> </div>
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">
@ -72,8 +73,8 @@
<i slot="before" class="fa-solid fa-bolt" /> <i slot="before" class="fa-solid fa-bolt" />
</Input> </Input>
<p class="text-sm text-gray-1"> <p class="text-sm text-gray-1">
Enter a <Anchor external href={lud16Url}>LUD-16</Anchor> address to enable sending and receiving Enter a <Anchor class="underline" external href={lud16Url}>LUD-16</Anchor> address to enable
lightning tips (LUD-06 will also work). sending and receiving lightning tips (LUD-06 will also work).
</p> </p>
</div> </div>
<div class="flex flex-col gap-1"> <div class="flex flex-col gap-1">

View File

@ -9,7 +9,7 @@
export let killEvent = false export let killEvent = false
export let external = false export let external = false
export let loading = false export let loading = false
export let theme = "anchor" export let theme = "unstyled"
export let type = null export let type = null
export let href = null export let href = null
export let tag = "a" export let tag = "a"