This commit is contained in:
john 2025-05-18 13:41:08 +02:00
parent abd7c2f073
commit 384da1e832
18 changed files with 150 additions and 116 deletions

View file

@ -5,7 +5,8 @@ import { useParams } from 'react-router-dom'
import SingleColumnLayout from '../../../layouts/SingleColumnLayout.tsx'
import NavBar from '../../../components/NavBar.tsx'
import { useFeedViewModel } from '../components/FeedView.ts'
import NavLinkButton from '../../../components/NavLinkButton.tsx'
import NavButton from '../../../components/buttons/NavButton.tsx'
import AuthNavButtons from '../../auth/components/AuthNavButtons.tsx'
interface AuthorPageParams {
postsService: PostsService
@ -27,8 +28,8 @@ export default function AuthorPage({ postsService }: AuthorPageParams) {
<SingleColumnLayout
navbar={
<NavBar>
<NavLinkButton to={'/'}>home</NavLinkButton>
<NavLinkButton to="/logout">logout</NavLinkButton>
<NavButton to={'/'}>home</NavButton>
<AuthNavButtons />
</NavBar>
}
>

View file

@ -9,7 +9,7 @@ import { Post } from '../posts/posts.ts'
import { Temporal } from '@js-temporal/polyfill'
import SingleColumnLayout from '../../../layouts/SingleColumnLayout.tsx'
import NavBar from '../../../components/NavBar.tsx'
import NavLinkButton from '../../../components/NavLinkButton.tsx'
import AuthNavButtons from '../../auth/components/AuthNavButtons.tsx'
interface HomePageProps {
postsService: PostsService
@ -18,7 +18,6 @@ interface HomePageProps {
export default function HomePage({ postsService, mediaService }: HomePageProps) {
const { user } = useUser()
const [isSubmitting, setIsSubmitting] = useState(false)
const fetchPosts = useCallback(
@ -59,16 +58,18 @@ export default function HomePage({ postsService, mediaService }: HomePageProps)
[mediaService, postsService, setPages, user],
)
const isLoggedIn = user != null
return (
<SingleColumnLayout
navbar={
<NavBar>
<NavLinkButton to="/logout">logout</NavLinkButton>
<AuthNavButtons />
</NavBar>
}
>
<main className={`w-full max-w-3xl mx-auto`}>
<NewPostWidget onSubmit={onCreatePost} isSubmitting={isSubmitting} />
{isLoggedIn && <NewPostWidget onSubmit={onCreatePost} isSubmitting={isSubmitting} />}
<FeedView pages={pages} onLoadMore={loadNextPage} />
</main>
</SingleColumnLayout>