Skip to content

Commit

Permalink
feat: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomer-shvadron committed Nov 3, 2024
1 parent 4cf119b commit 471fe85
Show file tree
Hide file tree
Showing 51 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { useEffect } from 'react';
import { ctw } from '@ballerine/ui';
import { EditorContent } from '@tiptap/react';
import type { Content, Editor } from '@tiptap/react';
Expand All @@ -10,7 +11,6 @@ import { useMinimalTiptapEditor } from './hooks/use-minimal-tiptap';
import { MeasuredContainer } from './components/measured-container';
import { LinkBubbleMenu } from './components/bubble-menu/link-bubble-menu';
import type { UseMinimalTiptapEditorProps } from './hooks/use-minimal-tiptap';
import { useEffect } from 'react';

export interface MinimalTiptapProps extends Omit<UseMinimalTiptapEditorProps, 'onUpdate'> {
value?: Content;
Expand Down Expand Up @@ -75,7 +75,7 @@ export const MinimalTiptapEditor = React.forwardRef<HTMLDivElement, MinimalTipta
<Toolbar editor={editor} />
<EditorContent
editor={editor}
className={ctw('minimal-tiptap-editor', editorContentClassName)}
className={ctw('minimal-tiptap-editor h-full', editorContentClassName)}
/>
<LinkBubbleMenu editor={editor} />
</MeasuredContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { ctw } from '@ballerine/ui';
import { Link } from 'react-router-dom';
import { Loader2, X } from 'lucide-react';

import { Note } from './Note';
Expand All @@ -9,17 +10,16 @@ import { Button } from '@/common/components/atoms/Button/Button';
import { FormItem } from '@/common/components/organisms/Form/Form.Item';
import { FormField } from '@/common/components/organisms/Form/Form.Field';
import { Separator } from '@/common/components/atoms/Separator/Separator';
import { MinimalTiptapEditor } from '@/common/components/organisms/Editor';
import { FormControl } from '@/common/components/organisms/Form/Form.Control';
import { FormMessage } from '@/common/components/organisms/Form/Form.Message';
import { MinimalTiptapEditor } from '@/common/components/organisms/TextEditor';
import { useNotesLogic } from '@/pages/Entity/components/Notes/hooks/useNotesLogic';
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarHeader,
} from '@/common/components/organisms/Sidebar/Sidebar';
import { Link } from 'react-router-dom';

const fallbackUser = {
id: 'test',
Expand Down Expand Up @@ -84,7 +84,7 @@ export const Notes = ({
placeholder="Add a note..."
autofocus={true}
editable={true}
editorClassName="focus:outline-none"
editorClassName="focus:outline-none h-full"
{...field}
/>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { zodResolver } from '@hookform/resolvers/zod';
import { SubmitHandler, useForm } from 'react-hook-form';

import { useUsersQuery } from '@/domains/users/hooks/queries/useUsersQuery/useUsersQuery';
import { useUpdateIsNotesOpen } from '@/common/hooks/useUpdateIsNotesOpen/useUpdateIsNotesOpen';
import { CreateNoteSchema } from '@/pages/Entity/components/Notes/hooks/schemas/create-note-schema';
import { useCreateNoteMutation } from '@/pages/Entity/components/Notes/hooks/mutations/useCreateNoteMutation/useCreateNoteMutation';
import { useUpdateIsNotesOpen } from '@/common/hooks/useUpdateIsNotesOpen/useUpdateIsNotesOpen';

export const useNotesLogic = () => {
const { data: users } = useUsersQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { ScrollArea } from '@/common/components/molecules/ScrollArea/ScrollArea'
import { useMerchantMonitoringBusinessReportLogic } from '@/pages/MerchantMonitoringBusinessReport/hooks/useMerchantMonitoringBusinessReportLogic/useMerchantMonitoringBusinessReportLogic';
import { SidebarInset, SidebarProvider } from '@/common/components/organisms/Sidebar/Sidebar';
import { Notes } from '@/pages/Entity/components/Notes/Notes';
import { workflow } from '@/pages/Entity/hooks/useEntityLogic/mock-workflow-with-children';
import { NotesButton } from '@/common/components/molecules/NotesButton/NotesButton';

export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
Expand All @@ -29,7 +28,7 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
isNotesOpen,
} = useMerchantMonitoringBusinessReportLogic();

if (!notes) {
if (!notes || !businessReport) {
return;
}

Expand Down Expand Up @@ -60,24 +59,23 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
<span className={`me-4 text-sm leading-6 text-slate-400`}>Status</span>
<Badge
variant={
statusToBadgeData[businessReport?.status as keyof typeof statusToBadgeData]
statusToBadgeData[businessReport.status as keyof typeof statusToBadgeData]
?.variant
}
className={ctw(`text-sm font-bold`, {
'bg-info/20 text-info': businessReport?.status === BusinessReportStatus.COMPLETED,
'bg-info/20 text-info': businessReport.status === BusinessReportStatus.COMPLETED,
'bg-violet-500/20 text-violet-500':
businessReport?.status === BusinessReportStatus.IN_PROGRESS,
'bg-slate-200 text-slate-500':
businessReport?.status === BusinessReportStatus.NEW,
businessReport.status === BusinessReportStatus.IN_PROGRESS,
'bg-slate-200 text-slate-500': businessReport.status === BusinessReportStatus.NEW,
})}
>
{statusToBadgeData[businessReport?.status as keyof typeof statusToBadgeData]?.text}
{statusToBadgeData[businessReport.status as keyof typeof statusToBadgeData]?.text}
</Badge>
</div>
<div>
<span className={`me-2 text-sm leading-6 text-slate-400`}>Created at</span>
{businessReport?.createdAt &&
dayjs(new Date(businessReport?.createdAt)).format('HH:mm MMM Do, YYYY')}
{businessReport.createdAt &&
dayjs(new Date(businessReport.createdAt)).format('HH:mm MMM Do, YYYY')}
</div>
<NotesButton numberOfNotes={notes.length} />
</div>
Expand All @@ -104,14 +102,14 @@ export const MerchantMonitoringBusinessReport: FunctionComponent = () => {
</ScrollArea>
</Tabs>
</section>
<Notes
notes={notes}
entityId={workflow.entity.id}
entityType={`Business`}
noteableId={workflow.id}
noteableType={`Report`}
/>
</SidebarInset>
<Notes
notes={notes}
entityId={businessReport.business?.id || ''}
entityType={`Business`}
noteableId={businessReport.id || ''}
noteableType={`Report`}
/>
</SidebarProvider>
);
};

0 comments on commit 471fe85

Please sign in to comment.