From dc8d687f0c506541a4059f9566a0ed19925c4b34 Mon Sep 17 00:00:00 2001
From: Gigi
Date: Thu, 9 Oct 2025 13:08:24 +0100
Subject: [PATCH] refactor: move local relay info box to Offline Mode section
- Move recommendation text from Relays to Offline Mode section
- Info box about Citrine and nostr-relay-tray now appears at end of Offline Mode
- Remove unused handleLinkClick and useNavigate from RelaySettings
- Add handleLinkClick to OfflineModeSettings for clickable links
- Clean up unused onClose prop in RelaySettings
---
src/components/Settings.tsx | 2 +-
.../Settings/OfflineModeSettings.tsx | 62 ++++++++++++++++++-
src/components/Settings/RelaySettings.tsx | 60 +-----------------
3 files changed, 63 insertions(+), 61 deletions(-)
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 4ce1009a..7591ed2a 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -162,7 +162,7 @@ const Settings: React.FC = ({ settings, onSave, onClose, relayPoo
-
+
diff --git a/src/components/Settings/OfflineModeSettings.tsx b/src/components/Settings/OfflineModeSettings.tsx
index a35e4ccc..cd26e02f 100644
--- a/src/components/Settings/OfflineModeSettings.tsx
+++ b/src/components/Settings/OfflineModeSettings.tsx
@@ -1,12 +1,21 @@
import React from 'react'
+import { useNavigate } from 'react-router-dom'
import { UserSettings } from '../../services/settingsService'
interface OfflineModeSettingsProps {
settings: UserSettings
onUpdate: (updates: Partial) => void
+ onClose?: () => void
}
-const OfflineModeSettings: React.FC = ({ settings, onUpdate }) => {
+const OfflineModeSettings: React.FC = ({ settings, onUpdate, onClose }) => {
+ const navigate = useNavigate()
+
+ const handleLinkClick = (url: string) => {
+ if (onClose) onClose()
+ navigate(`/r/${encodeURIComponent(url)}`)
+ }
+
return (
Offline Mode
@@ -36,6 +45,57 @@ const OfflineModeSettings: React.FC = ({ settings, onU
Rebroadcast events to all relays
+
+
)
}
diff --git a/src/components/Settings/RelaySettings.tsx b/src/components/Settings/RelaySettings.tsx
index f71f1597..c20f181c 100644
--- a/src/components/Settings/RelaySettings.tsx
+++ b/src/components/Settings/RelaySettings.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import { useNavigate } from 'react-router-dom'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCheckCircle, faCircle, faClock, faPlane } from '@fortawesome/free-solid-svg-icons'
import { RelayStatus } from '../../services/relayStatusService'
@@ -11,16 +10,10 @@ interface RelaySettingsProps {
onClose?: () => void
}
-const RelaySettings: React.FC = ({ relayStatuses, onClose }) => {
- const navigate = useNavigate()
+const RelaySettings: React.FC = ({ relayStatuses }) => {
const activeRelays = relayStatuses.filter(r => r.isInPool)
const recentRelays = relayStatuses.filter(r => !r.isInPool)
- const handleLinkClick = (url: string) => {
- if (onClose) onClose()
- navigate(`/r/${encodeURIComponent(url)}`)
- }
-
const formatRelayUrl = (url: string) => {
return url.replace(/^wss?:\/\//, '').replace(/\/$/, '')
}
@@ -186,57 +179,6 @@ const RelaySettings: React.FC = ({ relayStatuses, onClose })
No relay connections found
)}
-
-
)
}