Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alimaktabi committed Dec 17, 2023
2 parents 903396e + 82aef1b commit f7b1577
Show file tree
Hide file tree
Showing 22 changed files with 970 additions and 242 deletions.
35 changes: 29 additions & 6 deletions app/gastap/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
import GasTapProvider from "@/context/gasTapProvider";
import { Chain } from "@/types";
import { FC, PropsWithChildren } from "react";
import { cookies } from "next/headers";
import {
getClaimedReceiptsServer,
getOneTimeClaimedReceiptsServer,
} from "@/utils/serverApis";

const GasTapLayout: FC<PropsWithChildren> = async ({ children }) => {
const chains = await fetch(
const chainsApi = await fetch(
process.env.NEXT_PUBLIC_API_URL! + "/api/gastap/chain/list/",
{
next: {
revalidate: 10,
},
cache: "no-cache",
cache: "no-store",
}
).then((res) => res.json());

return <GasTapProvider chains={chains}>{children}</GasTapProvider>;
const cookieStore = cookies();

const token = cookieStore.get("userToken");

const oneTimeClaimedChains = await getOneTimeClaimedReceiptsServer(
token?.value
);

const claimedChains = await getClaimedReceiptsServer(token?.value);

const chains = chainsApi as Array<Chain>;

return (
<GasTapProvider
claimReceiptInitial={claimedChains}
oneTimeClaimedGasListInitial={oneTimeClaimedChains}
chains={chains}
>
{children}
</GasTapProvider>
);
};

export default GasTapLayout;
22 changes: 11 additions & 11 deletions app/gastap/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import ClaimNonEVMModal from "@/components/containers/gas-tap/Modals/claimNonEVMModal"
import ClaimModal from "@/components/containers/gas-tap/Modals/ClaimModal"
import Header from "@/components/containers/gas-tap/header"
import { Metadata } from "next"
import GasTapMainContent from "@/components/containers/gas-tap"
import FundContextProvider from "@/components/containers/gas-tap/Modals/FundGasModal"
import ProvideGasCard from "@/components/containers/gas-tap/Cards/ProvideGasCard/provideGasCard"
import ClaimNonEVMModal from "@/components/containers/gas-tap/Modals/claimNonEVMModal";
import ClaimModal from "@/components/containers/gas-tap/Modals/ClaimModal";
import Header from "@/components/containers/gas-tap/header";
import { Metadata } from "next";
import GasTapMainContent from "@/components/containers/gas-tap";
import FundContextProvider from "@/components/containers/gas-tap/Modals/FundGasModal";
import ProvideGasCard from "@/components/containers/gas-tap/Cards/ProvideGasCard/provideGasCard";

export const metadata: Metadata = {
title: "Unitap | Gas Tap ⛽",
description: "Enjoy surfing Web3 without the worry of gas fees",
}
};

const GasTap = () => {
return (
Expand All @@ -21,7 +21,7 @@ const GasTap = () => {
<ClaimModal />
<ClaimNonEVMModal />
</FundContextProvider>
)
}
);
};

export default GasTap
export default GasTap;
10 changes: 5 additions & 5 deletions app/globals.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@import "../styles/buttons.scss";
@import "../styles/cards.scss";
@import "../styles/index.scss";
@import "../styles/animations.scss";

@tailwind base;
@tailwind components;
@tailwind utilities;

@import "@/styles/buttons.scss";
@import "@/styles/cards.scss";
@import "@/styles/index.scss";
@import "@/styles/animations.scss";

@mixin btn {
@apply ease-out duration-300;
}
Expand Down
87 changes: 87 additions & 0 deletions app/prizetap/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import Icon from "@/components/ui/Icon";

