Skip to content
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

feat: add rescan #33

Merged
merged 2 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/api/services/Rescan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

import { BASE_INSTANCE } from "../constant"

export const getRescanHash = (id:string) => {
return BASE_INSTANCE.get(`/rescan/${id}`)
}


29 changes: 29 additions & 0 deletions src/assets/icons/XIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { IconProps } from "types/iconProps";

const XIcon = ({ className }: IconProps) => {
return (
<svg
className={className}
width="30"
height="30"
viewBox="0 0 30 30"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M3.68555 26.5L26.313 3.87266"
stroke="currentColor"
strokeWidth="7"
strokeLinecap="round"
/>
<path
d="M3.68555 3.5L26.3129 26.1275"
stroke="currentColor"
strokeWidth="7"
strokeLinecap="round"
/>
</svg>
);
};

export { XIcon };
1 change: 1 addition & 0 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export * from "./ArrowTopRightOnSquare";
export * from "./BurgerIcon";
export * from "./DiscordIcon";
export * from "./GithubIcon";
export * from "./XIcon";
export * from "./ArrowRightIcon";
2 changes: 1 addition & 1 deletion src/components/Home/TransferBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default function TransferBox({
rightIcon={actionButton}
/>
{errorText && (
<p className="caption text-error animate-fade-up transition-all duration-700 pt-sp2">
<p className="caption-1 text-error animate-fade-up transition-all duration-700 pt-sp2">
{errorText}
</p>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Home/TransferSection/TransferBoxes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function TransferBoxes({
args: [address],
});
const maxContract = contractData ? unDecimal(Number(contractData)) : 0;
const fee = handleFee(+transferFrom);

const handlePaste = async () => {
await navigator.clipboard.readText().then(text => {
Expand All @@ -61,9 +62,8 @@ export default function TransferBoxes({
};

const handleMax = () => {
setTransferFrom(maxContract);
setTransferFrom(maxContract - fee);
};
const fee = handleFee(+transferFrom);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"icon": "/companies/pactus.svg"
}
]
}
}
2 changes: 1 addition & 1 deletion src/components/SuccessTx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function SuccessTx() {
<CheckIcon className="text-secondary w-full" />
</span>
<div className="space-y-sp5 text-center">
<span className="caption font-bold text-secondary">
<span className="caption-1 font-bold text-secondary">
Grate Job!
</span>

Expand Down
6 changes: 3 additions & 3 deletions src/components/Transactions/ResultTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function ResultTable({ data }: ResultTableProps) {
<p className="body-1 text-white truncate max-w-[140px]">
{chainFrom}
</p>
<p className="caption text-gray-300"></p>
<p className="caption-1 text-gray-300"></p>
</div>
</div>
</TableCell>
Expand All @@ -91,7 +91,7 @@ export default function ResultTable({ data }: ResultTableProps) {
<p className="body-1 text-white">
{chainTo}
</p>
<p className="caption text-gray-300 truncate max-w-[140px]">
<p className="caption-1 text-gray-300 truncate max-w-[140px]">
{item.to}
</p>
</div>
Expand All @@ -113,7 +113,7 @@ export default function ResultTable({ data }: ResultTableProps) {
<p className="body-1 text-white">
{formattedDate}
</p>
<p className="caption text-gray-300">
<p className="caption-1 text-gray-300">
{formattedTime}
</p>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const buttonVariants = cva(
},
size: {
default: "py-sp2 px-4 h-[34px] body-2",
md: "py-sp3 px-sp7 h-[40px] body-1",
lg: "h-[54px] rounded-md px-8 py-[17px] body-1",
},
},
Expand Down
9 changes: 5 additions & 4 deletions src/components/shared/ConnectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ReactNode } from "react";

type ComponentProps<T extends keyof JSX.IntrinsicElements> = {
variant?: "secondary" | null | undefined;
size?: "default" | "lg" | null | undefined;
size?: "default" | "lg" | "md" | null | undefined;
className?: string;
variantType?: "button" | "link";
leftIcon?: ReactNode;
Expand Down Expand Up @@ -41,7 +41,7 @@ export const ConnectButton = <T extends keyof JSX.IntrinsicElements>({
// (!authenticationStatus ||
// authenticationStatus === "authenticated");
// if (account) setAccount && setAccount(account);

return (
<div
{...(!ready && {
Expand All @@ -52,18 +52,19 @@ export const ConnectButton = <T extends keyof JSX.IntrinsicElements>({
userSelect: "none",
},
})}
className="w-full"
>
{(() => {
if (!connected) {
return (
<button
className={cn(
"w-full ",
styleVariants({
variant,
size,
className,
}),
"!w-full",
)}
onClick={openConnectModal}
type="button"
Expand All @@ -77,12 +78,12 @@ export const ConnectButton = <T extends keyof JSX.IntrinsicElements>({
return (
<button
className={cn(
"w-full",
styleVariants({
variant,
size,
className,
}),
"!w-full",
)}
onClick={openChainModal}
type="button"
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(

const [isFocused, setIsFocused] = React.useState<boolean>(false);
const helperTextClasses = clsx(
"caption font-bold text-gray-400 animate-fade-up transition-all duration-700",
"caption-1 font-bold text-gray-400 animate-fade-up transition-all duration-700",
);

return (
<div className={` group space-y-sp2 ${parentClasses || ""}`}>
{label && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TooltipContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
"z-50 overflow-hidden caption font-thin bg-gray-900 px-sp4 py-sp2 rounded-md text-white shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
"z-50 overflow-hidden caption-1 font-thin bg-gray-900 px-sp4 py-sp2 rounded-md text-white shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
Expand Down
30 changes: 22 additions & 8 deletions src/layout/BurgerMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link as ReactRouteLink } from "react-router-dom";
import { BurgerIcon, CloseIcon, EllipseIcon } from "assets/icons";
import { BurgerIcon, CloseIcon } from "assets/icons";
import { communityLinks, CommunityLinksT, links } from "./links.tsx";
import { ConnectButton } from "components/shared/ConnectButton";
import {
Expand All @@ -12,12 +12,14 @@ import {
import Link from "components/shared/Link";
import Logo from "assets/svg/logo.svg";
import { useState } from "react";
import ReScanModal from "./RescanModal.tsx";
import { Button } from "components/shared/Button.tsx";

export default function BurgerMenu() {

const fullLinks = communityLinks.concat(links as CommunityLinksT[]);

const [open, setOpen] = useState(false);
const [reScanModalOpen, setReScanModalOpen] = useState(false);
return (
<div className="flex justify-between items-center lg:hidden">
<Sheet
Expand Down Expand Up @@ -48,7 +50,6 @@ export default function BurgerMenu() {
</SheetHeader>
<div className="py-sp9 px-sp5">
<ul className=" gap-sp5 flex flex-col ">

{fullLinks.map((link, key) => (
<li
onClick={() => setOpen(false)}
Expand All @@ -70,18 +71,31 @@ export default function BurgerMenu() {
</li>
))}
</ul>
<div onClick={() => setOpen(false)} className="mt-sp9">
<div
onClick={() => setOpen(false)}
className="flex flex-col gap-sp2 items-center mt-sp9"
>
<Button
onClick={() => setReScanModalOpen(true)}
className="w-full"
variant={"default"}
size={"md"}
>
Rescan
</Button>
<ConnectButton
size={"md"}
variant="secondary"
variantType="link"
leftIcon={
<EllipseIcon className="text-secondary" />
}
variantType="button"
/>
</div>
</div>
</SheetContent>
</Sheet>
<ReScanModal
onClose={() => setReScanModalOpen(false)}
isOpen={reScanModalOpen}
/>
<ReactRouteLink draggable={false} to="/">
<img src={Logo} alt="Logo" className="text-primary" />
</ReactRouteLink>
Expand Down
29 changes: 24 additions & 5 deletions src/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ import {
NavigationMenuList,
NavigationMenuTrigger,
} from "components/shared/NavigationMenu.tsx";
import ReScanModal from "./RescanModal.tsx";
import { Button } from "components/shared/Button.tsx";
import { useState } from "react";

export function Header() {
const [reScanModalOpen, setReScanModalOpen] = useState(false);
return (
<header className="container mx-auto py-sp6 px-sp5 lg:px-10 lg:py-sp6 border-b border-gray-normal font-light">
<nav className="lg:flex hidden justify-between items-center">
Expand Down Expand Up @@ -76,11 +80,26 @@ export function Header() {
</li>
))}
</ul>
<ConnectButton
variant="secondary"
variantType="link"
leftIcon={<EllipseIcon className="text-secondary" />}
/>
<div className="flex gap-sp2 items-center">
<ReScanModal
onClose={() => setReScanModalOpen(false)}
isOpen={reScanModalOpen}
/>

<Button
onClick={() => setReScanModalOpen(true)}
className="w-full"
variant={"default"}
size={"md"}
>
Rescan
</Button>
<ConnectButton
size={"md"}
variant="secondary"
variantType="button"
/>
</div>
</nav>
<BurgerMenu />
</header>
Expand Down
Loading