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] = const [emailNotificationSettings, setEmailNotificationSettings] =
useState<notification_subscribe_types>('all') useState<notification_subscribe_types>('all')
const [privateUser, setPrivateUser] = useState<PrivateUser | null>(null) const [privateUser, setPrivateUser] = useState<PrivateUser | null>(null)
const [showSettings, setShowSettings] = useState<'in-app' | 'email' | 'none'>(
'none'
)
useEffect(() => { useEffect(() => {
if (user) listenForPrivateUser(user.id, setPrivateUser) if (user) listenForPrivateUser(user.id, setPrivateUser)
@ -310,7 +307,6 @@ function NotificationSettings() {
const success = 'Notification Settings Changed!' const success = 'Notification Settings Changed!'
function changeEmailNotifications(newValue: notification_subscribe_types) { function changeEmailNotifications(newValue: notification_subscribe_types) {
if (!privateUser) return if (!privateUser) return
setShowSettings('email')
if (newValue === 'all') { if (newValue === 'all') {
toast.promise( toast.promise(
updatePrivateUser(privateUser.id, { updatePrivateUser(privateUser.id, {
@ -367,7 +363,6 @@ function NotificationSettings() {
error: (err) => `${err.message}`, error: (err) => `${err.message}`,
} }
) )
setShowSettings('in-app')
} }
useEffect(() => { useEffect(() => {
@ -407,6 +402,29 @@ function NotificationSettings() {
className={'col-span-4 p-2'} className={'col-span-4 p-2'}
toggleClassName={'w-24'} toggleClassName={'w-24'}
/> />
<div className={'mt-4 text-sm'}>
<div>
<div className={''}>
You will receive notifications for:
<NotificationSettingLine
label={"Resolution of questions you've interacted with"}
highlight={notificationSettings !== 'none'}
/>
<NotificationSettingLine
highlight={notificationSettings !== 'none'}
label={'Activity on your own questions, comments, & answers'}
/>
<NotificationSettingLine
highlight={notificationSettings !== 'none'}
label={"Activity on questions you're betting on"}
/>
<NotificationSettingLine
label={"Activity on questions you've ever bet or commented on"}
highlight={notificationSettings === 'all'}
/>
</div>
</div>
</div>
<div className={'mt-4'}>Email Notifications</div> <div className={'mt-4'}>Email Notifications</div>
<ChoicesToggleGroup <ChoicesToggleGroup
currentChoice={emailNotificationSettings} currentChoice={emailNotificationSettings}
@ -417,52 +435,26 @@ function NotificationSettings() {
className={'col-span-4 p-2'} className={'col-span-4 p-2'}
toggleClassName={'w-24'} toggleClassName={'w-24'}
/> />
<div className={'mt-4 text-base'}> <div className={'mt-4 text-sm'}>
{showSettings === 'in-app' ? ( <div>
<div> You will receive emails for:
<div className={''}> <NotificationSettingLine
You will receive notifications for: label={"Resolution of questions you're betting on"}
<NotificationSettingLine highlight={emailNotificationSettings !== 'none'}
label={"Resolution of questions you've interacted with"} />
highlight={notificationSettings !== 'none'} <NotificationSettingLine
/> label={'Closure of your questions'}
<NotificationSettingLine highlight={emailNotificationSettings !== 'none'}
highlight={notificationSettings !== 'none'} />
label={'Activity on your own questions, comments, & answers'} <NotificationSettingLine
/> label={'Activity on your questions'}
<NotificationSettingLine highlight={emailNotificationSettings === 'all'}
highlight={notificationSettings !== 'none'} />
label={"Activity on questions you're betting on"} <NotificationSettingLine
/> label={"Activity on questions you've answered or commented on"}
<NotificationSettingLine highlight={emailNotificationSettings === 'all'}
label={"Activity on questions you've ever bet or commented on"} />
highlight={notificationSettings === 'all'} </div>
/>
</div>
</div>
) : showSettings === 'email' ? (
<div>
You will receive emails for:
<NotificationSettingLine
label={"Resolution of questions you're betting on"}
highlight={emailNotificationSettings !== 'none'}
/>
<NotificationSettingLine
label={'Closure of your questions'}
highlight={emailNotificationSettings !== 'none'}
/>
<NotificationSettingLine
label={'Activity on your questions'}
highlight={emailNotificationSettings === 'all'}
/>
<NotificationSettingLine
label={"Activity on questions you've answered or commented on"}
highlight={emailNotificationSettings === 'all'}
/>
</div>
) : (
<div />
)}
</div> </div>
</div> </div>
) )