Use a default inbox for the home view for now, combining the two library and subscription queries

This commit is contained in:
Jackson Harper
2024-08-07 14:55:19 +08:00
parent 3f73a969f4
commit 15f201fcfc
5 changed files with 23 additions and 14 deletions

View File

@ -20,7 +20,7 @@ import { MoveToInboxIcon } from '../../elements/icons/MoveToInboxIcon'
export type MultiSelectProps = {
viewer: UserBasicData | undefined
folder: string
folder: string | undefined
searchTerm: string | undefined
applySearchQuery: (searchQuery: string) => void

View File

@ -80,7 +80,7 @@ const debouncedFetchSearchResults = debounce((query, cb) => {
const TIMEOUT_DELAYS = [2000, 3500, 5000]
type LibraryContainerProps = {
folder: string
folder: string | undefined
filterFunc: (item: LibraryItemNode) => boolean
showNavigationMenu: boolean
@ -101,13 +101,11 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
const gridContainerRef = useRef<HTMLDivElement>(null)
const [labelsTarget, setLabelsTarget] = useState<LibraryItem | undefined>(
undefined
)
const [labelsTarget, setLabelsTarget] =
useState<LibraryItem | undefined>(undefined)
const [notebookTarget, setNotebookTarget] = useState<LibraryItem | undefined>(
undefined
)
const [notebookTarget, setNotebookTarget] =
useState<LibraryItem | undefined>(undefined)
const [showAddLinkModal, setShowAddLinkModal] = useState(false)
const [showEditTitleModal, setShowEditTitleModal] = useState(false)
@ -928,7 +926,7 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
}
export type HomeFeedContentProps = {
folder: string
folder: string | undefined
items: LibraryItem[]
searchTerm?: string
gridContainerRef: React.RefObject<HTMLDivElement>
@ -1067,7 +1065,7 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element {
}
type LibraryItemsLayoutProps = {
folder: string
folder: string | undefined
layout: LayoutType
viewer?: UserBasicData
@ -1305,7 +1303,7 @@ export function LibraryItemsLayout(
}
type LibraryItemsProps = {
folder: string
folder: string | undefined
items: LibraryItem[]
layout: LayoutType
viewer: UserBasicData | undefined

View File

@ -26,7 +26,7 @@ export type LibraryHeaderProps = {
layout: LayoutType
updateLayout: (layout: LayoutType) => void
folder: string
folder: string | undefined
searchTerm: string | undefined
applySearchQuery: (searchQuery: string) => void

View File

@ -170,6 +170,7 @@ export function useGetLibraryItems(
{ limit, searchQuery }: LibraryItemsQueryInput,
enabled = true
) {
console.log('folder: ', folder)
const fullQuery = folder
? (`in:${folder} use:folders ` + (searchQuery ?? '')).trim()
: searchQuery ?? ''

View File

@ -9,7 +9,6 @@ import { LibraryContainer } from '../../components/templates/library/LibraryCont
import { useMemo } from 'react'
import { HighlightsContainer } from '../../components/nav-containers/HighlightsContainer'
import { usePersistedState } from '../../lib/hooks/usePersistedState'
import { isTouchScreenDevice } from '../../lib/deviceType'
import { State } from '../../lib/networking/fragments/articleFragment'
export default function Home(): JSX.Element {
@ -43,7 +42,18 @@ export default function Home(): JSX.Element {
}
switch (name) {
case 'home':
return <HomeContainer />
// return <HomeContainer />
return (
<LibraryContainer
folder={undefined}
filterFunc={(item) => {
return (
item.state !== State.ARCHIVED && item.state !== State.DELETED
)
}}
showNavigationMenu={showNavigationMenu}
/>
)
case 'highlights':
return <HighlightsContainer />
case 'library':