feat: collapsed metadata for posts
This commit is contained in:
@@ -115,6 +115,32 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.metadata-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 6px 4px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--vscode-descriptionForeground);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
cursor: pointer;
|
||||
transition: color 0.15s;
|
||||
}
|
||||
|
||||
.metadata-toggle:hover {
|
||||
color: var(--vscode-foreground);
|
||||
}
|
||||
|
||||
.metadata-toggle-chevron {
|
||||
font-size: 10px;
|
||||
transition: transform 0.15s;
|
||||
}
|
||||
|
||||
.editor-header-row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
|
||||
@@ -189,6 +189,7 @@ export const PostEditor: React.FC<PostEditorProps> = ({ postId }) => {
|
||||
const [lightboxIndex, setLightboxIndex] = useState(0);
|
||||
const [showPostSearch, setShowPostSearch] = useState(false);
|
||||
const [showMediaSearch, setShowMediaSearch] = useState(false);
|
||||
const [metadataExpanded, setMetadataExpanded] = useState(true);
|
||||
const editorRef = useRef<unknown>(null);
|
||||
|
||||
const isDirty = checkIsDirty(postId);
|
||||
@@ -298,6 +299,9 @@ export const PostEditor: React.FC<PostEditorProps> = ({ postId }) => {
|
||||
setAuthor(post.author || '');
|
||||
setTags(post.tags);
|
||||
setSelectedCategories(post.categories.length > 0 ? post.categories : ['article']);
|
||||
if (!isInitialized) {
|
||||
setMetadataExpanded(post.title === '');
|
||||
}
|
||||
markClean(postId);
|
||||
// Mark as initialized AFTER setting local state
|
||||
setIsInitialized(true);
|
||||
@@ -718,6 +722,14 @@ export const PostEditor: React.FC<PostEditorProps> = ({ postId }) => {
|
||||
</div>
|
||||
|
||||
<div className="editor-content">
|
||||
<button
|
||||
className={`metadata-toggle ${metadataExpanded ? 'expanded' : ''}`}
|
||||
onClick={() => setMetadataExpanded(v => !v)}
|
||||
>
|
||||
<span className="metadata-toggle-chevron">{metadataExpanded ? '▼' : '▶'}</span>
|
||||
<span>{tr('editor.metadata.toggle')}</span>
|
||||
</button>
|
||||
{metadataExpanded && (
|
||||
<div className="editor-header-row">
|
||||
<div className="editor-meta">
|
||||
<div className="editor-field">
|
||||
@@ -768,18 +780,19 @@ export const PostEditor: React.FC<PostEditorProps> = ({ postId }) => {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<PostLinks
|
||||
postId={postId}
|
||||
updatedAt={post.updatedAt}
|
||||
onPostClick={(id) => useAppStore.getState().setSelectedPost(id)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="editor-media-panel">
|
||||
<LinkedMediaPanel postId={postId} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="editor-body">
|
||||
<div className="editor-toolbar">
|
||||
|
||||
Reference in New Issue
Block a user