Skip to content

Commit

Permalink
Dev (#62)
Browse files Browse the repository at this point in the history
* fixed enroll modal bug

* sort raffles in home page
  • Loading branch information
abbasnosrati authored Jun 29, 2024
1 parent 6c437d5 commit 6066e8e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
21 changes: 10 additions & 11 deletions app/prizetap/components/Modals/enroll-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import WrongNetworkBody from "./enroll-body/WrongNetworkBody";
import WinnersModal from "./winnersModal";

const EnrollModalBody = ({ chain }: { chain: Chain }) => {
const { userProfile } = useUserProfileContext();
// const { userProfile } = useUserProfileContext();

const { selectedNetwork } = useNetworkSwitcher();

Expand All @@ -28,13 +28,13 @@ const EnrollModalBody = ({ chain }: { chain: Chain }) => {

if (!selectedRaffleForEnroll) return null;

if (!userProfile)
return (
<BrightNotConnectedBody
method={method!}
raffle={selectedRaffleForEnroll}
/>
);
// if (!userProfile)
// return (
// <BrightNotConnectedBody
// method={method!}
// raffle={selectedRaffleForEnroll}
// />
// );

if (claimOrEnrollWalletResponse?.state === "Done")
return <SuccessBody method={method!} raffle={selectedRaffleForEnroll} />;
Expand Down Expand Up @@ -68,9 +68,8 @@ const EnrollModal = () => {

return (
<Modal
title={`${
method === "Verify" ? "Requirements" : selectedRaffleForEnroll.name
}`}
title={`${method === "Verify" ? "Requirements" : selectedRaffleForEnroll.name
}`}
size="small"
closeModalHandler={closeClaimTokenModal}
isOpen={isOpen}
Expand Down
4 changes: 2 additions & 2 deletions app/prizetap/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BrightConnectionModal } from "@/components/containers/modals";
// import { BrightConnectionModal } from "@/components/containers/modals";
import LineaCheckWalletsModal from "@/app/prizetap/components/Linea/LineaCheckWalletsModal";
import LineaWinnersModal from "@/app/prizetap/components/Linea/LineaWinnersModal";
import EnrollModal from "@/app/prizetap/components/Modals/enroll-modal";
Expand All @@ -18,7 +18,7 @@ const PrizeTapPage: FC = () => {
<LineaCheckWalletsModal />
<LineaWinnersModal />
<EnrollModal />
<BrightConnectionModal />
{/* <BrightConnectionModal /> */}
</>
);
};
Expand Down
11 changes: 6 additions & 5 deletions components/containers/landing/prizeTap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ const PrizeTapLanding: FC = async () => {
raffle.status !== "PENDING" && raffle.status !== "REJECTED",
);

const validRaffles = rafflesList.sort(
(a, b) => new Date(a.deadline).getTime() - new Date(b.deadline).getTime(),
);
// const validRaffles = rafflesList.sort(
// (a, b) => new Date(a.deadline).getTime() - new Date(b.deadline).getTime(),
// );


const availableRaffles = rafflesList.filter(
(raffle) =>
Expand Down Expand Up @@ -57,8 +58,8 @@ const PrizeTapLanding: FC = async () => {
}
>
<div className="mt-14">
{validRaffles.length > 0 &&
validRaffles.slice(0, 2).map((raffle, key) => (
{rafflesList.length > 0 &&
rafflesList.slice(0, 2).map((raffle, key) => (
<div
key={key}
className={
Expand Down
6 changes: 5 additions & 1 deletion context/prizeTapProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,15 @@ const PrizeTapProvider: FC<PropsWithChildren & { raffles: Prize[] }> = ({
setIsWalletPromptOpen(true);
return;
}
if (!address && method !== "Winners") {
setIsWalletPromptOpen(true);
return;
}
setClaimOrEnrollWalletResponse(null);
setMethod(method);
setSelectedRaffleForEnroll(raffle);
},
[isConnected, setIsWalletPromptOpen],
[isConnected, setIsWalletPromptOpen, address],
);

const closeEnrollModal = useCallback(() => {
Expand Down

0 comments on commit 6066e8e

Please sign in to comment.