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

Commit ce30387

Browse files
fix: retrofunding improvements for pool details (#125)
* checker: add standalone prop to toggle pool summary * poolsummary: fix label and padding * add custom fields based on pool type
1 parent 4806b55 commit ce30387

File tree

14 files changed

+353
-137
lines changed

14 files changed

+353
-137
lines changed

src/components/IconLabel/IconLabel.tsx

+29-26
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,35 @@ export const IconLabel: React.FC<
7272
))}
7373
</IconLabelContainer>
7474
))
75-
.with({ type: "roundPeriod" }, ({ startDate, endDate = undefined, className, isLoading }) => (
76-
<IconLabelContainer
77-
type="period"
78-
className={className}
79-
iconType={IconType.CLOCK}
80-
iconVariant={icon({ type: isLoading ? "loading" : "roundPeriod" })}
81-
>
82-
{match(isLoading)
83-
.with(true, () => (
84-
<div className="flex items-center gap-1">
85-
<span className={text({ type: "roundPeriod" })}>{`Review period:`}</span>
86-
<Skeleton className="h-6 w-72 rounded-lg" />
87-
</div>
88-
))
89-
.otherwise(() => (
90-
<span className={text({ type: "roundPeriod" })}>{`Review period: ${formatDate(
91-
startDate,
92-
DateFormat.ShortMonthDayYear24HourUTC,
93-
)} - ${
94-
endDate
95-
? formatDate(endDate, DateFormat.ShortMonthDayYear24HourUTC)
96-
: "No end date (open round)"
97-
}`}</span>
98-
))}
99-
</IconLabelContainer>
100-
))
75+
.with(
76+
{ type: "roundPeriod" },
77+
({ startDate, endDate = undefined, className, isLoading, label = "Review Period" }) => (
78+
<IconLabelContainer
79+
type="period"
80+
className={className}
81+
iconType={IconType.CLOCK}
82+
iconVariant={icon({ type: isLoading ? "loading" : "roundPeriod" })}
83+
>
84+
{match(isLoading)
85+
.with(true, () => (
86+
<div className="flex items-center gap-1">
87+
<span className={text({ type: "roundPeriod" })}>{label}</span>
88+
<Skeleton className="h-6 w-72 rounded-lg" />
89+
</div>
90+
))
91+
.otherwise(() => (
92+
<span className={text({ type: "roundPeriod" })}>{`${label}: ${formatDate(
93+
startDate,
94+
DateFormat.ShortMonthDayYear24HourUTC,
95+
)} - ${
96+
endDate
97+
? formatDate(endDate, DateFormat.ShortMonthDayYear24HourUTC)
98+
: "No end date (open round)"
99+
}`}</span>
100+
))}
101+
</IconLabelContainer>
102+
),
103+
)
101104
.with({ type: "dateWithPrefix" }, ({ date, prefix, className, isLoading }) => (
102105
<IconLabelContainer
103106
type="date"

src/components/IconLabel/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface RoundPeriodProps {
2323
type: "roundPeriod";
2424
startDate: Date;
2525
endDate?: Date;
26+
label?: string;
2627
className?: string;
2728
}
2829

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

+29
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,32 @@ export const Default: Story = {
4646
);
4747
},
4848
};
49+
50+
export const Embedded: Story = {
51+
render(args) {
52+
// New StoryWrapper component
53+
const StoryWrapper = () => {
54+
const { setEvaluationBody, isSuccess, isEvaluating, isError } = usePerformEvaluation();
55+
const { steps, setReviewBody, isReviewing } = usePerformOnChainReview();
56+
57+
return (
58+
<Checker
59+
{...args}
60+
setEvaluationBody={setEvaluationBody}
61+
isSuccess={isSuccess}
62+
isEvaluating={isEvaluating}
63+
isError={isError}
64+
steps={steps}
65+
setReviewBody={setReviewBody}
66+
isReviewing={isReviewing}
67+
isStandalone={false}
68+
/>
69+
);
70+
};
71+
return (
72+
<CheckerProvider>
73+
<StoryWrapper />
74+
</CheckerProvider>
75+
);
76+
},
77+
};

