From 4c3863fb662b50a8423bb5cb272d1144eec8853b Mon Sep 17 00:00:00 2001 From: Nico <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:10:46 +0200 Subject: [PATCH] fixing e2e --- components/discover/claimModal.tsx | 7 ++++-- components/discover/defiTable.tsx | 36 ++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/components/discover/claimModal.tsx b/components/discover/claimModal.tsx index e62ee705..7b3818de 100644 --- a/components/discover/claimModal.tsx +++ b/components/discover/claimModal.tsx @@ -148,7 +148,7 @@ const ClaimModal: FunctionComponent = ({ />
- {rewards && Object.keys(rewards).length > 0 ? ( + {rewards && calls.length > 0 ? ( Object.entries(rewards) .filter(([key, rewardList]) => key && rewardList.length > 0) .map(([key, rewardList]) => ( @@ -178,7 +178,10 @@ const ClaimModal: FunctionComponent = ({ Cancel
-
diff --git a/components/discover/defiTable.tsx b/components/discover/defiTable.tsx index 716bc2ba..87728d37 100644 --- a/components/discover/defiTable.tsx +++ b/components/discover/defiTable.tsx @@ -36,6 +36,7 @@ import { getRedirectLink } from "@utils/defi"; import DefiTableSkeleton from "./defiTableSkeleton"; import ClaimModal from "./claimModal"; import SuccessModal from "./successModal"; +import { useAccount } from "@starknet-react/core"; type DataTableProps = { data: TableInfo[]; @@ -247,6 +248,8 @@ const DataTable: FunctionComponent = ({ data, loading }) => { }, ]); + const { address } = useAccount(); + const [tokenFilter, setTokenFilter] = useState(); const [liquidityFilter, setLiquidityFilter] = useState(); const [securityFilter, setSecurityFilter] = useState(); @@ -254,7 +257,7 @@ const DataTable: FunctionComponent = ({ data, loading }) => { const [showClaimModal, setShowClaimModal] = useState(false); const [showSuccessModal, setShowSuccessModal] = useState(false); - + const table = useReactTable({ data, columns, @@ -312,7 +315,9 @@ const DataTable: FunctionComponent = ({ data, loading }) => { return (
-
+
Explore reward opportunities @@ -322,8 +327,9 @@ const DataTable: FunctionComponent = ({ data, loading }) => {
setShowClaimModal(true)} - className="flex flex-row items-center justify-evenly gap-4 bg-white rounded-xl modified-cursor-pointer h-min lg:mt-2 mt-8 px-6 py-2.5"> + onClick={() => address && setShowClaimModal(true)} + className="flex flex-row items-center justify-evenly gap-4 bg-white rounded-xl modified-cursor-pointer h-min lg:mt-2 mt-8 px-6 py-2.5" + > Claim all @@ -414,13 +420,14 @@ const DataTable: FunctionComponent = ({ data, loading }) => { return ( + onClick={header.column.getToggleSortingHandler()} + > {header.isPlaceholder ? null : flexRender( - header.column.columnDef.header, - header.getContext() - )} + header.column.columnDef.header, + header.getContext() + )} ); })} @@ -435,9 +442,12 @@ const DataTable: FunctionComponent = ({ data, loading }) => { data-state={row.getIsSelected() && "selected"} onClick={() => { window.open( - getRedirectLink(row.getValue("app"), row.getValue("action")), + getRedirectLink( + row.getValue("app"), + row.getValue("action") + ), "_blank" - ) + ); }} > {row.getVisibleCells().map((cell) => ( @@ -463,7 +473,9 @@ const DataTable: FunctionComponent = ({ data, loading }) => { onClick={() => table.getCanPreviousPage() ? table.previousPage() : null } - style={table.getCanPreviousPage() ? {} : { cursor: 'not-allowed' }} + style={ + table.getCanPreviousPage() ? {} : { cursor: "not-allowed" } + } > = ({ data, loading }) => {
(table.getCanNextPage() ? table.nextPage() : null)} - style={table.getCanNextPage() ? {} : { cursor: 'not-allowed' }} + style={table.getCanNextPage() ? {} : { cursor: "not-allowed" }} >