11"use client" ;
22
33import { useState , useRef , useEffect } from "react" ;
4- import { Shield , ShieldAlert , ShieldQuestion } from "lucide-react" ;
4+ import { Shield , ShieldAlert , ShieldCheck , ShieldQuestion } from "lucide-react" ;
55import { useNetwork } from "@/context/NetworkContext" ;
66import { useTranslation } from "react-i18next" ;
77
@@ -11,7 +11,7 @@ import { useTranslation } from "react-i18next";
1111 */
1212export function ConnectionBadge ( ) {
1313 const { t } = useTranslation ( ) ;
14- const { torStatus : status } = useNetwork ( ) ;
14+ const { torStatus, localApiStatus } = useNetwork ( ) ;
1515 const [ showTip , setShowTip ] = useState ( false ) ;
1616 const ref = useRef < HTMLDivElement > ( null ) ;
1717
@@ -27,28 +27,37 @@ export function ConnectionBadge() {
2727 return ( ) => document . removeEventListener ( "click" , handleClick , true ) ;
2828 } , [ showTip ] ) ;
2929
30- const config = {
31- checking : {
32- icon : < Shield size = { 16 } className = "text-muted animate-pulse" /> ,
33- label : null ,
34- tip : t ( "common.connectionChecking" , { defaultValue : "Checking connection type..." } ) ,
35- } ,
36- tor : {
37- icon : < Shield size = { 16 } className = "text-success" /> ,
38- label : < span className = "text-success text-xs hidden sm:inline" > { t ( "common.tor" , { defaultValue : "Tor" } ) } </ span > ,
39- tip : t ( "common.connectionTor" , { defaultValue : "Connected via Tor - your IP is hidden from API providers" } ) ,
40- } ,
41- unknown : {
42- icon : < ShieldQuestion size = { 16 } className = "text-muted" /> ,
43- label : null ,
44- tip : t ( "common.connectionUnknown" , { defaultValue : "Connection privacy status could not be determined" } ) ,
45- } ,
46- clearnet : {
47- icon : < ShieldAlert size = { 16 } className = "text-warning" /> ,
48- label : < span className = "text-warning text-xs hidden sm:inline" > { t ( "common.clearnet" , { defaultValue : "Clearnet" } ) } </ span > ,
49- tip : t ( "common.connectionClearnet" , { defaultValue : "Not using Tor - mempool.space can see your IP address" } ) ,
50- } ,
51- } [ status ] ;
30+ // Local API (Umbrel) takes display priority - it's the most private option
31+ const isLocal = localApiStatus === "available" ;
32+
33+ const config = isLocal
34+ ? {
35+ icon : < ShieldCheck size = { 16 } className = "text-success" /> ,
36+ label : < span className = "text-success text-xs hidden sm:inline" > { t ( "common.local" , { defaultValue : "Local" } ) } </ span > ,
37+ tip : t ( "common.connectionLocal" , { defaultValue : "Connected to local mempool instance - all queries stay on your network" } ) ,
38+ }
39+ : {
40+ checking : {
41+ icon : < Shield size = { 16 } className = "text-muted animate-pulse" /> ,
42+ label : null ,
43+ tip : t ( "common.connectionChecking" , { defaultValue : "Checking connection type..." } ) ,
44+ } ,
45+ tor : {
46+ icon : < Shield size = { 16 } className = "text-success" /> ,
47+ label : < span className = "text-success text-xs hidden sm:inline" > { t ( "common.tor" , { defaultValue : "Tor" } ) } </ span > ,
48+ tip : t ( "common.connectionTor" , { defaultValue : "Connected via Tor - your IP is hidden from API providers" } ) ,
49+ } ,
50+ unknown : {
51+ icon : < ShieldQuestion size = { 16 } className = "text-muted" /> ,
52+ label : null ,
53+ tip : t ( "common.connectionUnknown" , { defaultValue : "Connection privacy status could not be determined" } ) ,
54+ } ,
55+ clearnet : {
56+ icon : < ShieldAlert size = { 16 } className = "text-warning" /> ,
57+ label : < span className = "text-warning text-xs hidden sm:inline" > { t ( "common.clearnet" , { defaultValue : "Clearnet" } ) } </ span > ,
58+ tip : t ( "common.connectionClearnet" , { defaultValue : "Not using Tor - mempool.space can see your IP address" } ) ,
59+ } ,
60+ } [ torStatus ] ;
5261
5362 return (
5463 < div ref = { ref } className = "relative" >
0 commit comments