Browse Source

FEATURE | Search tasks, groups and executors with search string

merge-requests/269/head
Oksana Stepanenko 3 years ago
parent
commit
2bead8f5fc
  1. 2
      src/modules/executors/hooks/use-fetch-executors.hook.ts
  2. 2
      src/modules/groups/hooks/use-fetch-groups-with-tasks-count.hook.ts
  3. 7
      src/modules/home/screens/home.screen.tsx
  4. 17
      src/modules/home/smart-components/my-tasks-list.smart-component.tsx
  5. 1
      src/modules/tasks/hooks/use-fetch-tasks-by-filter.hook.ts

2
src/modules/executors/hooks/use-fetch-executors.hook.ts

@ -16,6 +16,7 @@ export const useFetchPermittedExecutors = ( @@ -16,6 +16,7 @@ export const useFetchPermittedExecutors = (
isLoadingNext,
loadMore,
resetFlatList,
setLoadParams
} = useFlatList<IShortUser>({
fetchItems: params =>
usersService.fetchPermittedExecutors({ ...params }),
@ -35,5 +36,6 @@ export const useFetchPermittedExecutors = ( @@ -35,5 +36,6 @@ export const useFetchPermittedExecutors = (
searchString,
loadMore,
setSearchVal,
setLoadParams
}
}

2
src/modules/groups/hooks/use-fetch-groups-with-tasks-count.hook.ts

@ -14,6 +14,7 @@ export const useFetchGroupsWithTasksCount = ( @@ -14,6 +14,7 @@ export const useFetchGroupsWithTasksCount = (
isLoadingNext,
loadMore,
resetFlatList,
setLoadParams
} = useFlatList<ITaxonomyWithTasksCount>({
fetchItems: params =>
taxonomiesService.fetchGroupsWithTasksCount({
@ -36,5 +37,6 @@ export const useFetchGroupsWithTasksCount = ( @@ -36,5 +37,6 @@ export const useFetchGroupsWithTasksCount = (
searchString,
loadMore,
setSearchVal,
setLoadParams
}
}

7
src/modules/home/screens/home.screen.tsx

@ -63,6 +63,11 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => { @@ -63,6 +63,11 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => {
5,
)
useEffect(() => {
respExecutors.setLoadParams({ searchString: searchValue })
respGroups.setLoadParams({ searchString: searchValue })
}, [searchValue])
useEffect(() => {
setTimeout(() => {
if (needRedirect.to) {
@ -152,7 +157,7 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => { @@ -152,7 +157,7 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => {
</ContentBlock>
<View style={{ paddingHorizontal: 20 }}>
<MyTasksListSmart />
<MyTasksListSmart searchString={searchValue} />
</View>
</ScrollView>
</>

17
src/modules/home/smart-components/my-tasks-list.smart-component.tsx

@ -17,9 +17,11 @@ import { @@ -17,9 +17,11 @@ import {
import { ActionsForSelectedItemsRow } from '@/modules/tasks/components/actions-for-selected-items-row.component'
import { getSelectedTasksMenuOptions } from '@/modules/tasks/config'
interface IProps {}
interface IProps {
searchString?: string
}
export const MyTasksListSmart: FC<IProps> = () => {
export const MyTasksListSmart: FC<IProps> = props => {
const nav = useNav()
const { selectedTasks, handleSelectTask, handleResetSelected } =
@ -27,10 +29,19 @@ export const MyTasksListSmart: FC<IProps> = () => { @@ -27,10 +29,19 @@ export const MyTasksListSmart: FC<IProps> = () => {
const { styles } = useTheme(createStyles)
const { items: myTasks, isLoading } = useFetchTasksByFilter({
const {
items: myTasks,
isLoading,
setLoadParams,
} = useFetchTasksByFilter({
limit: 5,
})
useEffect(
() => setLoadParams({ searchString: props.searchString }),
[props.searchString],
)
const {
handlePressSelectedTasksAction,
handlePressOneTaskAction,

1
src/modules/tasks/hooks/use-fetch-tasks-by-filter.hook.ts

@ -96,5 +96,6 @@ export const useFetchTasksByFilter = ({ @@ -96,5 +96,6 @@ export const useFetchTasksByFilter = ({
loadMore,
reloadTasks,
taskFilterProps,
setLoadParams
}
}

Loading…
Cancel
Save