fix: removed unpublish button

This commit is contained in:
2026-02-11 16:14:41 +01:00
parent 11ec82d12e
commit 258e313f0e
6 changed files with 1 additions and 88 deletions

View File

@@ -331,24 +331,6 @@ const PostEditor: React.FC<PostEditorProps> = ({ post }) => {
}
};
const handleUnpublish = async () => {
try {
const updated = await window.electronAPI?.posts.unpublish(post.id);
if (updated) {
updatePost(post.id, updated as Partial<PostData>);
showToast.success('Post unpublished');
}
} catch (error) {
console.error('Failed to unpublish post:', error);
const err = error as Error;
showErrorModal({
title: 'Unpublish Failed',
message: err.message || 'Failed to unpublish post',
stack: err.stack,
});
}
};
const handleDiscard = async () => {
// If this post has a published version, revert to it
// If never published, delete the post entirely
@@ -436,12 +418,10 @@ const PostEditor: React.FC<PostEditorProps> = ({ post }) => {
useEffect(() => {
const unsubscribeSave = window.electronAPI?.on('menu:save', handleSave);
const unsubscribePublish = window.electronAPI?.on('menu:publishSelected', handlePublish);
const unsubscribeUnpublish = window.electronAPI?.on('menu:unpublishSelected', handleUnpublish);
return () => {
unsubscribeSave?.();
unsubscribePublish?.();
unsubscribeUnpublish?.();
};
}, [handleSave]);
@@ -459,7 +439,7 @@ const PostEditor: React.FC<PostEditorProps> = ({ post }) => {
{post.status}
</span>
{isSaving && <span className="auto-save-indicator">Saving...</span>}
{post.status === 'draft' ? (
{post.status === 'draft' && (
<button
onClick={handlePublish}
className="success"
@@ -467,14 +447,6 @@ const PostEditor: React.FC<PostEditorProps> = ({ post }) => {
>
Publish
</button>
) : (
<button
onClick={handleUnpublish}
className="secondary"
title="Return to draft status"
>
Unpublish
</button>
)}
{post.status === 'draft' && (
<button

View File

@@ -189,7 +189,6 @@ export interface ElectronAPI {
getAll: (options?: { limit?: number; offset?: number }) => Promise<PaginatedPostsResult>;
getByStatus: (status: string) => Promise<PostData[]>;
publish: (id: string) => Promise<PostData | null>;
unpublish: (id: string) => Promise<PostData | null>;
discard: (id: string) => Promise<PostData | null>;
hasPublishedVersion: (id: string) => Promise<boolean>;
rebuildFromFiles: () => Promise<void>;