From f3dd984b92ba99ee19e9d610e2e67f7530656463 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Thu, 2 Jan 2025 18:15:22 +0700 Subject: [PATCH] feat: minor fixes --- .../components/launches/add.edit.model.tsx | 15 +--- .../src/components/launches/ai.image.tsx | 4 +- .../src/components/launches/calendar.tsx | 80 ++----------------- .../src/components/launches/new.post.tsx | 2 +- .../providers/high.order.provider.tsx | 13 +-- .../src/components/media/media.component.tsx | 6 +- 6 files changed, 17 insertions(+), 103 deletions(-) diff --git a/apps/frontend/src/components/launches/add.edit.model.tsx b/apps/frontend/src/components/launches/add.edit.model.tsx index 2f31271e..229be6e8 100644 --- a/apps/frontend/src/components/launches/add.edit.model.tsx +++ b/apps/frontend/src/components/launches/add.edit.model.tsx @@ -1,16 +1,7 @@ 'use client'; import React, { - ClipboardEventHandler, - FC, - Fragment, - MouseEventHandler, - useCallback, - useEffect, - useMemo, - useRef, - ClipboardEvent, - useState, + ClipboardEventHandler, FC, Fragment, MouseEventHandler, useCallback, useEffect, useMemo, useRef, ClipboardEvent, useState, memo } from 'react'; import dayjs from 'dayjs'; import { Integrations } from '@gitroom/frontend/components/launches/calendar.context'; @@ -79,7 +70,7 @@ export const AddEditModal: FC<{ id?: string; image?: Array<{ id: string; path: string }>; }>; -}> = (props) => { +}> = memo((props) => { const { date, integrations: ints, reopenModal, mutate, onlyValues } = props; const [customer, setCustomer] = useState(''); const [loading, setLoading] = useState(false); @@ -834,4 +825,4 @@ export const AddEditModal: FC<{ ); -}; +}); diff --git a/apps/frontend/src/components/launches/ai.image.tsx b/apps/frontend/src/components/launches/ai.image.tsx index 024ecffa..d5e3533d 100644 --- a/apps/frontend/src/components/launches/ai.image.tsx +++ b/apps/frontend/src/components/launches/ai.image.tsx @@ -91,11 +91,11 @@ ${type} > -
AI
+
AI
{value.length >= 30 && !loading && ( diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsx index e7f171e2..0918d238 100644 --- a/apps/frontend/src/components/launches/calendar.tsx +++ b/apps/frontend/src/components/launches/calendar.tsx @@ -1,12 +1,7 @@ 'use client'; import React, { - FC, - Fragment, - useCallback, - useEffect, - useMemo, - useState, + FC, Fragment, memo, useCallback, useEffect, useMemo, useState } from 'react'; import { CalendarContext, @@ -264,7 +259,7 @@ export const Calendar = () => { export const CalendarColumn: FC<{ getDate: dayjs.Dayjs; randomHour?: boolean; -}> = (props) => { +}> = memo((props) => { const { getDate, randomHour } = props; const [num, setNum] = useState(0); @@ -636,7 +631,7 @@ export const CalendarColumn: FC<{ ); -}; +}); const CalendarItem: FC<{ date: dayjs.Dayjs; @@ -647,7 +642,7 @@ const CalendarItem: FC<{ state: State; display: 'day' | 'week' | 'month'; post: Post & { integration: Integration }; -}> = (props) => { +}> = memo((props) => { const { editPost, duplicatePost, post, date, isBeforeNow, state, display } = props; @@ -718,69 +713,4 @@ const CalendarItem: FC<{ ); -}; - -export const CommentBox: FC<{ totalComments: number; date: dayjs.Dayjs }> = ( - props -) => { - const { totalComments, date } = props; - const { mutate } = useSWRConfig(); - - const openCommentsModal = useCallback(() => { - openModal({ - children: , - withCloseButton: false, - onClose() { - mutate(`/posts`); - }, - classNames: { - modal: 'bg-transparent text-textColor', - }, - size: '80%', - }); - }, [date]); - - return ( -
-
-
- {totalComments > 0 && ( -
- {totalComments} -
- )} - - - -
-
-
-
- ); -}; +}); diff --git a/apps/frontend/src/components/launches/new.post.tsx b/apps/frontend/src/components/launches/new.post.tsx index 51d5a456..bb87e414 100644 --- a/apps/frontend/src/components/launches/new.post.tsx +++ b/apps/frontend/src/components/launches/new.post.tsx @@ -31,7 +31,7 @@ export const NewPost = () => { size: '80%', title: ``, }); - }, []); + }, [integrations]); return (