From 8bcda47d83fd54d75d5532f5c57ac88287b2f1a6 Mon Sep 17 00:00:00 2001 From: MD Shuvo <66669067+shuvo7670@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:47:00 +0600 Subject: [PATCH 1/4] calender design modification --- .../Settings/fields/Calendar/EventRender.tsx | 32 ++++++++++--------- .../app/assets/sass/utils/_calendar.scss | 4 +++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx b/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx index 0dd0479e..a77ac128 100644 --- a/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx +++ b/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx @@ -3,7 +3,7 @@ import apiFetch from '@wordpress/api-fetch'; import { decodeEntities } from '@wordpress/html-entities'; import { Button } from '@wordpress/components'; import { addQueryArgs } from '@wordpress/url'; -import React, { useEffect } from 'react'; +import React, { Fragment, useEffect } from 'react'; import { SweetAlertDeleteMsgForPost } from '../../ToasterMsg'; import { PostCardProps, PostType, WP_Error } from './types'; @@ -143,7 +143,21 @@ const PostCard: React.FC = ({ } return ( -
+ +
+ + + {/* "1:00 am" */} + {/* @ts-ignore */} + {/* {format(post.end, 'h:mm a')} */} + {post.postTime} + +

{ decodeEntities( post.title ) }

+ + {post.postType} + {post.status} + +
{editAreaToggle?.[post.postId] && (
  • @@ -195,19 +209,7 @@ const PostCard: React.FC = ({
)} - - - {/* "1:00 am" */} - {/* @ts-ignore */} - {/* {format(post.end, 'h:mm a')} */} - {post.postTime} - -

{ decodeEntities( post.title ) }

- - {post.postType} - {post.status} - -
+ ); }; diff --git a/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss b/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss index a3b89fd7..ba028b52 100644 --- a/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss +++ b/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss @@ -436,6 +436,7 @@ // color: #000; // } } + } } } @@ -571,3 +572,6 @@ -ms-overflow-style: none !important; /* IE and Edge */ scrollbar-width: none !important; /* Firefox */ } +.fc-event.fc-event-past .wpsp-event-card{ + opacity: 0.5; +} \ No newline at end of file From ed24ff43731c02ec845901328666a45bc38d6267 Mon Sep 17 00:00:00 2001 From: MD Shuvo <66669067+shuvo7670@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:46:23 +0600 Subject: [PATCH 2/4] calender style modification --- .../Settings/fields/Calendar/EventRender.tsx | 64 ++++++++----------- .../app/assets/sass/utils/_calendar.scss | 2 +- 2 files changed, 26 insertions(+), 40 deletions(-) diff --git a/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx b/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx index a77ac128..8007b277 100644 --- a/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx +++ b/includes/Admin/Settings/app/Settings/fields/Calendar/EventRender.tsx @@ -3,7 +3,7 @@ import apiFetch from '@wordpress/api-fetch'; import { decodeEntities } from '@wordpress/html-entities'; import { Button } from '@wordpress/components'; import { addQueryArgs } from '@wordpress/url'; -import React, { Fragment, useEffect } from 'react'; +import React, { useEffect } from 'react'; import { SweetAlertDeleteMsgForPost } from '../../ToasterMsg'; import { PostCardProps, PostType, WP_Error } from './types'; @@ -64,28 +64,14 @@ const PostCard: React.FC = ({ }; - const handlePostStatus = (id, post_type, action_type) => { + const deletePost = (id) => { // @todo add confirm dialog. - let action = {}; - if( action_type === 'delete' ) { - action = { - path: addQueryArgs('/wpscp/v1/post', { ID: id }), - method: 'DELETE', - // data: query, - } - }else if( action_type === 'trash' ) { - action = { - path: "/wpscp/v1/post", - method: "POST", - data: { - ID : id, - post_type: post_type, - type : 'trashDrop', - }, - } - } - - return apiFetch(action).then((data: {id: string, message: string} | WP_Error) => { + + return apiFetch({ + path: addQueryArgs('/wpscp/v1/post', { ID: id }), + method: 'DELETE', + // data: query, + }).then((data: {id: string, message: string} | WP_Error) => { if('id' in data) { setEvents((events) => { return events.filter((event) => { @@ -105,7 +91,7 @@ const PostCard: React.FC = ({ const deleteFile = (item) => { toggleEditArea(); - return handlePostStatus(item.postId, item.postType, item.action_type); + return deletePost(item.postId); }; const addEventListeners = () => { @@ -143,21 +129,7 @@ const PostCard: React.FC = ({ } return ( - -
- - - {/* "1:00 am" */} - {/* @ts-ignore */} - {/* {format(post.end, 'h:mm a')} */} - {post.postTime} - -

{ decodeEntities( post.title ) }

- - {post.postType} - {post.status} - -
+
{editAreaToggle?.[post.postId] && (
  • @@ -209,7 +181,21 @@ const PostCard: React.FC = ({
)} - +
+ + + {/* "1:00 am" */} + {/* @ts-ignore */} + {/* {format(post.end, 'h:mm a')} */} + {post.postTime} + +

{ decodeEntities( post.title ) }

+ + {post.postType} + {post.status} + +
+
); }; diff --git a/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss b/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss index ba028b52..83a81e31 100644 --- a/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss +++ b/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss @@ -572,6 +572,6 @@ -ms-overflow-style: none !important; /* IE and Edge */ scrollbar-width: none !important; /* Firefox */ } -.fc-event.fc-event-past .wpsp-event-card{ +.fc-event.fc-event-past .wpsp-event-card .wpsp-event-card-content{ opacity: 0.5; } \ No newline at end of file From 60f15e812539dfe7e26eeb944b37d419f28e54b9 Mon Sep 17 00:00:00 2001 From: MD Shuvo <66669067+shuvo7670@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:32:59 +0600 Subject: [PATCH 3/4] calender style modification --- .../app/assets/sass/utils/_calendar.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss b/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss index 83a81e31..e8ea61ad 100644 --- a/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss +++ b/includes/Admin/Settings/app/assets/sass/utils/_calendar.scss @@ -574,4 +574,20 @@ } .fc-event.fc-event-past .wpsp-event-card .wpsp-event-card-content{ opacity: 0.5; +} +.fc-event.fc-event-past:hover .wpsp-event-card .wpsp-event-card-content { + opacity: 1; +} +.fc-day-today .fc-daygrid-day-frame.fc-scrollgrid-sync-inner { + background: #fff !important; +} + +.fc-day-today .fc-daygrid-day-frame.fc-scrollgrid-sync-inner .fc-daygrid-day-top .fc-daygrid-day-number { + background: #6c62ff !important; + color: #fff !important; +} + +.fc-theme-standard .fc-popover-header { + background: #f3f2ff; + color: #6c62ff; } \ No newline at end of file From f62d0213999f2e6bad8a9f1fb315832fb6c71a64 Mon Sep 17 00:00:00 2001 From: MD Shuvo <66669067+shuvo7670@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:29:44 +0600 Subject: [PATCH 4/4] calender post move to trash --- includes/Admin/Calendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Admin/Calendar.php b/includes/Admin/Calendar.php index 444399f3..de774d1d 100644 --- a/includes/Admin/Calendar.php +++ b/includes/Admin/Calendar.php @@ -599,7 +599,7 @@ public function delete_event_action($request) return new WP_Error('rest_post_update_error', __('Post type isn\'t allowed in Settings page.', 'wp-scheduled-posts'), array('status' => 400)); } - $result = wp_delete_post($postId, true); + $result = wp_delete_post($postId, false); if ($result === false) { $error = new WP_Error('delete_failed', 'Failed to delete post', array('status' => 500)); return new WP_REST_Response($error, 500);