Skip to content

Commit db494ba

Browse files
Update from samaritans.org e71f9f4d
1 parent 7b6ba6d commit db494ba

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

static_src/sass/components/_form-item.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@
420420
}
421421

422422
// Avoids the callout covering the top of error message text for PhoneNumberFields
423-
&--only_uk_and_roi_phone_number_form_field, &--uk_and_roi_phone_number_widget {
423+
&--only_uk_and_roi_phone_number_form_field,
424+
&--uk_and_roi_phone_number_widget {
424425
.errorlist {
425426
margin-top: 10px;
426427
}

static_src/typescript/App.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ const App = () => {
3939
);
4040

4141
// The queue is available if it is open and there are agents staffed.
42-
const { isOpen, agentsStaffed } = useSelector(
42+
const { isOpen, isAtQueueLimit, agentsStaffed } = useSelector(
4343
(state: RootState) => state.queue,
4444
);
4545
const isQueueAvailable =
46-
isOpen && agentsStaffed !== null && agentsStaffed > 0;
46+
isOpen &&
47+
agentsStaffed !== null &&
48+
agentsStaffed > 0 &&
49+
!isAtQueueLimit;
4750

4851
/**
4952
* Loading the LexWebUi

static_src/typescript/screens/WaitingScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ const WaitingScreen = () => {
6767
useEffect(() => {
6868
dispatch(refreshQueueStatus())
6969
.unwrap()
70-
.then(({ is_open, agents_staffed }) => {
71-
const queueAvailable = is_open && agents_staffed > 0;
70+
.then(({ is_open, is_at_queue_limit, agents_staffed }) => {
71+
const queueAvailable =
72+
is_open && agents_staffed > 0 && !is_at_queue_limit;
7273

7374
if (!queueAvailable) {
7475
dispatch(setScreen('landing'));

static_src/typescript/slices/queueSlice.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type QueueState = {
99
agentsOnline: number | null;
1010
agentsAvailable: number | null;
1111
isOpen: boolean | null;
12+
isAtQueueLimit: boolean | null;
1213
averageQueueAnswerTime: number | null;
1314
averageQueueAnswerTimePeriod: 'Hour' | 'Day' | 'Week' | null;
1415
};
@@ -19,6 +20,7 @@ const initialState: QueueState = {
1920
agentsOnline: null,
2021
agentsAvailable: null,
2122
isOpen: null,
23+
isAtQueueLimit: null,
2224
averageQueueAnswerTime: null,
2325
averageQueueAnswerTimePeriod: null,
2426
};
@@ -46,12 +48,15 @@ export const queueSlice = createSlice({
4648
state.agentsOnline = action.payload.agents_online;
4749
state.agentsAvailable = action.payload.agents_available;
4850
state.isOpen = action.payload.is_open;
51+
state.isAtQueueLimit = action.payload.is_at_queue_limit;
4952
state.averageQueueAnswerTime = action.payload.avg_queue_answer_time;
5053
state.averageQueueAnswerTimePeriod =
5154
action.payload.avg_queue_answer_time_period;
5255
});
5356
builder.addCase(refreshQueueStatus.rejected, (state) => {
5457
if (state.lastUpdated === null) {
58+
// If this is the first time we're fetching the queue status and it fails,
59+
// assume the queue is closed.
5560
state.lastUpdated = Date.now();
5661
state.isOpen = false;
5762
}

static_src/typescript/utils/queue-status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type QueueStatusResponse = {
55
agents_online: number;
66
agents_available: number;
77
is_open: boolean;
8+
is_at_queue_limit: boolean;
89
avg_queue_answer_time: number;
910
avg_queue_answer_time_period: 'Hour' | 'Day' | 'Week';
1011
};

0 commit comments

Comments
 (0)