Skip to content

Commit 3cb5721

Browse files
committed
feat: scheduling post for now
1 parent d504fac commit 3cb5721

File tree

2 files changed

+19
-52
lines changed

2 files changed

+19
-52
lines changed

apps/frontend/src/components/launches/calendar.tsx

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const DayView = () => {
108108
const currentLanguage = i18next.resolvedLanguage || 'en';
109109
dayjs.locale(currentLanguage);
110110

111-
const currentDay = dayjs(startDate);
111+
const currentDay = dayjs.utc(startDate);
112112

113113
const options = useMemo(() => {
114114
const createdPosts = posts.map((post) => ({
@@ -390,17 +390,16 @@ export const CalendarColumn: FC<{
390390
}
391391
return postList.slice(0, 3);
392392
}, [postList, showAll]);
393-
const canBeTrending = useMemo(() => {
394-
return !!trendings.find((trend) => {
395-
return dayjs
396-
.utc(trend)
397-
.local()
398-
.isBetween(getDate, getDate.add(10, 'minute'), 'minute', '[)');
399-
});
400-
}, [trendings]);
393+
401394
const isBeforeNow = useMemo(() => {
402-
return getDate.startOf('hour').isBefore(dayjs().startOf('hour'));
395+
const originalUtc = getDate.startOf('hour');
396+
console.log(
397+
originalUtc.startOf('hour').format(),
398+
dayjs().startOf('hour').utc().format()
399+
);
400+
return originalUtc.startOf('hour').isBefore(dayjs().startOf('hour').utc());
403401
}, [getDate, num]);
402+
404403
const { start, stop } = useInterval(
405404
useCallback(() => {
406405
if (isBeforeNow) {
@@ -410,6 +409,7 @@ export const CalendarColumn: FC<{
410409
}, [isBeforeNow]),
411410
random(120000, 150000)
412411
);
412+
413413
useEffect(() => {
414414
start();
415415
return () => {
@@ -459,42 +459,6 @@ export const CalendarColumn: FC<{
459459
},
460460
[]
461461
);
462-
const previewPublication = useCallback(
463-
async (
464-
postInfo: Post & {
465-
integration: Integration;
466-
}
467-
) => {
468-
const post = await (
469-
await fetch(`/marketplace/posts/${postInfo.id}`)
470-
).json();
471-
const integration = await getIntegration(postInfo);
472-
modal.openModal({
473-
classNames: {
474-
modal: 'text-textColor',
475-
},
476-
size: 'auto',
477-
withCloseButton: false,
478-
children: (
479-
<IntegrationContext.Provider
480-
value={{
481-
allIntegrations: [],
482-
date: dayjs(),
483-
integration,
484-
value: [],
485-
}}
486-
>
487-
<PreviewPopup
488-
providerId={post?.providerId!}
489-
post={post}
490-
postId={post.id}
491-
/>
492-
</IntegrationContext.Provider>
493-
),
494-
});
495-
},
496-
[]
497-
);
498462

499463
const editPost = useCallback(
500464
(
@@ -509,9 +473,7 @@ export const CalendarColumn: FC<{
509473
// @ts-ignore
510474
publishDate: loadPost.actualDate || loadPost.publishDate,
511475
};
512-
if (user?.orgId === post.submittedForOrganizationId) {
513-
return previewPublication(post);
514-
}
476+
515477
const data = await (await fetch(`/posts/${post.id}`)).json();
516478
const date = !isDuplicate
517479
? null
@@ -631,7 +593,12 @@ export const CalendarColumn: FC<{
631593
}
632594
: {})}
633595
date={
634-
randomHour ? getDate.hour(Math.floor(Math.random() * 24)) : getDate
596+
randomHour
597+
? getDate.hour(Math.floor(Math.random() * 24))
598+
: getDate.format('YYYY-MM-DDTHH:mm:ss') ===
599+
dayjs().startOf('hour').format('YYYY-MM-DDTHH:mm:ss')
600+
? dayjs().add(10, 'minute')
601+
: getDate
635602
}
636603
{...(set?.content ? { set: JSON.parse(set.content) } : {})}
637604
reopenModal={() => ({})}

apps/frontend/src/components/launches/menu/menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,12 @@ export const Menu: FC<{
364364
width={18}
365365
height={18}
366366
viewBox="0 0 32 32"
367-
fill="yellow"
367+
fill="currentColor"
368368
xmlns="http://www.w3.org/2000/svg"
369369
>
370370
<path
371371
d="M3.00079 15.9999C3.00343 13.6138 3.95249 11.3262 5.63975 9.63891C7.327 7.95165 9.61465 7.00259 12.0008 6.99995H25.587L24.2933 5.70745C24.1056 5.5198 24.0002 5.26531 24.0002 4.99995C24.0002 4.73458 24.1056 4.48009 24.2933 4.29245C24.4809 4.1048 24.7354 3.99939 25.0008 3.99939C25.2661 3.99939 25.5206 4.10481 25.7083 4.29245L28.7083 7.29245C28.8013 7.38532 28.875 7.49561 28.9253 7.61701C28.9757 7.7384 29.0016 7.86853 29.0016 7.99995C29.0016 8.13136 28.9757 8.26149 28.9253 8.38289C28.875 8.50428 28.8013 8.61457 28.7083 8.70745L25.7083 11.7074C25.5206 11.8951 25.2661 12.0005 25.0008 12.0005C24.7354 12.0005 24.4809 11.8951 24.2933 11.7074C24.1056 11.5198 24.0002 11.2653 24.0002 10.9999C24.0002 10.7346 24.1056 10.4801 24.2933 10.2924L25.587 8.99995H12.0008C10.1449 9.00193 8.36556 9.74007 7.05323 11.0524C5.74091 12.3647 5.00277 14.144 5.00079 15.9999C5.00079 16.2652 4.89543 16.5195 4.70789 16.7071C4.52036 16.8946 4.266 16.9999 4.00079 16.9999C3.73557 16.9999 3.48122 16.8946 3.29368 16.7071C3.10614 16.5195 3.00079 16.2652 3.00079 15.9999ZM28.0008 14.9999C27.7356 14.9999 27.4812 15.1053 27.2937 15.2928C27.1061 15.4804 27.0008 15.7347 27.0008 15.9999C26.9988 17.8559 26.2607 19.6352 24.9483 20.9475C23.636 22.2598 21.8567 22.998 20.0008 22.9999H6.41454L7.70829 21.7074C7.8012 21.6145 7.8749 21.5042 7.92518 21.3828C7.97546 21.2614 8.00134 21.1313 8.00134 20.9999C8.00134 20.8686 7.97546 20.7384 7.92518 20.6171C7.8749 20.4957 7.8012 20.3854 7.70829 20.2924C7.61538 20.1995 7.50508 20.1258 7.38368 20.0756C7.26229 20.0253 7.13218 19.9994 7.00079 19.9994C6.86939 19.9994 6.73928 20.0253 6.61789 20.0756C6.4965 20.1258 6.3862 20.1995 6.29329 20.2924L3.29329 23.2924C3.20031 23.3853 3.12655 23.4956 3.07623 23.617C3.0259 23.7384 3 23.8685 3 23.9999C3 24.1314 3.0259 24.2615 3.07623 24.3829C3.12655 24.5043 3.20031 24.6146 3.29329 24.7074L6.29329 27.7074C6.3862 27.8004 6.4965 27.8741 6.61789 27.9243C6.73928 27.9746 6.86939 28.0005 7.00079 28.0005C7.13218 28.0005 7.26229 27.9746 7.38368 27.9243C7.50508 27.8741 7.61538 27.8004 7.70829 27.7074C7.8012 27.6145 7.8749 27.5042 7.92518 27.3828C7.97546 27.2614 8.00134 27.1313 8.00134 26.9999C8.00134 26.8686 7.97546 26.7384 7.92518 26.6171C7.8749 26.4957 7.8012 26.3854 7.70829 26.2924L6.41454 24.9999H20.0008C22.3869 24.9973 24.6746 24.0482 26.3618 22.361C28.0491 20.6737 28.9981 18.3861 29.0008 15.9999C29.0008 15.7347 28.8954 15.4804 28.7079 15.2928C28.5204 15.1053 28.266 14.9999 28.0008 14.9999Z"
372-
fill="yellow"
372+
fill="currentColor"
373373
/>
374374
</svg>
375375
</div>

0 commit comments

Comments
 (0)