From d16b8fcc0868123d3429117349e8514d4b8224d7 Mon Sep 17 00:00:00 2001 From: 0x7u <0xju@pm.me> Date: Fri, 21 Feb 2025 12:54:13 +0800 Subject: [PATCH] refactor: SuccessStatus.tsx --- components/send/SuccessStatus.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/components/send/SuccessStatus.tsx b/components/send/SuccessStatus.tsx index e27ff21..5ad2152 100644 --- a/components/send/SuccessStatus.tsx +++ b/components/send/SuccessStatus.tsx @@ -27,16 +27,20 @@ export const SuccessStatus = ({ transactionIds }: SuccessProps) => { const isKrc20Operation = "opData" in formFields; const ticker = isKrc20Operation ? formFields.opData.tick : "KAS"; const op = isKrc20Operation ? formFields?.opData?.op : ""; - const opFormatted = op === "deploy" ? "Deployed" : "Minted"; - const title = !isKrc20Operation - ? `${ticker} ${opFormatted}` - : "KAS Dispatched!"; - const krc20DescriptionFormatted = - op === "deploy" - ? "A new token has been forget" - : `${ticker} has been forged!`; + const opTitle: Record = { + transfer: `${ticker} Dispatched`, + deploy: `${ticker} Deployed`, + mint: `${ticker} Minted`, + }; + const opDescription: Record = { + transfer: `Your ${ticker} has been sent to the recipient's address`, + deploy: "A new token has been forget", + mint: `${ticker} has been forged!`, + }; + + const title = isKrc20Operation ? opTitle[op] : "KAS Dispatched!"; const description = isKrc20Operation - ? krc20DescriptionFormatted + ? opDescription[op] : "Your KAS has been sent to the recipient's address"; const openTransactions = () => {