Feature/notification system #26

Open
mattdimegs wants to merge 34 commits from feature/notification-system into main
2 changed files with 24 additions and 19 deletions
Showing only changes of commit 4d21fbebf8 - Show all commits

View file

@ -86,17 +86,22 @@ const formatCallDateTime = (callValue) => {
const getIncidents = async (departments, incidentStatus) => {
let response;
try {
response = await fetch(`${process.env.EXPO_PUBLIC_DATABASE_URL}/getRecentCalls/${5}`, {
method: "GET",
response = await fetch(`${process.env.EXPO_PUBLIC_DATABASE_URL}/getCallsParams`, {
method: "POST",
headers: {
apiKey: process.env.EXPO_PUBLIC_DATABASE_API_KEY
apiKey: process.env.EXPO_PUBLIC_DATABASE_API_KEY,
"Content-Type": 'application/json'
},
// body: JSON.stringify({
// callCount: 25,
// departments,
// status: incidentStatus,
// }),
body: JSON.stringify({
numCalls: 25,
departments,
status: incidentStatus
}),
});
console.log('response: ', response);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
} catch (e) {
console.error("Failed to fetch initial calls:", e);
}
@ -115,7 +120,7 @@ export const useCallFeed = () => {
useEffect(() => {
async function fetchData() {
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.id }), selectedStatus?.id);
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.deptId }), selectedStatus?.id);
setAllCalls(incidents);
setInit(false);
}
@ -133,7 +138,7 @@ export const useCallFeed = () => {
useEffect(() => {
async function fetchData() {
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.id }), selectedStatus?.id);
const incidents = await getIncidents(InitList?.map((dept) => { return dept?.deptId }), selectedStatus?.id);
setAllCalls(incidents);
}
if (!init) {
@ -144,13 +149,13 @@ export const useCallFeed = () => {
const callColorSelector = (callAcuity, cardiacArrestCall, status) => {
if (status?.toLowerCase() === "closed") {
return "#0000CD";
} else if (CriticalCallList.includes(cardiacArrestCall)) {
} else if (CriticalCallList.some(critical => cardiacArrestCall.includes(critical))) {
return "#8B0000";
} else if (HighCallList.includes(callAcuity)) {
} else if (HighCallList.some(high => callAcuity.includes(high))) {
return "#FF0000";
} else if (MediumCallList.includes(callAcuity)) {
} else if (MediumCallList.some(medium => callAcuity.includes(medium))) {
return "#FF8C00";
} else if (LowCallList.includes(callAcuity)) {
} else if (LowCallList.some(low => callAcuity.includes(low))) {
return "#228B22";
}
return "grey";

View file

@ -9,7 +9,7 @@ const departmentTypeMap = {
const accountDetails = {
"CallThemes" : {
"CriticalCallList": [
"CARDIAC ARREST|DEATH",
"CARDIAC ARREST"
],
"HighCallList": [
"EMS ALS PRIORITY (ALS)",
@ -42,7 +42,7 @@ const accountDetails = {
},
"InitList": [
{
deptId: 0,
deptId: 1,
dept: 'Darien EMS',
addDepts: [
'Darien EMS Supv'
@ -58,7 +58,7 @@ const accountDetails = {
hasVolunteer: true,
},
{
deptId: 1,
deptId: 2,
dept: 'Noroton Fire Department',
deptAbv: 'NFD',
rank: 'Lieutenant',
@ -71,8 +71,8 @@ const accountDetails = {
hasVolunteer: true,
},
{
deptId: 2,
dept: 'Stamford Fire Department',
deptId: 3,
dept: 'Stamford Fire Rescue',
deptAbv: 'SFD',
rank: 'Paramedic',
rankAbv: 'EMT-P',