Skip to content

Commit

Permalink
post and display extra links
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanlesich committed Jun 4, 2024
1 parent 893ede9 commit 30ab3fb
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 64 deletions.
147 changes: 88 additions & 59 deletions src/components/dashboard/ship/PortfolioReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Spoiler,
Stack,
Text,
TextInput,
Textarea,
useMantineTheme,
} from '@mantine/core';
Expand Down Expand Up @@ -45,11 +46,15 @@ type FormValues = z.infer<typeof portfolioReportSchema>;
const defaultValues: FormValues = {
roundReview: '',
grantReviews: {},
grantDemos: {},
grantExtras: {},
};

type ReportData = {
roundReview: string;
grantReviews: Record<string, string>;
grantDemos: Record<string, string>;
grantExtras: Record<string, string>;
};

export const PortfolioReport = ({
Expand Down Expand Up @@ -236,7 +241,9 @@ const PortfolioItem = ({

const status =
completedMilestones === grant.milestones?.length ? 'Completed' : 'Active';
const demoLink = reportData?.grantDemos?.[grant.id];

const extraLink = reportData?.grantExtras?.[grant.id];
return (
<Box px="sm">
<Text fz="sm" className="ws-pre-wrap" mb="md">
Expand All @@ -259,16 +266,34 @@ const PortfolioItem = ({
</Box>
{(reportStatus === ReportStatus.Submit ||
reportStatus === ReportStatus.Vote) && (
<Textarea
label="Your Report"
required
autosize
minRows={4}
maxRows={8}
description="How did the project go? What did you learn? What would you do differently next time?"
placeholder="Type your report here..."
{...form.getInputProps(`grantReviews.${grant.id}`)}
/>
<Box>
<Textarea
label="Your Report"
required
autosize
minRows={4}
maxRows={8}
mb={'sm'}
description="How did the project go? What did you learn? What would you do differently next time?"
placeholder="Type your report here..."
{...form.getInputProps(`grantReviews.${grant.id}`)}
/>
<TextInput
mb="sm"
label="Demo Link"
description="Optional. If you have a demo link, please provide it here."
placeholder="https://app.grantships.fun/"
{...form.getInputProps(`grantDemos.${grant.id}`)}
value={form.values.grantDemos[grant.id] || ''}
/>
<TextInput
label="Extra Link"
description="Optional. If you have any additional links or resources, please provide them here."
placeholder="https://app.grantships.fun/"
{...form.getInputProps(`grantExtras.${grant.id}`)}
value={form.values.grantExtras[grant.id] || ''}
/>
</Box>
)}

{reportStatus === ReportStatus.Review && reportData && (
Expand All @@ -286,56 +311,60 @@ const PortfolioItem = ({
avatarUrl: grant.shipMetadata.imgUrl,
}}
/>
<Text fz="sm" mb="xs" fw={600} mt="md">
Links:
</Text>
<Group mb="md" align="center" gap={4}>
<Text
component={Link}
to={`/project/${grant.projectId.id}`}
target="_blank"
fz={'sm'}
rel="noopener noreferrer"
td="underline"
>
Project
</Text>
<IconExternalLink size={16} />
</Group>
{demoLink && (
<Group mb="md" align="center" gap={4}>
<Text
component="a"
href={demoLink}
target="_blank"
fz={'sm'}
rel="noopener noreferrer"
td="underline"
>
Demo
</Text>
<IconExternalLink size={16} />
<Text fz="sm" lineClamp={1} w={250} opacity={0.5}>
({demoLink})
</Text>
</Group>
)}
{extraLink && (
<Group mb="md" align="center" gap={4}>
<Text
component="a"
href={extraLink}
target="_blank"
fz={'sm'}
rel="noopener noreferrer"
td="underline"
>
Extra
</Text>
<IconExternalLink size={16} />
<Text fz="sm" lineClamp={1} w={250} opacity={0.5}>
({extraLink})
</Text>
</Group>
)}
</>
)}
<Text fz="sm" mb="xs" fw={600} mt="md">
Links:
</Text>
<Group mb="md" align="center" gap={4}>
<Text
component={Link}
to={`/project/${grant.projectId.id}`}
target="_blank"
fz={'sm'}
rel="noopener noreferrer"
td="underline"
>
Project
</Text>
<IconExternalLink size={16} />
</Group>
<Group mb="md" align="center" gap={4}>
<Text
component={Link}
to={`/project/${grant.projectId.id}`}
target="_blank"
fz={'sm'}
rel="noopener noreferrer"
td="underline"
>
Demo
</Text>
<IconExternalLink size={16} />
<Text fz="sm" lineClamp={1} w={250} opacity={0.5}>
(https://www.figma.com/design/CgYFonR6ZFu7bGZJVlNqSN/Grantships?node-id=5616-15872&t=6E8hdGKHLya2d6NX-0)
</Text>
</Group>
<Group mb="md" align="center" gap={4}>
<Text
component={Link}
to={`/project/${grant.projectId.id}`}
target="_blank"
fz={'sm'}
rel="noopener noreferrer"
td="underline"
>
Extra
</Text>
<IconExternalLink size={16} />
<Text fz="sm" lineClamp={1} w={250} opacity={0.5}>
(https://www.figma.com/design/CgYFonR6ZFu7bGZJVlNqSN/Grantships?node-id=5616-15872&t=6E8hdGKHLya2d6NX-0)
</Text>
</Group>
</Box>
);
};
Expand Down Expand Up @@ -375,7 +404,7 @@ const SubmitReport = ({
return;
}

const pinRes = await pinJSONToIPFS(formValues);
const pinRes = await pinJSONToIPFS(validated.data);

const nonce = generateRandomBytes32();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ export const portfolioReportSchema = z.object({
grantReviews: z.record(
z.string().min(1, { message: 'Grant Review is required' })
),
grantDemos: z.record(
z.string().url({ message: 'Invalid URL' }).or(z.literal(''))
),
grantExtras: z.record(
z.string().url({ message: 'Invalid URL' }).or(z.literal(''))
),
});
2 changes: 1 addition & 1 deletion src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const ADDR_TESTNET: Record<string, Address> = {
GM_FACTORY: '0x14e32E7893D6A1fA5f852d8B2fE8c57A2aB670ba',
GS_FACTORY: '0x8D994BEef251e30C858e44eCE3670feb998CA77a',
HATS_POSTER: '0x4F0dc1C7d91d914d921F3C9C188F4454AE260317',
VOTE_CONTEST: '0xA1bA1C8A74Abcb6AF16b1a9c3408DbF623232886',
VOTE_CONTEST: '0xEa246dc795832Abc76110066EE4d8D5EC88b4756',
} as const;

export const ADDR_PROD: Record<string, Address> = {
Expand Down
4 changes: 0 additions & 4 deletions src/pages/Vote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ export const Vote = () => {
return null;
}

// if (hasUserVoted || votingStage > VotingStage.Active) {
// return <PostVote ships={ships} />;
// }

const nextStep = () =>
setStep((current) => (current < 3 ? current + 1 : current));
const prevStep = () =>
Expand Down

0 comments on commit 30ab3fb

Please sign in to comment.