Skip to content

Commit 7b1c601

Browse files
authored
Fix: Modify checker endpoints setup with InitChecker (#85)
* checker provider update with InitChecker for api url * update stories to use the InitChecker setup * changeset * lockfile
1 parent 8b7151d commit 7b1c601

File tree

15 files changed

+11406
-13788
lines changed

15 files changed

+11406
-13788
lines changed

.changeset/purple-bugs-sing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@gitcoin/ui": patch
3+
---
4+
5+
Updated default setup for CheckerProvider with InitChecker

packages/ui/src/features/checker/apps/ApplicationView.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import { CheckerProvider } from "~checker/store";
88

99
export const ApplicationView: React.FC<ViewApplicationEvaluationsPageProps> = (props) => {
1010
return (
11-
<CheckerProvider>
11+
<CheckerProvider
12+
config={{
13+
checkerEndpoint: "https://checker-api-production.up.railway.app",
14+
gsIndexerEndpoint: "https://hasura-production-3454.up.railway.app/v1/graphql",
15+
}}
16+
>
1217
<ViewApplicationEvaluationsPage {...props} />
1318
</CheckerProvider>
1419
);

packages/ui/src/features/checker/apps/Checker.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ export const Default: Story = {
4040
);
4141
};
4242
return (
43-
<CheckerProvider>
43+
<CheckerProvider
44+
config={{
45+
checkerEndpoint: "https://checker-api-production.up.railway.app",
46+
gsIndexerEndpoint: "https://hasura-production-3454.up.railway.app/v1/graphql",
47+
}}
48+
>
4449
<StoryWrapper />
4550
</CheckerProvider>
4651
);

packages/ui/src/features/checker/apps/Checker.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export interface CheckerProps {
2424

2525
export const Checker = (props: CheckerProps) => {
2626
return (
27-
<CheckerProvider>
27+
<CheckerProvider
28+
config={{
29+
checkerEndpoint: "https://checker-api-production.up.railway.app",
30+
gsIndexerEndpoint: "https://hasura-production-3454.up.railway.app/v1/graphql",
31+
}}
32+
>
2833
<CheckerRouter {...props} />
2934
</CheckerProvider>
3035
);

packages/ui/src/features/checker/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ export * from "./store";
99
export * from "./types";
1010
export * from "./utils";
1111
export * from "./constants";
12+
export * from "./init/InitChecker";
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { ReactNode, useEffect, useState } from "react";
2+
3+
import { initializeAlloClient } from "../services/allo/alloClient";
4+
import { initializeCheckerClient } from "../services/checker/checkerClient";
5+
6+
export interface CheckerConfig {
7+
checkerEndpoint: string;
8+
gsIndexerEndpoint: string;
9+
}
10+
11+
interface InitCheckerProps {
12+
children?: ReactNode;
13+
config: CheckerConfig;
14+
}
15+
16+
// Default configuration
17+
export const defaultConfig: CheckerConfig = {
18+
checkerEndpoint: "https://api.checker.gitcoin.co",
19+
gsIndexerEndpoint: "https://yc7lia2566.execute-api.us-east-2.amazonaws.com/api/v1/graphql",
20+
};
21+
22+
export const InitChecker: React.FC<InitCheckerProps> = ({
23+
children = null,
24+
config = defaultConfig,
25+
}) => {
26+
const [initialized, setInitialized] = useState(false);
27+
28+
useEffect(() => {
29+
initializeCheckerClient(config.checkerEndpoint);
30+
initializeAlloClient(config.gsIndexerEndpoint);
31+
setInitialized(true);
32+
}, [config]);
33+
34+
return <>{initialized ? children : null}</>;
35+
};

packages/ui/src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ const meta: Meta<typeof ApplicationEvaluationOverviewPage> = {
2222
},
2323
decorators: [
2424
(Story) => (
25-
<CheckerProvider>
25+
<CheckerProvider
26+
config={{
27+
checkerEndpoint: "https://checker-api-production.up.railway.app",
28+
gsIndexerEndpoint: "https://hasura-production-3454.up.railway.app/v1/graphql",
29+
}}
30+
>
2631
<Story />
2732
</CheckerProvider>
2833
),

packages/ui/src/features/checker/pages/ReviewApplicationsPage/ReviewApplicationsPage.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ export const ReviewApplicationsPage = ({ isStandalone }: { isStandalone: boolean
6060
};
6161

6262
const openCheckerApplicationEvaluations = (projectId: string) => {
63-
window.open(
64-
`https://beta.checker.gitcoin.co/view/application/${chainId}/${poolId}/${projectId}`,
65-
"_blank",
66-
);
63+
window.open(`/view/application/${chainId}/${poolId}/${projectId}`, "_blank");
6764
};
6865

6966
return (

packages/ui/src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ const meta: Meta<typeof SubmitApplicationEvaluationPage> = {
2424
decorators: [
2525
(Story) => {
2626
return (
27-
<CheckerProvider>
27+
<CheckerProvider
28+
config={{
29+
checkerEndpoint: "https://checker-api-production.up.railway.app",
30+
gsIndexerEndpoint: "https://hasura-production-3454.up.railway.app/v1/graphql",
31+
}}
32+
>
2833
<Story />
2934
</CheckerProvider>
3035
);

packages/ui/src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ const meta: Meta<typeof ViewApplicationEvaluationsPage> = {
2222
},
2323
decorators: [
2424
(Story) => (
25-
<CheckerProvider>
25+
<CheckerProvider
26+
config={{
27+
checkerEndpoint: "https://checker-api-production.up.railway.app",
28+
gsIndexerEndpoint: "https://hasura-production-3454.up.railway.app/v1/graphql",
29+
}}
30+
>
2631
<Story />
2732
</CheckerProvider>
2833
),

0 commit comments

Comments
 (0)