Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcasey committed Dec 20, 2024
1 parent 1dd9020 commit 9b93111
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 17 deletions.
6 changes: 4 additions & 2 deletions __e2e__/proposals/proposalPassedReadonly.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ test.beforeAll(async () => {
fieldConfig: {},
options: [],
index: 0,
private: false
private: false,
dependsOnStepIndex: null
},
{
type: 'milestone',
Expand All @@ -102,7 +103,8 @@ test.beforeAll(async () => {
required: false,
id: uuid(),
index: 0,
private: false
private: false,
dependsOnStepIndex: null
}
]
}).then(({ proposal }) => proposal.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ describe('GET /api/proposals/[id] - Get proposal', () => {
options: [],
private: false,
required: true,
fieldConfig: null
fieldConfig: null,
dependsOnStepIndex: null
}
];
const formId = await createForm(fieldsInput);
Expand Down
5 changes: 3 additions & 2 deletions components/[pageId]/DocumentPage/DocumentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const RewardProperties = dynamic(
() => import('components/[pageId]/DocumentPage/components/RewardProperties').then((r) => r.RewardProperties),
{ ssr: false }
);
export type ProposalProps = ReturnType<typeof useProposal> & ReturnType<typeof useProposalFormAnswers>;

export type DocumentPageProps = {
page: PageWithContent;
savePage: (p: Partial<Page>) => void;
Expand All @@ -72,8 +74,7 @@ export type DocumentPageProps = {
setSidebarView?: IPageSidebarContext['setActiveView'];
showCard?: (cardId: string | null) => void;
showParentChip?: boolean;
} & ReturnType<typeof useProposal> &
ReturnType<typeof useProposalFormAnswers>;
} & ProposalProps;

function DocumentPageComponent({
insideModal = false,
Expand Down
4 changes: 2 additions & 2 deletions components/[pageId]/DocumentPage/DocumentPageWithSidebars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { DocumentColumn, DocumentColumnLayout } from './components/DocumentColum
import { PageSidebar } from './components/Sidebar/PageSidebar';
import { ProposalSidebar } from './components/Sidebar/ProposalSidebar';
import { RewardSidebar } from './components/Sidebar/RewardSidebar';
import type { DocumentPageProps } from './DocumentPage';
import type { DocumentPageProps, ProposalProps } from './DocumentPage';
import { DocumentPage } from './DocumentPage';
import { usePageSidebar } from './hooks/usePageSidebar';
import { useProposal } from './hooks/useProposal';
import { useReward } from './hooks/useReward';

type DocumentPageWithSidebarsProps = DocumentPageProps & {
type DocumentPageWithSidebarsProps = Omit<DocumentPageProps, keyof ProposalProps> & {
readOnly?: boolean;
insideModal?: boolean;
refreshPage?: VoidFunction;
Expand Down
6 changes: 4 additions & 2 deletions lib/proposals/__tests__/createDraftProposal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('createDraftProposal', () => {
options: [],
private: false,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
},
{
id: uuid(),
Expand All @@ -34,7 +35,8 @@ describe('createDraftProposal', () => {
options: [],
private: true,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
}
];

Expand Down
3 changes: 2 additions & 1 deletion lib/proposals/__tests__/getProposalTemplate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ describe('getProposal', () => {
options: [],
private: true,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
}
];
const formId = await createForm(fieldsInput);
Expand Down
3 changes: 2 additions & 1 deletion lib/proposals/createDraftProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ export async function createDraftProposal(input: CreateDraftProposalInput) {
private: false,
required: true,
id: uuid(),
fieldConfig: createDefaultProjectAndMembersFieldConfig({ allFieldsRequired: true })
fieldConfig: createDefaultProjectAndMembersFieldConfig({ allFieldsRequired: true }),
dependsOnStepIndex: null
}
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const fieldsInput: FormFieldInput[] = [
private: true
}
}
})
}),
dependsOnStepIndex: null
}
];

Expand Down
15 changes: 10 additions & 5 deletions lib/proposals/forms/__tests__/upsertProposalFormFields.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const numberFieldInput: FormFieldInput = {
options: [],
private: true,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
};

describe('upsertProposalFormFields', () => {
Expand Down Expand Up @@ -45,7 +46,8 @@ describe('upsertProposalFormFields', () => {
options: [],
private: false,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
},
{
id: v4(),
Expand All @@ -56,7 +58,8 @@ describe('upsertProposalFormFields', () => {
options: [],
private: true,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
}
];

Expand Down Expand Up @@ -104,7 +107,8 @@ describe('upsertProposalFormFields', () => {
options: [],
private: false,
required: true,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
},
{
id: v4(),
Expand All @@ -115,7 +119,8 @@ describe('upsertProposalFormFields', () => {
options: [],
private: true,
required: false,
fieldConfig: {}
fieldConfig: {},
dependsOnStepIndex: null
}
];

Expand Down
1 change: 1 addition & 0 deletions scripts/applicationImport/restoreFormFromLogs.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { prisma } from '@charmverse/core/prisma-client';
import { FormFieldInput } from '@root/lib/proposals/forms/interfaces';
import { createProposal } from 'lib/proposals/createProposal';
Expand Down
1 change: 1 addition & 0 deletions testing/mocks/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function getFormInput(input: Partial<FormFieldInput>): FormFieldInput {
private: false,
required: true,
fieldConfig: {},
dependsOnStepIndex: null,
...input
};
}
Expand Down

0 comments on commit 9b93111

Please sign in to comment.