Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions src/components/sidebar/call-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { useColorScheme } from 'nativewind';
import * as React from 'react';
import { useTranslation } from 'react-i18next';
import { Alert, Pressable, ScrollView } from 'react-native';
import { Alert, Platform, Pressable, ScrollView } from 'react-native';

import { CustomBottomSheet } from '@/components/ui/bottom-sheet';
import { Text } from '@/components/ui/text';
Expand Down Expand Up @@ -40,6 +40,14 @@
});

const handleDeselect = () => {
if (Platform.OS === 'web') {
const confirmed = window.confirm(`${t('calls.confirm_deselect_title')}\n${t('calls.confirm_deselect_message')}`);
if (confirmed) {
setActiveCall(null);
}
return;
}

Alert.alert(
t('calls.confirm_deselect_title'),
t('calls.confirm_deselect_message'),
Expand All @@ -66,6 +74,14 @@
return hasCoordinates || hasAddress;
};

const showLocationAlert = () => {
if (Platform.OS === 'web') {
window.alert(`${t('calls.no_location_title')}\n${t('calls.no_location_message')}`);
} else {
Alert.alert(t('calls.no_location_title'), t('calls.no_location_message'), [{ text: t('common.ok') }]);
}
};

const handleDirections = async () => {
if (!activeCall) return;

Expand All @@ -77,19 +93,19 @@
if (latitude && longitude) {
try {
await openMapsWithDirections(latitude, longitude, address);
} catch (error) {
Alert.alert(t('calls.no_location_title'), t('calls.no_location_message'), [{ text: t('common.ok') }]);
} catch {
showLocationAlert();
}
} else if (address && address.trim() !== '') {
// Fall back to address if no coordinates
try {
await openMapsWithAddress(address);
} catch (error) {
Alert.alert(t('calls.no_location_title'), t('calls.no_location_message'), [{ text: t('common.ok') }]);
} catch {
showLocationAlert();
}
} else {
// No location data available
Alert.alert(t('calls.no_location_title'), t('calls.no_location_message'), [{ text: t('common.ok') }]);
showLocationAlert();
}
};

Expand Down Expand Up @@ -153,9 +169,8 @@
console.error('Failed to handle call selection:', error);
});
}}
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') : ''
}`}
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') : ''

Check warning on line 172 in src/components/sidebar/call-sidebar.tsx

View workflow job for this annotation

GitHub Actions / test

Insert `⏎····················`
}`}

Check warning on line 173 in src/components/sidebar/call-sidebar.tsx

View workflow job for this annotation

GitHub Actions / test

Delete `··`
Comment on lines +172 to +173
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting per linter.

Static analysis flagged whitespace issues on these lines. The multi-line template literal has trailing spaces and a missing line break.

Suggested fix
-                  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') : ''
-                    }`}
+                  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') : ''
+                  }`}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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') : ''
}`}
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') : ''
}`}
🧰 Tools
🪛 GitHub Check: test

[warning] 173-173:
Delete ··


[warning] 172-172:
Insert ⏎····················

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/sidebar/call-sidebar.tsx` around lines 172 - 173, The
className template literal for the call item has trailing spaces and a missing
line break; open the template on one line and split conditional parts cleanly to
avoid trailing spaces and ensure the closing backtick and closing
brace/parenthesis are on their own line. Locate the JSX attribute using
className on the call item (references: activeCall, CallId, call, colorScheme)
and reformat the multi-line template literal so each conditional segment is
concatenated without trailing whitespace and the final closing `}` and `)` are
placed on a new line to satisfy the linter.

testID={`call-item-${call.CallId}`}
>
<HStack space="md" className="items-center justify-between">
Expand Down
Loading