feat: generate new account & profile editor
This commit is contained in:
@@ -6,10 +6,10 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue
|
||||
} from '@/components/ui/select'
|
||||
import { TMailboxRelay, TMailboxRelayScope } from '@/types'
|
||||
import { CircleX, Server } from 'lucide-react'
|
||||
import { useMemo } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { TMailboxRelay, TMailboxRelayScope } from './types'
|
||||
|
||||
export default function MailboxRelay({
|
||||
mailboxRelay,
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { useToast } from '@/hooks'
|
||||
import { createRelayListDraftEvent } from '@/lib/draft-event'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import dayjs from 'dayjs'
|
||||
import { TMailboxRelay } from '@/types'
|
||||
import { CloudUpload, Loader } from 'lucide-react'
|
||||
import { kinds } from 'nostr-tools'
|
||||
import { useState } from 'react'
|
||||
import { Button } from '../ui/button'
|
||||
import { TMailboxRelay } from './types'
|
||||
|
||||
export default function SaveButton({
|
||||
mailboxRelays,
|
||||
@@ -24,14 +23,7 @@ export default function SaveButton({
|
||||
if (!pubkey) return
|
||||
|
||||
setPushing(true)
|
||||
const event = {
|
||||
kind: kinds.RelayList,
|
||||
content: '',
|
||||
tags: mailboxRelays.map(({ url, scope }) =>
|
||||
scope === 'both' ? ['r', url] : ['r', url, scope]
|
||||
),
|
||||
created_at: dayjs().unix()
|
||||
}
|
||||
const event = createRelayListDraftEvent(mailboxRelays)
|
||||
const relayListEvent = await publish(event)
|
||||
updateRelayListEvent(relayListEvent)
|
||||
toast({
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { normalizeUrl } from '@/lib/url'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { TMailboxRelay, TMailboxRelayScope } from '@/types'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import MailboxRelay from './MailboxRelay'
|
||||
import NewMailboxRelayInput from './NewMailboxRelayInput'
|
||||
import SaveButton from './SaveButton'
|
||||
import { TMailboxRelay, TMailboxRelayScope } from './types'
|
||||
|
||||
export default function MailboxSetting() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export type TMailboxRelayScope = 'read' | 'write' | 'both'
|
||||
export type TMailboxRelay = {
|
||||
url: string
|
||||
scope: TMailboxRelayScope
|
||||
}
|
||||
Reference in New Issue
Block a user