Skip to content

Commit

Permalink
patch:fix notes from accountPanel (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
umihai29 authored Feb 21, 2025
1 parent d037f39 commit d1f5438
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useParams } from 'react-router-dom';
import { FC, useRef, useEffect, PropsWithChildren } from 'react';

import { observer } from 'mobx-react-lite';

Expand All @@ -25,7 +24,6 @@ import {
const AccountPanelComponent = observer(() => {
const store = useStore();
const baseCurrency = store.settings.tenant.value?.baseCurrency;
const createButtonRef = useRef<HTMLButtonElement>(null);

const id = useParams()?.id as string;

Expand Down Expand Up @@ -65,14 +63,6 @@ const AccountPanelComponent = observer(() => {
);
}

useEffect(() => {
if (createButtonRef.current) {
setTimeout(() => {
createButtonRef.current?.focus();
}, 10);
}
}, [createButtonRef.current]);

return (
<>
<OrganizationPanel
Expand All @@ -85,7 +75,6 @@ const AccountPanelComponent = observer(() => {
<IconButton
size='xs'
variant='ghost'
ref={createButtonRef}
className='text-gray-500 mr-1'
onClick={() => handleCreate()}
aria-label='Create new contract'
Expand Down Expand Up @@ -117,7 +106,7 @@ const AccountPanelComponent = observer(() => {
);
});

export const AccountPanel: FC<PropsWithChildren> = () => (
export const AccountPanel = () => (
<AccountModalsContextProvider>
<AccountPanelComponent />
</AccountModalsContextProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -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<HTMLButtonElement>(null);

useEffect(() => {
setTimeout(() => {
buttonRef.current?.focus();
}, 10);
}, []);
interface EmptyContractsProps {
isPending: boolean;
onCreate: () => void;
children: React.ReactNode;
}

export const EmptyContracts = ({
children,
onCreate,
isPending,
}: EmptyContractsProps) => {
return (
<OrganizationPanel title='Account' actionItem={<RelationshipButton />}>
<article className='my-4 w-full flex flex-col items-center'>
Expand All @@ -27,7 +25,6 @@ export const EmptyContracts: FC<

<Button
size='sm'
ref={buttonRef}
variant='outline'
onClick={onCreate}
colorScheme='primary'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ export const Notes = observer(({ id }: NotesProps) => {
className='cursor-text'
namespace='opportunity-next-step'
placeholderClassName='cursor-text'
onBlur={() => editNotesUsecase.execute()}
dataTest='organization-account-notes-editor'
defaultHtmlValue={editNotesUsecase.defaultNote ?? ''}
placeholder='Write some notes or anything related to this customer'
onBlur={() => {
editNotesUsecase.execute();
}}
onChange={(html) => {
editNotesUsecase.setNotes(html);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { FC, useRef, PropsWithChildren } from 'react';
import { observer } from 'mobx-react-lite';
import { TimelineEmailUsecase } from '@domain/usecases/email-composer/send-timeline-email.usecase.ts';

import { Button } from '@ui/form/Button/Button.tsx';
import { Editor } from '@ui/form/Editor/Editor.tsx';
import { Button } from '@ui/form/Button/Button';
import { Editor } from '@ui/form/Editor/Editor';
import { ParticipantsSelectGroup } from '@organization/components/Timeline/PastZone/events/email/compose-email/ParticipantsSelectGroup';

export interface ComposeEmailProps extends PropsWithChildren {
Expand Down

0 comments on commit d1f5438

Please sign in to comment.