Feature/notification system #26

Open
mattdimegs wants to merge 34 commits from feature/notification-system into main
Showing only changes of commit 34e0325f37 - Show all commits

View file

@ -6,8 +6,8 @@ import { Platform, Linking, View, ScrollView, Text, TouchableOpacity } from 'rea
import { StatusBar } from 'expo-status-bar';
import { SafeAreaView } from 'react-native-safe-area-context';
import {
PageHeader,
PageFooter,
PageHeader,
PageFooter,
} from '@/components/generalHelpers.jsx';
import { Ionicons } from '@expo/vector-icons';
import { AccidentAndEmergency } from "healthicons-react-native/dist/outline";
@ -20,41 +20,41 @@ export default function Incidents() {
const callFeed = useCallFeed();
const {
departments,
callIconMap,
callDetails,
callColorSelector,
formatCallTimePast,
formatCallDateTime
departments,
callIconMap,
callDetails,
callColorSelector,
formatCallTimePast,
formatCallDateTime
} = callFeed;
const sortedAndFilteredCalls = callDetails
.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp))
.filter((item, index, self) => {
return index === self.findIndex(i => {
return `${i?.data?.Incident?.IncID}${i?.data?.Response?.ServiceName}` === `${item?.data?.Incident?.IncID}${item?.data?.Response?.ServiceName}`
});
.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp))
.filter((item, index, self) => {
return index === self.findIndex(i => {
return `${i?.data?.Incident?.IncID}${i?.data?.Response?.ServiceName}` === `${item?.data?.Incident?.IncID}${item?.data?.Response?.ServiceName}`
});
});
const {
departmentTypeMap,
accountDetails,
deptList,
setDeptList,
selectedDepartment,
setSelectedDepartment,
updateSelectedDepartment,
selectedDepartmentColorPicker,
departmentTypeMap,
accountDetails,
deptList,
setDeptList,
selectedDepartment,
setSelectedDepartment,
updateSelectedDepartment,
selectedDepartmentColorPicker,
} = departments;
return (
<React.Fragment>
<PageHeader>
<View
style={{
flexDirection: 'column',
height: 80,
alignItems: 'center',
<View
style={{
flexDirection: 'column',
height: 80,
alignItems: 'center',
justifyContent: 'flex-end',
paddingBottom: 7
}}
@ -75,10 +75,10 @@ export default function Incidents() {
actionSheetRef.current?.show();
}}
>
<Text
style={{
color: selectedDepartmentColorPicker(selectedDepartment?.type),
fontWeight: 600,
<Text
style={{
color: selectedDepartmentColorPicker(selectedDepartment?.type),
fontWeight: 600,
fontSize: 14
}}
>
@ -88,11 +88,11 @@ export default function Incidents() {
</View>
</PageHeader>
<ScrollView>
<StatusBar style="dark" />
<SafeAreaView />
<View style={{ flexDirection: 'column', padding: 20 }}>
{sortedAndFilteredCalls?.length ? (
sortedAndFilteredCalls?.map((callItem, index) => {
<StatusBar style="dark" />
<SafeAreaView />
<View style={{ flexDirection: 'column', padding: 20 }}>
{sortedAndFilteredCalls?.length ? (
sortedAndFilteredCalls?.map((callItem, index) => {
const { data: call, timestamp } = callItem;
const { Incident, Address, Response } = call;
const {
@ -115,8 +115,8 @@ export default function Incidents() {
} = Response;
const SelectedIcon = callIconMap[IncNature] || AccidentAndEmergency;
return (
<TouchableOpacity
key={`callDetails - ${timestamp}`}
<TouchableOpacity
key={`callDetails - ${timestamp}`}
style={{ padding: 2 }}
onPress={() => {
router.push({
@ -127,14 +127,14 @@ export default function Incidents() {
})
}}
>
<View
<View
style={{
borderRadius: 12,
elevation: 3,
backgroundColor: '#fff',
shadowOffset: { width: 0, height: 0 },
shadowColor: callColorSelector(
IncNatureCode,
IncNatureCode,
IncNature,
Status
),
@ -145,10 +145,10 @@ export default function Incidents() {
>
<View style={{ flexDirection: 'column' }}>
<View key="callDateAndTime"
style={{
style={{
paddingBottom: 6,
flexDirection: 'row',
justifyContent: 'space-between'
flexDirection: 'row',
justifyContent: 'space-between'
}}
>
<Text style={{ fontSize: 12 }}>{formatCallDateTime(IncDate)}</Text>
@ -159,9 +159,9 @@ export default function Incidents() {
name="lock-closed-outline"
color='red'
style={{
shadowColor: 'black',
shadowColor: 'black',
shadowOffset: 0,
shadowOpacity: 1,
shadowOpacity: 1,
shadowRadius: 10
}}
/>
@ -169,53 +169,53 @@ export default function Incidents() {
</View>
</View>
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
<SelectedIcon
<SelectedIcon
color={callColorSelector(
IncNatureCode,
IncNatureCode,
IncNature,
Status
)}
opacity={0.3}
width={56}
)}
opacity={0.3}
width={56}
height={56}
/>
<View style={{ flexDirection: 'column' }}>
{LocationName ? (
<Text
style={{
color: 'black',
fontWeight: 600,
fontSize: 16
}}
>
{`${LocationName}`}
</Text>
<Text
style={{
color: 'black',
fontWeight: 600,
fontSize: 16
}}
>
{`${LocationName}`}
</Text>
) : (
<View style={{ flexDirection: 'row' }}>
<Text
<Text
style={[{
color: 'black',
fontSize: 12,
fontSize: 12,
fontWeight: 600
}]}
>
{`${StreetAddress}`}
</Text>
{AddressApartment ? (
<Text
<Text
style={[{
color: 'black',
fontSize: 12,
fontSize: 12,
fontWeight: 600
}]}
>
{` - ${AddressApartment}`}
</Text>
) : null }
<Text
) : null}
<Text
style={[{
color: 'black',
fontSize: 12,
fontSize: 12,
fontWeight: 600
}]}
>
@ -223,26 +223,26 @@ export default function Incidents() {
</Text>
</View>
)}
<Text
style={{
color: 'black',
fontWeight: 600,
fontSize: 16
<Text
style={{
color: 'black',
fontWeight: 600,
fontSize: 16
}}
>
{`${IncNature}`}
</Text>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text
style={{
color: 'black',
fontSize: 12,
<Text
style={{
color: 'black',
fontSize: 12,
textShadowColor: callColorSelector(
IncNatureCode,
IncNatureCode,
IncNature,
Status
),
textShadowRadius: 1
),
textShadowRadius: 1
}}
>
{`${IncNatureCodeDesc}`}
@ -250,14 +250,14 @@ export default function Incidents() {
</View>
</View>
<View style={{ padding: 0 }}>
<View>
<Ionicons name="chevron-forward-outline" />
</View>
<View>
<Ionicons name="chevron-forward-outline" />
</View>
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text
style={{
style={{
fontSize: 12,
}}
>
@ -277,82 +277,82 @@ export default function Incidents() {
</TouchableOpacity>
)
})) : (
<Text>There are no Calls</Text>
) }
<Text>There are no Calls</Text>
)}
</View>
</ScrollView>
<PageFooter>
<View
style={{
flexDirection: 'column',
height: 100,
alignItems: 'center',
justifyContent: 'flex-start',
paddingTop: 7
}}
</ScrollView>
<PageFooter>
<View
style={{
flexDirection: 'column',
height: 100,
alignItems: 'center',
justifyContent: 'flex-start',
paddingTop: 7
}}
/>
</PageFooter>
<DepartmentActionSheet
</PageFooter>
<DepartmentActionSheet
ref={actionSheetRef}
gestureEnabled
containerStyle={{
height: "50%",
width: "100%",
backgroundColor: '#ECEDEE',
height: "50%",
width: "100%",
backgroundColor: '#ECEDEE',
}}
>
>
<View style={{ flexDirection: 'column', padding: 20 }}>
{deptList?.map((item) => {
return (
<View style={{ padding: 2 }} key={item?.deptId}>
<TouchableOpacity
style={{
borderRadius: 6,
elevation: 3,
backgroundColor: item?.selected ? 'grey' : '#fff',
shadowOffset: { width: 1, height: 1 },
shadowColor: '#333',
shadowOpacity: 0.3,
shadowRadius: 2,
marginHorizontal: 20,
marginVertical: 6,
padding: 10
}}
onPress={() => {
actionSheetRef.current?.hide();
return updateSelectedDepartment(
selectedDepartment?.deptId,
item?.deptId
)
}}
>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text
style={{
color: selectedDepartmentColorPicker(
item?.type
),
fontWeight: 600,
fontSize: 16
}}
>
{item?.dept}
</Text>
{item?.primary ? <Ionicons name="star" size={16} color="yellow" style={{
paddingLeft: 20,
shadowColor: '#333',
shadowOffset: 1,
shadowOpacity: 1,
shadowRadius: 6
}} /> : null}
</View>
<Text>{`${item?.deptAbv} - ${departmentTypeMap[item?.type]}`}</Text>
</TouchableOpacity>
</View>
);
})}
{deptList?.map((item) => {
return (
<View style={{ padding: 2 }} key={item?.deptId}>
<TouchableOpacity
style={{
borderRadius: 6,
elevation: 3,
backgroundColor: item?.selected ? 'grey' : '#fff',
shadowOffset: { width: 1, height: 1 },
shadowColor: '#333',
shadowOpacity: 0.3,
shadowRadius: 2,
marginHorizontal: 20,
marginVertical: 6,
padding: 10
}}
onPress={() => {
actionSheetRef.current?.hide();
return updateSelectedDepartment(
selectedDepartment?.deptId,
item?.deptId
)
}}
>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<Text
style={{
color: selectedDepartmentColorPicker(
item?.type
),
fontWeight: 600,
fontSize: 16
}}
>
{item?.dept}
</Text>
{item?.primary ? <Ionicons name="star" size={16} color="yellow" style={{
paddingLeft: 20,
shadowColor: '#333',
shadowOffset: 1,
shadowOpacity: 1,
shadowRadius: 6
}} /> : null}
</View>
<Text>{`${item?.deptAbv} - ${departmentTypeMap[item?.type]}`}</Text>
</TouchableOpacity>
</View>
);
})}
</View>
</DepartmentActionSheet>
</DepartmentActionSheet>
</React.Fragment>
)
}