diff --git a/apps/frontend/src/components/launches/calendar.tsx b/apps/frontend/src/components/launches/calendar.tsx
index c55e617a..aa45b651 100644
--- a/apps/frontend/src/components/launches/calendar.tsx
+++ b/apps/frontend/src/components/launches/calendar.tsx
@@ -53,6 +53,7 @@ import { StatisticsModal } from '@gitroom/frontend/components/launches/statistic
import { useT } from '@gitroom/react/translation/get.transation.service.client';
import i18next from 'i18next';
import { AddEditModal } from '@gitroom/frontend/components/new-launch/add.edit.modal';
+import { deleteDialog } from '@gitroom/react/helpers/delete.dialog';
// Extend dayjs with necessary plugins
extend(isSameOrAfter);
@@ -474,6 +475,7 @@ export const CalendarColumn: FC<{
},
[]
);
+
const editPost = useCallback(
(
loadPost: Post & {
@@ -632,6 +634,34 @@ export const CalendarColumn: FC<{
},
[]
);
+
+ const deletePost = useCallback(
+ (post: Post) => async () => {
+ if (
+ !(await deleteDialog(
+ t(
+ 'are_you_sure_you_want_to_delete_post',
+ 'Are you sure you want to delete post?'
+ )
+ ))
+ ) {
+ return;
+ }
+
+ await fetch(`/posts/${post.group}`, {
+ method: 'DELETE',
+ });
+
+ toaster.show(
+ t('post_deleted_successfully', 'Post deleted successfully'),
+ 'success'
+ );
+
+ reloadCalendarView();
+ },
+ [toaster, t]
+ );
+
const addProvider = useAddProvider();
return (
@@ -682,6 +712,7 @@ export const CalendarColumn: FC<{
duplicatePost={editPost(post, true)}
post={post}
integrations={integrations}
+ deletePost={deletePost(post)}
/>
@@ -782,6 +813,7 @@ const CalendarItem: FC<{
isBeforeNow: boolean;
editPost: () => void;
duplicatePost: () => void;
+ deletePost: () => void;
statistics: () => void;
integrations: Integrations[];
state: State;
@@ -803,6 +835,7 @@ const CalendarItem: FC<{
isBeforeNow,
state,
display,
+ deletePost,
} = props;
const preview = useCallback(() => {
window.open(`/p/` + post.id + '?share=true', '_blank');
@@ -871,6 +904,15 @@ const CalendarItem: FC<{
onClick={statistics}
>
+ {' '}
+
+
{
);
};
+export const DeletePost = () => {
+ const t = useT();
+ return (
+
+ );
+};
+
export const SetSelectionModal: FC<{
sets: any[];
onSelect: (set: any) => void;
diff --git a/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts b/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts
index 432c0a2a..c50638ce 100644
--- a/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts
+++ b/libraries/nestjs-libraries/src/database/prisma/posts/posts.repository.ts
@@ -160,6 +160,7 @@ export class PostsRepository {
submittedForOrderId: true,
state: true,
intervalInDays: true,
+ group: true,
tags: {
select: {
tag: true,
diff --git a/libraries/react-shared-libraries/src/translation/locales/en/translation.json b/libraries/react-shared-libraries/src/translation/locales/en/translation.json
index 66e7e749..a17cd719 100644
--- a/libraries/react-shared-libraries/src/translation/locales/en/translation.json
+++ b/libraries/react-shared-libraries/src/translation/locales/en/translation.json
@@ -180,6 +180,8 @@
"add_comment_or_post": "Add comment / post",
"you_are_in_global_editing_mode": "You are in global editing mode",
"the_post_should_be_at_least_6_characters_long": "The post should be at least 6 characters long",
+ "are_you_sure_you_want_to_delete_post": "Are you sure you want to delete this post?",
+ "post_deleted_successfully": "Post deleted successfully",
"delete_post": "Delete Post",
"save_as_draft": "Save as draft",
"post_now": "Post now",