-
Notifications
You must be signed in to change notification settings - Fork 21
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
Added Receive functionality for dashboard #135
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,5 @@ | ||
--- | ||
"abstraxion-dashboard": minor | ||
--- | ||
|
||
Added receive functionality to dashboard |
This file contains 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 contains 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
60 changes: 60 additions & 0 deletions
60
apps/abstraxion-dashboard/components/WalletReceive/index.tsx
This file contains 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,60 @@ | ||
import { ReactElement, useState } from "react"; | ||
import { Button, Dialog, DialogContent, DialogTrigger } from "@burnt-labs/ui"; | ||
import { DialogClose } from "@burnt-labs/ui"; | ||
import { CloseIcon } from "@burnt-labs/ui"; | ||
import { truncateAddress } from "@/utils"; | ||
import { CopyIcon } from "../Icons"; | ||
import { QRCodeSVG } from "qrcode.react"; | ||
|
||
export function WalletReceive({ | ||
trigger, | ||
xionAddress, | ||
}: { | ||
trigger: ReactElement; | ||
xionAddress: string; | ||
}) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const copyXionAddress = () => { | ||
if (xionAddress) { | ||
navigator.clipboard.writeText(xionAddress); | ||
} | ||
}; | ||
|
||
return ( | ||
<Dialog onOpenChange={setIsOpen} open={isOpen}> | ||
<DialogTrigger>{trigger}</DialogTrigger> | ||
<DialogContent | ||
className="ui-text-white" | ||
onPointerDownOutside={(e: any) => e.preventDefault()} | ||
> | ||
<DialogClose className="ui-absolute ui-top-5 ui-right-10"> | ||
<CloseIcon className="ui-stroke-white/50" /> | ||
</DialogClose> | ||
<div className="ui-flex ui-flex-col ui-pt-8"> | ||
<h1 className="ui-w-full ui-text-center ui-text-3xl ui-font-akkuratLL ui-font-thin"> | ||
RECEIVE | ||
</h1> | ||
<h3 className="ui-text-white ui-text-sm ui-font-bold ui-font-akkuratLL ui-leading-none ui-my-6"> | ||
XION Address | ||
</h3> | ||
<div | ||
onClick={copyXionAddress} | ||
className="ui-flex ui-cursor-pointer ui-items-center ui-justify-between ui-px-4 ui-w-full ui-h-16 ui-bg-black ui-rounded-lg" | ||
> | ||
<p className="ui-text-white ui-text-base ui-font-normal ui-font-akkuratLL ui-leading-normal"> | ||
{truncateAddress(xionAddress)} | ||
</p> | ||
<CopyIcon color="white" /> | ||
</div> | ||
<div className="ui-flex ui-items-center ui-justify-center ui-my-6 ui-p-6 ui-w-full ui-bg-black ui-rounded-lg"> | ||
<QRCodeSVG value={"uxion:" + xionAddress} /> | ||
</div> | ||
<Button onClick={() => setIsOpen(false)} fullWidth> | ||
Close | ||
</Button> | ||
</div> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
} |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for pulling this in as prop as opposed to getting value from context or useAccount hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily a huge reason for one over the other. I could switch it so there is less prop drilling, was just following what was already done in AccountInfo component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just curious. I had prop drilled because I couldn't get the parent component to update the balance after performing a send tx in the child component so was curious if you were seeing similar stale data issues. All good though