fix: post creation working again, also slugs
This commit is contained in:
@@ -373,7 +373,7 @@ const PostEditor: React.FC<PostEditorProps> = ({ post }) => {
|
||||
type="text"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="Post title"
|
||||
placeholder="Untitled"
|
||||
/>
|
||||
</div>
|
||||
<div className="editor-field">
|
||||
@@ -667,18 +667,17 @@ const MediaEditor: React.FC<{ mediaId: string }> = ({ mediaId }) => {
|
||||
};
|
||||
|
||||
const WelcomeScreen: React.FC = () => {
|
||||
const { addPost, setSelectedPost } = useAppStore();
|
||||
const { setSelectedPost } = useAppStore();
|
||||
|
||||
const handleNewPost = async () => {
|
||||
try {
|
||||
const newPost = await window.electronAPI?.posts.create({
|
||||
title: 'Untitled',
|
||||
title: '',
|
||||
content: '',
|
||||
tags: [],
|
||||
categories: [],
|
||||
});
|
||||
if (newPost) {
|
||||
addPost(newPost as PostData);
|
||||
setSelectedPost(newPost.id);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -324,15 +324,14 @@ const PostsList: React.FC = () => {
|
||||
const handleCreatePost = async () => {
|
||||
// Create a real post immediately in the database with default empty content
|
||||
try {
|
||||
const { addPost, setSelectedPost: selectPost } = useAppStore.getState();
|
||||
const { setSelectedPost: selectPost } = useAppStore.getState();
|
||||
const newPost = await window.electronAPI?.posts.create({
|
||||
title: 'Untitled',
|
||||
title: '',
|
||||
content: '',
|
||||
tags: [],
|
||||
categories: [],
|
||||
});
|
||||
if (newPost) {
|
||||
addPost(newPost as PostData);
|
||||
selectPost(newPost.id);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -434,7 +433,7 @@ const PostsList: React.FC = () => {
|
||||
>
|
||||
<span className="post-type-icon" title={postType.type}>{postType.icon}</span>
|
||||
<div className="sidebar-item-content">
|
||||
<div className="sidebar-item-title">{post.title}</div>
|
||||
<div className="sidebar-item-title">{post.title || 'Untitled'}</div>
|
||||
<div className="sidebar-item-meta">{formatDate(post.updatedAt)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -461,7 +460,7 @@ const PostsList: React.FC = () => {
|
||||
>
|
||||
<span className="post-type-icon" title={postType.type}>{postType.icon}</span>
|
||||
<div className="sidebar-item-content">
|
||||
<div className="sidebar-item-title">{post.title}</div>
|
||||
<div className="sidebar-item-title">{post.title || 'Untitled'}</div>
|
||||
<div className="sidebar-item-meta">{formatDate(post.publishedAt || post.updatedAt)}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -488,7 +487,7 @@ const PostsList: React.FC = () => {
|
||||
>
|
||||
<span className="post-type-icon" title={postType.type}>{postType.icon}</span>
|
||||
<div className="sidebar-item-content">
|
||||
<div className="sidebar-item-title">{post.title}</div>
|
||||
<div className="sidebar-item-title">{post.title || 'Untitled'}</div>
|
||||
<div className="sidebar-item-meta">{formatDate(post.updatedAt)}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user