mirror of
https://github.com/coracle-social/coracle.git
synced 2024-10-06 11:43:30 +00:00
Clean up pull request
This commit is contained in:
parent
6c41ee8cd8
commit
ba7caf1d7c
@ -246,11 +246,11 @@
|
||||
{:else if $modal.type === 'login/connect'}
|
||||
<ConnectUser />
|
||||
{:else if $modal.type === 'person/settings'}
|
||||
<PersonSettings />
|
||||
<PersonSettings person={$modal.person} />
|
||||
{:else if $modal.type === 'person/info'}
|
||||
<PersonProfileInfo />
|
||||
<PersonProfileInfo person={$modal.person} />
|
||||
{:else if $modal.type === 'person/share'}
|
||||
<PersonShare />
|
||||
<PersonShare person={$modal.person} />
|
||||
{:else if $modal.type === 'person/list'}
|
||||
<PersonList pubkeys={$modal.pubkeys} />
|
||||
{:else if $modal.type === 'message'}
|
||||
|
@ -8,7 +8,7 @@
|
||||
{#if $toast}
|
||||
{#key 'key'}
|
||||
<div
|
||||
class="fixed top-0 left-0 right-0 z-20 pointer-events-none flex justify-center"
|
||||
class="fixed top-0 left-0 right-0 z-30 pointer-events-none flex justify-center"
|
||||
transition:fly={{y: -50, duration: 300}}>
|
||||
<div
|
||||
class={cx(
|
||||
|
@ -169,7 +169,7 @@
|
||||
<div on:click|stopPropagation={toggleActions} class="px-5 py-2 cursor-pointer">
|
||||
<i class="fa fa-xl fa-ellipsis-vertical" />
|
||||
</div>
|
||||
<div class="absolute top-0 right-0 mt-12 flex flex-col gap-2 opacity-90">
|
||||
<div class="absolute top-0 right-0 mt-12 flex flex-col gap-2 opacity-90 z-10">
|
||||
<div
|
||||
class="absolute inset-0 bg-black rounded-full"
|
||||
class:hidden={!showActions}
|
||||
|
@ -1,48 +1,33 @@
|
||||
<script lang="ts">
|
||||
import cx from "classnames"
|
||||
import {nip05, nip19} from "nostr-tools"
|
||||
import {last} from "ramda"
|
||||
import {toast} from "src/app/ui"
|
||||
import Anchor from "src/partials/Anchor.svelte"
|
||||
import Content from "src/partials/Content.svelte"
|
||||
import Spinner from "src/partials/Spinner.svelte"
|
||||
import RelayCard from "src/views/relays/RelayCard.svelte"
|
||||
import {copyToClipboard} from "src/util/html"
|
||||
import {warn} from "src/util/logger"
|
||||
import {stringToColor} from "src/util/misc"
|
||||
import {onMount} from "svelte"
|
||||
import {fly} from "svelte/transition"
|
||||
import {modal} from "src/app/ui"
|
||||
import Button from "src/partials/Button.svelte"
|
||||
|
||||
export let person: Record<string, any> | undefined = undefined
|
||||
|
||||
// get from modal store, if not passed
|
||||
if (!person) {
|
||||
person = $modal.person
|
||||
}
|
||||
export let person
|
||||
|
||||
// local items
|
||||
let nip05ProfileData = null
|
||||
let nip05QueryEndpoint = null
|
||||
let nProfile = null
|
||||
let npub = person?.pubkey ? nip19.npubEncode(person?.pubkey) : null
|
||||
let npub = nip19.npubEncode(person.pubkey)
|
||||
|
||||
// local state
|
||||
let loaded = false
|
||||
|
||||
// controls whether nprofile is displayed.
|
||||
let displayNprofile = false
|
||||
|
||||
onMount(() => {
|
||||
if (person && person.verified_as) {
|
||||
// get target URI
|
||||
nip05QueryEndpoint = getNip05QueryEndpoint(person.verified_as)
|
||||
// nip05QueryEndpoint = getNip05QueryURI(`NostrVerified.com`)
|
||||
|
||||
// calculate nProfile from NIP05 data, if available
|
||||
nProfile = nip19.nprofileEncode({
|
||||
pubkey: person.pubkey,
|
||||
relays: person?.relays,
|
||||
relays: person.relays,
|
||||
})
|
||||
|
||||
// fetch data
|
||||
@ -97,20 +82,18 @@
|
||||
|
||||
<div in:fly={{y: 20}}>
|
||||
<Content>
|
||||
<h1 class="text-3xl">Profile Details</h1>
|
||||
|
||||
<div class="">
|
||||
<h1 class="staatliches text-2xl">Profile Details</h1>
|
||||
<div>
|
||||
<div class="text-lg mb-1">Public Key (Hex)</div>
|
||||
<div class="text-sm font-mono">
|
||||
<button
|
||||
class="fa-solid fa-copy cursor-pointer"
|
||||
on:click={() => copy(person?.pubkey)}
|
||||
on:click={() => copy(person.pubkey)}
|
||||
/>
|
||||
{person?.pubkey || "?"}
|
||||
{person.pubkey}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<div>
|
||||
<div class="text-lg mb-1">Public Key (npub)</div>
|
||||
<div class="text-sm font-mono">
|
||||
{#if npub}
|
||||
@ -119,33 +102,24 @@
|
||||
on:click={() => copy(npub)}
|
||||
/>
|
||||
{/if}
|
||||
{person?.pubkey ? nip19.npubEncode(person?.pubkey) : "?"}
|
||||
{npub}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if displayNprofile}
|
||||
<div class="">
|
||||
<div class="text-lg mb-1">nprofile</div>
|
||||
<div class="text-sm font-mono" style="overflow-wrap: anywhere;">
|
||||
{#if nProfile}
|
||||
<button
|
||||
class="fa-solid fa-copy cursor-pointer inline"
|
||||
on:click={() => copy(nProfile)}
|
||||
/>
|
||||
{/if}
|
||||
{nProfile || "?"}
|
||||
</div>
|
||||
{#if nProfile}
|
||||
<div>
|
||||
<div class="text-lg mb-1">nprofile</div>
|
||||
<div class="text-sm font-mono break-all">
|
||||
<button
|
||||
class="fa-solid fa-copy cursor-pointer inline"
|
||||
on:click={() => copy(nProfile)}
|
||||
/>
|
||||
{nProfile}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !loaded}
|
||||
<Spinner delay={10} />
|
||||
{/if}
|
||||
|
||||
<h1 class="text-3xl">NIP05</h1>
|
||||
|
||||
<h1 class="staatliches text-2xl mt-4">NIP05</h1>
|
||||
{#if loaded && person.verified_as}
|
||||
<div class="">
|
||||
<div>
|
||||
<div class="text-lg mb-1">NIP05 Identifier</div>
|
||||
<div class="text-sm font-mono">
|
||||
{#if person.verified_as}
|
||||
@ -158,7 +132,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<div>
|
||||
<div class="text-lg mb-1">NIP05 Validation Endpoint</div>
|
||||
<div class="text-sm font-mono">
|
||||
{#if nip05QueryEndpoint}
|
||||
@ -173,39 +147,16 @@
|
||||
</div>
|
||||
|
||||
{#if nip05ProfileData}
|
||||
<div class="">
|
||||
<div>
|
||||
<div class="text-lg mb-2">NIP05 Relay Configuration</div>
|
||||
{#if nip05ProfileData?.relays?.length}
|
||||
<p class="text-sm mb-4 text-light">
|
||||
<i class="fa-solid fa-info-circle" />
|
||||
These relays are advertised by the NIP05 identifier's validation endpoint.
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
{#each nip05ProfileData?.relays as r}
|
||||
<div class="text-sm font-mono">
|
||||
<div
|
||||
class={cx(
|
||||
`bg-dark`,
|
||||
"rounded border border-l-2 border-solid border-medium shadow flex flex-col justify-between gap-3 py-3 px-6"
|
||||
)}
|
||||
style={`border-left-color: ${stringToColor(r)}`}
|
||||
in:fly={{y: 20}}
|
||||
>
|
||||
<div class="flex gap-2 items-center justify-between">
|
||||
<div class="flex gap-2 items-center text-xl">
|
||||
<i
|
||||
class={r.startsWith("wss")
|
||||
? "fa fa-lock"
|
||||
: "fa fa-unlock"}
|
||||
/>
|
||||
<Anchor type="unstyled" href={`/relays/${btoa(r)}`}>
|
||||
{last(r.split("://"))}
|
||||
</Anchor>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{#each nip05ProfileData?.relays as url}
|
||||
<RelayCard relay={{url}} />
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
@ -227,19 +178,5 @@
|
||||
NIP05 identifier not available.
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{#if person?.pubkey}
|
||||
<h1 class="text-3xl">Relays</h1>
|
||||
|
||||
<p class="text-sm mb-4 text-light">
|
||||
<i class="fa-solid fa-info-circle" />
|
||||
See <Anchor href="/people/{nip19.npubEncode(person?.pubkey)}/relays"
|
||||
>relays</Anchor
|
||||
>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<Button type="button" class="text-center" on:click={()=>{history.back()}}>Close</Button>
|
||||
|
||||
</Content>
|
||||
</div>
|
||||
|
@ -8,12 +8,13 @@
|
||||
import user from 'src/agent/user'
|
||||
import {getUserWriteRelays} from 'src/agent/relays'
|
||||
import cmd from 'src/agent/cmd'
|
||||
import {modal} from 'src/app/ui'
|
||||
import {publishWithToast} from 'src/app'
|
||||
|
||||
export let person
|
||||
|
||||
const muffle = user.getProfile().muffle || []
|
||||
const muffleOptions = ['Never', 'Sometimes', 'Often', 'Always']
|
||||
const muffleValue = parseFloat(first(muffle.filter(t => t[1] === $modal.person.pubkey).map(last)) || 1)
|
||||
const muffleValue = parseFloat(first(muffle.filter(t => t[1] === person.pubkey).map(last)) || 1)
|
||||
|
||||
const values = {
|
||||
// Scale up to integers for each choice we have
|
||||
@ -26,8 +27,8 @@
|
||||
// Scale back down to a decimal based on string value
|
||||
const muffleValue = muffleOptions.indexOf(values.muffle) / 3
|
||||
const muffleTags = muffle
|
||||
.filter(t => t[1] !== $modal.person.pubkey)
|
||||
.concat([["p", $modal.person.pubkey, muffleValue.toString()]])
|
||||
.filter(t => t[1] !== person.pubkey)
|
||||
.concat([["p", person.pubkey, muffleValue.toString()]])
|
||||
.filter(t => last(t) !== "1")
|
||||
|
||||
publishWithToast(getUserWriteRelays(), cmd.muffle(muffleTags))
|
||||
|
@ -7,9 +7,11 @@
|
||||
import Content from 'src/partials/Content.svelte'
|
||||
import Input from 'src/partials/Input.svelte'
|
||||
import {getPubkeyWriteRelays} from 'src/agent/relays'
|
||||
import {modal, toast} from 'src/app/ui'
|
||||
import {toast} from 'src/app/ui'
|
||||
|
||||
const {pubkey} = $modal.person
|
||||
export let person
|
||||
|
||||
const {pubkey} = person
|
||||
const relays = [prop('url', getPubkeyWriteRelays(pubkey))]
|
||||
const nprofile = nip19.nprofileEncode({pubkey, relays})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user