Skip to content

Commit

Permalink
chore: move invalid json message to refund button
Browse files Browse the repository at this point in the history
  • Loading branch information
jackstar12 committed Jan 8, 2025
1 parent a40bd5d commit 362c391
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/components/RefundButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const RefundEvm = (props: {
const RefundButton = (props: {
swap: Accessor<SubmarineSwap | ChainSwap>;
setRefundTxId?: Setter<string>;
buttonOverride?: string;
}) => {
const {
getSwap,
Expand Down Expand Up @@ -338,7 +339,7 @@ const RefundButton = (props: {
class="btn"
disabled={!valid() || refundRunning()}
onClick={() => refundAction()}>
{t("refund")}
{props.buttonOverride ?? t("refund")}
</button>
</Match>
<Match when={lockupTransaction.state === "pending"}>
Expand Down
6 changes: 3 additions & 3 deletions src/i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const dict = {
"If any of the above applies to you, we strongly recommend downloading this refund file!",
refund_swap: "Refund Swap",
refund_a_swap_subline:
"Upload your refund file and reclaim your locked funds",
"Upload your Swap’s refund file, to refund a swap that is not available in this browser’s swap history.",
refund_past_swaps: "Past swaps",
refund_past_swaps_subline:
"Swaps that got saved into your browsers storage",
Expand All @@ -116,9 +116,9 @@ const dict = {
refund_external_swap: "Refund External Swap",
history_no_swaps: "Looks like you didn't do any swaps yet.",
refund_address_header:
"Enter address of your {{ asset }} wallet to refund",
"Enter a {{ asset }} address to receive your refund on:",
refund_address_header_no_asset:
"Enter address of your wallet to refund",
"Enter an address to receive your refund on:",
refund_backup: "Backup",
refund_import: "Import Backup",
refund_clear: "Delete storage",
Expand Down
17 changes: 5 additions & 12 deletions src/pages/RefundExternal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,12 @@ const RefundBtcLike = () => {
accept="application/json,image/png,imagine/jpg,image/jpeg"
onChange={(e) => uploadChange(e)}
/>
<Show when={refundInvalid() !== undefined}>
<hr />
<button class="btn" disabled={true}>
{(() => {
switch (refundInvalid()) {
case RefundError.InvalidData:
return t("invalid_refund_file");
}
})()}
</button>
</Show>
<hr />
<RefundButton swap={refundJson} setRefundTxId={setRefundTxId} />
<RefundButton
swap={refundJson}
setRefundTxId={setRefundTxId}
buttonOverride={refundInvalid() == RefundError.InvalidData ? t("invalid_refund_file") : undefined}
/>
<Show when={refundTxId() !== ""}>
<hr />
<p>{t("refunded")}</p>
Expand Down

0 comments on commit 362c391

Please sign in to comment.