/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react' // Components import { StyledWrapper, StyledTitle, StyledSubTitle, StyledHeader, StyledLeft, StyledRight, StyledIconWrap, StyledIconText, StyledBalance, StyledWarning, StyledWarningText, StyledTables, StyledNote, StyledTableTitle, StyledTableSubTitle, StyledVerified, StyledVerifiedText, StyledSelectOption, StyledIcon, StyledClosing, StyledActionIcon, StyledAlertWrapper, StyledWarningWrapper, StyledVerifiedIcon } from './style' import TableContribute, { DetailRow as ContributeRow } from '../tableContribute' import TableTransactions, { DetailRow as TransactionRow } from '../tableTransactions' import { Select, ControlWrapper, Modal } from '../../../components' import { AlertCircleIcon, DownloadIcon, PrintIcon, VerifiedIcon } from '../../../components/icons' import ListToken from '../listToken' import { Type as TokenType } from '../tokens' // Utils import { getLocale } from '../../../helpers' export interface Token { value: string converted: string isNegative?: boolean } export type SummaryType = 'deposit' | 'grant' | 'ads' | 'contribute' | 'recurring' | 'donations' export interface SummaryItem { type: SummaryType token: Token text: string notPaid?: boolean } export interface Props { contributeRows: ContributeRow[] onClose: () => void onPrint: () => void onDownloadPDF: () => void onMonthChange: (value: string, child: React.ReactNode) => void months: Record currentMonth: string transactionRows: TransactionRow[] openBalance?: Token closingBalance?: Token id?: string summary: SummaryItem[] total: Token paymentDay: number } export default class ModalActivity extends React.PureComponent { private colors: Record = { deposit: 'earnings', grant: 'earnings', ads: 'earnings', contribute: 'contribute', recurring: 'donation', donations: 'donation' } private hasWarnings: boolean = false get headers () { return [ getLocale('rewardsContributeVisited'), getLocale('rewardsContributeAttention'), getLocale('payment') ] } get selectTitle () { return ( {getLocale('braveRewards')} {getLocale('walletActivity')} ) } getSummaryBox = () => { this.hasWarnings = false let items: React.ReactNode[] if (!this.props.summary) { return null } items = this.props.summary.map((item: SummaryItem, i: number) => { let title: React.ReactNode = item.text if (item.notPaid) { this.hasWarnings = true title = ( {title} ) } return ( ) }) items.push( {getLocale('total')}} value={this.props.total.value} converted={this.props.total.converted} size={'small'} border={'last'} /> ) return items } render () { const { id, onClose, contributeRows, onMonthChange, currentMonth, openBalance, closingBalance, months, transactionRows, paymentDay } = this.props return ( { months ? : null } { openBalance && closingBalance ? {getLocale('closeBalance')}} value={closingBalance.value} converted={closingBalance.converted} color={'contribute'} border={'last'} /> : null } {getLocale('print')} {getLocale('downloadPDF')} {this.getSummaryBox()} { this.hasWarnings ? {getLocale('paymentNotMade')} {getLocale('paymentWarning')} : null } {getLocale('transactions')} {getLocale('contributeAllocation')} {getLocale('paymentMonthly', { day: paymentDay })} {getLocale('braveVerified')} {getLocale('pleaseNote')} {getLocale('activityNote')}

{getLocale('activityCopy')}
) } }