src/features/checker/apps/Checker.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface CheckerProps {
1919
steps: Step[];
2020
setReviewBody: (reviewBody: ReviewBody | null) => void;
2121
isReviewing: boolean;
22+
isStandalone: boolean;
2223
}
2324

2425
export const Checker = (props: CheckerProps) => {

src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.tsx

+15-11
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ export interface ApplicationEvaluationOverviewPageProps {
2020
poolId: string;
2121
applicationId: string;
2222
address: Hex;
23+
isStandalone: boolean;
2324
}
2425

2526
export const ApplicationEvaluationOverviewPage = ({
2627
chainId,
2728
poolId,
2829
applicationId,
2930
address,
31+
isStandalone,
3032
}: ApplicationEvaluationOverviewPageProps) => {
3133
useInitialize({ address, poolId, chainId });
3234

@@ -49,17 +51,19 @@ export const ApplicationEvaluationOverviewPage = ({
4951

5052
return (
5153
<div className="flex flex-col gap-6">
52-
<PoolSummary
53-
chainId={chainId}
54-
poolId={poolId}
55-
programId={poolData?.project.id as string}
56-
strategyName={poolData?.strategyName}
57-
name={poolData?.roundMetadata.name}
58-
applicationsStartTime={poolData?.applicationsStartTime}
59-
applicationsEndTime={poolData?.applicationsEndTime}
60-
donationsStartTime={poolData?.donationsStartTime}
61-
donationsEndTime={poolData?.donationsEndTime}
62-
/>
54+
{isStandalone && (
55+
<PoolSummary
56+
chainId={chainId}
57+
poolId={poolId}
58+
programId={poolData?.project.id as string}
59+
strategyName={poolData?.strategyName}
60+
name={poolData?.roundMetadata.name}
61+
applicationsStartTime={poolData?.applicationsStartTime}
62+
applicationsEndTime={poolData?.applicationsEndTime}
63+
donationsStartTime={poolData?.donationsStartTime}
64+
donationsEndTime={poolData?.donationsEndTime}
65+
/>
66+
)}
6367
<div className="mx-auto flex max-w-[1440px] flex-col gap-4 px-20">
6468
<div>
6569
<Button

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

+31-23
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Button } from "@/primitives/Button";
66
import { Icon, IconType } from "@/primitives/Icon";
77
import { StatCardProps } from "@/primitives/StatCard";
88
import { StatCardGroup } from "@/primitives/StatCardGroup";
9+
import { PoolType } from "@/types";
910

1011
import { ApplicationsSection } from "~checker/components";
1112
import { useGetApplicationsReviewPage } from "~checker/hooks";
@@ -15,10 +16,10 @@ import {
1516
useCheckerContext,
1617
useCheckerDispatchContext,
1718
} from "~checker/store";
18-
import { getManagerUrl } from "~checker/utils";
19+
import { getManagerUrl, getRoundLinkOnManager } from "~checker/utils";
1920
import { PoolSummary } from "~pool";
2021

21-
export const ReviewApplicationsPage = () => {
22+
export const ReviewApplicationsPage = ({ isStandalone }: { isStandalone: boolean }) => {
2223
const { categorizedReviews, statCardsProps, poolData, poolFetchState } =
2324
useGetApplicationsReviewPage() || {};
2425
const { poolId, chainId } = useCheckerContext();
@@ -51,7 +52,10 @@ export const ReviewApplicationsPage = () => {
5152
};
5253

5354
const openRoundInManager = () => {
54-
window.open(`${getManagerUrl(chainId)}/#/chain/${chainId}/round/${poolId}`, "_blank");
55+
window.open(
56+
getRoundLinkOnManager(chainId, poolId, poolData?.strategyName as PoolType),
57+
"_blank",
58+
);
5559
};
5660

5761
const openCheckerApplicationEvaluations = (projectId: string) => {
@@ -63,27 +67,31 @@ export const ReviewApplicationsPage = () => {
6367

6468
return (
6569
<div className="flex flex-col gap-6 ">
66-
<PoolSummary
67-
isLoading={isLoading}
68-
chainId={chainId}
69-
poolId={poolId}
70-
programId={poolData?.project.id as string}
71-
strategyName={poolData?.strategyName}
72-
name={poolData?.roundMetadata?.name}
73-
applicationsStartTime={poolData?.applicationsStartTime}
74-
applicationsEndTime={poolData?.applicationsEndTime}
75-
donationsStartTime={poolData?.donationsStartTime}
76-
donationsEndTime={poolData?.donationsEndTime}
77-
/>
70+
{isStandalone && (
71+
<PoolSummary
72+
isLoading={isLoading}
73+
chainId={chainId}
74+
poolId={poolId}
75+
programId={poolData?.project.id as string}
76+
strategyName={poolData?.strategyName}
77+
name={poolData?.roundMetadata?.name}
78+
applicationsStartTime={poolData?.applicationsStartTime}
79+
applicationsEndTime={poolData?.applicationsEndTime}
80+
donationsStartTime={poolData?.donationsStartTime}
81+
donationsEndTime={poolData?.donationsEndTime}
82+
/>
83+
)}
7884
<div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-20">
79-
<div className="flex justify-start">
80-
<Button
81-
variant="secondry"
82-
icon={<Icon type={IconType.CHEVRON_LEFT} />}
83-
onClick={openRoundInManager}
84-
value="back to round manager"
85-
/>
86-
</div>
85+
{isStandalone && (
86+
<div className="flex justify-start">
87+
<Button
88+
variant="secondry"
89+
icon={<Icon type={IconType.CHEVRON_LEFT} />}
90+
onClick={openRoundInManager}
91+
value="back to round manager"
92+
/>
93+
</div>
94+
)}
8795
<StatCardGroup stats={statCardsProps as StatCardProps[]} justify="center" />
8896
<div className="flex flex-col gap-8">
8997
<div className="flex flex-col gap-4">

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

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const Default: Story = {
6060
chainId={args.chainId}
6161
poolId={args.poolId}
6262
address={args.address}
63+
isStandalone={true}
6364
/>
6465
);
6566
},

src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.tsx

+15-11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface SubmitApplicationEvaluationPageProps {
3333
isSuccess: boolean;
3434
isEvaluating: boolean;
3535
isError: boolean;
36+
isStandalone: boolean;
3637
}
3738

3839
export const SubmitApplicationEvaluationPage = ({
@@ -44,6 +45,7 @@ export const SubmitApplicationEvaluationPage = ({
4445
isSuccess,
4546
isEvaluating,
4647
isError,
48+
isStandalone,
4749
}: SubmitApplicationEvaluationPageProps) => {
4850
useInitialize({ address, poolId, chainId });
4951

@@ -134,17 +136,19 @@ export const SubmitApplicationEvaluationPage = ({
134136

135137
return (
136138
<div className="flex flex-col gap-6">
137-
<PoolSummary
138-
chainId={chainId}
139-
poolId={poolId}
140-
programId={poolData?.project.id as string}
141-
strategyName={poolData?.strategyName}
142-
name={poolData?.roundMetadata?.name}
143-
applicationsStartTime={poolData?.applicationsStartTime}
144-
applicationsEndTime={poolData?.applicationsEndTime}
145-
donationsStartTime={poolData?.donationsStartTime}
146-
donationsEndTime={poolData?.donationsEndTime}
147-
/>
139+
{isStandalone && (
140+
<PoolSummary
141+
chainId={chainId}
142+
poolId={poolId}
143+
programId={poolData?.project.id as string}
144+
strategyName={poolData?.strategyName}
145+
name={poolData?.roundMetadata?.name}
146+
applicationsStartTime={poolData?.applicationsStartTime}
147+
applicationsEndTime={poolData?.applicationsEndTime}
148+
donationsStartTime={poolData?.donationsStartTime}
149+
donationsEndTime={poolData?.donationsEndTime}
150+
/>
151+
)}
148152
<div className="mx-auto flex max-w-[1440px] flex-col gap-4 px-20">
149153
<SubmitApplicationEvaluationModal
150154
evaluationStatus={evaluationStatus}

src/features/checker/pages/SubmitFinalEvaluationPage/SubmitFinalEvaluationPage.tsx

+24-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useToast } from "@/hooks/useToast";
99
import { Button } from "@/primitives/Button";
1010
import { Icon, IconType } from "@/primitives/Icon";
1111
import { StatCardGroup } from "@/primitives/StatCardGroup";
12-
import { Step } from "@/types";
12+
import { PoolType, Step } from "@/types";
1313

1414
import { ProjectEvaluationList } from "~checker/components";
1515
import { useGetApplicationsFinalEvaluationPage } from "~checker/hooks";
@@ -19,7 +19,7 @@ import {
1919
useCheckerContext,
2020
} from "~checker/store";
2121
import { EvaluationAction, ReviewBody } from "~checker/types";
22-
import { getManagerUrl } from "~checker/utils";
22+
import { getManagerUrl, getRoundLinkOnManager } from "~checker/utils";
2323
import { PoolSummary } from "~pool";
2424

2525
import { SubmitFinalEvaluationModal } from "./SubmitFinalEvaluationModal";
@@ -28,12 +28,14 @@ export interface SubmitFinalEvaluationPageProps {
2828
steps: Step[];
2929
setReviewBody: (reviewBody: ReviewBody | null) => void;
3030
isReviewing: boolean;
31+
isStandalone: boolean;
3132
}
3233

3334
export const SubmitFinalEvaluationPage = ({
3435
steps,
3536
setReviewBody,
3637
isReviewing,
38+
isStandalone,
3739
}: SubmitFinalEvaluationPageProps) => {
3840
const { categorizedReviews, statCardsProps, reviewBody, poolData } =
3941
useGetApplicationsFinalEvaluationPage() || {};
@@ -115,24 +117,32 @@ export const SubmitFinalEvaluationPage = ({
115117

116118
return (
117119
<div className="flex flex-col gap-6">
118-
<PoolSummary
119-
chainId={chainId as number}
120-
poolId={poolId as string}
121-
programId={poolData?.project.id as string}
122-
strategyName={poolData?.strategyName}
123-
name={poolData?.roundMetadata.name}
124-
applicationsStartTime={poolData?.applicationsStartTime}
125-
applicationsEndTime={poolData?.applicationsEndTime}
126-
donationsStartTime={poolData?.donationsStartTime}
127-
donationsEndTime={poolData?.donationsEndTime}
128-
/>
120+
{isStandalone && (
121+
<PoolSummary
122+
chainId={chainId as number}
123+
poolId={poolId as string}
124+
programId={poolData?.project.id as string}
125+
strategyName={poolData?.strategyName}
126+
name={poolData?.roundMetadata.name}
127+
applicationsStartTime={poolData?.applicationsStartTime}
128+
applicationsEndTime={poolData?.applicationsEndTime}
129+
donationsStartTime={poolData?.donationsStartTime}
130+
donationsEndTime={poolData?.donationsEndTime}
131+
/>
132+
)}
129133
<div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-20">
130134
<div className="flex justify-start">
131135
<Button
132136
variant="secondry"
133137
icon={<Icon type={IconType.CHEVRON_LEFT} />}
134138
onClick={() =>
135-
window.open(`${getManagerUrl(chainId as number)}/#/chain/${chainId}/round/${poolId}`)
139+
window.open(
140+
getRoundLinkOnManager(
141+
chainId as number,
142+
poolId as string,
143+
poolData?.strategyName as PoolType,
144+
),
145+
)
136146
}
137147
value="back to round manager"
138148
/>

src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Icon, IconType } from "@/primitives/Icon";
1111
import { ApplicationSummary, SummaryAccordians } from "~application";
1212
import { ReviewDropdownList } from "~checker/components";
1313
import { useApplicationEvaluations, useGetPastApplications } from "~checker/hooks";
14-
import { getExplorerUrl } from "~checker/utils";
14+
import { getApplicationLinkOnExplorer, getExplorerUrl } from "~checker/utils";
1515
import { ProjectBanner } from "~project";
1616
import { ProjectSummary } from "~project";
1717

@@ -80,10 +80,7 @@ export const ViewApplicationEvaluationsPage: React.FC<ViewApplicationEvaluations
8080
variant="none"
8181
className="h-[38px] w-40 bg-white"
8282
onClick={() => {
83-
window.open(
84-
`${getExplorerUrl(chainId)}/#/round/${chainId}/${poolId}/${applicationId}`,
85-
"_blank",
86-
);
83+
window.open(getApplicationLinkOnExplorer(chainId, poolId, applicationId), "_blank");
8784
}}
8885
/>
8986
</div>

0 commit comments

Comments
 (0)