Always show notif settings details (#460)

This commit is contained in:
Ian Philips 2022-06-08 11:24:07 -06:00 committed by GitHub
parent 470e36a5a3
commit 45eb5a3e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -276,9 +276,6 @@ function NotificationSettings() {
const [emailNotificationSettings, setEmailNotificationSettings] =
useState<notification_subscribe_types>('all')
const [privateUser, setPrivateUser] = useState<PrivateUser | null>(null)
const [showSettings, setShowSettings] = useState<'in-app' | 'email' | 'none'>(
'none'
)
useEffect(() => {
if (user) listenForPrivateUser(user.id, setPrivateUser)
@ -310,7 +307,6 @@ function NotificationSettings() {
const success = 'Notification Settings Changed!'
function changeEmailNotifications(newValue: notification_subscribe_types) {
if (!privateUser) return
setShowSettings('email')
if (newValue === 'all') {
toast.promise(
updatePrivateUser(privateUser.id, {
@ -367,7 +363,6 @@ function NotificationSettings() {
error: (err) => `${err.message}`,
}
)
setShowSettings('in-app')
}
useEffect(() => {
@ -407,18 +402,7 @@ function NotificationSettings() {
className={'col-span-4 p-2'}
toggleClassName={'w-24'}
/>
<div className={'mt-4'}>Email Notifications</div>
<ChoicesToggleGroup
currentChoice={emailNotificationSettings}
choicesMap={{ All: 'all', Less: 'less', None: 'none' }}
setChoice={(choice) =>
changeEmailNotifications(choice as notification_subscribe_types)
}
className={'col-span-4 p-2'}
toggleClassName={'w-24'}
/>
<div className={'mt-4 text-base'}>
{showSettings === 'in-app' ? (
<div className={'mt-4 text-sm'}>
<div>
<div className={''}>
You will receive notifications for:
@ -440,7 +424,18 @@ function NotificationSettings() {
/>
</div>
</div>
) : showSettings === 'email' ? (
</div>
<div className={'mt-4'}>Email Notifications</div>
<ChoicesToggleGroup
currentChoice={emailNotificationSettings}
choicesMap={{ All: 'all', Less: 'less', None: 'none' }}
setChoice={(choice) =>
changeEmailNotifications(choice as notification_subscribe_types)
}
className={'col-span-4 p-2'}
toggleClassName={'w-24'}
/>
<div className={'mt-4 text-sm'}>
<div>
You will receive emails for:
<NotificationSettingLine
@ -460,9 +455,6 @@ function NotificationSettings() {
highlight={emailNotificationSettings === 'all'}
/>
</div>
) : (
<div />
)}
</div>
</div>
)