const PrizeTapLoading = () => {
return (
<div>
<div className="bg-gray60 h-[202px] rounded-2xl flex flex-col md:flex-row lg:items-end md:justify-between overflow-hidden relative p-4 mb-5 border-3 border-gray70">
<div className="header-left z-10 flex flex-col items-start">
<div className="h-12 w-[140px] bg-gray70 rounded-lg"></div>
<div className="mt-3 h-4 rounded-lg w-[240px] bg-gray70"></div>
</div>

<div className="flex flex-wrap justify-center md:justify-start mt-2">
<div className="rounded-lg bg-gray70 py-[2px] px-3 items-center h-14 flex gap-x-3">
<img
className="w-full"
src="/assets/images/prize-tap/daimond-ticket.svg"
alt="loading"
/>
<div className="ml-16"></div>
</div>
</div>
<div className="absolute w-96 h-[400px] animate-skeleton -top-40 z-10 opacity-20 rotate-[21.574deg] blur-2xl bg-[#797992]"></div>
</div>
<div className="mt-10"></div>
{Array.from(new Array(7)).map((_, key) => (
<PrizeCardLoading key={key} />
))}
</div>
);
};

const PrizeCardLoading = () => {
return (
<div className="relative mb-16">
<div className="absolute rounded-2xl inset-0 left-6 overflow-hidden">
<div className="absolute w-96 h-[500px] animate-skeleton -top-40 z-20 opacity-20 rotate-[21.574deg] blur-2xl bg-[#797992]"></div>
</div>
<div className="relative z-10">
<div className="absolute z-20 right-5 top-5 flex gap-x-6 items-center">
<Icon
className="opacity-40"
iconSrc="/assets/images/token-tap/twitter-icon.svg"
width="auto"
height="20px"
/>
<Icon
className="opacity-40"
iconSrc="/assets/images/token-tap/discord-icon.svg"
width="auto"
height="20px"
/>
</div>
<div className="absolute left-0 -top-5 -z-10 -bottom-5 rounded-lg bg-gray20 w-100"></div>
<div className="flex gap-6">
<div className="relative border-2 border-gray40 bg-gray60 ml-6 rounded-lg w-[220px]">
<div className="absolute bottom-0 translate-y-1/2 bg-gray40 border-2 left-1/2 -translate-x-1/2 border-gray70 rounded-lg h-6 w-24"></div>
</div>
<div className="bg-gray60 border-2 p-4 border-gray40 flex-1 rounded-2xl relative overflow-hidden">
<div className="h-5 w-52 rounded-lg bg-gray70"></div>
<div className="h-4 w-24 mt-3 rounded-lg bg-gray70"></div>
<div className="mr-16 mt-3">
<div className="h-5 w-full rounded-lg bg-gray70"></div>
</div>

<div
className={`flex mt-3 items-center flex-wrap text-xs gap-2 text-white`}
>
{Array.from(new Array(6)).map((_, key) => (
<div
className="bg-gray70 w-28 h-6 px-3 py-2 rounded-lg"
key={key}
></div>
))}
</div>

<div className="mt-10 flex items-center gap-4">
<div className="bg-gray70 flex-1 h-12 px-3 py-2 rounded-lg"></div>
<div className="bg-gray70 w-64 border-2 border-gray80 h-12 px-3 py-2 rounded-xl"></div>
</div>
</div>
</div>
</div>
</div>
);
};

export default PrizeTapLoading;
67 changes: 50 additions & 17 deletions components/containers/gas-tap/Cards/Chainlist/ChainCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import {
SecondaryButton,
ClaimedButton,
ClaimButton,
Button,
} from "@/components/ui/Button/button";
import { DV } from "@/components/ui/designVariables";
import { useGasTapContext } from "@/context/gasTapProvider";
Expand All @@ -16,6 +16,8 @@ import styled from "styled-components";
import { FundContext } from "../../Modals/FundGasModal";
import Icon from "@/components/ui/Icon";
import Tooltip from "@/components/ui/Tooltip";
import Styles from "./chain-card.module.scss";
import Image from "next/image";

