From 7243a2ff88ec6097c148f4b527ced5a1d6491728 Mon Sep 17 00:00:00 2001 From: David Colon <38386583+Da-Colon@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:38:18 -0400 Subject: [PATCH 01/46] type the push --- src/components/pages/Roles/RoleCard.tsx | 2 +- src/components/pages/Roles/RolesTable.tsx | 7 +- .../Roles/forms/RoleFormCreateProposal.tsx | 23 +-- .../pages/Roles/forms/RoleFormInfo.tsx | 6 +- .../Roles/forms/RoleFormPaymentStream.tsx | 6 +- .../Roles/forms/RoleFormPaymentStreams.tsx | 7 +- .../pages/Roles/forms/RoleFormTabs.tsx | 4 +- src/components/pages/Roles/types.tsx | 12 +- .../ui/modals/PaymentWithdrawModal.tsx | 9 +- .../[daoAddress]/roles/edit/details/index.tsx | 3 +- src/store/roles/rolesStoreUtils.ts | 12 +- ....timestamp-1724166329011-a3ecd76c28483.mjs | 149 ++++++++++++++++++ 12 files changed, 211 insertions(+), 29 deletions(-) create mode 100644 vite.config.mts.timestamp-1724166329011-a3ecd76c28483.mjs diff --git a/src/components/pages/Roles/RoleCard.tsx b/src/components/pages/Roles/RoleCard.tsx index 56fac6bef8..94c3aef0d1 100644 --- a/src/components/pages/Roles/RoleCard.tsx +++ b/src/components/pages/Roles/RoleCard.tsx @@ -19,7 +19,7 @@ export function AvatarAndRoleName({ paymentsCount, }: { wearerAddress: string | undefined; - name: string; + name?: string; paymentsCount?: number; }) { const { addressPrefix } = useNetworkConfig(); diff --git a/src/components/pages/Roles/RolesTable.tsx b/src/components/pages/Roles/RolesTable.tsx index 00bb487164..8fe3c8c0c7 100644 --- a/src/components/pages/Roles/RolesTable.tsx +++ b/src/components/pages/Roles/RolesTable.tsx @@ -53,7 +53,7 @@ function RoleNameEditColumn({ roleName, editStatus, }: { - roleName: string; + roleName?: string; editStatus?: EditBadgeStatus; }) { return ( @@ -311,8 +311,11 @@ export function RolesEditTable({ handleRoleClick }: { handleRoleClick: (hatId: H name={role.name} wearerAddress={role.wearer} handleRoleClick={() => { + if (!role.id) { + throw new Error('Role ID is missing'); + } setFieldValue('roleEditing', role); - handleRoleClick(role.id); + handleRoleClick(getAddress(role.id)); }} editStatus={role.editedRole?.status} payments={role.payments} diff --git a/src/components/pages/Roles/forms/RoleFormCreateProposal.tsx b/src/components/pages/Roles/forms/RoleFormCreateProposal.tsx index b5560eb7eb..ba216283e6 100644 --- a/src/components/pages/Roles/forms/RoleFormCreateProposal.tsx +++ b/src/components/pages/Roles/forms/RoleFormCreateProposal.tsx @@ -123,16 +123,19 @@ export default function RoleFormCreateProposal({ close }: { close: () => void }) boxShadow={CARD_SHADOW} borderRadius="0.5rem" > - {editedRoles.map((role, index) => ( - { - setDrawerViewingRole(normalizeRoleFormData(role)); - }} - editStatus={role.editedRole?.status} - /> - ))} + {editedRoles.map((role, index) => { + const normalizedRole = normalizeRoleFormData(role); + return ( + { + setDrawerViewingRole(normalizedRole); + }} + editStatus={role.editedRole?.status} + /> + ); + })} (); + console.log("🚀 ~ values:", values.roleEditing) + console.log("🚀 ~ errors:", errors) return ( } isDisabled={!values?.roleEditing?.payments?.[formIndex]} onClick={() => { - if (!values?.roleEditing?.payments?.[formIndex]) return; + const hatId = values.roleEditing?.id; + if (!values?.roleEditing?.payments?.[formIndex] || !hatId) return; const streamId = values.roleEditing?.payments?.[formIndex]?.streamId; const isExistingPayment = !!streamId - ? getPayment(values.roleEditing.id, streamId) + ? getPayment(getAddress(hatId), streamId) : undefined; // if payment is new, and unedited, remove it if ( diff --git a/src/components/pages/Roles/forms/RoleFormPaymentStreams.tsx b/src/components/pages/Roles/forms/RoleFormPaymentStreams.tsx index d438166a7f..ca18010d51 100644 --- a/src/components/pages/Roles/forms/RoleFormPaymentStreams.tsx +++ b/src/components/pages/Roles/forms/RoleFormPaymentStreams.tsx @@ -12,17 +12,16 @@ export function RoleFormPaymentStreams() { return ( - {({ push: pushPayment }) => ( + {({ push: pushPayment }: { push: (obj: SablierPaymentFormValues) => void }) => (