diff --git a/package.json b/package.json index 1be823f3..991069d6 100644 --- a/package.json +++ b/package.json @@ -36,4 +36,4 @@ "engines": { "node": ">=20.10.0" } -} +} \ No newline at end of file diff --git a/static/index.html b/static/index.html index ac75797f..4b6e62f0 100644 --- a/static/index.html +++ b/static/index.html @@ -62,14 +62,14 @@ xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 490 490" xml:space="preserve" - style="cursor: pointer; padding: 10px" + class="paginateClaims" > -
1/x reward
+
diff --git a/static/scripts/rewards/render-transaction/render-transaction.ts b/static/scripts/rewards/render-transaction/render-transaction.ts index c9638ef4..6ed55729 100644 --- a/static/scripts/rewards/render-transaction/render-transaction.ts +++ b/static/scripts/rewards/render-transaction/render-transaction.ts @@ -33,6 +33,7 @@ export async function init() { console.error(error); setClaimMessage({ type: "Error", message: `Invalid claim data passed in URL` }); table.setAttribute(`data-claim`, "error"); + return false; } @@ -47,29 +48,36 @@ export async function init() { }); const rewardsCount = document.getElementById("rewardsCount"); - if (rewardsCount) { - rewardsCount.innerHTML = `${app.currentIndex + 1}/${app.claimTxs.length} reward`; - const nextTxButton = document.getElementById("nextTx"); - if (nextTxButton) { - nextTxButton.addEventListener("click", () => { - claimButton.element = removeAllEventListeners(claimButton.element) as HTMLButtonElement; - app.nextTx(); - rewardsCount.innerHTML = `${app.currentIndex + 1}/${app.claimTxs.length} reward`; - table.setAttribute(`data-claim`, "none"); - renderTransaction(); - }); - } - - const prevTxButton = document.getElementById("previousTx"); - if (prevTxButton) { - prevTxButton.addEventListener("click", () => { - claimButton.element = removeAllEventListeners(claimButton.element) as HTMLButtonElement; - app.previousTx(); - rewardsCount.innerHTML = `${app.currentIndex + 1}/${app.claimTxs.length} reward`; - table.setAttribute(`data-claim`, "none"); - renderTransaction(); - }); + if (rewardsCount) { + if (!app.claimTxs || app.claimTxs.length <= 1) { + // already hidden + } else { + rewardsCount.innerHTML = `${app.currentIndex + 1}/${app.claimTxs.length} reward`; + + const nextTxButton = document.getElementById("nextTx"); + if (nextTxButton) { + nextTxButton.style.display = "block"; + nextTxButton.addEventListener("click", () => { + claimButton.element = removeAllEventListeners(claimButton.element) as HTMLButtonElement; + app.nextTx(); + rewardsCount.innerHTML = `${app.currentIndex + 1}/${app.claimTxs.length} reward`; + table.setAttribute(`data-claim`, "none"); + renderTransaction(); + }); + } + + const prevTxButton = document.getElementById("previousTx"); + if (prevTxButton) { + prevTxButton.style.display = "block"; + prevTxButton.addEventListener("click", () => { + claimButton.element = removeAllEventListeners(claimButton.element) as HTMLButtonElement; + app.previousTx(); + rewardsCount.innerHTML = `${app.currentIndex + 1}/${app.claimTxs.length} reward`; + table.setAttribute(`data-claim`, "none"); + renderTransaction(); + }); + } } } diff --git a/static/scripts/rewards/web3/erc20-permit.ts b/static/scripts/rewards/web3/erc20-permit.ts index 24a521d0..ba5cbcc1 100644 --- a/static/scripts/rewards/web3/erc20-permit.ts +++ b/static/scripts/rewards/web3/erc20-permit.ts @@ -55,7 +55,7 @@ export function claimErc20PermitHandler(permit: Erc20Permit) { export async function checkPermitClaimable(permit: Erc20Permit, signer: ethers.providers.JsonRpcSigner | null) { const claimed = await isNonceClaimed(permit); if (claimed) { - toaster.create("error", `This reward has already been claimed or invalidated.`); + toaster.create("error", `Your reward for this task has already been claimed or invalidated.`); return false; } diff --git a/static/styles/rewards/claim-table.css b/static/styles/rewards/claim-table.css index 3837b1e1..6145bc32 100644 --- a/static/styles/rewards/claim-table.css +++ b/static/styles/rewards/claim-table.css @@ -271,6 +271,12 @@ table[data-claim-rendered="true"][data-claim="none"][data-contract-loaded="true" color: #fff; } +.paginateClaims { + display: none; + cursor: pointer; + padding: 10px; +} + .show-cl { display: block; }