Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/__tests__/app/call/[id].security.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ jest.mock('../../../components/status/status-bottom-sheet', () => ({
StatusBottomSheet: () => <div data-testid="status-bottom-sheet">Status Sheet</div>,
}));

// The dispatch selection modal is now a gluestack Actionsheet; importing the real one
// pulls in @gluestack-ui overlay code that needs the full react-native StatusBar, which
// this suite's minimal react-native mock does not provide. Mock it like the other sheets.
jest.mock('../../../components/calls/dispatch-selection-modal', () => ({
DispatchSelectionModal: () => <div data-testid="dispatch-selection-modal">Dispatch Selection</div>,
}));

jest.mock('@/components/incident-command/incident-command-tab', () => ({
IncidentCommandTab: () => <div data-testid="incident-command-tab">Incident Command Tab</div>,
}));
Expand Down
18 changes: 9 additions & 9 deletions src/app/call/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export default function CallDetail() {
title: t('call_detail.tabs.info'),
icon: <InfoIcon size={16} />,
content: (
<Box className={`p-4 shadow-xs ${colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-100'}`}>
<Box className="p-4">
<VStack className="space-y-3">
<Box className="border-b border-outline-100 pb-2">
<Text className="text-sm text-gray-500">{t('call_detail.priority')}</Text>
Expand Down Expand Up @@ -483,7 +483,7 @@ export default function CallDetail() {
{callExtraData?.Protocols && callExtraData.Protocols.length > 0 ? (
<VStack className="space-y-3">
{callExtraData.Protocols.map((protocol, index) => (
<Box key={index} className="rounded-lg bg-gray-50 p-3 dark:bg-gray-800">
<Box key={index} className="rounded-lg bg-gray-50 p-3 dark:bg-gray-700">
<Text className="font-semibold">{protocol.Name}</Text>
<Text className="text-sm text-gray-600 dark:text-gray-400">{protocol.Description}</Text>
<Box>
Expand Down Expand Up @@ -554,7 +554,7 @@ export default function CallDetail() {
{callExtraData?.Dispatches && callExtraData.Dispatches.length > 0 ? (
<VStack className="space-y-3">
{callExtraData.Dispatches.map((dispatched, index) => (
<Box key={index} className={`rounded-lg p-3 ${colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-100'}`}>
<Box key={index} className="rounded-lg bg-gray-50 p-3 dark:bg-gray-700">
<Text className="font-semibold">{dispatched.Name}</Text>
<HStack className="mt-1">
<Text className="mr-2 text-sm text-gray-600">
Expand Down Expand Up @@ -655,9 +655,9 @@ export default function CallDetail() {
headerBackTitle: '',
}}
/>
<ScrollView className={`size-full w-full flex-1 ${colorScheme === 'dark' ? 'bg-neutral-950' : 'bg-neutral-50'}`}>
<ScrollView className="size-full w-full flex-1 bg-gray-50 dark:bg-gray-900" contentContainerStyle={{ paddingBottom: 16 }}>
{/* Header */}
<Box className={`p-4 shadow-xs ${colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-100'}`}>
<Box className="mx-4 mt-3 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<HStack className="mb-2 items-center justify-between">
<Heading size="md">
{call.Name} ({call.Number})
Expand Down Expand Up @@ -708,9 +708,9 @@ export default function CallDetail() {
</Box>

{/* Map (toggles between the call address and the destination POI when one exists) */}
<Box className="w-full">
<Box className="mx-4 mt-3 overflow-hidden rounded-xl shadow-xs">
{hasDestinationLocation ? (
<HStack className={`px-4 pt-3 ${colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-100'}`} space="sm">
<HStack className="bg-white px-4 py-3 dark:bg-gray-800" space="sm">
<Button variant={mapView === 'call' ? 'solid' : 'outline'} size="sm" className="flex-1" onPress={() => setMapView('call')}>
<ButtonIcon as={MapPinIcon} className="mr-1" />
<ButtonText className={isLandscape ? '' : 'text-xs'}>{t('call_detail.map_call')}</ButtonText>
Expand All @@ -725,7 +725,7 @@ export default function CallDetail() {
</Box>

{/* Action Buttons */}
<HStack className={`justify-around p-4 shadow-xs ${colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-100'}`}>
<HStack className="mx-4 mt-3 justify-around rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<Box className="relative mx-1 flex-1">
<Button onPress={() => openNotesModal()} variant="outline" className="w-full" size={isLandscape ? 'md' : 'sm'}>
<ButtonIcon as={FileTextIcon} />
Expand Down Expand Up @@ -779,7 +779,7 @@ export default function CallDetail() {
</HStack>

{/* Tabs */}
<Box className={`mt-4 flex-1 pb-8 ${colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-100'}`}>
<Box className="mx-4 mb-4 mt-3 flex-1 overflow-hidden rounded-xl bg-white pb-8 shadow-xs dark:bg-gray-800">
<SharedTabs tabs={renderTabs()} variant="underlined" size={isLandscape ? 'md' : 'sm'} />
</Box>
</ScrollView>
Expand Down
4 changes: 1 addition & 3 deletions src/app/call/[id]/command.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Stack, useLocalSearchParams } from 'expo-router';
import { useColorScheme } from 'nativewind';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ScrollView } from 'react-native';
Expand All @@ -12,12 +11,11 @@ export default function CallCommandBoard() {
const { id } = useLocalSearchParams();
const callId = Array.isArray(id) ? id[0] : id;
const { t } = useTranslation();
const { colorScheme } = useColorScheme();

return (
<>
<Stack.Screen options={{ title: t('incident_command.title'), headerShown: true, headerBackTitle: '' }} />
<ScrollView className={`size-full flex-1 ${colorScheme === 'dark' ? 'bg-neutral-950' : 'bg-neutral-50'}`}>
<ScrollView className="size-full flex-1 bg-gray-50 dark:bg-gray-900">
<FocusAwareStatusBar />
{callId ? <IncidentCommandTab callId={callId} /> : null}
</ScrollView>
Expand Down
24 changes: 12 additions & 12 deletions src/app/call/[id]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ export default function EditCall() {
}}
/>
<View className="size-full flex-1">
<Box className={`size-full w-full flex-1 ${colorScheme === 'dark' ? 'bg-neutral-950' : 'bg-neutral-50'}`}>
<Box className="size-full w-full flex-1 bg-gray-50 dark:bg-gray-900">
<ScrollView className="flex-1 px-4 py-6">
<Text className="mb-6 text-2xl font-bold">{t('calls.edit_call_description')}</Text>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl isInvalid={!!errors.name}>
<FormControlLabel>
<FormControlLabelText>{t('calls.name')}</FormControlLabelText>
Expand All @@ -535,7 +535,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl isInvalid={!!errors.nature}>
<FormControlLabel>
<FormControlLabelText>{t('calls.nature')}</FormControlLabelText>
Expand All @@ -557,7 +557,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl isInvalid={!!errors.priority}>
<FormControlLabel>
<FormControlLabelText>{t('calls.priority')}</FormControlLabelText>
Expand Down Expand Up @@ -590,7 +590,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl isInvalid={!!errors.type}>
<FormControlLabel>
<FormControlLabelText>{t('calls.type')}</FormControlLabelText>
Expand Down Expand Up @@ -623,7 +623,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl>
<FormControlLabel>
<FormControlLabelText>{t('calls.note')}</FormControlLabelText>
Expand All @@ -640,7 +640,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<Text className="mb-4 text-lg font-semibold">{t('calls.call_location')}</Text>

{/* Address Field */}
Expand Down Expand Up @@ -707,7 +707,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl>
<FormControlLabel>
<FormControlLabelText>{t('calls.contact_name')}</FormControlLabelText>
Expand All @@ -724,7 +724,7 @@ export default function EditCall() {
</FormControl>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<FormControl>
<FormControlLabel>
<FormControlLabelText>{t('calls.contact_info')}</FormControlLabelText>
Expand All @@ -742,7 +742,7 @@ export default function EditCall() {
</Card>

{/* Additional Fields (UDF) */}
<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<TouchableOpacity className="flex-row items-center justify-between" onPress={() => setIsAdditionalFieldsExpanded((prev) => !prev)}>
<Text className="text-lg font-semibold">{t('calls.additional_fields', 'Additional Fields')}</Text>
{isAdditionalFieldsExpanded ? <ChevronUpIcon size={16} color={colorScheme === 'dark' ? '#9ca3af' : '#6b7280'} /> : <ChevronDownIcon size={16} color={colorScheme === 'dark' ? '#9ca3af' : '#6b7280'} />}
Expand All @@ -754,14 +754,14 @@ export default function EditCall() {
) : null}
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<Text className="mb-4 text-lg font-semibold">{t('calls.dispatch_to')}</Text>
<Button onPress={() => setShowDispatchModal(true)} className="w-full">
<ButtonText>{getDispatchSummary()}</ButtonText>
</Button>
</Card>

<Card className={`mb-8 rounded-lg border p-4 ${colorScheme === 'dark' ? 'border-neutral-800 bg-neutral-900' : 'border-neutral-200 bg-white'}`}>
<Card className="mb-4 rounded-xl bg-white p-4 shadow-xs dark:bg-gray-800">
<View className="flex-row items-center justify-between">
<View className="mr-3 flex-1">
<Text className="text-base font-semibold">{t('calls.notify_cancelled_entities')}</Text>
Expand Down
Loading
Loading