Add move operation to home, fix query inputs

This commit is contained in:
Jackson Harper
2024-06-25 17:14:33 +08:00
parent 0ba46d0de8
commit 8a8b98f266
4 changed files with 22 additions and 1 deletions

View File

@ -644,7 +644,7 @@ const TopPicksItemView = (
</Box>
<SpanBox css={{ px: '20px' }}></SpanBox>
<HStack css={{ gap: '10px', my: '15px', px: '20px' }}>
{props.homeItem.canSave && (
{props.homeItem.canMove && (
<Button
style="homeAction"
onClick={async (event) => {

View File

@ -144,6 +144,24 @@ export function LibraryContainer(props: LibraryContainerProps): JSX.Element {
} else setSearchResults([])
}, [queryValue])
useEffect(() => {
if (!router.isReady) return
const q = router.query['q']
let qs = 'in:inbox' // Default to in:inbox search term.
if (q && typeof q === 'string') {
qs = q
}
if (qs !== (queryInputs.searchQuery || '')) {
setQueryInputs({ ...queryInputs, searchQuery: qs })
performActionOnItem('refresh', undefined as unknown as any)
}
// intentionally not watching queryInputs and performActionOnItem
// here to prevent infinite looping
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [setQueryInputs, router.isReady, router.query])
const hasMore = useMemo(() => {
if (!itemsPages) {
return false

View File

@ -51,6 +51,7 @@ export function useGetHiddenHomeSection(): HiddenHomeSectionResponse {
type
}
canSave
canMove
canComment
canShare
canArchive

View File

@ -35,6 +35,7 @@ export type HomeItem = {
canComment?: boolean
canDelete?: boolean
canSave?: boolean
canMove?: boolean
canShare?: boolean
dir?: string
@ -105,6 +106,7 @@ export function useGetHomeItems(): HomeItemResponse {
type
}
canSave
canMove
canComment
canShare
canArchive