-
Notifications
You must be signed in to change notification settings - Fork 128
chore: update Historical Transactions view #1967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1a276bd
fix: starting point for historical txns
neocybereth c465570
chore: update history fetching, list and cards
neocybereth 2ee1e76
fix: update received type
neocybereth 40bb3c2
fix: types
neocybereth bde504a
fix: cleanup
neocybereth 74fe523
fix: remove clickability of card
neocybereth b5adafc
chore: test txn
neocybereth 44b46cb
fix: update types
neocybereth c3955bf
chore: update to new design views
neocybereth dd3a983
fix: make it work as screen shrinks
neocybereth 23c3068
fix: cleanup pending txns
neocybereth e3324a9
fix: cleanup
neocybereth fe0b49e
fix: cleanup pending txns
neocybereth b022ed3
fix: cleanup
neocybereth 5620173
fix: cleanup[
neocybereth a73d39d
fix: update boldness of font
neocybereth 9aab2a7
fix: title
neocybereth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
138 changes: 138 additions & 0 deletions
138
apps/namadillo/src/App/Transactions/PendingTransactionCard.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| import { shortenAddress } from "@namada/utils"; | ||
| import { TokenCurrency } from "App/Common/TokenCurrency"; | ||
| import { AssetImage } from "App/Transfer/AssetImage"; | ||
| import { isShieldedAddress, isTransparentAddress } from "App/Transfer/common"; | ||
| import clsx from "clsx"; | ||
| import { FaLock } from "react-icons/fa"; | ||
| import { | ||
| IoArrowForward, | ||
| IoCheckmarkCircleOutline, | ||
| IoCloseCircleOutline, | ||
| } from "react-icons/io5"; | ||
| import { twMerge } from "tailwind-merge"; | ||
| import { | ||
| ibcTransferStages, | ||
| namadaTransferStages, | ||
| TransferTransactionData, | ||
| } from "types"; | ||
| import keplrSvg from "../../integrations/assets/keplr.svg"; | ||
|
|
||
| type TransactionCardProps = { | ||
| transaction: TransferTransactionData; | ||
| }; | ||
|
|
||
| const getTitle = (transferTransaction: TransferTransactionData): string => { | ||
| const { type } = transferTransaction; | ||
|
|
||
| if (Object.keys(namadaTransferStages).includes(type)) { | ||
| return "Transfer"; | ||
| } | ||
|
|
||
| if (Object.keys(ibcTransferStages).includes(type)) { | ||
| return "Transfer IBC"; | ||
| } | ||
|
|
||
| return ""; | ||
| }; | ||
|
|
||
| export const PendingTransactionCard = ({ | ||
| transaction, | ||
| }: TransactionCardProps): JSX.Element => { | ||
| const renderKeplrIcon = (address: string): JSX.Element | null => { | ||
| if (isShieldedAddress(address)) return null; | ||
| if (isTransparentAddress(address)) return null; | ||
| return <img src={keplrSvg} height={18} width={18} />; | ||
| }; | ||
| const sender = transaction.sourceAddress; | ||
| const receiver = transaction.destinationAddress; | ||
| return ( | ||
| <article | ||
| className={twMerge( | ||
| clsx( | ||
| "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 items-center my-2", | ||
| "gap-5 bg-neutral-800 rounded-sm px-5 py-5 text-white border border-transparent", | ||
| "transition-colors duration-200 hover:border-neutral-500 border-yellow" | ||
| ) | ||
| )} | ||
| > | ||
| <div className="flex items-center gap-3"> | ||
| <i | ||
| className={twMerge( | ||
| clsx("text-2xl", { | ||
| "text-success": transaction.status === "success", | ||
| "text-fail": transaction.status === "error", | ||
| "text-yellow": transaction.status === "pending", | ||
| }) | ||
| )} | ||
| > | ||
| <IoArrowForward width={20} height={20} /> | ||
| </i> | ||
|
|
||
| <div className="flex flex-col"> | ||
| <h3 | ||
| className={twMerge( | ||
| clsx("flex", { | ||
| "text-success": transaction.status === "success", | ||
| "text-fail": transaction.status === "error", | ||
| "text-yellow": transaction.status === "pending", | ||
| }) | ||
| )} | ||
| > | ||
| {getTitle(transaction)}{" "} | ||
| {transaction.status === "success" && ( | ||
| <IoCheckmarkCircleOutline className="ml-1 mt-0.5 w-5 h-5" /> | ||
| )} | ||
| {transaction.status === "error" && ( | ||
| <IoCloseCircleOutline className="ml-1 mt-0.5 w-5 h-5" /> | ||
| )} | ||
| </h3> | ||
| <h3 className="text-neutral-400">Pending</h3> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex items-center"> | ||
| <div className="aspect-square w-8 h-8"> | ||
| <AssetImage asset={transaction.asset} /> | ||
| </div> | ||
| <TokenCurrency | ||
| className="text-white mt-1 ml-2" | ||
| amount={transaction.displayAmount} | ||
| symbol={transaction.asset.symbol} | ||
| /> | ||
| </div> | ||
| <div className="flex flex-col"> | ||
| <h4 className={isShieldedAddress(sender ?? "") ? "text-yellow" : ""}> | ||
| From | ||
| </h4> | ||
| <h4 className={isShieldedAddress(sender ?? "") ? "text-yellow" : ""}> | ||
| {isShieldedAddress(sender ?? "") ? | ||
| <span className="flex items-center gap-1"> | ||
| <FaLock className="w-4 h-4" /> znam | ||
| </span> | ||
| : <div className="flex items-center gap-1"> | ||
| {renderKeplrIcon(sender ?? "")} | ||
| {shortenAddress(sender ?? "", 10, 10)} | ||
| </div> | ||
| } | ||
| </h4> | ||
| </div> | ||
|
|
||
| <div className="flex flex-col"> | ||
| <h4 className={isShieldedAddress(receiver ?? "") ? "text-yellow" : ""}> | ||
| To | ||
| </h4> | ||
| <h4 className={isShieldedAddress(receiver ?? "") ? "text-yellow" : ""}> | ||
| {isShieldedAddress(receiver ?? "") ? | ||
| <span className="flex items-center gap-1"> | ||
| <FaLock className="w-4 h-4" /> znam | ||
| </span> | ||
| : <div className="flex items-center gap-1"> | ||
| {renderKeplrIcon(receiver ?? "")} | ||
| {shortenAddress(receiver ?? "", 10, 10)} | ||
| </div> | ||
| } | ||
| </h4> | ||
| </div> | ||
| </article> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.