diff --git a/functions/src/emails.ts b/functions/src/emails.ts index 77d75769..44d3d7ee 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -14,9 +14,7 @@ import { formatNumericProbability } from '../../common/pseudo-numeric' import { sendTemplateEmail, sendTextEmail } from './send-email' import { getPrivateUser, getUser } from './utils' import { getFunctionUrl } from '../../common/api' -import { richTextToString } from '../../common/util/parse' import { buildCardUrl, getOpenGraphProps } from '../../common/contract-details' -import { JSONContent } from '@tiptap/core' const UNSUBSCRIBE_ENDPOINT = getFunctionUrl('unsubscribe') @@ -345,7 +343,7 @@ export const sendNewCommentEmail = async ( userId: string, commentCreator: User, contract: Contract, - commentContent: JSONContent | string, + commentText: string, commentId: string, bet?: Bet, answerText?: string, @@ -366,11 +364,6 @@ export const sendNewCommentEmail = async ( const { name: commentorName, avatarUrl: commentorAvatarUrl } = commentCreator - const text = - typeof commentContent !== 'string' - ? richTextToString(commentContent) - : commentContent - let betDescription = '' if (bet) { const { amount, sale } = bet @@ -394,7 +387,7 @@ export const sendNewCommentEmail = async ( answerNumber, commentorName, commentorAvatarUrl: commentorAvatarUrl ?? '', - comment: text, + comment: commentText, marketUrl, unsubscribeUrl, betDescription, @@ -415,7 +408,7 @@ export const sendNewCommentEmail = async ( { commentorName, commentorAvatarUrl: commentorAvatarUrl ?? '', - comment: text, + comment: commentText, marketUrl, unsubscribeUrl, betDescription, diff --git a/web/components/notification-settings.tsx b/web/components/notification-settings.tsx index cb868160..f21a3a53 100644 --- a/web/components/notification-settings.tsx +++ b/web/components/notification-settings.tsx @@ -11,15 +11,17 @@ import { updatePrivateUser } from 'web/lib/firebase/users' import { Switch } from '@headlessui/react' import { Col } from 'web/components/layout/col' import { - AdjustmentsIcon, CashIcon, ChatIcon, ChevronDownIcon, ChevronUpIcon, + CurrencyDollarIcon, + InboxInIcon, InformationCircleIcon, LightBulbIcon, TrendingUpIcon, UserIcon, + UsersIcon, } from '@heroicons/react/outline' import { WatchMarketModal } from 'web/components/contract/watch-market-modal' import { filterDefined } from 'common/util/array' @@ -93,40 +95,51 @@ export function NotificationSettings() { all_comments_on_my_markets: 'Comments on your markets', all_answers_on_my_markets: 'Answers on your markets', subsidized_your_market: 'Your market was subsidized', + tips_on_your_markets: 'Likes on your markets', } const watched_markets_explanations_market_updates: { [key in keyof Partial]: string } = { - resolutions_on_watched_markets: 'Market resolutions', - resolutions_on_watched_markets_with_shares_in: - 'Market resolutions you have shares in', market_updates_on_watched_markets: 'Updates made by the creator', market_updates_on_watched_markets_with_shares_in: 'Updates made by the creator on markets you have shares in', + resolutions_on_watched_markets: 'Market resolutions', + resolutions_on_watched_markets_with_shares_in: + 'Market resolutions you have shares in', // probability_updates_on_watched_markets: 'Probability updates', } - const balance_change_explanations: { + const bonuses_explanations: { [key in keyof Partial]: string } = { - loan_income: 'Automatic loans from your profitable bets', betting_streaks: 'Betting streak bonuses', referral_bonuses: 'Referral bonuses from referring users', unique_bettors_on_your_contract: 'Unique bettor bonuses on your markets', - tips_on_your_comments: 'Tips on your comments', + } + + const other_balance_change_explanations: { + [key in keyof Partial]: string + } = { + loan_income: 'Automatic loans from your profitable bets', limit_order_fills: 'Limit order fills', + tips_on_your_comments: 'Tips on your comments', } const general_explanations: { [key in keyof Partial]: string } = { tagged_user: 'A user tagged you', - contract_from_followed_user: 'New markets created by users you follow', trending_markets: 'Weekly trending markets', - on_new_follow: 'New followers', // profit_loss_updates: 'Weekly profit/loss updates', } + const follows_and_followers_explanations: { + [key in keyof Partial]: string + } = { + on_new_follow: 'New followers', + contract_from_followed_user: 'New markets created by users you follow', + } + const NotificationSettingLine = ( description: string, key: keyof notification_subscription_types, @@ -304,29 +317,39 @@ export function NotificationSettings() { watched_markets_explanations_answers )} {Section( - , - 'On Markets You Created', - watched_markets_explanations_your_markets + , + 'Updates & Resolutions', + watched_markets_explanations_market_updates )} {Section( - , - 'Market Updates', - watched_markets_explanations_market_updates + , + 'Markets You Created', + watched_markets_explanations_your_markets )} Balance Changes + {Section( + , + 'Bonuses', + bonuses_explanations + )} {Section( , - 'Loans and Bonuses', - balance_change_explanations + 'Other', + other_balance_change_explanations )} - Other + General {Section( - , - 'General', + , + 'Follows & Followers', + follows_and_followers_explanations + )} + {Section( + , + 'Other', general_explanations )}