Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Placing refresh publisher link
Browse files Browse the repository at this point in the history
Fixing column widths

Adding function for link. Storybook changes.

Make method optional

Adding flex attribute to a element

Align last flex item to right for check link

Replace removed margin

Update z-index for link

Adding loading icon

Correcting refreshed check

Add missing attribute for prop

Removed unneeded prop
  • Loading branch information
Jason Sadler committed Apr 3, 2019
1 parent 44513d1 commit 11ffffd
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 4 deletions.
22 changes: 19 additions & 3 deletions src/features/rewards/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
StyledProviderWrap,
StyledInlineVerified,
StyledVerifiedText,
StyledInlineUnVerified
StyledInlineUnVerified,
StyledVerifiedCheckLink,
StyledRefresh
} from './style'
import { getLocale } from '../../../helpers'
import { VerifiedIcon, UnVerifiedIcon } from '../../../components/icons'
import { VerifiedIcon, UnVerifiedIcon, LoaderIcon } from '../../../components/icons'

export type Provider = 'twitter' | 'youtube' | 'twitch'

Expand All @@ -31,6 +33,9 @@ export interface Props {
verified?: boolean
tableCell?: boolean
showUnVerifiedHelpIcon?: boolean
refreshingPublisher?: boolean
publisherRefreshed?: boolean
onRefreshPublisher?: () => void
}

/*
Expand Down Expand Up @@ -66,7 +71,9 @@ export default class Profile extends React.PureComponent<Props, {}> {
title,
verified,
tableCell,
showUnVerifiedHelpIcon
showUnVerifiedHelpIcon,
onRefreshPublisher,
refreshingPublisher
} = this.props

return (
Expand Down Expand Up @@ -109,6 +116,15 @@ export default class Profile extends React.PureComponent<Props, {}> {
<StyledVerifiedText>
{getLocale('unVerifiedPublisher')}
</StyledVerifiedText>
{
refreshingPublisher ?
<StyledRefresh>
<LoaderIcon />
</StyledRefresh>
: <StyledVerifiedCheckLink onClick={onRefreshPublisher}>
{getLocale('unVerifiedCheck')}
</StyledVerifiedCheckLink>
}
</StyledProviderWrap>
) : null}
</StyledContent>
Expand Down
19 changes: 19 additions & 0 deletions src/features/rewards/profile/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import styled, { css } from 'styled-components'
import palette from '../../../theme/colors'
import { Props, Provider } from './index'

const getOverflowRules = (provider?: Provider) => {
Expand Down Expand Up @@ -147,6 +148,24 @@ export const StyledVerifiedText = styled<{}, 'span'>('span')`
margin-left: 4px;
`

export const StyledRefresh = styled<{}, 'span'>('span')`
color: ${palette.blue400};
line-height: 0;
height: 18px;
width: 18px;
vertical-align: bottom;
margin-left: auto;
`

export const StyledVerifiedCheckLink = styled<{}, 'span'>('span')`
font-size: 12px;
color: ${palette.blue400};
cursor: pointer;
text-decoration: none;
margin-left: auto;
z-index: 1;
`

export const StyledInlineVerified = styled<{}, 'span'>('span')`
width: 19px;
padding-top: 2px;
Expand Down
6 changes: 6 additions & 0 deletions src/features/rewards/walletPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export interface Props {
onToggleTips: () => void
onAmountChange: () => void
onIncludeInAuto: () => void
onRefreshPublisher?: () => void
refreshingPublisher?: boolean
publisherRefreshed?: boolean
showUnVerified?: boolean
moreLink?: string
acEnabled?: boolean
Expand All @@ -75,6 +78,9 @@ export default class WalletPanel extends React.PureComponent<Props, {}> {
showUnVerifiedHelpIcon={
!this.props.isVerified && this.props.showUnVerified
}
refreshingPublisher={this.props.refreshingPublisher}
onRefreshPublisher={this.props.onRefreshPublisher}
publisherRefreshed={this.props.publisherRefreshed}
/>
</StyledProfileWrapper>
)
Expand Down
1 change: 1 addition & 0 deletions stories/assets/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ const locale: Record<string, string> = {
turnOnRewardsTitle: 'Turn on Rewards',
type: 'Type',
uhOh: 'Uh oh…',
unVerifiedCheck: 'Check Again...',
unVerifiedPublisher: 'Not yet verified',
unVerifiedText: 'This creator has not yet signed up to receive contributions from Brave users.',
unVerifiedTextMore: 'Learn more.',
Expand Down
8 changes: 7 additions & 1 deletion stories/features/rewards/concepts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ storiesOf('Feature Components/Rewards/Concepts/Desktop', module)
</div>
)
})
.add('Wallet Panel', withState({ grant: defaultGrant, notification: grantNotification, showSummary: false, tipsEnabled: true, includeInAuto: true }, (store) => {
.add('Wallet Panel', withState({ grant: defaultGrant, notification: grantNotification, showSummary: false, tipsEnabled: true, includeInAuto: true, refreshingPublisher: false }, (store) => {
const curveRgb = '233,235,255'
const panelRgb = '249,251,252'

Expand All @@ -286,6 +286,10 @@ storiesOf('Feature Components/Rewards/Concepts/Desktop', module)
store.set({ includeInAuto: !store.state.includeInAuto })
}

const onRefreshPublisher = () => {
store.set({ refreshingPublisher: !store.state.refreshingPublisher })
}

const onToggleTips = () => {
store.set({ tipsEnabled: !store.state.tipsEnabled })
}
Expand Down Expand Up @@ -396,6 +400,8 @@ storiesOf('Feature Components/Rewards/Concepts/Desktop', module)
donationAction={doNothing}
onAmountChange={doNothing}
onIncludeInAuto={onIncludeInAuto}
refreshingPublisher={store.state.refreshingPublisher}
onRefreshPublisher={onRefreshPublisher}
/>
<WalletSummary
compact={true}
Expand Down
1 change: 1 addition & 0 deletions stories/features/rewards/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ storiesOf('Feature Components/Rewards/Wallet/Desktop', module)
onAmountChange={doNothing}
onIncludeInAuto={doNothing}
showUnVerified={boolean('Show unverified content', true)}
onRefreshPublisher={doNothing}
/>
</div>
)
Expand Down

0 comments on commit 11ffffd

Please sign in to comment.