From 81c2cc5bdbf80d6a83ff1b065bd97a42be84ec8d Mon Sep 17 00:00:00 2001 From: Steve Jensen Date: Mon, 24 Feb 2025 16:53:38 -0700 Subject: [PATCH] feat: add continue button to company document list --- .../DocumentSigner/DocumentList/Actions.tsx | 19 +++++++++++++++++++ .../DocumentList/DocumentList.tsx | 12 ++++++++++-- .../DocumentSigner/DocumentList/Head.tsx | 3 +-- .../DocumentSigner/DocumentList/List.tsx | 4 ++-- .../DocumentList/ManageSignatories.tsx | 3 +-- src/i18n/en/Company.DocumentList.json | 3 ++- src/shared/constants.ts | 1 + src/types/i18next.d.ts | 1 + 8 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 src/components/Company/DocumentSigner/DocumentList/Actions.tsx diff --git a/src/components/Company/DocumentSigner/DocumentList/Actions.tsx b/src/components/Company/DocumentSigner/DocumentList/Actions.tsx new file mode 100644 index 0000000..83f6537 --- /dev/null +++ b/src/components/Company/DocumentSigner/DocumentList/Actions.tsx @@ -0,0 +1,19 @@ +import { ActionsLayout, Button } from '@/components/Common' + +import { useTranslation } from 'react-i18next' +import { useDocumentList } from './DocumentList' + +export function Actions() { + const { t } = useTranslation('Company.DocumentList') + const { companyForms, handleContinue, isSelfSignatory } = useDocumentList() + + const hasSignedAllForms = companyForms.every(companyForm => !companyForm.requires_signing) + + return ( + + + + ) +} diff --git a/src/components/Company/DocumentSigner/DocumentList/DocumentList.tsx b/src/components/Company/DocumentSigner/DocumentList/DocumentList.tsx index a418669..4e3f0bf 100644 --- a/src/components/Company/DocumentSigner/DocumentList/DocumentList.tsx +++ b/src/components/Company/DocumentSigner/DocumentList/DocumentList.tsx @@ -15,12 +15,13 @@ import { companyEvents } from '@/shared/constants' import { Head } from './Head' import { List } from './List' import { ManageSignatories } from './ManageSignatories' - +import { Actions } from './Actions' type DocumentListContextType = { companyForms: Schemas['Form'][] documentListError: Error | null handleRequestFormToSign: (form: Schemas['Form']) => void handleChangeSignatory: () => void + handleContinue: () => void isSelfSignatory: boolean signatory?: Schemas['Signatory'] } @@ -74,6 +75,10 @@ function Root({ companyId, signatoryId, className, children }: DocumentListProps onEvent(companyEvents.COMPANY_FORM_EDIT_SIGNATORY, signatory) } + const handleContinue = () => { + onEvent(companyEvents.COMPANY_FORMS_DONE) + } + return (
@@ -94,6 +100,7 @@ function Root({ companyId, signatoryId, className, children }: DocumentListProps + )} @@ -105,3 +112,4 @@ function Root({ companyId, signatoryId, className, children }: DocumentListProps DocumentList.Head = Head DocumentList.ManageSignatories = ManageSignatories DocumentList.List = List +DocumentList.Actions = Actions diff --git a/src/components/Company/DocumentSigner/DocumentList/Head.tsx b/src/components/Company/DocumentSigner/DocumentList/Head.tsx index b04c736..64ddea6 100644 --- a/src/components/Company/DocumentSigner/DocumentList/Head.tsx +++ b/src/components/Company/DocumentSigner/DocumentList/Head.tsx @@ -1,8 +1,7 @@ import { useTranslation } from 'react-i18next' export function Head() { - // @ts-expect-error HACK missing translations - const { t } = useTranslation('Company.DocumentSigner') + const { t } = useTranslation('Company.DocumentList') return

{t('documentListTitle')}

} diff --git a/src/components/Company/DocumentSigner/DocumentList/List.tsx b/src/components/Company/DocumentSigner/DocumentList/List.tsx index 917e1ce..f7d0052 100644 --- a/src/components/Company/DocumentSigner/DocumentList/List.tsx +++ b/src/components/Company/DocumentSigner/DocumentList/List.tsx @@ -5,8 +5,8 @@ import { useDocumentList } from './DocumentList' function List() { const { companyForms, handleRequestFormToSign, documentListError, isSelfSignatory } = useDocumentList() - // @ts-expect-error HACK missing translations - const { t } = useTranslation('Company.DocumentSigner') + + const { t } = useTranslation('Company.DocumentList') const onRequestSign = (requestedForm: FormData) => { const companyForm = companyForms.find(currentForm => currentForm.uuid === requestedForm.uuid) diff --git a/src/components/Company/DocumentSigner/DocumentList/ManageSignatories.tsx b/src/components/Company/DocumentSigner/DocumentList/ManageSignatories.tsx index c1a6ee8..60ffd0a 100644 --- a/src/components/Company/DocumentSigner/DocumentList/ManageSignatories.tsx +++ b/src/components/Company/DocumentSigner/DocumentList/ManageSignatories.tsx @@ -13,8 +13,7 @@ function isValidSignatoryTitle( } function ManageSignatories() { - // @ts-expect-error HACK missing translations - const { t } = useTranslation('Company.DocumentSigner') + const { t } = useTranslation('Company.DocumentList') const { isSelfSignatory, signatory, handleChangeSignatory } = useDocumentList() let signatorySubtext = t('noSignatorySubtext') diff --git a/src/i18n/en/Company.DocumentList.json b/src/i18n/en/Company.DocumentList.json index 9bef69d..a06b28d 100644 --- a/src/i18n/en/Company.DocumentList.json +++ b/src/i18n/en/Company.DocumentList.json @@ -14,5 +14,6 @@ "signDocumentComplete": "Complete", "notSigned": "Not signed", "documentListError": "Could not load your documents, try again later.", - "emptyTableTitle": "No documents found" + "emptyTableTitle": "No documents found", + "continueCta": "Continue" } diff --git a/src/shared/constants.ts b/src/shared/constants.ts index 5068f87..60553fa 100644 --- a/src/shared/constants.ts +++ b/src/shared/constants.ts @@ -60,6 +60,7 @@ export const companyEvents = { COMPANY_ASSIGN_SIGNATORY_DONE: 'company/signatory/assignSignatory/done', COMPANY_VIEW_FORM_TO_SIGN: 'company/forms/view', COMPANY_FORM_EDIT_SIGNATORY: 'company/forms/editSignatory', + COMPANY_FORMS_DONE: 'company/forms/done', } as const export const componentEvents = { diff --git a/src/types/i18next.d.ts b/src/types/i18next.d.ts index f26f2b5..deff9df 100644 --- a/src/types/i18next.d.ts +++ b/src/types/i18next.d.ts @@ -101,6 +101,7 @@ export interface CompanyDocumentList{ "notSigned":string; "documentListError":string; "emptyTableTitle":string; +"continueCta":string; }; export interface CompanyFederalTaxes{ "pageTitle":string;