diff --git a/src/components/PostEditor/PostContent.tsx b/src/components/PostEditor/PostContent.tsx index 089061e4..031aa8bc 100644 --- a/src/components/PostEditor/PostContent.tsx +++ b/src/components/PostEditor/PostContent.tsx @@ -82,7 +82,6 @@ export default function PostContent({ relays: [] } ) - setSpecifiedRelayUrls(cachedSettings.specifiedRelayUrls) setAddClientTag(cachedSettings.addClientTag ?? false) } return @@ -93,7 +92,6 @@ export default function PostContent({ isNsfw, isPoll, pollCreateData, - specifiedRelayUrls, addClientTag } ) diff --git a/src/components/RelayBadges/index.tsx b/src/components/RelayBadges/index.tsx index 22f1d2f2..f277acf3 100644 --- a/src/components/RelayBadges/index.tsx +++ b/src/components/RelayBadges/index.tsx @@ -8,12 +8,6 @@ export default function RelayBadges({ relayInfo }: { relayInfo: TRelayInfo }) { const badges = useMemo(() => { const b: string[] = [] - if (relayInfo.limitation?.auth_required) { - b.push('Auth') - } - if (relayInfo.supported_nips?.includes(50)) { - b.push('Search') - } if (relayInfo.limitation?.payment_required) { b.push('Payment') } @@ -26,12 +20,6 @@ export default function RelayBadges({ relayInfo }: { relayInfo: TRelayInfo }) { return (
- {badges.includes('Auth') && ( - {t('relayInfoBadgeAuth')} - )} - {badges.includes('Search') && ( - {t('relayInfoBadgeSearch')} - )} {badges.includes('Payment') && ( {t('relayInfoBadgePayment')} )} diff --git a/src/components/RelayInfo/index.tsx b/src/components/RelayInfo/index.tsx index 8950dc50..97645c08 100644 --- a/src/components/RelayInfo/index.tsx +++ b/src/components/RelayInfo/index.tsx @@ -3,12 +3,14 @@ import { Button } from '@/components/ui/button' import { useFetchRelayInfo } from '@/hooks' import { normalizeHttpUrl } from '@/lib/url' import { cn } from '@/lib/utils' -import { GitBranch, Mail, SquareCode } from 'lucide-react' +import { Check, Copy, GitBranch, Link, Mail, SquareCode } from 'lucide-react' import { useState } from 'react' import { useTranslation } from 'react-i18next' +import { toast } from 'sonner' import PostEditor from '../PostEditor' import RelayBadges from '../RelayBadges' import RelayIcon from '../RelayIcon' +import SaveRelayDropdownMenu from '../SaveRelayDropdownMenu' import UserAvatar from '../UserAvatar' import Username from '../Username' @@ -24,11 +26,14 @@ export default function RelayInfo({ url, className }: { url: string; className?: return (
-
- -
- {relayInfo.name || relayInfo.shortUrl} +
+
+ +
+ {relayInfo.name || relayInfo.shortUrl} +
+
{!!relayInfo.tags?.length && ( @@ -107,3 +112,33 @@ function formatSoftware(software: string) { const parts = software.split('/') return parts[parts.length - 1] } + +function RelayControls({ url }: { url: string }) { + const [copiedUrl, setCopiedUrl] = useState(false) + const [copiedShareableUrl, setCopiedShareableUrl] = useState(false) + + const handleCopyUrl = () => { + navigator.clipboard.writeText(url) + setCopiedUrl(true) + setTimeout(() => setCopiedUrl(false), 2000) + } + + const handleCopyShareableUrl = () => { + navigator.clipboard.writeText(`https://jumble.social/?r=${url}`) + setCopiedShareableUrl(true) + toast.success('Shareable URL copied to clipboard') + setTimeout(() => setCopiedShareableUrl(false), 2000) + } + + return ( +
+ + + +
+ ) +} diff --git a/src/components/RelayPageControls/index.tsx b/src/components/RelayPageControls/index.tsx deleted file mode 100644 index cb412879..00000000 --- a/src/components/RelayPageControls/index.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Button } from '@/components/ui/button' -import { Check, Copy, Link } from 'lucide-react' -import { useState } from 'react' -import { toast } from 'sonner' -import SaveRelayDropdownMenu from '../SaveRelayDropdownMenu' - -export default function RelayPageControls({ url }: { url: string }) { - const [copiedUrl, setCopiedUrl] = useState(false) - const [copiedShareableUrl, setCopiedShareableUrl] = useState(false) - - const handleCopyUrl = () => { - navigator.clipboard.writeText(url) - setCopiedUrl(true) - setTimeout(() => setCopiedUrl(false), 2000) - } - - const handleCopyShareableUrl = () => { - navigator.clipboard.writeText(`https://jumble.social/?r=${url}`) - setCopiedShareableUrl(true) - toast.success('Shareable URL copied to clipboard') - setTimeout(() => setCopiedShareableUrl(false), 2000) - } - - return ( - <> - - - - - ) -} diff --git a/src/components/SearchBar/index.tsx b/src/components/SearchBar/index.tsx index aa2bc80c..89994624 100644 --- a/src/components/SearchBar/index.tsx +++ b/src/components/SearchBar/index.tsx @@ -1,7 +1,4 @@ -import Nip05 from '@/components/Nip05' import SearchInput from '@/components/SearchInput' -import UserAvatar from '@/components/UserAvatar' -import Username from '@/components/Username' import { useSearchProfiles } from '@/hooks' import { toNote } from '@/lib/link' import { randomString } from '@/lib/random' @@ -23,7 +20,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { UserItemSkeleton } from '../UserItem' +import UserItem, { UserItemSkeleton } from '../UserItem' const SearchBar = forwardRef< TSearchBarRef, @@ -154,7 +151,11 @@ const SearchBar = forwardRef< } /> ))} - {isFetchingProfiles && profiles.length < 5 && } + {isFetchingProfiles && profiles.length < 5 && ( +
+ +
+ )} {profiles.length >= 5 && ( updateSearch({ type: 'profiles', search })}>
{t('Show more...')}
@@ -259,18 +260,8 @@ function ProfileIdItem({ id, onClick }: { id: string; onClick?: () => void }) { function ProfileItem({ profile, onClick }: { profile: TProfile; onClick?: () => void }) { return ( -
-
- -
- - -
-
+
+
) } diff --git a/src/components/UserItem/index.tsx b/src/components/UserItem/index.tsx index 1ace83d4..785655ff 100644 --- a/src/components/UserItem/index.tsx +++ b/src/components/UserItem/index.tsx @@ -3,10 +3,19 @@ import Nip05 from '@/components/Nip05' import UserAvatar from '@/components/UserAvatar' import Username from '@/components/Username' import { Skeleton } from '@/components/ui/skeleton' +import { cn } from '@/lib/utils' -export default function UserItem({ pubkey }: { pubkey: string }) { +export default function UserItem({ + pubkey, + hideFollowButton, + className +}: { + pubkey: string + hideFollowButton?: boolean + className?: string +}) { return ( -
+
- + {!hideFollowButton && }
) } diff --git a/src/pages/primary/RelayPage/index.tsx b/src/pages/primary/RelayPage/index.tsx index f8e4471a..cb14e349 100644 --- a/src/pages/primary/RelayPage/index.tsx +++ b/src/pages/primary/RelayPage/index.tsx @@ -1,5 +1,4 @@ import Relay from '@/components/Relay' -import RelayPageControls from '@/components/RelayPageControls' import PrimaryPageLayout from '@/layouts/PrimaryPageLayout' import { normalizeUrl, simplifyUrl } from '@/lib/url' import { useCurrentRelays } from '@/providers/CurrentRelaysProvider' @@ -32,14 +31,9 @@ export default RelayPage function RelayPageTitlebar({ url }: { url?: string }) { return ( -
-
- -
{simplifyUrl(url ?? '')}
-
-
- -
+
+ +
{simplifyUrl(url ?? '')}
) } diff --git a/src/pages/secondary/RelayPage/index.tsx b/src/pages/secondary/RelayPage/index.tsx index 393d41d7..6c012407 100644 --- a/src/pages/secondary/RelayPage/index.tsx +++ b/src/pages/secondary/RelayPage/index.tsx @@ -1,5 +1,4 @@ import Relay from '@/components/Relay' -import RelayPageControls from '@/components/RelayPageControls' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { normalizeUrl, simplifyUrl } from '@/lib/url' import { forwardRef, useMemo } from 'react' @@ -14,13 +13,7 @@ const RelayPage = forwardRef(({ url, index }: { url?: string; index?: number }, } return ( - } - displayScrollToTopButton - > + ) diff --git a/src/services/post-editor-cache.service.ts b/src/services/post-editor-cache.service.ts index 5604d1ba..f2ac915e 100644 --- a/src/services/post-editor-cache.service.ts +++ b/src/services/post-editor-cache.service.ts @@ -6,7 +6,6 @@ type TPostSettings = { isNsfw?: boolean isPoll?: boolean pollCreateData?: TPollCreateData - specifiedRelayUrls?: string[] addClientTag?: boolean }