Skip to content

Commit

Permalink
handle link input
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrepreneur committed Feb 25, 2024
1 parent bd1d164 commit f32f3ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 21 additions & 14 deletions packages/forms/src/ProjectDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { Box, Button, Grid, HStack, Stack } from '@chakra-ui/react';
import { yupResolver } from '@hookform/resolvers/yup';
import { ESCROW_STEPS, INVOICE_TYPES } from '@smart-invoice/constants';
import { ValueOf } from '@smart-invoice/types';
import { DatePicker, Input, Textarea, useMediaStyles } from '@smart-invoice/ui';
import {
DatePicker,
Input,
LinkInput,
Textarea,
useMediaStyles,
} from '@smart-invoice/ui';
import {
oneMonthFromNow,
projectDetailsSchema,
Expand Down Expand Up @@ -50,20 +56,20 @@ export function ProjectDetailsForm({
const { primaryButtonSize } = useMediaStyles();

const onSubmit = async (values: Partial<any>) => {
const localProjectAgreement = [];
if (values.projectAgreement) {
// TODO align with AddMilestones handling for projectAgreement
// TODO handle ipfs agreement link
localProjectAgreement.push({
type: 'https',
src: values.projectAgreement,
createdAt: Math.floor(Date.now() / 1000),
});
}
// if (values.projectAgreement) {
// // TODO align with AddMilestones handling for projectAgreement
// // TODO handle ipfs agreement link
// localProjectAgreement.push({
// type: 'https',
// src: values.projectAgreement,
// createdAt: Math.floor(Date.now() / 1000),
// });
// }
// don't handle project agreement here

setValue('projectName', values.projectName);
setValue('projectDescription', values.projectDescription);
setValue('projectAgreement', localProjectAgreement);
setValue('projectAgreement', values.projectAgreement);
setValue('startDate', values.startDate);
setValue('endDate', values.endDate);
setValue('safetyValveDate', values.safetyValveDate);
Expand Down Expand Up @@ -93,13 +99,14 @@ export function ProjectDetailsForm({
registerOptions={{ required: true }}
localForm={localForm}
/>
<Input
label="Project Proposal, Agreement or Specification"
<LinkInput
name="projectAgreement"
label="Project Proposal, Agreement or Specification"
tooltip="A URL to a project proposal, agreement or specification. This could be a RIP or other proposal. This is optional."
placeholder="https://github.com/AcmeAcademy/buidler"
localForm={localForm}
/>

<HStack>
<Box w="30%">
<DatePicker
Expand Down
2 changes: 1 addition & 1 deletion packages/hooks/src/useInvoiceCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const useInvoiceCreate = ({
const detailsData = {
projectName,
projectDescription,
projectAgreement: _.get(_.first(projectAgreement), 'src', ''),
projectAgreement,
startDate,
endDate,
};
Expand Down

0 comments on commit f32f3ba

Please sign in to comment.