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

Victor/feature/banner 1.1 #304

Merged
merged 2 commits into from
Dec 11, 2024
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
14 changes: 10 additions & 4 deletions src/app/BridgeSwap/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { Flex } from "@chakra-ui/layout";
import Swap from "./Swap";
import { Details } from "./Details";
import MaintenanceBanner from "@/components/modal/MaintenanceBanner";
import { SwitchToTestNetwork } from "@/staging/components/cross-trade/components/common/WrongNetwork";
import { BANNER10 } from "@/staging/constants/banner";
import { InitialBanner } from "@/staging/components/legacy-titan/InitialBanner";
import { Banner10Component } from "@/staging/components/legacy-titan/Banner10";
import { BRIDGE_VERSION } from "@/staging/constants/legacyTitan";
import { LegacyTitanBridgeVersionEnum } from "@/staging/types/legacyTitan";
import { Banner11Component } from "@/staging/components/legacy-titan/Banner11";

export default function BridgeSwap() {
return (
Expand All @@ -25,7 +26,12 @@ export default function BridgeSwap() {
>
{/* <ServiceSuspensionBanner/> */}
<MaintenanceBanner />
{BANNER10 && <InitialBanner />}
{BRIDGE_VERSION === LegacyTitanBridgeVersionEnum.V01 && (
<Banner10Component />
)}
{BRIDGE_VERSION === LegacyTitanBridgeVersionEnum.V10 && (
<Banner11Component />
)}
{/* <SwitchToTestNetwork
style={{ marginTop: "55px", marginBottom: "14px" }}
/> */}
Expand Down
6 changes: 6 additions & 0 deletions src/app/BridgeSwap/components/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import useSwapConfirmModal from "@/staging/components/new-confirm/hooks/useSwapC

// FW UI test @Robert
import useCTOptionModal from "@/staging/components/cross-trade/hooks/useCTOptionModal";
import { LegacyTitanBridgeVersionEnum } from "@/staging/types/legacyTitan";
import { BRIDGE_VERSION } from "@/staging/constants/legacyTitan";

export default function ActionButton() {
const { isConnected } = useAccount();
Expand All @@ -47,6 +49,10 @@ export default function ActionButton() {

const isDisabled = useMemo(() => {
if (!isConnected) return false;
if (BRIDGE_VERSION === LegacyTitanBridgeVersionEnum.V10) {
if (mode === "Deposit" || mode === "Withdraw") return true;
if (isL2) return true;
}
if (mode === "Withdraw" && !isInputZero) return false;
const disabled =
!isReady ||
Expand Down
6 changes: 6 additions & 0 deletions src/constant/url/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ export const GoogleFormURL =

export const TitanSunSetGuideURL =
"https://medium.com/tokamak-network/tokamak-network-to-sunset-titan-b4471019c92";

export const ClaimableListPlanURL =
"https://medium.com/tokamak-network/tokamak-network-to-sunset-titan-b4471019c92";

export const WithdrawAssetsGuideURL =
"https://medium.com/tokamak-network/tokamak-network-to-sunset-titan-b4471019c92";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TitanSunSetGuideURL } from "@/constant/url";
import { Flex, Text } from "@chakra-ui/react";
import React from "react";

export const InitialBanner = () => {
export const Banner10Component = () => {
return (
<Flex
w={"493px"}
Expand Down
84 changes: 84 additions & 0 deletions src/staging/components/legacy-titan/Banner11.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import {
ClaimableListPlanURL,
WithdrawAssetsGuideURL,
TitanSunSetGuideURL,
} from "@/constant/url";
import { BridgeShutdownDate } from "@/staging/constants/legacyTitan";
import { Button, Flex, Text } from "@chakra-ui/react";
import React from "react";

export const Banner11Component = () => {
const daysLeft = Math.floor(
(BridgeShutdownDate.getTime() - new Date().getTime()) /
(1000 * 60 * 60 * 24)
);
return (
<Flex
w={"493px"}
flexDir={"column"}
gap={"12px"}
justifyContent={"center"}
alignItems={"center"}
mb={"48px"}
>
<Flex
width={"100%"}
flexDir={"column"}
px={"16px"}
py={"10px"}
borderRadius={"8px"}
bg={"#F9C03E"}
>
<Text fontSize={"14px"} color={"#0F0F12"} fontWeight={500}>
Claimable list plan
</Text>
<Text fontSize={"11px"} color={"#0F0F12"} fontWeight={400}>
Read about it more{" "}
<a
href={ClaimableListPlanURL}
target="_blank"
style={{ textDecoration: "underline" }}
>
here
</a>
. The exact date will be announced soon.
</Text>
</Flex>
<Flex
w={"100%"}
justifyContent={"space-between"}
alignItems={"center"}
px={"16px"}
py={"10px"}
borderRadius={"8px"}
bg={"#DD3A44"}
>
<Flex flexDir={"column"}>
<Text fontSize={"14px"} color={"#FFF"} fontWeight={500}>
Tokamak Bridge to be shutdown
</Text>
<Text w={"320px"} fontSize={"11px"} color={"#FFF"} fontWeight={400}>
Make sure to withdraw your assets using Tokamak Bridge by end of
January 2025. See this{" "}
<a
href={WithdrawAssetsGuideURL}
target="_blank"
style={{ textDecoration: "underline" }}
>
guide
</a>{" "}
.
</Text>
</Flex>
<Flex>
<Text color={"FFF"} fontSize={"16px"}>
<Text as="span" fontSize={"18px"} fontWeight={600}>
{daysLeft}
</Text>{" "}
days Left
</Text>
</Flex>
</Flex>
</Flex>
);
};
2 changes: 0 additions & 2 deletions src/staging/constants/banner.ts

This file was deleted.

7 changes: 7 additions & 0 deletions src/staging/constants/legacyTitan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { LegacyTitanBridgeVersionEnum } from "../types/legacyTitan";

export const BRIDGE_VERSION: LegacyTitanBridgeVersionEnum =
LegacyTitanBridgeVersionEnum.V01;

export const BridgeShutdownDate = new Date("2025-01-31");
export const TitanShutdownDate = new Date("2024-12-30");
5 changes: 5 additions & 0 deletions src/staging/types/legacyTitan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export enum LegacyTitanBridgeVersionEnum {
V01 = "v0.1",
V10 = "v1.0",
V11 = "v1.1",
}
Loading