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