Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
feat(notifications): add pending actions to the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Feb 26, 2018
1 parent 560dc95 commit a340d7d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/containers/disputes/components/disputes-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const columns = [
{
id: 'subcourt',
Header: 'Subcourt',
accessor: () => 'Unknown subcourt'
accessor: () => 'General Court'
},
{
Header: 'Deadline',
Expand Down
64 changes: 24 additions & 40 deletions src/containers/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Home extends PureComponent {
accounts: walletSelectors.accountsShape.isRequired,
balance: walletSelectors.balanceShape.isRequired,
notifications: notificationSelectors.notificationsShape.isRequired,
pendingActions: notificationSelectors.pendingActionsShape.isRequired,
PNKBalance: arbitratorSelectors.PNKBalanceShape.isRequired,
arbitratorData: arbitratorSelectors.arbitratorDataShape.isRequired,

Expand Down Expand Up @@ -106,6 +107,7 @@ class Home extends PureComponent {
accounts,
balance,
notifications,
pendingActions,
PNKBalance,
arbitratorData
} = this.props
Expand Down Expand Up @@ -237,46 +239,27 @@ class Home extends PureComponent {
<h4>Pending Actions</h4>
</div>
<div className="Home-cardList">
<div className="Home-cardList-card">
<DisputeCard
status={0}
subcourt="SUBCOURT"
date={new Date(Date.now() - 1e10)}
title="Unknown Website Owner Claims Services Were Not Delivered"
/>
</div>
<div className="Home-cardList-card">
<DisputeCard
status={0}
subcourt="SUBCOURT"
date={new Date(Date.now() - 1e10)}
title="Unknown Website Owner Claims Services Were Not Delivered"
/>
</div>
<div className="Home-cardList-card">
<DisputeCard
status={0}
subcourt="SUBCOURT"
date={new Date(Date.now() - 1e10)}
title="Unknown Website Owner Claims Services Were Not Delivered"
/>
</div>
<div className="Home-cardList-card">
<DisputeCard
status={0}
subcourt="SUBCOURT"
date={new Date(Date.now() - 1e10)}
title="Unknown Website Owner Claims Services Were Not Delivered"
/>
</div>
<div className="Home-cardList-card">
<DisputeCard
status={0}
subcourt="SUBCOURT"
date={new Date(Date.now() - 1e10)}
title="Unknown Website Owner Claims Services Were Not Delivered"
/>
</div>
<RenderIf
resource={pendingActions}
loading={<Icosahedron />}
done={
pendingActions.data &&
pendingActions.data.map(p => (
<div
key={p.message + p.data.disputeId}
className="Home-cardList-card"
>
<DisputeCard
status={0}
subcourt="GENERAL COURT"
date={new Date()}
title={p.message}
/>
</div>
))
}
failedLoading="There was an error fetching your notifications..."
/>
</div>
</div>
)
Expand All @@ -288,6 +271,7 @@ export default connect(
accounts: state.wallet.accounts,
balance: state.wallet.balance,
notifications: notificationSelectors.getNotifications(state),
pendingActions: state.notification.pendingActions,
PNKBalance: state.arbitrator.PNKBalance,
arbitratorData: state.arbitrator.arbitratorData,
activatePNKFormIsInvalid: getActivatePNKFormIsInvalid(state)
Expand Down
2 changes: 1 addition & 1 deletion src/sagas/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function* fetchPendingActions() {
ARBITRATOR_ADDRESS,
account
)
console.log(pendingActions)

yield put(
action(notificationActions.pendingActions.RECEIVE, { pendingActions })
)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function dateToString(
if (!withTime) return dateString

let hours = date.getHours()
const minutes = date.getMinutes()
const minutes = String(date.getMinutes()).padStart(2, '0')
const amOrPm = hours >= 12 ? 'pm' : 'am'
hours = amOrPm === 'pm' ? hours % 12 || 12 : hours

Expand Down

0 comments on commit a340d7d

Please sign in to comment.