refactor: 🏗️
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { relayListToMailboxRelay } from '@/lib/relay'
|
||||
import { normalizeUrl } from '@/lib/url'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { TMailboxRelay, TMailboxRelayScope } from '@/types'
|
||||
@@ -18,7 +17,7 @@ export default function MailboxSetting() {
|
||||
useEffect(() => {
|
||||
if (!relayList) return
|
||||
|
||||
setRelays(relayListToMailboxRelay(relayList))
|
||||
setRelays(relayList.originalRelays)
|
||||
}, [relayList])
|
||||
|
||||
if (!pubkey) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Button } from '@/components/ui/button'
|
||||
import { useFetchRelayList } from '@/hooks'
|
||||
import { toRelay } from '@/lib/link'
|
||||
import { userIdToPubkey } from '@/lib/pubkey'
|
||||
import { relayListToMailboxRelay } from '@/lib/relay'
|
||||
import { simplifyUrl } from '@/lib/url'
|
||||
import { TMailboxRelay } from '@/types'
|
||||
import { ListPlus, Telescope } from 'lucide-react'
|
||||
@@ -17,7 +16,6 @@ export default function OthersRelayList({ userId }: { userId: string }) {
|
||||
const { t } = useTranslation()
|
||||
const pubkey = useMemo(() => userIdToPubkey(userId), [userId])
|
||||
const { relayList, isFetching } = useFetchRelayList(pubkey)
|
||||
const mailboxRelays = useMemo(() => relayListToMailboxRelay(relayList), [relayList])
|
||||
|
||||
if (isFetching) {
|
||||
return <div className="text-center text-sm text-muted-foreground">{t('loading...')}</div>
|
||||
@@ -25,7 +23,7 @@ export default function OthersRelayList({ userId }: { userId: string }) {
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{mailboxRelays.map((relay, index) => (
|
||||
{relayList.originalRelays.map((relay, index) => (
|
||||
<RelayItem key={`read-${relay.url}-${index}`} relay={relay} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -20,8 +20,13 @@ export default function RelayInfo({ url }: { url: string }) {
|
||||
{relayInfo.name && <div className="text-2xl font-semibold">{relayInfo.name}</div>}
|
||||
</div>
|
||||
<RelayBadges relayInfo={relayInfo} />
|
||||
{!!relayInfo.tags?.length &&
|
||||
relayInfo.tags.map((tag) => <Badge variant="secondary">{tag}</Badge>)}
|
||||
{!!relayInfo.tags?.length && (
|
||||
<div className="flex gap-2">
|
||||
{relayInfo.tags.map((tag) => (
|
||||
<Badge variant="secondary">{tag}</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{relayInfo.description && (
|
||||
<div className="text-wrap break-words whitespace-pre-wrap mt-2">
|
||||
{relayInfo.description}
|
||||
|
||||
Reference in New Issue
Block a user