Skip to content

Commit

Permalink
added notification if phone is inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Sep 10, 2024
1 parent bbbeaf6 commit 3c524af
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/containers/Chat/ChatMessages/StatusBar/StatusBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { useQuery } from '@apollo/client';
import { getUserSession } from 'services/AuthService';
import { BSPBALANCE, GET_ORGANIZATION_STATUS } from 'graphql/queries/Organization';
import styles from './StatusBar.module.css';
import { GET_WA_MANAGED_PHONES, GET_WA_MANAGED_PHONES_STATUS } from 'graphql/queries/WaGroups';
import { GET_WA_MANAGED_PHONES_STATUS } from 'graphql/queries/WaGroups';
import { useLocation } from 'react-router';

const StatusBar = () => {
const location = useLocation();
const variables = { organizationId: getUserSession('organizationId') };

// get gupshup balance
Expand All @@ -17,7 +19,7 @@ const StatusBar = () => {
});

const { data } = useQuery(GET_WA_MANAGED_PHONES_STATUS);
console.log(data);
const hasInactivePhone = data?.waManagedPhones?.some((phone: any) => phone.status !== 'active');

if (!balanceData && !orgStatus) {
return null;
Expand All @@ -36,6 +38,9 @@ const StatusBar = () => {
} else if (balance <= 0) {
statusMessage =
'All the outgoing messages have been suspended. Please note: on recharging, the messages that were stuck will not be sent.';
} else if (hasInactivePhone && location.pathname.includes('group')) {
statusMessage =
'One or more of your phones are not active. Please check the status of your phones to ensure smooth message delivery.';
}
}

Expand Down

0 comments on commit 3c524af

Please sign in to comment.