Merge pull request #4296 from omnivore-app/fix/web-pagemetadata
Make sure metadata is set for navigation layout
This commit is contained in:
@ -18,11 +18,6 @@ import { Button } from '../elements/Button'
|
||||
import { List } from '@phosphor-icons/react'
|
||||
import { LIBRARY_LEFT_MENU_WIDTH } from './navMenu/LibraryLegacyMenu'
|
||||
import { AddLinkModal } from './AddLinkModal'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import {
|
||||
showErrorToast,
|
||||
showSuccessToastWithAction,
|
||||
} from '../../lib/toastHelpers'
|
||||
import useWindowDimensions from '../../lib/hooks/useGetWindowDimensions'
|
||||
import { useAddItem } from '../../lib/networking/library_items/useLibraryItems'
|
||||
import { useHandleAddUrl } from '../../lib/hooks/useHandleAddUrl'
|
||||
@ -39,6 +34,7 @@ export type NavigationSection =
|
||||
type NavigationLayoutProps = {
|
||||
children: ReactNode
|
||||
rightPane?: ReactNode
|
||||
title: string
|
||||
section: NavigationSection
|
||||
pageMetaDataProps?: PageMetaDataProps
|
||||
|
||||
@ -115,10 +111,7 @@ export function NavigationLayout(props: NavigationLayoutProps): JSX.Element {
|
||||
distribution="start"
|
||||
alignment="start"
|
||||
>
|
||||
{props.pageMetaDataProps ? (
|
||||
<PageMetaData {...props.pageMetaDataProps} />
|
||||
) : null}
|
||||
|
||||
<PageMetaData path={props.section} title={props.title} />
|
||||
<Header
|
||||
menuOpen={props.showNavigationMenu}
|
||||
toggleMenu={() => {
|
||||
|
||||
@ -127,9 +127,28 @@ export default function Home(): JSX.Element {
|
||||
}
|
||||
}
|
||||
|
||||
const sectionTitle = (section: NavigationSection | undefined) => {
|
||||
switch (section) {
|
||||
case 'home':
|
||||
return 'Home'
|
||||
case 'library':
|
||||
return 'Library'
|
||||
case 'subscriptions':
|
||||
return 'Subscriptions'
|
||||
case 'highlights':
|
||||
return 'Highlights'
|
||||
case 'archive':
|
||||
return 'Archive'
|
||||
case 'trash':
|
||||
return 'Trash'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
return (
|
||||
<NavigationLayout
|
||||
section={section ?? 'home'}
|
||||
title={sectionTitle(section)}
|
||||
showNavigationMenu={showNavigationMenu}
|
||||
setShowNavigationMenu={setShowNavigationMenu}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user