UI Tweaks

This commit is contained in:
Ian Philips 2022-09-09 10:15:36 -06:00
parent 06467dc1d7
commit 7308e4f358
2 changed files with 46 additions and 30 deletions

View File

@ -14,9 +14,7 @@ import { formatNumericProbability } from '../../common/pseudo-numeric'
import { sendTemplateEmail, sendTextEmail } from './send-email' import { sendTemplateEmail, sendTextEmail } from './send-email'
import { getPrivateUser, getUser } from './utils' import { getPrivateUser, getUser } from './utils'
import { getFunctionUrl } from '../../common/api' import { getFunctionUrl } from '../../common/api'
import { richTextToString } from '../../common/util/parse'
import { buildCardUrl, getOpenGraphProps } from '../../common/contract-details' import { buildCardUrl, getOpenGraphProps } from '../../common/contract-details'
import { JSONContent } from '@tiptap/core'
const UNSUBSCRIBE_ENDPOINT = getFunctionUrl('unsubscribe') const UNSUBSCRIBE_ENDPOINT = getFunctionUrl('unsubscribe')
@ -345,7 +343,7 @@ export const sendNewCommentEmail = async (
userId: string, userId: string,
commentCreator: User, commentCreator: User,
contract: Contract, contract: Contract,
commentContent: JSONContent | string, commentText: string,
commentId: string, commentId: string,
bet?: Bet, bet?: Bet,
answerText?: string, answerText?: string,
@ -366,11 +364,6 @@ export const sendNewCommentEmail = async (
const { name: commentorName, avatarUrl: commentorAvatarUrl } = commentCreator const { name: commentorName, avatarUrl: commentorAvatarUrl } = commentCreator
const text =
typeof commentContent !== 'string'
? richTextToString(commentContent)
: commentContent
let betDescription = '' let betDescription = ''
if (bet) { if (bet) {
const { amount, sale } = bet const { amount, sale } = bet
@ -394,7 +387,7 @@ export const sendNewCommentEmail = async (
answerNumber, answerNumber,
commentorName, commentorName,
commentorAvatarUrl: commentorAvatarUrl ?? '', commentorAvatarUrl: commentorAvatarUrl ?? '',
comment: text, comment: commentText,
marketUrl, marketUrl,
unsubscribeUrl, unsubscribeUrl,
betDescription, betDescription,
@ -415,7 +408,7 @@ export const sendNewCommentEmail = async (
{ {
commentorName, commentorName,
commentorAvatarUrl: commentorAvatarUrl ?? '', commentorAvatarUrl: commentorAvatarUrl ?? '',
comment: text, comment: commentText,
marketUrl, marketUrl,
unsubscribeUrl, unsubscribeUrl,
betDescription, betDescription,

View File

@ -11,15 +11,17 @@ import { updatePrivateUser } from 'web/lib/firebase/users'
import { Switch } from '@headlessui/react' import { Switch } from '@headlessui/react'
import { Col } from 'web/components/layout/col' import { Col } from 'web/components/layout/col'
import { import {
AdjustmentsIcon,
CashIcon, CashIcon,
ChatIcon, ChatIcon,
ChevronDownIcon, ChevronDownIcon,
ChevronUpIcon, ChevronUpIcon,
CurrencyDollarIcon,
InboxInIcon,
InformationCircleIcon, InformationCircleIcon,
LightBulbIcon, LightBulbIcon,
TrendingUpIcon, TrendingUpIcon,
UserIcon, UserIcon,
UsersIcon,
} from '@heroicons/react/outline' } from '@heroicons/react/outline'
import { WatchMarketModal } from 'web/components/contract/watch-market-modal' import { WatchMarketModal } from 'web/components/contract/watch-market-modal'
import { filterDefined } from 'common/util/array' import { filterDefined } from 'common/util/array'
@ -93,40 +95,51 @@ export function NotificationSettings() {
all_comments_on_my_markets: 'Comments on your markets', all_comments_on_my_markets: 'Comments on your markets',
all_answers_on_my_markets: 'Answers on your markets', all_answers_on_my_markets: 'Answers on your markets',
subsidized_your_market: 'Your market was subsidized', subsidized_your_market: 'Your market was subsidized',
tips_on_your_markets: 'Likes on your markets',
} }
const watched_markets_explanations_market_updates: { const watched_markets_explanations_market_updates: {
[key in keyof Partial<notification_subscription_types>]: string [key in keyof Partial<notification_subscription_types>]: 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: 'Updates made by the creator',
market_updates_on_watched_markets_with_shares_in: market_updates_on_watched_markets_with_shares_in:
'Updates made by the creator on markets you have 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', // probability_updates_on_watched_markets: 'Probability updates',
} }
const balance_change_explanations: { const bonuses_explanations: {
[key in keyof Partial<notification_subscription_types>]: string [key in keyof Partial<notification_subscription_types>]: string
} = { } = {
loan_income: 'Automatic loans from your profitable bets',
betting_streaks: 'Betting streak bonuses', betting_streaks: 'Betting streak bonuses',
referral_bonuses: 'Referral bonuses from referring users', referral_bonuses: 'Referral bonuses from referring users',
unique_bettors_on_your_contract: 'Unique bettor bonuses on your markets', 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<notification_subscription_types>]: string
} = {
loan_income: 'Automatic loans from your profitable bets',
limit_order_fills: 'Limit order fills', limit_order_fills: 'Limit order fills',
tips_on_your_comments: 'Tips on your comments',
} }
const general_explanations: { const general_explanations: {
[key in keyof Partial<notification_subscription_types>]: string [key in keyof Partial<notification_subscription_types>]: string
} = { } = {
tagged_user: 'A user tagged you', tagged_user: 'A user tagged you',
contract_from_followed_user: 'New markets created by users you follow',
trending_markets: 'Weekly trending markets', trending_markets: 'Weekly trending markets',
on_new_follow: 'New followers',
// profit_loss_updates: 'Weekly profit/loss updates', // profit_loss_updates: 'Weekly profit/loss updates',
} }
const follows_and_followers_explanations: {
[key in keyof Partial<notification_subscription_types>]: string
} = {
on_new_follow: 'New followers',
contract_from_followed_user: 'New markets created by users you follow',
}
const NotificationSettingLine = ( const NotificationSettingLine = (
description: string, description: string,
key: keyof notification_subscription_types, key: keyof notification_subscription_types,
@ -304,29 +317,39 @@ export function NotificationSettings() {
watched_markets_explanations_answers watched_markets_explanations_answers
)} )}
{Section( {Section(
<UserIcon className={'h-6 w-6'} />, <TrendingUpIcon className={'h-6 w-6'} />,
'On Markets You Created', 'Updates & Resolutions',
watched_markets_explanations_your_markets watched_markets_explanations_market_updates
)} )}
{Section( {Section(
<TrendingUpIcon className={'h-6 w-6'} />, <UserIcon className={'h-6 w-6'} />,
'Market Updates', 'Markets You Created',
watched_markets_explanations_market_updates watched_markets_explanations_your_markets
)} )}
<Row className={'gap-2 text-xl text-gray-700'}> <Row className={'gap-2 text-xl text-gray-700'}>
<span>Balance Changes</span> <span>Balance Changes</span>
</Row> </Row>
{Section(
<CurrencyDollarIcon className={'h-6 w-6'} />,
'Bonuses',
bonuses_explanations
)}
{Section( {Section(
<CashIcon className={'h-6 w-6'} />, <CashIcon className={'h-6 w-6'} />,
'Loans and Bonuses', 'Other',
balance_change_explanations other_balance_change_explanations
)} )}
<Row className={'gap-2 text-xl text-gray-700'}> <Row className={'gap-2 text-xl text-gray-700'}>
<span>Other</span> <span>General</span>
</Row> </Row>
{Section( {Section(
<AdjustmentsIcon className={'h-6 w-6'} />, <UsersIcon className={'h-6 w-6'} />,
'General', 'Follows & Followers',
follows_and_followers_explanations
)}
{Section(
<InboxInIcon className={'h-6 w-6'} />,
'Other',
general_explanations general_explanations
)} )}
<WatchMarketModal open={showWatchModal} setOpen={setShowWatchModal} /> <WatchMarketModal open={showWatchModal} setOpen={setShowWatchModal} />