Skip to content

Commit

Permalink
Use Toolbar in NewBlogPost
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Sep 27, 2024
1 parent de85d39 commit 5339d63
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/ui/flows/blog-post/NewBlogPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ContentBus } from '@/bus/ContentBus';
import { useSessionContext } from '@/ui/session/SessionProvider';
import { useNavigate } from 'react-router-dom';
import { Screens } from '@/ui/App';
import { Toolbar } from '@/ui/flows/blog-post/Toolbar';

export function NewBlogPost() {
const navigate = useNavigate();
Expand All @@ -29,27 +30,30 @@ export function NewBlogPost() {

const element = (
<>
<Toolbar>
<button
onClick={ async () => {
const currentPage =
await ContentBus.getCurrentPageInfo();
let post = await apiClient!.posts.findByGuid(
currentPage.url
);
if ( ! post ) {
post = await apiClient!.posts.create( {
guid: currentPage.url,
} );
}
navigate(
Screens.flows.blogPost.edit( session.id, post.id )
);
} }
>
Continue
</button>
</Toolbar>
<div>
Navigate to the page of the post you&apos;d like to import
</div>
<button
onClick={ async () => {
const currentPage = await ContentBus.getCurrentPageInfo();
let post = await apiClient!.posts.findByGuid(
currentPage.url
);
if ( ! post ) {
post = await apiClient!.posts.create( {
guid: currentPage.url,
} );
}
navigate(
Screens.flows.blogPost.edit( session.id, post.id )
);
} }
>
Continue
</button>
</>
);

Expand Down

0 comments on commit 5339d63

Please sign in to comment.