feat: 💨

This commit is contained in:
codytseng
2025-09-05 22:53:55 +08:00
parent be3c0023fe
commit ab51f768f9
3 changed files with 7 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ import RelayInfo from '@/components/RelayInfo'
import SearchInput from '@/components/SearchInput' import SearchInput from '@/components/SearchInput'
import { useFetchRelayInfo } from '@/hooks' import { useFetchRelayInfo } from '@/hooks'
import { normalizeUrl } from '@/lib/url' import { normalizeUrl } from '@/lib/url'
import { cn } from '@/lib/utils'
import { useEffect, useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import NotFound from '../NotFound' import NotFound from '../NotFound'
@@ -30,8 +29,8 @@ export default function Relay({ url, className }: { url?: string; className?: st
} }
return ( return (
<div className={cn('pt-3', className)}> <div className={className}>
<RelayInfo url={normalizedUrl} /> <RelayInfo url={normalizedUrl} className="pt-3" />
{relayInfo?.supported_nips?.includes(50) && ( {relayInfo?.supported_nips?.includes(50) && (
<div className="px-4 py-2"> <div className="px-4 py-2">
<SearchInput <SearchInput

View File

@@ -2,6 +2,7 @@ import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { useFetchRelayInfo } from '@/hooks' import { useFetchRelayInfo } from '@/hooks'
import { normalizeHttpUrl } from '@/lib/url' import { normalizeHttpUrl } from '@/lib/url'
import { cn } from '@/lib/utils'
import { GitBranch, Mail, SquareCode } from 'lucide-react' import { GitBranch, Mail, SquareCode } from 'lucide-react'
import { useState } from 'react' import { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
@@ -11,7 +12,7 @@ import RelayIcon from '../RelayIcon'
import UserAvatar from '../UserAvatar' import UserAvatar from '../UserAvatar'
import Username from '../Username' import Username from '../Username'
export default function RelayInfo({ url }: { url: string }) { export default function RelayInfo({ url, className }: { url: string; className?: string }) {
const { t } = useTranslation() const { t } = useTranslation()
const { relayInfo, isFetching } = useFetchRelayInfo(url) const { relayInfo, isFetching } = useFetchRelayInfo(url)
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
@@ -21,7 +22,7 @@ export default function RelayInfo({ url }: { url: string }) {
} }
return ( return (
<div className="px-4 space-y-4 mb-2"> <div className={cn('px-4 space-y-4 mb-2', className)}>
<div className="space-y-2"> <div className="space-y-2">
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
<RelayIcon url={url} className="w-8 h-8" /> <RelayIcon url={url} className="w-8 h-8" />

View File

@@ -284,7 +284,7 @@ export default function ReplyNoteList({ index, event }: { index?: number; event:
return ( return (
<div className="min-h-[80vh]"> <div className="min-h-[80vh]">
{loading && (replies.length === 0 ? <ReplyNoteSkeleton /> : <LoadingBar />)} {loading && <LoadingBar />}
{!loading && until && ( {!loading && until && (
<div <div
className={`text-sm text-center text-muted-foreground border-b py-2 ${!loading ? 'hover:text-foreground cursor-pointer' : ''}`} className={`text-sm text-center text-muted-foreground border-b py-2 ${!loading ? 'hover:text-foreground cursor-pointer' : ''}`}
@@ -338,6 +338,7 @@ export default function ReplyNoteList({ index, event }: { index?: number; event:
</div> </div>
)} )}
<div ref={bottomRef} /> <div ref={bottomRef} />
{loading && <ReplyNoteSkeleton />}
</div> </div>
) )
} }