type ChainCardProps = {
chain: Chain;
Expand Down Expand Up @@ -84,7 +86,9 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {
>
<div
onClick={() => window.open(chain.blockScanAddress, "_blank")}
className="hover:cursor-pointer items-center flex mb-6 sm:mb-0"
className={`cursor-pointer ${
isOneTimeCollected ? "opacity-60" : ""
} items-center flex mb-6 sm:mb-0`}
>
<span className="chain-logo-container w-10 h-10 flex justify-center">
<img
Expand All @@ -101,7 +105,7 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {
</p>
<img
className="arrow-icon mt-1 ml-1.5 w-2 h-2"
src="assets/images/arrow-icon.svg"
src="/assets/images/arrow-icon.svg"
alt="arrow"
/>
<p className="text-gray ml-2 text-2xs px-2 py-1 rounded bg-gray30">
Expand Down Expand Up @@ -136,20 +140,49 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {

<div className="action flex flex-col md:flex-row w-full sm:w-auto items-center sm:items-end">
{isMonthlyCollected || isOneTimeCollected ? (
<ClaimedButton
<Button
data-testid={`chain-claimed-${chain.pk}`}
$mlAuto
$icon="../assets/images/claim/claimedIcon.svg"
$iconWidth={24}
$iconHeight={20}
onClick={() => openClaimModal(chain.pk)}
className="text-sm bg-g-primary-low border-2 border-space-green m-auto"
className={`text-sm ${Styles.claimedButton} !w-[220px] !py-2 m-auto`}
>
<p className="text-gradient-primary flex-[2] font-semibold text-sm">
Claimed!
</p>
</ClaimedButton>
<div className="flex-[2] text-left text-xs">
<p className="text-space-green font-semibold">
Gas Claimed!
</p>
<p
className={`${
isOneTimeCollected
? "text-warning2"
: "text-secondary-text"
} text-2xs font-normal`}
>
{isOneTimeCollected
? "Not claimable anymore"
: "Claimable again in next round"}
</p>
</div>
<Image
width={24}
height={20}
src={`/assets/images/${
isOneTimeCollected
? "gas-tap/claimed-logo.svg"
: "claim/claimedIcon.svg"
}`}
alt="claimed logo"
/>
</Button>
) : chain.needsFunding && chain.chainType !== ChainType.SOLANA ? (
// <Button
// onClick={() => handleRefillButtonClicked(chain.pk)}
// className="bg-gray60 text-xs !block border-2 !font-normal border-gray100 !w-[220px] !py-1 m-auto"
// >
// <p>Refuel</p>
// <p className="text-2xs text-gray90">
// This FASET is out of balance
// </p>
// </Button>
<div className="btn btn--claim btn--sm btn--out-of-balance">
Out of Gas
<button
Expand All @@ -168,7 +201,7 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {
data-testid={`chain-show-claim-${chain.pk}`}
$mlAuto
onClick={() => openClaimModal(chain.pk)}
className="text-sm m-auto"
className="text-sm !h-11 m-auto"
>
<p>{`Claim ${formatChainBalance(
chain.maxClaimAmount,
Expand All @@ -180,7 +213,7 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {
data-testid={`chain-show-claim-${chain.pk}`}
$mlAuto
onClick={() => openClaimModal(chain.pk)}
className="text-sm m-auto"
className="text-sm !h-11 before:!bg-gray30 opacity-90 m-auto"
>
<p>Pending ...</p>
</ClaimButton>
Expand Down Expand Up @@ -217,11 +250,11 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {
}
>
<div
className={`items-center flex rounded-none justify-between md:justify-center`}
className={`items-center font-semibold px-4 text-secondary-text flex rounded-none justify-between md:justify-center`}
>
{chain.isOneTimeClaim ? (
<>
<p className="text-xs">Single-Claim Tap</p>
<p className="flex-1">Single-Claim Tap</p>
<Icon
className="text-white"
ml={4}
Expand All @@ -230,7 +263,7 @@ const ChainCard = ({ chain, isHighlighted }: ChainCardProps) => {
</>
) : (
<>
<p>Periodic Tap</p>
<p className="flex-1">Periodic Tap</p>
<Icon
className="text-white"
ml={4}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.claimedButton {
background: linear-gradient(
91deg,
#284236 -4.66%,
#0f0b25 60.65%,
#bc97d4 111.44%
) !important;
}
Loading

1 comment on commit f7b1577

@vercel
Copy link

@vercel vercel bot commented on f7b1577 Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.