Skip to content

Commit

Permalink
dao: fix claim button status
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian committed Dec 27, 2023
1 parent 4cadea2 commit a03ed8c
Showing 1 changed file with 34 additions and 30 deletions.
64 changes: 34 additions & 30 deletions src/app/accounts/[address]/dao-cells.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,44 +80,48 @@ export function WithdrawRow({ address, cell, tipHeader }) {
const depositBlockNumber = dao.getDepositBlockNumberFromWithdrawCell(cell);
const depositHeader = useHeaderByNumber(depositBlockNumber);
const withdrawHeader = useHeaderByNumber(cell.blockNumber);
const waitingDuration =
tipHeader && depositHeader && withdrawHeader
? dao.estimateWithdrawWaitingDurationUntil(
tipHeader,
depositHeader,
withdrawHeader,
)
: null;
const loaded = tipHeader && depositHeader && withdrawHeader;
const waitingDuration = loaded
? dao.estimateWithdrawWaitingDurationUntil(
tipHeader,
depositHeader,
withdrawHeader,
)
: null;
const key = cellKey(cell);

return (
<tr key={key}>
<td>
<Capacity value={cell.cellOutput.capacity} />
</td>
<td>
{tipHeader && depositHeader ? (
<>
+<Capacity value={dao.reward(cell, depositHeader, tipHeader)} />
</>
) : (
{loaded ? (
<>
<td>
<>
+<Capacity value={dao.reward(cell, depositHeader, tipHeader)} />
</>
</td>
<td>
{waitingDuration ? (
<p>Waiting for {waitingDuration.humanize()}</p>
) : (
<Button
as={Link}
color="green"
href={`/accounts/${address}/claim/${key}`}
className="not-prose inline-block"
>
Claim
</Button>
)}
</td>
</>
) : (
<td colSpan="2" className="text-center">
<Loading />
)}
</td>
<td>
{waitingDuration ? (
<p>Waiting for {waitingDuration.humanize()}</p>
) : (
<Button
as={Link}
color="green"
href={`/accounts/${address}/claim/${key}`}
className="not-prose inline-block"
>
Claim
</Button>
)}
</td>
</td>
)}
</tr>
);
}
Expand Down

0 comments on commit a03ed8c

Please sign in to comment.