@@ -26,7 +26,7 @@ import classes from './Location.module.css';
2626
2727export default function LocationView ( ) {
2828 const { t } = useTranslation ( ) ;
29- const { vpnConnected, vpnConnect, connectionInProgress, vpnDisconnectConnect , appStatus } = useContext ( AppContext ) ;
29+ const { vpnConnected, vpnConnect, connectionInProgress, appStatus } = useContext ( AppContext ) ;
3030 const { exitList } = useContext ( ExitsContext ) ;
3131
3232 const onExitSelect = async ( exit : Exit ) => {
@@ -42,7 +42,7 @@ export default function LocationView() {
4242 color : 'yellow.4' ,
4343 id : NotificationId . VPN_DISCONNECT_CONNECT
4444 } ) ;
45- await vpnDisconnectConnect ( exit . id ) ;
45+ await vpnConnect ( exit . id ) ;
4646 } else if ( exitList !== null ) {
4747 try {
4848 exit = getRandomExitFromCity ( exitList , exit . country_code , exit . city_code ) ;
@@ -265,7 +265,7 @@ function VpnStatusCard() {
265265
266266 const getStatusTitle = ( ) => {
267267 if ( isOffline ) return t ( 'Offline' ) ;
268- if ( connectionInProgress !== ConnectionInProgress . UNSET && connectionInProgress !== ConnectionInProgress . ChangingLocations ) return t ( connectionInProgress ) + '...' ;
268+ if ( connectionInProgress !== ConnectionInProgress . UNSET ) return t ( connectionInProgress ) + '...' ;
269269 const selectedLocation = appStatus . vpnStatus . connected ?. exit . city_name ;
270270 // vpnConnected <-> vpnStatus.connected.exit defined
271271 if ( selectedLocation !== undefined ) return t ( 'connectedToLocation' , { location : selectedLocation } ) ;
@@ -274,6 +274,9 @@ function VpnStatusCard() {
274274
275275 const getStatusSubtitle = ( ) => {
276276 if ( isOffline ) return t ( 'connectToInternet' ) ;
277+ if ( connectionInProgress === ConnectionInProgress . ChangingLocations ) {
278+ return t ( 'trafficSuspended' ) ;
279+ }
277280 return vpnConnected ? t ( 'trafficProtected' ) : t ( 'trafficVulnerable' ) ;
278281 } ;
279282
@@ -294,15 +297,20 @@ function VpnStatusCard() {
294297 return t ( 'busyConnection' ) ;
295298 } ;
296299
300+ const statusColor = vpnConnected ? 'green.7' : ( connectionInProgress === ConnectionInProgress . ChangingLocations ? 'gray' : 'red.7' ) ;
301+
297302 return (
298303 < Card shadow = 'sm' padding = 'lg' radius = 'md' withBorder w = '90%' mb = 'xs' >
299304 < Group justify = 'space-between' >
300305 < Stack gap = { 0 } >
301306 < Group align = 'center' gap = { 5 } >
302- < ThemeIcon color = { vpnConnected ? 'green.7' : 'red.7' } variant = 'transparent' >
303- { vpnConnected ? < BsShieldFillCheck size = { 25 } /> : < BsShieldFillExclamation size = { 25 } /> }
307+ < ThemeIcon color = { statusColor } variant = 'transparent' >
308+ { connectionInProgress === ConnectionInProgress . ChangingLocations
309+ ? < Loader size = 'xs' color = 'gray' /> : vpnConnected
310+ ? < BsShieldFillCheck size = { 25 } />
311+ : < BsShieldFillExclamation size = { 25 } /> }
304312 </ ThemeIcon >
305- < Title order = { 4 } fw = { 600 } c = { vpnConnected ? 'green.7' : 'red.7' } > { getStatusTitle ( ) } </ Title >
313+ < Title order = { 4 } fw = { 600 } c = { statusColor } > { getStatusTitle ( ) } </ Title >
306314 </ Group >
307315 < Text c = 'gray' size = 'sm' ml = { 34 } > { getStatusSubtitle ( ) } </ Text >
308316 </ Stack >
0 commit comments