diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 7127e562..46e30d95 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -20,9 +20,9 @@ const preview: Preview = { order: ["Welcome", "Features", "Components", "Primitives", "Shadcn", "Styles", "*"], }, }, - msw: { - handlers, - }, + // msw: { + // handlers, + // }, }, loaders: [mswLoader], diff --git a/src/features/checker/apps/Checker.stories.tsx b/src/features/checker/apps/Checker.stories.tsx index 462a816b..afb4b33b 100644 --- a/src/features/checker/apps/Checker.stories.tsx +++ b/src/features/checker/apps/Checker.stories.tsx @@ -10,8 +10,8 @@ const meta = { component: Checker, args: { address: "0x0D1781F0b693b35939A49831A6C799B938Bd2F80", - poolId: "597", - chainId: 11155111, + poolId: "7", + chainId: 10, }, } satisfies Meta; @@ -20,6 +20,11 @@ export default meta; type Story = StoryObj; export const Default: Story = { + args: { + poolId: "5", + chainId: 10, + }, + render(args) { // New StoryWrapper component const StoryWrapper = () => { diff --git a/src/features/checker/hooks/useApplicationEvaluations.ts b/src/features/checker/hooks/useApplicationEvaluations.ts index 0ebdedbc..cf6c3f43 100644 --- a/src/features/checker/hooks/useApplicationEvaluations.ts +++ b/src/features/checker/hooks/useApplicationEvaluations.ts @@ -18,6 +18,7 @@ export const useApplicationEvaluations = ( roundId, applicationId, ); + if (!application || !applicationEvaluations) return undefined; const data = { application, applicationEvaluations: applicationEvaluations, diff --git a/src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.stories.tsx b/src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.stories.tsx index 6d66f6f8..d09d2004 100644 --- a/src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.stories.tsx +++ b/src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.stories.tsx @@ -1,7 +1,6 @@ import { Meta, StoryObj } from "@storybook/react"; -import { handlers } from "@/mocks/handlers"; - +// import { handlers } from "@/mocks/handlers"; import { CheckerProvider } from "~checker/store"; import { ApplicationEvaluationOverviewPage } from "./ApplicationEvaluationOverviewPage"; @@ -34,14 +33,15 @@ export default meta; type Story = StoryObj; export const Default: Story = { - parameters: { - msw: { - handlers, - }, - }, + // parameters: { + // msw: { + // handlers, + // }, + // }, args: { - chainId: 42161, - poolId: "609", - applicationId: "17", + chainId: 10, + poolId: "7", + applicationId: "1", + address: "0x0D1781F0b693b35939A49831A6C799B938Bd2F80", }, }; diff --git a/src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.stories.tsx b/src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.stories.tsx index fc89c879..5fdab729 100644 --- a/src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.stories.tsx +++ b/src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.stories.tsx @@ -37,15 +37,15 @@ export default meta; type Story = StoryObj; export const Default: Story = { - parameters: { - msw: { - handlers, - }, - }, + // parameters: { + // // msw: { + // // handlers, + // // }, + // }, args: { - chainId: 42161, - poolId: "609", - applicationId: "17", + chainId: 10, + poolId: "7", + applicationId: "1", address: "0x0D1781F0b693b35939A49831A6C799B938Bd2F80", }, render: (args) => { diff --git a/src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.stories.tsx b/src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.stories.tsx index 77ae7486..079a0e32 100644 --- a/src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.stories.tsx +++ b/src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.stories.tsx @@ -34,14 +34,14 @@ export default meta; type Story = StoryObj; export const Default: Story = { - parameters: { - msw: { - handlers, - }, - }, + // parameters: { + // // msw: { + // // handlers, + // // }, + // }, args: { - chainId: 42161, - poolId: "609", - applicationId: "0", + chainId: 10, + poolId: "6", + applicationId: "4", }, }; diff --git a/src/features/checker/services/allo/alloClient.ts b/src/features/checker/services/allo/alloClient.ts index 878259ea..14913a9a 100644 --- a/src/features/checker/services/allo/alloClient.ts +++ b/src/features/checker/services/allo/alloClient.ts @@ -2,12 +2,13 @@ import { GraphQLClient } from "graphql-request"; // Base URL for the GraphQL API -const GS_INDEXER_ENDPOINT = "https://grants-stack-indexer-v2.gitcoin.co/graphql"; +const GS_INDEXER_ENDPOINT = "http://localhost:8082/v1/graphql"; // Create a new instance of GraphQLClient export const graphqlClient = new GraphQLClient(GS_INDEXER_ENDPOINT, { headers: { "Content-Type": "application/json", + "x-hasura-admin-secret": "my-admin-secret ", }, }); diff --git a/src/features/checker/services/allo/dataLayer.ts b/src/features/checker/services/allo/dataLayer.ts index 3705eee7..b55f5874 100644 --- a/src/features/checker/services/allo/dataLayer.ts +++ b/src/features/checker/services/allo/dataLayer.ts @@ -19,7 +19,7 @@ export async function getApplicationsFromIndexer( }); return { applications: response.applications as ProjectApplicationForManager[], - roundData: response.round as PoolInfo, + roundData: response.rounds[0] as PoolInfo, }; } catch (e) { throw new Error(`Failed to fetch applications data. with error: ${e}`); @@ -37,7 +37,8 @@ export async function getApplicationByIdFromIndexer( roundId, applicationId, }); - return response.application as ProjectApplication; + //TODO: handle empty ([]) gracefully + return response.applications[0] as ProjectApplication; } catch (e) { throw new Error(`Failed to fetch application data. with error: ${e}`); } @@ -55,7 +56,7 @@ export async function getPastApplicationsByApplicationIdFromIndexer( applicationId, }); - return response.applications[0].project.applications as PastApplication[]; + return response.applications[0].project[0].applications as PastApplication[]; } catch (e) { throw new Error(`Failed to fetch past applications data. with error: ${e}`); } diff --git a/src/features/checker/services/allo/queries.ts b/src/features/checker/services/allo/queries.ts index 667a29f1..8122aaf6 100644 --- a/src/features/checker/services/allo/queries.ts +++ b/src/features/checker/services/allo/queries.ts @@ -2,10 +2,7 @@ import { gql } from "graphql-request"; export const applicationsForManagerQuery = gql` query getApplicationsForManager($chainId: Int!, $roundId: String!) { - applications( - first: 1000 - filter: { roundId: { equalTo: $roundId }, chainId: { equalTo: $chainId } } - ) { + applications(limit: 1000, where: { roundId: { _eq: $roundId }, chainId: { _eq: $chainId } }) { id projectId chainId @@ -22,7 +19,7 @@ export const applicationsForManagerQuery = gql` } } } - round(chainId: $chainId, id: $roundId) { + rounds(where: { chainId: { _eq: $chainId }, id: { _eq: $roundId } }) { roundMetadata strategyName strategyAddress @@ -42,7 +39,9 @@ export const applicationsForManagerQuery = gql` export const getApplicationByIdQuery = gql` query getApplicationById($chainId: Int!, $roundId: String!, $applicationId: String!) { - application(chainId: $chainId, roundId: $roundId, id: $applicationId) { + applications( + where: { chainId: { _eq: $chainId }, roundId: { _eq: $roundId }, id: { _eq: $applicationId } } + ) { id projectId chainId @@ -69,11 +68,7 @@ export const getPastApplicationsQueryByApplicationId = gql` $applicationId: String! ) { applications( - filter: { - chainId: { equalTo: $chainId } - roundId: { equalTo: $roundId } - id: { equalTo: $applicationId } - } + where: { chainId: { _eq: $chainId }, roundId: { _eq: $roundId }, id: { _eq: $applicationId } } ) { project { applications {