Skip to content

Commit

Permalink
feat(AdminNotifications): update emailReceipients to groupUsers and a…
Browse files Browse the repository at this point in the history
…dd state to control which "group" value is displayed when the user makes a radio button selection
  • Loading branch information
ryandotfurrer committed Oct 10, 2024
1 parent 7e23ba9 commit a1a3084
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/(admin)/admin/notifications/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import React, { useEffect } from 'react';
*/
const AdminNotifications = (): JSX.Element => {
const [content, setContent] = useState<string>('');
const [emailSubjects, setEmailSubjects] = useState<string>('all users');
const [groupUsers, setGroupUsers] = useState<string[]>([]);
const [leagueName, setLeagueName] = useState<string>('');
const [subject, setSubject] = useState<string>('');
const [emailRecipients, setEmailRecipients] = useState<string>('');

/**
* To grab all users from the league.
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -143,7 +144,7 @@ const AdminNotifications = (): JSX.Element => {
<p>
This email will be sent to{' '}
<span className="font-bold text-orange-500">
{emailRecipients.toLowerCase()}
{emailSubjects.toLowerCase()}
</span>{' '}
in <span className="font-bold text-orange-500">{leagueName}</span>
</p>
Expand Down

0 comments on commit a1a3084

Please sign in to comment.