Skip to content

Commit

Permalink
feat: add email reminders for partner users (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
annarhughes committed Sep 11, 2024
1 parent 88ee561 commit 1f1ecfa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
23 changes: 9 additions & 14 deletions components/forms/AboutYouSetAForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const AboutYouSetAForm = () => {
const user = useTypedSelector((state) => state.user);
const partnerAccesses = useTypedSelector((state) => state.partnerAccesses);
const partnerAdmin = useTypedSelector((state) => state.partnerAdmin);
const isPublicUser = partnerAccesses.length === 0 && !partnerAdmin.id;

const scaleQuestions: ScaleFieldItem[] = [
{ name: 'Q1', inputState: scale1Input, inputStateSetter: setScale1Input },
Expand Down Expand Up @@ -187,19 +186,15 @@ const AboutYouSetAForm = () => {
))}

{/* Additional user setting for email reminders frequency */}
{isPublicUser && (
<>
<Typography mt={3} mb={1.5}>
{tAccount('introduction')}
</Typography>
<Typography>{tAccount('description')}</Typography>
<EmailRemindersSettingsFormControl
selectedInput={emailRemindersSettingInput}
setSelectedInput={setEmailRemindersSettingInput}
/>
<Typography variant="body2">{tAccount('update')}</Typography>
</>
)}
<Typography mt={3} mb={1.5}>
{tAccount('introduction')}
</Typography>
<Typography>{tAccount('description')}</Typography>
<EmailRemindersSettingsFormControl
selectedInput={emailRemindersSettingInput}
setSelectedInput={setEmailRemindersSettingInput}
/>
<Typography variant="body2">{tAccount('update')}</Typography>

{formError && (
<Typography color="error.main" mb={2}>
Expand Down
3 changes: 1 addition & 2 deletions pages/account/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const AccountSettings: NextPage = () => {
const t = useTranslations('Account.accountSettings');
const partnerAccesses = useTypedSelector((state) => state.partnerAccesses);
const partnerAdmin = useTypedSelector((state) => state.partnerAdmin);
const isPublicUser = partnerAccesses.length === 0 && !partnerAdmin.id;

const headerProps = {
title: t('title'),
Expand All @@ -57,7 +56,7 @@ const AccountSettings: NextPage = () => {
</Box>
<Box sx={columnContainerStyle}>
<AccountActionsCard />
{isPublicUser && <EmailRemindersSettingsCard />}
<EmailRemindersSettingsCard />
</Box>
</Container>
</Box>
Expand Down
3 changes: 1 addition & 2 deletions pages/courses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const CourseList: NextPage<Props> = ({ stories }) => {
const partnerAccesses = useTypedSelector((state) => state.partnerAccesses);
const partnerAdmin = useTypedSelector((state) => state.partnerAdmin);
const courses = useTypedSelector((state) => state.courses);
const isPublicUser = partnerAccesses.length === 0 && !partnerAdmin.id;

const eventUserData = getEventUserData(userCreatedAt, partnerAccesses, partnerAdmin);
const liveCourseAccess = partnerAccesses.length === 0 && !partnerAdmin.id;
Expand Down Expand Up @@ -240,7 +239,7 @@ const CourseList: NextPage<Props> = ({ stories }) => {
</Box>
)}
</Container>
{!!showEmailRemindersBanner && isPublicUser && <EmailRemindersSettingsBanner />}
{!!showEmailRemindersBanner && <EmailRemindersSettingsBanner />}
</Box>
);
};
Expand Down

0 comments on commit 1f1ecfa

Please sign in to comment.