Skip to content

Commit

Permalink
Bootstrap flow for importing blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
psrpinto committed Sep 9, 2024
1 parent c041718 commit 9d77519
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ import { getSession, listSessions, Session } from '@/storage/session';
import { PlaceholderPreview } from '@/ui/preview/PlaceholderPreview';
import { SessionContext, SessionProvider } from '@/ui/session/SessionProvider';
import { ApiClient } from '@/api/ApiClient';
import { BlogPostFlow } from '@/ui/flow/blog-post/BlogPostFlow';

export const Screens = {
home: () => '/start/home',
newSession: () => '/start/new-session',
viewSession: ( id: string ) => `/session/${ id }`,
viewSession: ( sessionId: string ) => `/session/${ sessionId }`,
flowBlogPost: ( sessionId: string ) =>
`/session/${ sessionId }/flow/blog-post`,
};

const homeLoader: LoaderFunction = async () => {
Expand Down Expand Up @@ -63,6 +66,9 @@ function Routes( props: { initialScreen: string } ) {
loader={ sessionLoader }
>
<Route path="" element={ <ViewSession /> } />
<Route path="flow">
<Route path="blog-post" element={ <BlogPostFlow /> } />
</Route>
</Route>
</Route>
);
Expand Down
3 changes: 3 additions & 0 deletions src/ui/flow/blog-post/BlogPostFlow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function BlogPostFlow() {
return <>hello</>;
}
17 changes: 10 additions & 7 deletions src/ui/session/ViewSession.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useSessionContext } from '@/ui/session/SessionProvider';
import { Post } from '@/api/ApiClient';
import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { Screens } from '@/ui/App';

export function ViewSession() {
const { session, apiClient } = useSessionContext();
Expand All @@ -18,14 +20,15 @@ export function ViewSession() {

return (
<>
<div>view session: { session.id }</div>
{ apiClient?.siteUrl ? (
<div>url: { apiClient.siteUrl }</div>
) : null }
<h1>
{ session.title } ({ session.url })
</h1>
<ul>
{ posts.map( ( post ) => {
return <li key={ post.id }>{ post.title }</li>;
} ) }
<li>
<Link to={ Screens.flowBlogPost( session.id ) }>
Import Blog Post
</Link>
</li>
</ul>
</>
);
Expand Down

0 comments on commit 9d77519

Please sign in to comment.