From d6fa1611d89e980547b0e447e6feadf9003bd8bf Mon Sep 17 00:00:00 2001 From: chandresh Date: Wed, 11 Feb 2026 22:29:26 +0530 Subject: [PATCH] Blog editor ui done --- frontend/src/pages/Dashboard.jsx | 142 ++++++++++++++++++++----------- frontend/src/pages/Editor.jsx | 12 ++- 2 files changed, 100 insertions(+), 54 deletions(-) diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx index 1667ac6..7f1f445 100644 --- a/frontend/src/pages/Dashboard.jsx +++ b/frontend/src/pages/Dashboard.jsx @@ -133,16 +133,16 @@ export default function Dashboard() { ) : ( -
+
{posts.map((postGroup) => { const post = postGroup.en || postGroup.hi if (!post) return null return ( -
+
{/* Display both language titles */}
-
+
EN -

+

{postGroup.en?.title || 'No English version'}

-
+
HI -

+

{postGroup.hi?.title || 'No Hindi version'}

@@ -170,18 +170,18 @@ export default function Dashboard() { {/* Status badges */}
-
+
{post.content_type === 'link' && ( - + Link )} {/* Show publish status for each language */} -
+
{postGroup.en && ( - + {new Date(post.updated_at).toLocaleDateString()}
{/* Summary status message */} -
+
{(() => { const enPublished = postGroup.en?.status === 'published' const hiPublished = postGroup.hi?.status === 'published' if (enPublished && hiPublished) { - return 📱 Published in: Both Languages + return 📱Published in: Both Languages } else if (enPublished) { - return 📱 Published in: English Only + return 📱Published in: English Only } else if (hiPublished) { - return 📱 Published in: Hindi Only + return 📱Published in: Hindi Only } else { - return 📝 Draft - Not Published + return 📝Draft - Not Published } })()}
{/* Action buttons */} -
+
+ {/* Row 1: Edit button (full width) */} Edit - {post.status === 'published' && postGroup.en && ( - post.content_type === 'link' && postGroup.en.external_url ? ( - - View EN - - ) : ( - - View EN - - ) + + {/* Row 2: View buttons (side by side if both exist) */} + {(postGroup.en?.status === 'published' || postGroup.hi?.status === 'published') && ( +
+ {/* View EN button - only show if English is published */} + {postGroup.en?.status === 'published' && ( + post.content_type === 'link' && postGroup.en.external_url ? ( + + View EN + + ) : ( + + View EN + + ) + )} + + {/* View HI button - only show if Hindi is published */} + {postGroup.hi?.status === 'published' && ( + post.content_type === 'link' && postGroup.hi.external_url ? ( + + View HI + + ) : ( + + View HI + + ) + )} +
)} - - + + {/* Row 3: Publish and Delete buttons (side by side) */} +
+ + +
) diff --git a/frontend/src/pages/Editor.jsx b/frontend/src/pages/Editor.jsx index 0c7c914..5bdf497 100644 --- a/frontend/src/pages/Editor.jsx +++ b/frontend/src/pages/Editor.jsx @@ -691,9 +691,10 @@ export default function EditorPage() { )}
- {/* Always show dual-language layout - all content preserved */} -
- {/* English Section */} + {/* Conditional language layout based on publish mode */} +
+ {/* English Section - only show if publishMode is 'en' or 'both' */} + {(publishMode === 'en' || publishMode === 'both') && (
+ )} - {/* Hindi Section */} + {/* Hindi Section - only show if publishMode is 'hi' or 'both' */} + {(publishMode === 'hi' || publishMode === 'both') && (
+ )}