Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: save post as draft requires no params

Nevo David1a3b52ac3418
diff --git a/apps/frontend/src/components/launches/add.edit.model.tsx b/apps/frontend/src/components/launches/add.edit.model.tsx
index 74308b33d..147b21b7c 100644
--- a/apps/frontend/src/components/launches/add.edit.model.tsx
+++ b/apps/frontend/src/components/launches/add.edit.model.tsx
@@ -311,50 +311,52 @@ export const AddEditModal: FC<{
maximumCharacters: values[v].maximumCharacters,
}));
- for (const key of allKeys) {
- if (key.checkValidity) {
- const check = await key.checkValidity(
- key?.value.map((p: any) => p.image || []),
- key.settings
- );
- if (typeof check === 'string') {
- toaster.show(check, 'warning');
- return;
+ if (type !== 'draft') {
+ for (const key of allKeys) {
+ if (key.checkValidity) {
+ const check = await key.checkValidity(
+ key?.value.map((p: any) => p.image || []),
+ key.settings
+ );
+ if (typeof check === 'string') {
+ toaster.show(check, 'warning');
+ return;
+ }
}
- }
- if (
- key.value.some((p) => {
- return (
- countCharacters(p.content, key?.integration?.identifier || '') >
- (key.maximumCharacters || 1000000)
- );
- })
- ) {
if (
- !(await deleteDialog(
- `${key?.integration?.name} post is too long, it will be cropped, do you want to continue?`,
- 'Yes, continue'
- ))
+ key.value.some((p) => {
+ return (
+ countCharacters(p.content, key?.integration?.identifier || '') >
+ (key.maximumCharacters || 1000000)
+ );
+ })
) {
- await key.trigger();
- moveToIntegration({
- identifier: key?.integration?.id!,
- toPreview: true,
- });
- return;
+ if (
+ !(await deleteDialog(
+ `${key?.integration?.name} post is too long, it will be cropped, do you want to continue?`,
+ 'Yes, continue'
+ ))
+ ) {
+ await key.trigger();
+ moveToIntegration({
+ identifier: key?.integration?.id!,
+ toPreview: true,
+ });
+ return;
+ }
}
- }
- if (key.value.some((p) => !p.content || p.content.length < 6)) {
- setShowError(true);
- return;
- }
+ if (key.value.some((p) => !p.content || p.content.length < 6)) {
+ setShowError(true);
+ return;
+ }
- if (!key.valid) {
- await key.trigger();
- moveToIntegration({ identifier: key?.integration?.id! });
- return;
+ if (!key.valid) {
+ await key.trigger();
+ moveToIntegration({ identifier: key?.integration?.id! });
+ return;
+ }
}
}
@@ -753,6 +755,9 @@ export const AddEditModal: FC<{
? 'Submit for order'
: !existingData.integration
? 'Add to calendar'
+ : // @ts-ignore
+ existingData?.posts?.[0]?.state === 'DRAFT'
+ ? 'Schedule'
: 'Update'}
</div>
{!postFor && (
diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsx
index 4d6f54da9..ada2d2b6f 100644
--- a/apps/frontend/src/components/launches/calendar.tsx
+++ b/apps/frontend/src/components/launches/calendar.tsx
@@ -472,7 +472,7 @@ export const CalendarColumn: FC<{
'text-textColor p-[2.5px] relative flex flex-col justify-center items-center'
)}
>
- <div className="relative w-full flex flex-col items-center p-[2.5px]">
+ <div className="relative w-full flex flex-col items-center p-[2.5px] h-[56px]">
<CalendarItem
display={display as 'day' | 'week' | 'month'}
isBeforeNow={isBeforeNow}
@@ -606,9 +606,11 @@ const CalendarItem: FC<{
src={`/icons/platforms/${post.integration?.providerIdentifier}.png`}
/>
</div>
- <div className="whitespace-pre-wrap line-clamp-3">
- {state === 'DRAFT' ? 'Draft: ' : ''}
- {removeMd(post.content).replace(/\n/g, ' ')}
+ <div className="whitespace-nowrap line-clamp-2">
+ <div className="text-left">{state === 'DRAFT' ? 'Draft: ' : ''}</div>
+ <div className="w-full overflow-hidden overflow-ellipsis text-left">
+ {removeMd(post.content).replace(/\n/g, ' ')}
+ </div>
</div>
</div>
);