-
Notifications
You must be signed in to change notification settings - Fork 5
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
lumaivzqz-rs
committed
Aug 29, 2024
1 parent
e928345
commit 6366772
Showing
14 changed files
with
1,524 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'use client' | ||
|
||
import ConnectedWallet from "@/components/connectedWallet"; | ||
import Footer from "@/components/footer"; | ||
import Navbar from "@/components/navbar"; | ||
import ConnectWalletButton from "@/components/ui/connectWalletButton"; | ||
import { useAuth } from "@/context/AuthContext"; | ||
import DeployToken from "@/components/deployToken"; | ||
import { Button } from "@/components/ui/button"; | ||
import { useRouter } from "next/navigation"; | ||
import { ROUTER } from "@/constants"; | ||
import ListTokens from "@/components/listTokens"; | ||
|
||
export default function TokenLaunch() { | ||
const { isLoggedIn } = useAuth(); | ||
|
||
const router = useRouter() | ||
|
||
return ( | ||
<main className="h-full w-full flex flex-col"> | ||
<Navbar /> | ||
<section className="w-full px-6 xl:px-0 md:w-[1000px] xl:w-[1300px] m-auto mt-4"> | ||
<div className="flex justify-between flex-row"> | ||
<h1 className="md:text-6xl xl:text-[78px] relative z-10 font-bold text-black flex flex-col gap-2.5"> | ||
<span className="max-w-max px-1.5 bg-white">Meme Token Launch</span> | ||
<span className="flex gap-2"> | ||
<span className="bg-custom-green px-1.5 w-max xl:text-5xl"> | ||
Memes | ||
</span> | ||
<span className="bg-title px-1.5 w-max xl:text-5xl"> | ||
on Rootstock | ||
</span> | ||
</span> | ||
</h1> | ||
{isLoggedIn ? | ||
( | ||
<div className="flex items-center gap-4"> | ||
<ConnectedWallet /> | ||
</div> | ||
) : | ||
( | ||
<div className="flex items-center gap-4"> | ||
<ConnectWalletButton /> | ||
</div> | ||
) | ||
} | ||
</div> | ||
|
||
<div className="mt-10 w-full flex flex-col justify-center gap-4"> | ||
<div className="flex items-end justify-between flex-row gap-6"> | ||
<h1 className="text-2xl font-bold">Your tokens</h1> | ||
<Button | ||
className="bg-white text-2xl text-black before:w-full active:bg-slate-400" | ||
type="submit" | ||
variant={'outline'} | ||
onClick={() => router.push(ROUTER.DEPLOY_TOKEN)}> | ||
Deploy a new token | ||
</Button> | ||
</div> | ||
<div className="mt-8"> | ||
<ListTokens /> | ||
</div> | ||
</div> | ||
|
||
</section> | ||
<Footer /> | ||
</main> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
|
||
function ArrowLeftIcon({ className }: { className?: string }) { | ||
return ( | ||
<svg version="1.1" fill="currentColor" viewBox="0 0 14 14" className={className}> | ||
<svg xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M4.71829 11.8178L0.218728 7.93434C0.0624934 7.80659 -4.90485e-07 7.6533 -4.71954e-07 7.5C-4.53423e-07 7.3467 0.0624935 7.19341 0.218728 7.06566L4.71829 3.18217C4.99951 2.95222 5.46822 2.92667 5.74944 3.18217C6.06191 3.41211 6.09316 3.79535 5.78069 4.05084L1.78108 7.5L5.78069 10.9492C6.09316 11.2047 6.06191 11.5879 5.74944 11.8178C5.46822 12.0733 4.99951 12.0478 4.71829 11.8178Z"></path> | ||
<path d="M8.71829 11.8178L4.21873 7.93434C4.06249 7.80659 4 7.6533 4 7.5C4 7.3467 4.06249 7.19341 4.21873 7.06566L8.71829 3.18217C8.99951 2.95222 9.46822 2.92667 9.74944 3.18217C10.0619 3.41211 10.0932 3.79535 9.78069 4.05084L5.78108 7.5L9.78069 10.9492C10.0932 11.2047 10.0619 11.5879 9.74944 11.8178C9.46822 12.0733 8.99951 12.0478 8.71829 11.8178Z"></path> | ||
</svg> | ||
</svg> | ||
) | ||
} | ||
|
||
export default ArrowLeftIcon |
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,104 @@ | ||
'use client' | ||
|
||
import { useState } from "react"; | ||
import { Tooltip, TooltipTrigger } from "@/components/ui/tooltip" | ||
import { useAuth } from "@/context/AuthContext"; | ||
import { CheckCircleIcon, CopyIcon, } from "@/components/icons"; | ||
import { copyToClipboard, formatAddress } from "@/lib/utils"; | ||
import MintTokenButton from "../ui/mintTokenButton"; | ||
import { DEPLOY_STRATEGY_ENUM } from "@/constants"; | ||
|
||
interface Token { | ||
name: string | ||
symbol: string | ||
address: string | ||
strategy: DEPLOY_STRATEGY_ENUM | ||
} | ||
|
||
const ListTokens: React.FC = () => { | ||
const { isLoggedIn, env } = useAuth(); | ||
|
||
const [copiedAddresses, setCopiedAddresses] = useState<Record<string, boolean>>({}); | ||
|
||
const handleCopyToClipboard = (address: string) => { | ||
copyToClipboard(address).then(() => { | ||
setCopiedAddresses((prevState) => ({ | ||
...prevState, | ||
[address]: true, | ||
})); | ||
|
||
setTimeout(() => { | ||
setCopiedAddresses((prevState) => ({ | ||
...prevState, | ||
[address]: false, | ||
})); | ||
}, 1000); | ||
}); | ||
}; | ||
|
||
const tokens: Token[] = [ | ||
{ name: "Token One", symbol: "TK1", address: "0xfa4DD4F1c077C1979640474B874408D4FEee508a", strategy: DEPLOY_STRATEGY_ENUM.DEFLATIONARY }, | ||
{ name: "Token Two", symbol: "TK2", address: "0x303Fe7E52012DBF5970cDa98551A3a328146C3e0", strategy: DEPLOY_STRATEGY_ENUM.INFLATIONARY }, | ||
]; | ||
|
||
return ( | ||
<table className="min-w-full bg-background border-b border-border rounded-lg shadow-md"> | ||
<thead className="bg-border"> | ||
<tr> | ||
<th className="py-3 px-4 text-left font-semibold">Name</th> | ||
<th className="py-3 px-4 text-center font-semibold">Symbol</th> | ||
<th className="py-3 px-4 text-center font-semibold">Address</th> | ||
<th className="py-3 px-4 text-center font-semibold">Strategy</th> | ||
<th className="py-3 px-4 text-center font-semibold">Action</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{tokens.map((token, index) => ( | ||
<tr key={index} className="border-b hover:bg-card hover:text-custom-pink transition-colors"> | ||
<td className="py-3 px-4">{token.name}</td> | ||
<td className="py-3 px-4 text-center">{token.symbol}</td> | ||
<td className="py-3 px-4 my-3 flex justify-center items-center gap-3"> | ||
<a | ||
href={env.EXPLORER_ADDRESS_BASE_URL + token.address} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="font-semibold" | ||
> | ||
{formatAddress(token.address!)} | ||
</a> | ||
<Tooltip > | ||
<TooltipTrigger> | ||
{copiedAddresses[token.address] ? ( | ||
<CheckCircleIcon | ||
onClick={() => { | ||
handleCopyToClipboard(token.address!); | ||
}} | ||
className="w-5 h-5 text-green-500" | ||
></CheckCircleIcon> | ||
) : ( | ||
<CopyIcon | ||
onClick={() => { | ||
handleCopyToClipboard(token.address) | ||
}} | ||
className="w-5 h-5 hover:text-white cursor-pointer" | ||
/> | ||
)} | ||
</TooltipTrigger> | ||
</Tooltip> | ||
</td> | ||
<td className=" text-center"> | ||
<div className={(token.strategy == DEPLOY_STRATEGY_ENUM.DEFLATIONARY ? "bg-custom-cyan" : "bg-custom-orange") + " font-bold text-background py-1 rounded-full"}> | ||
{token.strategy} | ||
</div> | ||
</td> | ||
<td className="py-3 px-4 items-center text-center"> | ||
<MintTokenButton disabled={!isLoggedIn} address={token.address} strategy={token.strategy} /> | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
} | ||
|
||
export default ListTokens; |
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
Oops, something went wrong.