feat: improve style of others relay list
This commit is contained in:
@@ -51,10 +51,6 @@ export default function ProfilePage({ id, index }: { id?: string; index?: number
|
||||
() => (profile?.pubkey ? generateImageByPubkey(profile?.pubkey) : ''),
|
||||
[profile]
|
||||
)
|
||||
const relayCount = useMemo(
|
||||
() => new Set(relayList.write.concat(relayList.read)).size,
|
||||
[relayList]
|
||||
)
|
||||
const isSelf = accountPubkey === profile?.pubkey
|
||||
|
||||
if (!profile && isFetching) {
|
||||
@@ -128,7 +124,7 @@ export default function ProfilePage({ id, index }: { id?: string; index?: number
|
||||
to={isSelf ? toRelaySettings('mailbox') : toOthersRelaySettings(pubkey)}
|
||||
className="flex gap-1 hover:underline w-fit"
|
||||
>
|
||||
{relayCount}
|
||||
{relayList.originalRelays.length}
|
||||
<div className="text-muted-foreground">{t('Relays')}</div>
|
||||
</SecondaryPageLink>
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,8 @@ import SaveRelayDropdownMenu from '@/components/SaveRelayDropdownMenu'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { normalizeUrl, simplifyUrl } from '@/lib/url'
|
||||
import { ListPlus } from 'lucide-react'
|
||||
import { useMemo } from 'react'
|
||||
import { Check, Copy, ListPlus } from 'lucide-react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import NotFoundPage from '../NotFoundPage'
|
||||
|
||||
export default function RelayPage({ url, index }: { url?: string; index?: number }) {
|
||||
@@ -20,13 +20,7 @@ export default function RelayPage({ url, index }: { url?: string; index?: number
|
||||
<SecondaryPageLayout
|
||||
index={index}
|
||||
title={title}
|
||||
controls={
|
||||
<SaveRelayDropdownMenu urls={[normalizedUrl]} asChild>
|
||||
<Button variant="ghost" size="titlebar-icon">
|
||||
<ListPlus />
|
||||
</Button>
|
||||
</SaveRelayDropdownMenu>
|
||||
}
|
||||
controls={<RelayPageControls url={normalizedUrl} />}
|
||||
displayScrollToTopButton
|
||||
>
|
||||
<RelayInfo url={normalizedUrl} />
|
||||
@@ -34,3 +28,25 @@ export default function RelayPage({ url, index }: { url?: string; index?: number
|
||||
</SecondaryPageLayout>
|
||||
)
|
||||
}
|
||||
|
||||
function RelayPageControls({ url }: { url: string }) {
|
||||
const [copied, setCopied] = useState(false)
|
||||
const handleCopy = () => {
|
||||
navigator.clipboard.writeText(url)
|
||||
setCopied(true)
|
||||
setTimeout(() => setCopied(false), 2000)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant="ghost" size="titlebar-icon" onClick={handleCopy}>
|
||||
{copied ? <Check /> : <Copy />}
|
||||
</Button>
|
||||
<SaveRelayDropdownMenu urls={[url]} asChild>
|
||||
<Button variant="ghost" size="titlebar-icon">
|
||||
<ListPlus />
|
||||
</Button>
|
||||
</SaveRelayDropdownMenu>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user