From 4f952816ea832ff8bc0f0f0835fec62073e53414 Mon Sep 17 00:00:00 2001 From: Gigi Date: Sat, 11 Oct 2025 08:09:29 +0100 Subject: [PATCH] feat: compact relay status indicator on mobile - Show only icon on mobile (44x44px touch target) - Tap to expand for full details - Smooth transition between compact and expanded states - Maintains full display on desktop - Reduces screen clutter on mobile while keeping info accessible Flight mode notice now just shows airplane icon on mobile. Tap it to see full connection details. --- src/components/RelayStatusIndicator.tsx | 74 ++++++++++++++++--------- src/index.css | 28 ++++++++++ 2 files changed, 76 insertions(+), 26 deletions(-) diff --git a/src/components/RelayStatusIndicator.tsx b/src/components/RelayStatusIndicator.tsx index 1926171d..ddc8e13c 100644 --- a/src/components/RelayStatusIndicator.tsx +++ b/src/components/RelayStatusIndicator.tsx @@ -4,6 +4,7 @@ import { faPlane, faGlobe, faCircle, faSpinner } from '@fortawesome/free-solid-s import { RelayPool } from 'applesauce-relay' import { useRelayStatus } from '../hooks/useRelayStatus' import { isLocalRelay } from '../utils/helpers' +import { useIsMobile } from '../hooks/useMediaQuery' interface RelayStatusIndicatorProps { relayPool: RelayPool | null @@ -13,6 +14,8 @@ export const RelayStatusIndicator: React.FC = ({ rela // Poll frequently for responsive offline indicator (5s instead of default 20s) const relayStatuses = useRelayStatus({ relayPool, pollingInterval: 5000 }) const [isConnecting, setIsConnecting] = useState(true) + const [isExpanded, setIsExpanded] = useState(false) + const isMobile = useIsMobile() if (!relayPool) return null @@ -57,36 +60,55 @@ export const RelayStatusIndicator: React.FC = ({ rela // Don't show indicator when fully connected (but show when connecting) if (!localOnlyMode && !offlineMode && !isConnecting) return null + const handleClick = () => { + if (isMobile) { + setIsExpanded(!isExpanded) + } + } + + const showDetails = !isMobile || isExpanded + return ( -
+
-
- {isConnecting ? ( - Connecting - ) : offlineMode ? ( - <> - Offline - No relays connected - - ) : ( - <> - Flight Mode - {connectedUrls.length} local relay{connectedUrls.length !== 1 ? 's' : ''} - - )} -
- {!offlineMode && !isConnecting && ( -
- -
+ {showDetails && ( + <> +
+ {isConnecting ? ( + Connecting + ) : offlineMode ? ( + <> + Offline + No relays connected + + ) : ( + <> + Flight Mode + {connectedUrls.length} local relay{connectedUrls.length !== 1 ? 's' : ''} + + )} +
+ {!offlineMode && !isConnecting && ( +
+ +
+ )} + )}
) diff --git a/src/index.css b/src/index.css index 9249ea83..7a562419 100644 --- a/src/index.css +++ b/src/index.css @@ -2909,6 +2909,34 @@ body.mobile-sidebar-open { cursor: default; } +/* Mobile compact mode - just show icon */ +@media (max-width: 768px) { + .relay-status-indicator.mobile { + padding: 0.5rem; + width: var(--min-touch-target); + height: var(--min-touch-target); + display: flex; + align-items: center; + justify-content: center; + bottom: 1rem; + left: 1rem; + } + + .relay-status-indicator.mobile.expanded { + width: auto; + padding: 0.75rem 1rem; + gap: 0.75rem; + } + + .relay-status-indicator.mobile .relay-status-icon { + font-size: 1.1rem; + } + + .relay-status-indicator.mobile:active { + transform: scale(0.95); + } +} + .relay-status-indicator.connecting { background: rgba(100, 108, 255, 0.15); border: 1px solid rgba(100, 108, 255, 0.25);