Skip to content

Commit

Permalink
Merge pull request #690 from brave/panel_text
Browse files Browse the repository at this point in the history
Fixes panel text for rewards
  • Loading branch information
NejcZdovc committed Oct 18, 2018
1 parent d549184 commit ed8864c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
18 changes: 15 additions & 3 deletions components/brave_rewards/ui/reducers/publishers_reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const publishersReducer: Reducer<Rewards.State | undefined> = (state: Rewards.St
switch (action.type) {
case types.ON_CONTRIBUTE_LIST:
state = { ...state }
state.firstLoad = false
if (state.contributeLoad) {
state.firstLoad = false
} else {
state.contributeLoad = true
}
state.autoContributeList = action.payload.list
break
case types.ON_NUM_EXCLUDED_SITES:
Expand All @@ -31,7 +35,11 @@ const publishersReducer: Reducer<Rewards.State | undefined> = (state: Rewards.St
break
case types.ON_RECURRING_DONATION_UPDATE:
state = { ...state }
state.firstLoad = false
if (state.recurringLoad) {
state.firstLoad = false
} else {
state.recurringLoad = true
}
state.recurringList = action.payload.list
break
case types.ON_REMOVE_RECURRING:
Expand All @@ -42,7 +50,11 @@ const publishersReducer: Reducer<Rewards.State | undefined> = (state: Rewards.St
break
case types.ON_CURRENT_TIPS:
state = { ...state }
state.firstLoad = false
if (state.tipsLoad) {
state.firstLoad = false
} else {
state.tipsLoad = true
}
state.tipsList = action.payload.list
break
}
Expand Down
5 changes: 4 additions & 1 deletion components/brave_rewards/ui/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export const defaultState: Rewards.State = {
autoContributeList: [],
reports: {},
recurringList: [],
tipsList: []
tipsList: [],
contributeLoad: false,
recurringLoad: false,
tipsLoad: false
}

const cleanData = (state: Rewards.State) => state
Expand Down
37 changes: 20 additions & 17 deletions components/definitions/rewards.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,39 @@ declare namespace Rewards {

export interface State {
addresses?: Record<AddressesType, Address>
createdTimestamp: number | null
enabledMain: boolean
enabledAds: boolean
enabledContribute: boolean
firstLoad: boolean | null
walletCreated: boolean
walletCreateFailed: boolean
autoContributeList: Publisher[]
connectedWallet: boolean
contributeLoad: boolean
contributionMinTime: number
contributionMinVisits: number
contributionMonthly: number
contributionNonVerified: boolean
contributionVideos: boolean
donationAbilityYT: boolean
createdTimestamp: number | null
donationAbilityTwitter: boolean
numExcludedSites: number
walletInfo: WalletProperties
connectedWallet: boolean
recoveryKey: string
donationAbilityYT: boolean
enabledAds: boolean
enabledContribute: boolean
enabledMain: boolean
firstLoad: boolean | null
grant?: Grant
numExcludedSites: number
reconcileStamp: number
recoveryKey: string
recurringList: Publisher[]
recurringLoad: boolean
reports: Record<string, Report>
tipsList: Publisher[]
tipsLoad: boolean
ui: {
walletRecoverySuccess: boolean | null
emptyWallet: boolean
walletServerProblem: boolean
modalBackup: boolean
walletRecoverySuccess: boolean | null
walletServerProblem: boolean
}
autoContributeList: Publisher[]
recurringList: Publisher[]
tipsList: Publisher[]
walletCreated: boolean
walletCreateFailed: boolean
walletInfo: WalletProperties
}

export interface ComponentProps {
Expand Down

0 comments on commit ed8864c

Please sign in to comment.