fix(ui): Connected Nodes — consistent bottom actions
Drop the 'Discover Nodes on Nostr' button and the >=1800px header buttons; Find Nodes + Refresh are now a 50/50 bottom pair on every screen size, with Refresh acting on the active tab. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
af2dfd0bd6
commit
a66e4bac6d
@ -11,21 +11,6 @@
|
|||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<h2 class="text-xl font-semibold text-white mb-2">{{ t('web5.connectedNodes') }}</h2>
|
<h2 class="text-xl font-semibold text-white mb-2">{{ t('web5.connectedNodes') }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="web5-card-actions-top gap-2 shrink-0">
|
|
||||||
<button
|
|
||||||
@click="router.push('/dashboard/server/federation')"
|
|
||||||
class="px-3 py-1.5 glass-button glass-button-sm rounded text-xs font-medium text-white/90 hover:text-white transition-colors"
|
|
||||||
>
|
|
||||||
{{ t('web5.findNodes') }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
@click="loadPeers"
|
|
||||||
:disabled="loadingPeers"
|
|
||||||
class="px-3 py-1.5 glass-button glass-button-sm rounded text-xs font-medium text-white/90 hover:text-white transition-colors"
|
|
||||||
>
|
|
||||||
{{ loadingPeers ? t('common.loading') : t('common.refresh') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Mobile: stacked layout -->
|
<!-- Mobile: stacked layout -->
|
||||||
<div class="md:hidden mb-4">
|
<div class="md:hidden mb-4">
|
||||||
@ -174,7 +159,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-auto pt-4 space-y-3">
|
<div class="mt-auto pt-4 space-y-3">
|
||||||
<div class="web5-card-actions-bottom-grid grid-cols-2 gap-3">
|
<!-- Always the bottom 50/50 pair, every screen size — consistent with
|
||||||
|
the other web5 cards' full-width bottom actions. -->
|
||||||
|
<div class="grid grid-cols-2 gap-3">
|
||||||
<button
|
<button
|
||||||
@click="router.push('/dashboard/server/federation')"
|
@click="router.push('/dashboard/server/federation')"
|
||||||
class="mobile-card-action glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors"
|
class="mobile-card-action glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors"
|
||||||
@ -182,37 +169,13 @@
|
|||||||
{{ t('web5.findNodes') }}
|
{{ t('web5.findNodes') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@click="loadPeers"
|
@click="refreshActiveTab"
|
||||||
:disabled="loadingPeers"
|
:disabled="loadingPeers || loadingRequests"
|
||||||
class="mobile-card-action glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors"
|
class="mobile-card-action glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors"
|
||||||
>
|
>
|
||||||
{{ loadingPeers ? t('common.loading') : t('common.refresh') }}
|
{{ loadingPeers || loadingRequests ? t('common.loading') : t('common.refresh') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button
|
|
||||||
v-if="nodesContainerTab === 'trusted'"
|
|
||||||
@click="discoverAndAddPeers"
|
|
||||||
:disabled="discovering"
|
|
||||||
class="w-full px-4 py-2 glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors disabled:opacity-50"
|
|
||||||
>
|
|
||||||
{{ discovering ? t('web5.discovering') : t('web5.discoverNodes') }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
v-else-if="nodesContainerTab === 'observers'"
|
|
||||||
@click="loadPeers"
|
|
||||||
:disabled="loadingPeers"
|
|
||||||
class="w-full px-4 py-2 glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors disabled:opacity-50"
|
|
||||||
>
|
|
||||||
{{ loadingPeers ? t('common.loading') : t('common.refresh') }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
v-else
|
|
||||||
@click="loadConnectionRequests"
|
|
||||||
:disabled="loadingRequests"
|
|
||||||
class="w-full px-4 py-2 glass-button rounded-lg text-sm font-medium text-white/90 hover:text-white transition-colors disabled:opacity-50"
|
|
||||||
>
|
|
||||||
{{ loadingRequests ? t('common.loading') : t('web5.refreshRequests') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -328,7 +291,6 @@ const observers = ref<Peer[]>(cached.observers ?? [])
|
|||||||
const loadingPeers = ref(false)
|
const loadingPeers = ref(false)
|
||||||
const peerReachableLocal = ref<Record<string, boolean>>(cached.peerReachable ?? {})
|
const peerReachableLocal = ref<Record<string, boolean>>(cached.peerReachable ?? {})
|
||||||
const peerReachable = computed(() => ({ ...appStore.peerHealth, ...peerReachableLocal.value }))
|
const peerReachable = computed(() => ({ ...appStore.peerHealth, ...peerReachableLocal.value }))
|
||||||
const discovering = ref(false)
|
|
||||||
|
|
||||||
// Send message modal
|
// Send message modal
|
||||||
const showSendMessageModal = ref(false)
|
const showSendMessageModal = ref(false)
|
||||||
@ -378,6 +340,12 @@ function switchToRequestsTab() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The single bottom Refresh acts on whichever tab is open.
|
||||||
|
function refreshActiveTab() {
|
||||||
|
if (nodesContainerTab.value === 'requests') void loadConnectionRequests()
|
||||||
|
else void loadPeers()
|
||||||
|
}
|
||||||
|
|
||||||
async function loadPeers() {
|
async function loadPeers() {
|
||||||
const hadPeers = peers.value.length > 0 || observers.value.length > 0
|
const hadPeers = peers.value.length > 0 || observers.value.length > 0
|
||||||
loadingPeers.value = true
|
loadingPeers.value = true
|
||||||
@ -456,28 +424,6 @@ async function sendMessage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function discoverAndAddPeers() {
|
|
||||||
discovering.value = true
|
|
||||||
try {
|
|
||||||
const res = await rpcClient.discoverNodes()
|
|
||||||
const nodes = res.nodes || []
|
|
||||||
for (const n of nodes) {
|
|
||||||
if (n.onion && n.pubkey) {
|
|
||||||
try {
|
|
||||||
await rpcClient.addPeer({ onion: n.onion, pubkey: n.pubkey })
|
|
||||||
} catch (e) {
|
|
||||||
if (import.meta.env.DEV) console.warn('Peer may already exist', e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await loadPeers()
|
|
||||||
} catch (e) {
|
|
||||||
if (import.meta.env.DEV) console.error('Discover failed:', e)
|
|
||||||
} finally {
|
|
||||||
discovering.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadConnectionRequests() {
|
async function loadConnectionRequests() {
|
||||||
const hadRequests = connectionRequests.value.length > 0
|
const hadRequests = connectionRequests.value.length > 0
|
||||||
loadingRequests.value = true
|
loadingRequests.value = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user