@@ -4,7 +4,7 @@ import { Check, CircleX, Eye, MapPin } from 'lucide-react-native';
44import { useColorScheme } from 'nativewind' ;
55import * as React from 'react' ;
66import { useTranslation } from 'react-i18next' ;
7- import { Alert , Pressable , ScrollView } from 'react-native' ;
7+ import { Alert , Platform , Pressable , ScrollView } from 'react-native' ;
88
99import { CustomBottomSheet } from '@/components/ui/bottom-sheet' ;
1010import { Text } from '@/components/ui/text' ;
@@ -40,6 +40,14 @@ export const SidebarCallCard = () => {
4040 } ) ;
4141
4242 const handleDeselect = ( ) => {
43+ if ( Platform . OS === 'web' ) {
44+ const confirmed = window . confirm ( `${ t ( 'calls.confirm_deselect_title' ) } \n${ t ( 'calls.confirm_deselect_message' ) } ` ) ;
45+ if ( confirmed ) {
46+ setActiveCall ( null ) ;
47+ }
48+ return ;
49+ }
50+
4351 Alert . alert (
4452 t ( 'calls.confirm_deselect_title' ) ,
4553 t ( 'calls.confirm_deselect_message' ) ,
@@ -66,6 +74,14 @@ export const SidebarCallCard = () => {
6674 return hasCoordinates || hasAddress ;
6775 } ;
6876
77+ const showLocationAlert = ( ) => {
78+ if ( Platform . OS === 'web' ) {
79+ window . alert ( `${ t ( 'calls.no_location_title' ) } \n${ t ( 'calls.no_location_message' ) } ` ) ;
80+ } else {
81+ Alert . alert ( t ( 'calls.no_location_title' ) , t ( 'calls.no_location_message' ) , [ { text : t ( 'common.ok' ) } ] ) ;
82+ }
83+ } ;
84+
6985 const handleDirections = async ( ) => {
7086 if ( ! activeCall ) return ;
7187
@@ -77,19 +93,19 @@ export const SidebarCallCard = () => {
7793 if ( latitude && longitude ) {
7894 try {
7995 await openMapsWithDirections ( latitude , longitude , address ) ;
80- } catch ( error ) {
81- Alert . alert ( t ( 'calls.no_location_title' ) , t ( 'calls.no_location_message' ) , [ { text : t ( 'common.ok' ) } ] ) ;
96+ } catch {
97+ showLocationAlert ( ) ;
8298 }
8399 } else if ( address && address . trim ( ) !== '' ) {
84100 // Fall back to address if no coordinates
85101 try {
86102 await openMapsWithAddress ( address ) ;
87- } catch ( error ) {
88- Alert . alert ( t ( 'calls.no_location_title' ) , t ( 'calls.no_location_message' ) , [ { text : t ( 'common.ok' ) } ] ) ;
103+ } catch {
104+ showLocationAlert ( ) ;
89105 }
90106 } else {
91107 // No location data available
92- Alert . alert ( t ( 'calls.no_location_title' ) , t ( 'calls.no_location_message' ) , [ { text : t ( 'common.ok' ) } ] ) ;
108+ showLocationAlert ( ) ;
93109 }
94110 } ;
95111
@@ -153,9 +169,8 @@ export const SidebarCallCard = () => {
153169 console . error ( 'Failed to handle call selection:' , error ) ;
154170 } ) ;
155171 } }
156- className = { `rounded-lg border p-4 ${ colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-800' : 'border-neutral-200 bg-neutral-50' } ${
157- activeCall ?. CallId === call . CallId ? ( colorScheme === 'dark' ? 'bg-primary-900' : 'bg-primary-50' ) : ''
158- } `}
172+ className = { `rounded-lg border p-4 ${ colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-800' : 'border-neutral-200 bg-neutral-50' } ${ activeCall ?. CallId === call . CallId ? ( colorScheme === 'dark' ? 'bg-primary-900' : 'bg-primary-50' ) : ''
173+ } `}
159174 testID = { `call-item-${ call . CallId } ` }
160175 >
161176 < HStack space = "md" className = "items-center justify-between" >
0 commit comments