Skip to content

Commit

Permalink
Add unsub setting for weekly email to account page #519
Browse files Browse the repository at this point in the history
  • Loading branch information
mdirolf committed May 28, 2024
1 parent b0dcaca commit 6a5c4fe
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion app/pages/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ const UnsubSetting = (props: UnsubSettingProps) => {
className="marginRight1em"
type="checkbox"
disabled={!props.neverDisable && unsubbedAll}
checked={props.invert ? unsubbed : !unsubbed && !unsubbedAll}
checked={
props.invert
? unsubbed
: !unsubbed && (props.neverDisable || !unsubbedAll)
}
onChange={logAsyncErrors(async (e) => {
await setDoc(
getDocRef('prefs', props.userId),
Expand Down Expand Up @@ -131,6 +135,19 @@ export const AccountPage = ({ user, constructorPage, prefs }: AuthProps) => {
is displayed next to any comments you make or puzzles you create.
</p>
<DisplayNameForm />
<h3>Newsletter</h3>
<p>Email me (to {user.email}, at most once per week):</p>
<ul className="listStyleTypeNone">
<li>
<UnsubSetting
prefs={prefs}
userId={user.uid}
flag="weekly"
neverDisable
text="A write up of the most popular puzzles in the previous week along with any Crosshare announcements"
/>
</li>
</ul>
<h3>Notification Settings</h3>
<p>Email me (to {user.email}, at most once per day) when:</p>
<ul className="listStyleTypeNone">
Expand Down

0 comments on commit 6a5c4fe

Please sign in to comment.