Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit ac5beb7

Browse files
authored
feat: reorganize types (#70)
* chore: moved pool types to global types * chore: added new build/package entry point types
1 parent acdc61d commit ac5beb7

15 files changed

+47
-40
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
"types": "./dist/mocks.d.ts",
3939
"import": "./dist/mocks.js",
4040
"require": "./dist/mocks.js"
41+
},
42+
"./types": {
43+
"types": "./dist/types.d.ts",
44+
"import": "./dist/types.js",
45+
"require": "./dist/types.js"
4146
}
4247
},
4348
"scripts": {

src/components/Badges/PoolBadge/PoolBadge.stories.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Meta, StoryObj } from "@storybook/react";
22

3-
import { PoolBadge, PoolStatus, PoolType } from "./PoolBadge";
3+
import { PoolStatus, PoolType } from "@/types";
4+
5+
import { PoolBadge } from "./PoolBadge";
46

57
const meta: Meta<typeof PoolBadge> = {
68
title: "Components/PoolBadge",

src/components/Badges/PoolBadge/PoolBadge.tsx

+1-12
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,7 @@ import { match } from "ts-pattern";
55

66
import { cn } from "@/lib/utils";
77
import { Badge } from "@/primitives";
8-
9-
export enum PoolStatus {
10-
PreRound = "PreRound",
11-
RoundInProgress = "RoundInProgress",
12-
ApplicationsInProgress = "ApplicationsInProgress",
13-
FundingPending = "FundingPending",
14-
}
15-
16-
export enum PoolType {
17-
QuadraticFunding = "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
18-
DirectGrants = "allov2.DirectGrantsSimpleStrategy",
19-
}
8+
import { PoolStatus, PoolType } from "@/types";
209

2110
const PoolBadgeVariants = tv({
2211
variants: {

src/components/pool/components/PoolCard/PoolCard.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Meta, StoryObj } from "@storybook/react";
22

33
import { PoolCardProps, PoolCardQueryProps } from "@/components";
4-
import { PoolStatus, PoolType } from "@/components/Badges";
54
import { createQueryState } from "@/lib";
5+
import { PoolStatus, PoolType } from "@/types";
66

77
import { PoolCard } from "./PoolCard";
88

src/components/pool/components/PoolCard/PoolCard.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { UseQueryResult } from "@tanstack/react-query";
22
import { match, P } from "ts-pattern";
33

4+
import { OnClickProps, PoolData } from "@/types";
45
import { Skeleton } from "@/ui-shadcn/skeleton";
56

6-
import { onClickProps, PoolData } from "../../types";
77
import { PoolDataCard } from "./PoolDataCard";
88

9-
export interface PoolCardQueryProps extends onClickProps {
9+
export interface PoolCardQueryProps extends OnClickProps {
1010
queryResult: UseQueryResult<PoolData, Error>;
1111
}
1212

13-
export interface PoolCardProps extends PoolData, onClickProps {}
13+
export interface PoolCardProps extends PoolData, OnClickProps {}
1414

1515
export function PoolCard(props: PoolCardProps | PoolCardQueryProps) {
1616
return match(props)

src/components/pool/components/PoolCard/PoolDataCard.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { IconLabel, PoolBadge } from "@/components";
22
import { getChainInfo } from "@/lib";
33
import { modularRedirect } from "@/lib/utils";
4-
5-
import { onClickProps, PoolData } from "../../types";
4+
import { PoolData } from "@/types";
5+
import { OnClickProps } from "@/types";
66

77
export interface PoolDataCardProps {
88
data: PoolData;
9-
redirectProps?: onClickProps;
9+
redirectProps?: OnClickProps;
1010
}
1111

1212
export function PoolDataCard({ data, redirectProps }: PoolDataCardProps) {

src/components/pool/components/PoolSummary/PoolSummary.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { tv } from "tailwind-variants";
22

3-
import { IconLabel, PoolBadge, PoolStatus, PoolType } from "@/components";
3+
import { IconLabel, PoolBadge } from "@/components";
44
import { getChainInfo } from "@/lib";
55
import { cn } from "@/lib/utils";
66
import { Breadcrumb, Button, Icon, IconType } from "@/primitives";
7+
import { PoolStatus, PoolType } from "@/types";
78

89
const variants = tv({
910
variants: {

src/components/pool/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from "./components";
2-
export * from "./types";

src/components/pool/types/index.ts

-1
This file was deleted.

src/components/pool/types/types.ts

-16
This file was deleted.

src/features/checker/hooks/useGetApplicationsFinalEvaluationPage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Address } from "viem";
22

3-
import { PoolType } from "@/components/Badges";
43
import { useCheckerContext } from "@/features/checker/store/hooks/useCheckerContext";
4+
import { PoolType } from "@/types";
55

66
import { generatePoolUUID } from "~checker/utils/generatePoolUUID";
77
import { categorizeProjectReviews } from "~checker/utils/mapApplicationsForOverviewPage";

src/types/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./onClickProps";
2+
export * from "./pool";

src/types/onClickProps.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface OnClickProps {
2+
redirectLink?: string;
3+
redirect?: boolean;
4+
}

src/types/pool.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export enum PoolStatus {
2+
PreRound = "PreRound",
3+
RoundInProgress = "RoundInProgress",
4+
ApplicationsInProgress = "ApplicationsInProgress",
5+
FundingPending = "FundingPending",
6+
}
7+
8+
export enum PoolType {
9+
QuadraticFunding = "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
10+
DirectGrants = "allov2.DirectGrantsSimpleStrategy",
11+
}
12+
13+
export interface PoolData {
14+
roundName: string;
15+
roundId: string;
16+
chainId: number;
17+
poolType: PoolType;
18+
startDate: Date;
19+
endDate: Date;
20+
poolStatus: PoolStatus;
21+
}

vite.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default defineConfig({
2020
lib: resolve(__dirname, "./src/lib/index.ts"),
2121
mainAll: resolve(__dirname, "./src/mainAll.ts"),
2222
mocks: resolve(__dirname, "./src/mocks/handlers.ts"),
23+
types: resolve(__dirname, "./src/types/index.ts"),
2324
},
2425
name: "gitcoin-ui",
2526
fileName: (format: any, filename: any) => `${filename}.js`,

0 commit comments

Comments
 (0)