Add move operation to home, fix query inputs
This commit is contained in:
@ -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) => {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -51,6 +51,7 @@ export function useGetHiddenHomeSection(): HiddenHomeSectionResponse {
|
||||
type
|
||||
}
|
||||
canSave
|
||||
canMove
|
||||
canComment
|
||||
canShare
|
||||
canArchive
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user