From d1f5438c9ac42dd7596442b99030300912247bb4 Mon Sep 17 00:00:00 2001 From: Mihai <163020214+umihai29@users.noreply.github.com> Date: Fri, 21 Feb 2025 17:41:33 +0200 Subject: [PATCH] patch:fix notes from accountPanel (#43) --- .../edit-organization-notes.usecase.ts | 4 +++- .../Tabs/panels/AccountPanel/AccountPanel.tsx | 13 +---------- .../panels/AccountPanel/EmptyContracts.tsx | 23 ++++++++----------- .../Tabs/panels/AccountPanel/Notes/Notes.tsx | 4 +++- .../email/compose-email/ComposeEmail.tsx | 4 ++-- 5 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/domain/usecases/organization-details/edit-organization-notes.usecase.ts b/src/domain/usecases/organization-details/edit-organization-notes.usecase.ts index 5c9eb426..4e2de2da 100644 --- a/src/domain/usecases/organization-details/edit-organization-notes.usecase.ts +++ b/src/domain/usecases/organization-details/edit-organization-notes.usecase.ts @@ -43,6 +43,8 @@ export class EditOrganizationNotesUsecase { return; } - this.organizationService.updateNotes(organization, this.note); + if (this.note !== organization.value?.notes) { + this.organizationService.updateNotes(organization, this.note); + } } } diff --git a/src/routes/organization/src/components/Tabs/panels/AccountPanel/AccountPanel.tsx b/src/routes/organization/src/components/Tabs/panels/AccountPanel/AccountPanel.tsx index f0a8aae7..e33d49f7 100644 --- a/src/routes/organization/src/components/Tabs/panels/AccountPanel/AccountPanel.tsx +++ b/src/routes/organization/src/components/Tabs/panels/AccountPanel/AccountPanel.tsx @@ -1,5 +1,4 @@ import { useParams } from 'react-router-dom'; -import { FC, useRef, useEffect, PropsWithChildren } from 'react'; import { observer } from 'mobx-react-lite'; @@ -25,7 +24,6 @@ import { const AccountPanelComponent = observer(() => { const store = useStore(); const baseCurrency = store.settings.tenant.value?.baseCurrency; - const createButtonRef = useRef(null); const id = useParams()?.id as string; @@ -65,14 +63,6 @@ const AccountPanelComponent = observer(() => { ); } - useEffect(() => { - if (createButtonRef.current) { - setTimeout(() => { - createButtonRef.current?.focus(); - }, 10); - } - }, [createButtonRef.current]); - return ( <> { handleCreate()} aria-label='Create new contract' @@ -117,7 +106,7 @@ const AccountPanelComponent = observer(() => { ); }); -export const AccountPanel: FC = () => ( +export const AccountPanel = () => ( diff --git a/src/routes/organization/src/components/Tabs/panels/AccountPanel/EmptyContracts.tsx b/src/routes/organization/src/components/Tabs/panels/AccountPanel/EmptyContracts.tsx index fba2943a..ea71f3f0 100644 --- a/src/routes/organization/src/components/Tabs/panels/AccountPanel/EmptyContracts.tsx +++ b/src/routes/organization/src/components/Tabs/panels/AccountPanel/EmptyContracts.tsx @@ -1,22 +1,20 @@ -import { FC, useRef, useEffect, PropsWithChildren } from 'react'; - import { Button } from '@ui/form/Button/Button'; import { File02 } from '@ui/media/icons/File02'; import { FeaturedIcon } from '@ui/media/Icon/FeaturedIcon'; import { RelationshipButton } from '@organization/components/Tabs/panels/AccountPanel/RelationshipButton'; import { OrganizationPanel } from '@organization/components/Tabs/shared/OrganizationPanel/OrganizationPanel'; -export const EmptyContracts: FC< - PropsWithChildren<{ isPending: boolean; onCreate: () => void }> -> = ({ children, onCreate, isPending }) => { - const buttonRef = useRef(null); - - useEffect(() => { - setTimeout(() => { - buttonRef.current?.focus(); - }, 10); - }, []); +interface EmptyContractsProps { + isPending: boolean; + onCreate: () => void; + children: React.ReactNode; +} +export const EmptyContracts = ({ + children, + onCreate, + isPending, +}: EmptyContractsProps) => { return ( }>
@@ -27,7 +25,6 @@ export const EmptyContracts: FC<