11'use client' ;
22
3- import React , { FC , Fragment , useCallback , useEffect , useMemo , useState } from 'react' ;
3+ import React , {
4+ FC ,
5+ Fragment ,
6+ useCallback ,
7+ useEffect ,
8+ useMemo ,
9+ useState ,
10+ } from 'react' ;
411import {
512 Integrations ,
613 useCalendar ,
@@ -159,7 +166,14 @@ export const CalendarColumn: FC<{
159166} > = ( props ) => {
160167 const { getDate, randomHour } = props ;
161168 const user = useUser ( ) ;
162- const { integrations, posts, trendings, changeDate, display } = useCalendar ( ) ;
169+ const {
170+ integrations,
171+ posts,
172+ trendings,
173+ changeDate,
174+ display,
175+ reloadCalendarView,
176+ } = useCalendar ( ) ;
163177
164178 const toaster = useToaster ( ) ;
165179 const modal = useModals ( ) ;
@@ -168,15 +182,16 @@ export const CalendarColumn: FC<{
168182 const postList = useMemo ( ( ) => {
169183 return posts . filter ( ( post ) => {
170184 const pList = dayjs . utc ( post . publishDate ) . local ( ) ;
171- const check = display === 'week'
172- ? pList . isSameOrAfter ( getDate . startOf ( 'hour' ) ) && pList . isBefore ( getDate . endOf ( 'hour' ) )
173- : pList . format ( 'DD/MM/YYYY' ) === getDate . format ( 'DD/MM/YYYY' ) ;
185+ const check =
186+ display === 'week'
187+ ? pList . isSameOrAfter ( getDate . startOf ( 'hour' ) ) &&
188+ pList . isBefore ( getDate . endOf ( 'hour' ) )
189+ : pList . format ( 'DD/MM/YYYY' ) === getDate . format ( 'DD/MM/YYYY' ) ;
174190
175191 return check ;
176192 } ) ;
177193 } , [ posts , display , getDate ] ) ;
178194
179-
180195 const canBeTrending = useMemo ( ( ) => {
181196 return ! ! trendings . find ( ( trend ) => {
182197 return dayjs
@@ -282,6 +297,7 @@ export const CalendarColumn: FC<{
282297 < ExistingDataContextProvider value = { data } >
283298 < AddEditModal
284299 reopenModal = { editPost ( post ) }
300+ mutate = { reloadCalendarView }
285301 integrations = { integrations
286302 . slice ( 0 )
287303 . filter ( ( f ) => f . id === data . integration )
@@ -308,6 +324,7 @@ export const CalendarColumn: FC<{
308324 children : (
309325 < AddEditModal
310326 integrations = { integrations . slice ( 0 ) . map ( ( p ) => ( { ...p } ) ) }
327+ mutate = { reloadCalendarView }
311328 date = {
312329 randomHour ? getDate . hour ( Math . floor ( Math . random ( ) * 24 ) ) : getDate
313330 }
@@ -368,11 +385,15 @@ export const CalendarColumn: FC<{
368385 ) ) }
369386 </ div >
370387 { ! isBeforeNow && (
371- < div className = "pb-[2.5px] px-[5px] flex-1 flex" onClick = { integrations . length ? addModal : addProvider } >
388+ < div
389+ className = "pb-[2.5px] px-[5px] flex-1 flex"
390+ onClick = { integrations . length ? addModal : addProvider }
391+ >
372392 < div
373393 className = { clsx (
374- display === 'month' ? 'flex-1 min-h-[40px] w-full' :
375- ! postList . length
394+ display === 'month'
395+ ? 'flex-1 min-h-[40px] w-full'
396+ : ! postList . length
376397 ? 'h-full w-full absolute left-0 top-0 p-[5px]'
377398 : 'min-h-[40px] w-full' ,
378399 'flex items-center justify-center cursor-pointer pb-[2.5px]'
0 commit comments