Use a separate section for search so we can better control the folder
This commit is contained in:
@ -131,7 +131,7 @@ const userDefaultShortcuts = async (userId: string): Promise<Shortcut[]> => {
|
|||||||
id: label.id,
|
id: label.id,
|
||||||
type: 'label',
|
type: 'label',
|
||||||
name: label.name,
|
name: label.name,
|
||||||
section: 'library',
|
section: 'search',
|
||||||
label: label,
|
label: label,
|
||||||
filter: `in:all label:"${label.name}"`,
|
filter: `in:all label:"${label.name}"`,
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ const userDefaultShortcuts = async (userId: string): Promise<Shortcut[]> => {
|
|||||||
id: search.id,
|
id: search.id,
|
||||||
type: 'search',
|
type: 'search',
|
||||||
name: search.name,
|
name: search.name,
|
||||||
section: 'library',
|
section: 'seach',
|
||||||
filter: search.filter,
|
filter: search.filter,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -69,6 +69,10 @@ const moduleExports = {
|
|||||||
source: '/subscriptions',
|
source: '/subscriptions',
|
||||||
destination: '/l/subscriptions',
|
destination: '/l/subscriptions',
|
||||||
})
|
})
|
||||||
|
rewrites.push({
|
||||||
|
source: '/search',
|
||||||
|
destination: '/l/search',
|
||||||
|
})
|
||||||
rewrites.push({
|
rewrites.push({
|
||||||
source: '/archive',
|
source: '/archive',
|
||||||
destination: '/l/archive',
|
destination: '/l/archive',
|
||||||
|
|||||||
@ -84,6 +84,17 @@ export default function Home(): JSX.Element {
|
|||||||
showNavigationMenu={showNavigationMenu}
|
showNavigationMenu={showNavigationMenu}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
case 'search':
|
||||||
|
return (
|
||||||
|
<LibraryContainer
|
||||||
|
folder={undefined}
|
||||||
|
filterFunc={(item) => {
|
||||||
|
console.log('item: ', item)
|
||||||
|
return true
|
||||||
|
}}
|
||||||
|
showNavigationMenu={showNavigationMenu}
|
||||||
|
/>
|
||||||
|
)
|
||||||
case 'archive':
|
case 'archive':
|
||||||
return (
|
return (
|
||||||
<LibraryContainer
|
<LibraryContainer
|
||||||
|
|||||||
@ -40,6 +40,7 @@ import { useGetLabels } from '../../lib/networking/labels/useLabels'
|
|||||||
import { useGetSavedSearches } from '../../lib/networking/savedsearches/useSavedSearches'
|
import { useGetSavedSearches } from '../../lib/networking/savedsearches/useSavedSearches'
|
||||||
import {
|
import {
|
||||||
Shortcut,
|
Shortcut,
|
||||||
|
ShortcutType,
|
||||||
useGetShortcuts,
|
useGetShortcuts,
|
||||||
useResetShortcuts,
|
useResetShortcuts,
|
||||||
useSetShortcuts,
|
useSetShortcuts,
|
||||||
@ -220,25 +221,22 @@ const SavedSearches = (props: ListProps) => {
|
|||||||
<SwitchBox
|
<SwitchBox
|
||||||
checked={isChecked(search.id)}
|
checked={isChecked(search.id)}
|
||||||
setChecked={(checked) => {
|
setChecked={(checked) => {
|
||||||
|
const item = {
|
||||||
|
id: search.id,
|
||||||
|
type: 'search' as ShortcutType,
|
||||||
|
name: search.name,
|
||||||
|
section: 'search',
|
||||||
|
filter: search.filter,
|
||||||
|
}
|
||||||
if (checked) {
|
if (checked) {
|
||||||
props.dispatchList({
|
props.dispatchList({
|
||||||
type: 'ADD_ITEM',
|
type: 'ADD_ITEM',
|
||||||
item: {
|
item,
|
||||||
id: search.id,
|
|
||||||
type: 'search',
|
|
||||||
name: search.name,
|
|
||||||
section: 'library',
|
|
||||||
filter: search.filter,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
props.dispatchList({
|
props.dispatchList({
|
||||||
type: 'REMOVE_ITEM',
|
type: 'REMOVE_ITEM',
|
||||||
item: {
|
item,
|
||||||
type: 'search',
|
|
||||||
section: 'library',
|
|
||||||
...search,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@ -383,9 +381,9 @@ const Labels = (props: ListProps) => {
|
|||||||
id: label.id,
|
id: label.id,
|
||||||
type: 'label',
|
type: 'label',
|
||||||
label: label,
|
label: label,
|
||||||
section: 'library',
|
section: 'search',
|
||||||
name: label.name,
|
name: label.name,
|
||||||
filter: `label:\"${escapeQuotes(label.name)}\"`,
|
filter: `in:all label:\"${escapeQuotes(label.name)}\"`,
|
||||||
}
|
}
|
||||||
if (checked) {
|
if (checked) {
|
||||||
props.dispatchList({
|
props.dispatchList({
|
||||||
|
|||||||
Reference in New Issue
Block a user