From a1a30844392808d31fcb5abc27e01baf9fe957c0 Mon Sep 17 00:00:00 2001 From: Ryan Furrer Date: Wed, 9 Oct 2024 20:09:51 -0400 Subject: [PATCH] feat(AdminNotifications): update emailReceipients to groupUsers and add state to control which "group" value is displayed when the user makes a radio button selection --- app/(admin)/admin/notifications/page.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/(admin)/admin/notifications/page.tsx b/app/(admin)/admin/notifications/page.tsx index 0e522b8c..5ddceac1 100644 --- a/app/(admin)/admin/notifications/page.tsx +++ b/app/(admin)/admin/notifications/page.tsx @@ -21,10 +21,10 @@ import React, { useEffect } from 'react'; */ const AdminNotifications = (): JSX.Element => { const [content, setContent] = useState(''); + const [emailSubjects, setEmailSubjects] = useState('all users'); const [groupUsers, setGroupUsers] = useState([]); const [leagueName, setLeagueName] = useState(''); const [subject, setSubject] = useState(''); - const [emailRecipients, setEmailRecipients] = useState(''); /** * To grab all users from the league. @@ -60,7 +60,8 @@ const AdminNotifications = (): JSX.Element => { * @param value - Value of the radio buttons. */ const handleRadioChange = (value: string): void => { - setEmailRecipients(value); + setGroupUsers([value]); + setEmailSubjects(value); }; useEffect(() => { @@ -143,7 +144,7 @@ const AdminNotifications = (): JSX.Element => {

This email will be sent to{' '} - {emailRecipients.toLowerCase()} + {emailSubjects.toLowerCase()} {' '} in {leagueName}