-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
224 additions
and
130 deletions.
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
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
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
64 changes: 64 additions & 0 deletions
64
packages/nextjs/components/punk-society/PunkConnectButton/PrivateKeyModal.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,64 @@ | ||
import { useEffect, useState } from "react"; | ||
import { notification } from "~~/utils/scaffold-eth"; | ||
|
||
type AddressQRCodeModalProps = { | ||
modalId: string; | ||
}; | ||
|
||
export const PrivateKeyModal = ({ modalId }: AddressQRCodeModalProps) => { | ||
const [privateKey, setPrivateKey] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
const storedPrivateKey = localStorage.getItem("burnerWallet.pk"); | ||
setPrivateKey(storedPrivateKey); | ||
}, []); | ||
|
||
const handleCopy = () => { | ||
if (privateKey) { | ||
navigator.clipboard | ||
.writeText(privateKey) | ||
.then(() => { | ||
notification.success("Private key copied to clipboard"); | ||
// alert("Private key copied to clipboard"); | ||
}) | ||
.catch(err => { | ||
notification.error("Failed to copy private key: ", err); | ||
}); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<div> | ||
<input type="checkbox" id={`${modalId}`} className="modal-toggle" /> | ||
<label htmlFor={`${modalId}`} className="modal cursor-pointer"> | ||
<label className="modal-box relative" htmlFor=""> | ||
<div className="flex flex-col justify-center items-center text-center"> | ||
<h2 className="text-xl font-bold mb-4">Your Private Key</h2> | ||
<div className="break-words whitespace-pre-wrap text-red-600 font-bold text-center w-full"> | ||
Save this into a safe place and don't share it with anyone. | ||
</div> | ||
<div className="break-words whitespace-pre-wrap text-red-600 font-bold mt-4 text-center w-full"> | ||
This is the only way to recover your account and funds, and it can't be changed or retrieved by | ||
PunkSociety team. | ||
</div> | ||
<div className="break-words whitespace-pre-wrap mt-4 text-left w-full">{privateKey}</div> | ||
<button | ||
onClick={handleCopy} | ||
className="btn btn-primary bg-green-600 hover:bg-green-500 active:bg-green-500 mt-4" | ||
> | ||
Copy Private Key | ||
</button> | ||
</div> | ||
<label | ||
htmlFor={`${modalId}`} | ||
className="btn text-xl rounded-full bg-red-600 hover:bg-red-500 btn-ghost btn-sm btn-circle absolute right-3 top-3" | ||
> | ||
✕ | ||
</label> | ||
</label> | ||
</label> | ||
</div> | ||
</> | ||
); | ||
}; |
38 changes: 38 additions & 0 deletions
38
packages/nextjs/components/punk-society/PunkConnectButton/SwitchLanguageModal.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,38 @@ | ||
import Image from "next/image"; | ||
|
||
type AddressQRCodeModalProps = { | ||
modalId: string; | ||
}; | ||
|
||
export const SwitchLanguageModal = ({ modalId }: AddressQRCodeModalProps) => { | ||
const handleLearnEnglishClick = () => { | ||
window.open("https://www.duolingo.com/", "_blank"); | ||
}; | ||
return ( | ||
<> | ||
<div> | ||
<input type="checkbox" id={`${modalId}`} className="modal-toggle" /> | ||
<label htmlFor={`${modalId}`} className="modal cursor-pointer"> | ||
<label className="modal-box relative" htmlFor=""> | ||
<div className="flex flex-col justify-center items-center text-center"> | ||
<h2 className="text-xl font-bold mb-4 text-red-600">Sorry, we don't have other languages yet.</h2> | ||
<button | ||
onClick={handleLearnEnglishClick} | ||
className="btn btn-primary border-0 flex items-center hover:bg-green-600 active:bg-green-600" | ||
> | ||
<Image src="/duolingo.gif" alt="Duolingo" width={60} height={60} className="mr-2" /> | ||
Learn English in Duolingo! | ||
</button> | ||
<label | ||
htmlFor={`${modalId}`} | ||
className="btn text-xl rounded-full bg-red-600 hover:bg-red-500 btn-ghost btn-sm btn-circle absolute right-3 top-3" | ||
> | ||
✕ | ||
</label> | ||
</div> | ||
</label> | ||
</label> | ||
</div> | ||
</> | ||
); | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.