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

Commit 3d8c29e

Browse files
fix: clean up styling and final review behaviour (#65)
* ensure consistent styling between review and final review * - ensure toast appears only once - redirect to ApplicationReview after submitting final review * render default logo if ipfsCId is null
1 parent b37c6a3 commit 3d8c29e

File tree

8 files changed

+85
-66
lines changed

8 files changed

+85
-66
lines changed

src/features/checker/components/ProjectEvaluationList/ProjectEvaluationList.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DefaultLogo } from "@/assets";
12
import { IconLabel } from "@/components/IconLabel";
23
import { CircleStat } from "@/primitives/Indicators";
34
import { ListGrid, ListGridColumn } from "@/primitives/ListGrid";
@@ -31,7 +32,7 @@ export const ProjectEvaluationList = ({
3132
alt={item.name}
3233
className="aspect-square size-12 rounded-sm"
3334
onError={(event: React.SyntheticEvent<HTMLImageElement, Event>) => {
34-
event.currentTarget.src = "/images/grey-image.png";
35+
event.currentTarget.src = DefaultLogo;
3536
}}
3637
/>
3738
<span>{item.name}</span>

src/features/checker/components/ProjectReviewList/ProjectReviewList.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DefaultLogo } from "@/assets";
12
import { IconLabel } from "@/components/IconLabel";
23
import { Button } from "@/primitives/Button";
34
import { CircleStat } from "@/primitives/Indicators";
@@ -27,7 +28,7 @@ export const ProjectReviewList = ({ reviewer, projects, action }: ProjectReviewL
2728
alt={item.name}
2829
className="aspect-square size-12 rounded-sm"
2930
onError={(event: React.SyntheticEvent<HTMLImageElement, Event>) => {
30-
event.currentTarget.src = "/images/grey-image.png";
31+
event.currentTarget.src = DefaultLogo;
3132
}}
3233
/>
3334
<span>{item.name}</span>

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ export const ApplicationEvaluationOverviewPage = ({
7676
</p>
7777
<div className="flex flex-col gap-8">
7878
<div className="px-16">
79-
<EvaluationList evaluations={applicationEvaluations ?? []} />
79+
{applicationEvaluations ? (
80+
<EvaluationList evaluations={applicationEvaluations} />
81+
) : (
82+
<p className="text-center text-lg">
83+
No evaluations have been submitted for this project yet.
84+
</p>
85+
)}
8086
</div>
8187
<div className="flex items-center justify-center">
8288
<Button

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const ReviewApplicationsPage = () => {
4343
allocationStartDate={new Date()}
4444
allocationEndDate={new Date()}
4545
/>
46-
<div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-20">
46+
<div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-20">
4747
<div className="flex justify-start">
4848
<Button
4949
variant="secondry"

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export const SubmitApplicationEvaluationPage = ({
226226
<h1 className="text-3xl font-medium leading-9">Evaluate {project.title}</h1>
227227
<div className="h-0.5 bg-[#EAEAEA]" />
228228
<div className="flex gap-2">
229-
<div className="flex w-[628px] flex-col gap-4">
229+
<div className="flex w-full max-w-[600px] flex-col gap-4">
230230
<Accordion
231231
header={
232232
<IconLabel
@@ -320,7 +320,7 @@ export const SubmitApplicationEvaluationPage = ({
320320
/>
321321
</div>
322322

323-
<div className="w-[628px] rounded-[20px] border border-gray-100 p-5">
323+
<div className="rounded-[20px] border border-gray-100 p-5">
324324
<EvaluationForm groups={groups} onSubmit={handleSubmit} />
325325
</div>
326326
</div>

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

+52-49
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ export const SubmitFinalEvaluationPage = ({
8080
}, [steps]);
8181

8282
useEffect(() => {
83-
if (success) {
83+
if (success && isModalOpen) {
8484
setReviewBody(null);
8585
setIsModalOpen(false);
8686
toast({ status: "success", description: "Your evaluations have been submitted" });
87+
dispatch(goToReviewApplicationsAction());
8788
}
8889
if (error) {
8990
setReviewBody(null);
@@ -113,58 +114,60 @@ export const SubmitFinalEvaluationPage = ({
113114
allocationStartDate={new Date()}
114115
allocationEndDate={new Date()}
115116
/>
116-
<div className="mx-auto flex max-w-[1440px]">
117-
<div className="flex flex-col gap-6 px-20 pt-6">
118-
<div className="flex flex-col gap-8">
119-
<Button
120-
value="Exit"
121-
icon={<Icon type={IconType.X} className="fill-red-700" />}
122-
className="flex h-8 w-fit justify-start gap-2 bg-red-50 p-4 text-red-700"
123-
/>
124-
<StatCardGroup stats={statCardsProps || []} justify="center" />
125-
</div>
126-
<div className="flex flex-col gap-8">
127-
<div className="flex flex-col gap-4">
128-
<div className="font-mono text-2xl font-medium leading-loose text-black">
129-
Review applications
130-
</div>
131-
<div className="font-mono text-base font-normal leading-7 text-grey-900">
132-
Evaluate projects here.
133-
</div>
117+
<div className="mx-auto flex max-w-[1440px] flex-col gap-6 px-20">
118+
<div className="flex justify-start">
119+
<Button
120+
variant="secondry"
121+
icon={<Icon type={IconType.CHEVRON_LEFT} />}
122+
onClick={() =>
123+
window.open(`https://manager.gitcoin.co/#/chain/${chainId}/round/${poolId}`)
124+
}
125+
value="back to round manager"
126+
/>
127+
</div>
128+
<StatCardGroup stats={statCardsProps || []} justify="center" />
129+
130+
<div className="flex flex-col gap-8">
131+
<div className="flex flex-col gap-4">
132+
<div className="font-mono text-2xl font-medium leading-loose text-black">
133+
Review applications
134+
</div>
135+
<div className="font-mono text-base font-normal leading-7 text-grey-900">
136+
Evaluate projects here.
134137
</div>
135-
<div className="flex flex-col gap-2">
136-
<div className="pb-1">
137-
<div className="flex items-center justify-between pb-1">
138-
<div className="font-mono text-2xl font-medium leading-loose text-black">
139-
{`Ready to submit (${ReadyApplicationsToSubmit.length})`}
140-
</div>
141-
<div className="flex gap-2">
142-
<Button value="Cancel" onClick={handleCancel} />
143-
<Button
144-
value={`Record (${numberOfOnchainEvaluations}) evaluations onchain`}
145-
disabled={Object.keys(projectEvaluations).length === 0}
146-
onClick={() => {
147-
setIsModalOpen(true);
148-
}}
149-
/>
150-
</div>
138+
</div>
139+
<div className="flex flex-col gap-2">
140+
<div className="pb-1">
141+
<div className="flex items-center justify-between pb-1">
142+
<div className="font-mono text-2xl font-medium leading-loose text-black">
143+
{`Ready to submit (${ReadyApplicationsToSubmit.length})`}
151144
</div>
152-
<div className="h-px bg-grey-300" />
153-
</div>
154-
155-
<div>
156-
{ReadyApplicationsToSubmit.length === 0 ? (
157-
<div className="font-mono text-base font-normal leading-7 text-grey-900">
158-
Evaluations that are ready to be submitted onchain will appear here once
159-
reviewed. Manager supports multiple reviewers.
160-
</div>
161-
) : (
162-
<ProjectEvaluationList
163-
projects={ReadyApplicationsToSubmit}
164-
action={handleUpdateFinalEvaluations}
145+
<div className="flex gap-2">
146+
<Button value="Cancel" onClick={handleCancel} />
147+
<Button
148+
value={`Record (${numberOfOnchainEvaluations}) evaluations onchain`}
149+
disabled={Object.keys(projectEvaluations).length === 0}
150+
onClick={() => {
151+
setIsModalOpen(true);
152+
}}
165153
/>
166-
)}
154+
</div>
167155
</div>
156+
<div className="h-px bg-grey-300" />
157+
</div>
158+
159+
<div>
160+
{ReadyApplicationsToSubmit.length === 0 ? (
161+
<div className="font-mono text-base font-normal leading-7 text-grey-900">
162+
Evaluations that are ready to be submitted onchain will appear here once reviewed.
163+
Manager supports multiple reviewers.
164+
</div>
165+
) : (
166+
<ProjectEvaluationList
167+
projects={ReadyApplicationsToSubmit}
168+
action={handleUpdateFinalEvaluations}
169+
/>
170+
)}
168171
</div>
169172
</div>
170173
</div>

src/primitives/Avatar/Avatar.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ export const Avatar = ({
4040
variant = "default", // Default to default variant
4141
}: AvatarProps) => {
4242
const imageURL = useMemo(() => {
43-
return match({ ipfsCID, url, fallbackName })
44-
.with({ ipfsCID: P.nullish, url: P.nullish, fallbackName: P.nullish }, () => defaultImage)
45-
.with({ ipfsCID, url: P.string.length(0) }, ({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`)
46-
.with({ ipfsCID, url: P.nullish }, ({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`)
47-
.with({ ipfsCID: P.string.length(0), url }, ({ url }) => url)
48-
.with({ ipfsCID: P.nullish, url }, ({ url }) => url)
43+
return match({ ipfsCID, url })
44+
.with(
45+
{ ipfsCID: P.when((cid) => !cid || typeof cid !== "string"), url: P.nullish },
46+
() => defaultImage,
47+
)
48+
.with({ ipfsCID: P.when((cid) => !cid || typeof cid !== "string"), url }, ({ url }) => url)
49+
.with(
50+
{ ipfsCID: P.when((cid) => typeof cid === "string" && cid.length > 0), url: P.nullish },
51+
({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`,
52+
)
4953
.with(
5054
{ ipfsCID: P.string.minLength(1), url: P.string.minLength(1) },
5155
({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`,

src/primitives/BannerImage/BannerImage.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ export const BannerImage = ({
4141
}: BannerImageProps) => {
4242
const imageURL = useMemo(() => {
4343
return match({ ipfsCID, url })
44-
.with({ ipfsCID: P.nullish, url: P.nullish }, () => defaultImage)
45-
.with({ ipfsCID, url: P.string.length(0) }, ({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`)
46-
.with({ ipfsCID, url: P.nullish }, ({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`)
47-
.with({ ipfsCID: P.string.length(0), url }, ({ url }) => url)
48-
.with({ ipfsCID: P.nullish, url }, ({ url }) => url)
44+
.with(
45+
{ ipfsCID: P.when((cid) => !cid || typeof cid !== "string"), url: P.nullish },
46+
() => defaultImage,
47+
)
48+
.with({ ipfsCID: P.when((cid) => !cid || typeof cid !== "string"), url }, ({ url }) => url)
49+
.with(
50+
{ ipfsCID: P.when((cid) => typeof cid === "string" && cid.length > 0), url: P.nullish },
51+
({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`,
52+
)
4953
.with(
5054
{ ipfsCID: P.string.minLength(1), url: P.string.minLength(1) },
5155
({ ipfsCID }) => `${ipfsBaseURL}${ipfsCID}`,

0 commit comments

Comments
 (0)