fix: 🐛
This commit is contained in:
@@ -275,7 +275,7 @@ function isCurrentPage(stack: TStackItem[], url: string) {
|
||||
}
|
||||
|
||||
function findAndCreateComponent(url: string, index: number) {
|
||||
const path = url.split('?')[0]
|
||||
const path = url.split('?')[0].split('#')[0]
|
||||
for (const { matcher, element } of routes) {
|
||||
const match = matcher(path)
|
||||
if (!match) continue
|
||||
|
||||
@@ -31,7 +31,7 @@ export default function FeedSwitcher({ close }: { close?: () => void }) {
|
||||
<div className="flex justify-between px-2">
|
||||
<div className="text-muted-foreground text-sm font-semibold">{t('relay sets')}</div>
|
||||
<SecondaryPageLink
|
||||
to={toRelaySettings()}
|
||||
to={toRelaySettings('relay-sets')}
|
||||
className="text-highlight text-sm font-semibold"
|
||||
onClick={() => close?.()}
|
||||
>
|
||||
|
||||
@@ -32,7 +32,9 @@ export const toOthersRelaySettings = (pubkey: string) => {
|
||||
const npub = nip19.npubEncode(pubkey)
|
||||
return `/users/${npub}/relays`
|
||||
}
|
||||
export const toRelaySettings = () => '/relay-settings'
|
||||
export const toRelaySettings = (tag?: 'mailbox' | 'relay-sets') => {
|
||||
return '/relay-settings' + (tag === 'relay-sets' ? '#relay-sets' : '')
|
||||
}
|
||||
export const toSettings = () => '/settings'
|
||||
export const toProfileEditor = () => '/profile-editor'
|
||||
export const toRelay = (url: string) => `/relays/${encodeURIComponent(url)}`
|
||||
|
||||
@@ -2,14 +2,27 @@ import MailboxSetting from '@/components/MailboxSetting'
|
||||
import RelaySetsSetting from '@/components/RelaySetsSetting'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function RelaySettingsPage({ index }: { index?: number }) {
|
||||
const { t } = useTranslation()
|
||||
const [tabValue, setTabValue] = useState('mailbox')
|
||||
|
||||
useEffect(() => {
|
||||
if (window.location.hash === '#relay-sets') {
|
||||
setTabValue('relay-sets')
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<SecondaryPageLayout index={index} title={t('Relay settings')}>
|
||||
<Tabs defaultValue="mailbox" className="px-4 space-y-4">
|
||||
<Tabs
|
||||
defaultValue="mailbox"
|
||||
value={tabValue}
|
||||
onValueChange={setTabValue}
|
||||
className="px-4 space-y-4"
|
||||
>
|
||||
<TabsList>
|
||||
<TabsTrigger value="mailbox">{t('Read & Write Relays')}</TabsTrigger>
|
||||
<TabsTrigger value="relay-sets">{t('Relay Sets')}</TabsTrigger>
|
||||
|
||||
Reference in New Issue
Block a user