Skip to content

Commit

Permalink
Merge branch '296' into shakib-master
Browse files Browse the repository at this point in the history
  • Loading branch information
shuvo7670 committed Feb 23, 2024
2 parents 929a4e7 + f62d021 commit 3050032
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 35 deletions.
2 changes: 1 addition & 1 deletion includes/Admin/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,14 @@ const PostCard: React.FC<PostCardProps> = ({
};


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) => {
Expand All @@ -105,7 +91,7 @@ const PostCard: React.FC<PostCardProps> = ({

const deleteFile = (item) => {
toggleEditArea();
return handlePostStatus(item.postId, item.postType, item.action_type);
return deletePost(item.postId);
};

const addEventListeners = () => {
Expand Down Expand Up @@ -195,18 +181,20 @@ const PostCard: React.FC<PostCardProps> = ({
</li>
</ul>
)}
<i className="wpsp-icon wpsp-dots" onClick={toggleEditArea}></i>
<span className={`set-time ` + ('Published' === post.status ? 'published' : 'scheduled')}>
{/* "1:00 am" */}
{/* @ts-ignore */}
{/* {format(post.end, 'h:mm a')} */}
{post.postTime}
</span>
<h3>{ decodeEntities( post.title ) }</h3>
<span className="badge-wrapper">
<span className="Unscheduled-badge">{post.postType}</span>
<span className="status-badge">{post.status}</span>
</span>
<div className="wpsp-event-card-content">
<i className="wpsp-icon wpsp-dots" onClick={toggleEditArea}></i>
<span className={`set-time ` + ('Published' === post.status ? 'published' : 'scheduled')}>
{/* "1:00 am" */}
{/* @ts-ignore */}
{/* {format(post.end, 'h:mm a')} */}
{post.postTime}
</span>
<h3>{ decodeEntities( post.title ) }</h3>
<span className="badge-wrapper">
<span className="Unscheduled-badge">{post.postType}</span>
<span className="status-badge">{post.status}</span>
</span>
</div>
</div>
);
};
Expand Down
20 changes: 20 additions & 0 deletions includes/Admin/Settings/app/assets/sass/utils/_calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@
// color: #000;
// }
}

}
}
}
Expand Down Expand Up @@ -571,3 +572,22 @@
-ms-overflow-style: none !important; /* IE and Edge */
scrollbar-width: none !important; /* Firefox */
}
.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;
}

0 comments on commit 3050032

Please sign in to comment.