Skip to content

Commit

Permalink
added names to notifications (#75)
Browse files Browse the repository at this point in the history
* added names to notifications

* minor spacing fix

---------

Co-authored-by: Kristen Yee <[email protected]>
Co-authored-by: ThatMegamind <[email protected]>
Co-authored-by: ThatMegamind <[email protected]>
  • Loading branch information
4 people authored Apr 18, 2024
1 parent 457301b commit 9e801b7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/components/Notifications/AccountNotification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const AccountNotification = ({
{/* No accordion for 1 account notification */}
<Text pb="4">
<Text color="blue.600" as="b" display="inline">
{accounts?.[0]?.email}{' '}
{accounts?.[0]?.firstName} ({accounts?.[0]?.email}){' '}
</Text>
<Text as="span" display="inline" whiteSpace="wrap">
is requesting account approval...
Expand All @@ -142,7 +142,7 @@ const AccountNotification = ({
{/* Accordion for >1 account notification in block */}
<Text pb="4">
<Text as="b" color="blue.600">
{accounts?.[0]?.email} and {accounts?.length - 1} other
{accounts?.[0]?.firstName} and {accounts?.length - 1} other
{accounts?.length - 1 > 1 && 's'}{' '}
</Text>
<Text as="span" display="inline" whiteSpace="wrap">
Expand Down Expand Up @@ -179,11 +179,14 @@ const AccountNotification = ({
</Container>
<AccordionPanel whiteSpace="wrap" paddingLeft="3.25rem">
<Grid templateColumns="1fr auto" gap={6}>
{accounts?.map(({ id, email, approveCallback, declineCallback, undoCallback }) => (
{accounts?.map(({ id, firstName, email, approveCallback, declineCallback, undoCallback }) => (
<React.Fragment key={id}>
<GridItem>
<Text color="blue.600" decoration="underline">
{email}
<Text as="b" color="blue.600" decoration="underline">
{firstName}{' '}
</Text>
<Text as="span" color="blue.600" decoration="underline">
({email})
</Text>
</GridItem>
<GridItem>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Notifications/NotificationElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ class AccountNotificationBlock extends NotificationBlock {
this.pendingAccounts = [];
}

addPendingAccount(id, email, approveCallback, declineCallback, undoCallback) {
addPendingAccount(id, firstName, email, approveCallback, declineCallback, undoCallback) {
this.pendingAccounts.push({
id: id,
firstName: firstName,
email: email,
approveCallback: approveCallback,
declineCallback: declineCallback,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Notifications/Notifications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Notifications = () => {
// Map MM-DD-YY string to AccountNotificationBlock
const accountsMap = new Map();

pendingAccounts.forEach(({ approvedOn, email, id }) => {
pendingAccounts.forEach(({ approvedOn, email, id, firstName }) => {
const { dateObject, formattedDateString } = getDateFromISOString(approvedOn);
let notificationBlock;

Expand All @@ -90,6 +90,7 @@ const Notifications = () => {

notificationBlock.addPendingAccount(
id,
firstName,
email,
async () => {
await approveAccount(id);
Expand Down

0 comments on commit 9e801b7

Please sign in to comment.