diff --git a/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts b/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts
index 04802178..480612f2 100644
--- a/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts
+++ b/packages/ui-app/app/_features/ProjectView/useProjectViewAdd.ts
@@ -24,6 +24,7 @@ export const useProjectViewAdd = () => {
date: data.date,
priority: data.priority,
point: data.point,
+ statusIds: data.statusIds,
groupBy: data.groupBy
} : null
diff --git a/packages/ui-app/app/_features/ProjectView/useProjectViewList.ts b/packages/ui-app/app/_features/ProjectView/useProjectViewList.ts
index b3a6fc90..0926c10b 100644
--- a/packages/ui-app/app/_features/ProjectView/useProjectViewList.ts
+++ b/packages/ui-app/app/_features/ProjectView/useProjectViewList.ts
@@ -52,7 +52,6 @@ export const useProjectViewList = () => {
if (val) {
const views = val as ProjectView[]
-
views.forEach(v => projectViewMap.set(v.id, v.type))
addAllView(views)
}
diff --git a/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts b/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts
new file mode 100644
index 00000000..4b1b4f6f
--- /dev/null
+++ b/packages/ui-app/app/_features/ProjectView/useSetViewFilter.ts
@@ -0,0 +1,46 @@
+import { useDebounce } from "@/hooks/useDebounce"
+import { useSearchParams } from "next/navigation"
+import { useProjectViewList } from "./useProjectViewList"
+import { useTaskFilter } from "../TaskFilter/context"
+import { IBoardFilter } from "./context"
+
+export default function useSetViewFilter() {
+ const searchParams = useSearchParams()
+ const { views } = useProjectViewList()
+ const { setFilter, setDefaultFilter } = useTaskFilter()
+ const mode = searchParams.get('mode')
+
+ // update task filter once user change to another view
+ useDebounce(() => {
+ const viewId = mode
+ const view = views.find(v => v.id === viewId)
+
+ if (
+ view &&
+ view.data &&
+ !Object.keys(view.data as { [key: string]: unknown }).length
+ ) {
+ setDefaultFilter()
+ }
+
+ if (
+ view &&
+ view.data &&
+ Object.keys(view.data as { [key: string]: unknown }).length
+ ) {
+ const data = view.data as unknown as IBoardFilter
+ console.log('set view data fileter', data)
+
+ setFilter(filter => ({
+ ...filter,
+ ...{
+ date: data.date,
+ groupBy: data.groupBy,
+ priority: data.priority,
+ statusIds: data.statusIds,
+ point: data.point
+ }
+ }))
+ }
+ }, [mode, views.toString()])
+}
diff --git a/packages/ui-app/app/_features/ProjectViewFilter/CalendarFilter.tsx b/packages/ui-app/app/_features/ProjectViewFilter/CalendarFilter.tsx
index 37f1aa78..5c792c95 100644
--- a/packages/ui-app/app/_features/ProjectViewFilter/CalendarFilter.tsx
+++ b/packages/ui-app/app/_features/ProjectViewFilter/CalendarFilter.tsx
@@ -15,7 +15,7 @@ export default function ProjectViewFilterByCalendar({ type, desc, onAdd }: {
Calendar
{desc}
-
+
@@ -59,6 +61,12 @@ export default function FilterForm() {
setFilterValue('priority', val)
}}
/>
+ {type === ProjectViewType.CALENDAR ?
+ {
+ setFilterValue('statusIds', val)
+
+ }} />
+ : null}
diff --git a/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx b/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx
index 5967852c..17a87d3f 100644
--- a/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx
+++ b/packages/ui-app/app/_features/TaskFilter/CalendarModeFilter.tsx
@@ -51,19 +51,19 @@ const CalendarFilter = () => {
{ id: ICalendarView.MONTH, title: 'Month view' },
]} />
-
{
- setFilterValue('status', val)
- }}
- width={150}
- options={[
- { id: 'TODO', title: 'Not Implemented' },
- { id: 'INPROCESS', title: 'In Process' },
- { id: 'DONE', title: 'Completed Tasks' },
- { id: 'ALL', title: 'All Task' },
- ]} />
+ {/* { */}
+ {/* setFilterValue('status', val) */}
+ {/* }} */}
+ {/* width={150} */}
+ {/* options={[ */}
+ {/* { id: 'TODO', title: 'Not Implemented' }, */}
+ {/* { id: 'INPROCESS', title: 'In Process' }, */}
+ {/* { id: 'DONE', title: 'Completed Tasks' }, */}
+ {/* { id: 'ALL', title: 'All Task' }, */}
+ {/* ]} /> */}
diff --git a/packages/ui-app/app/_features/TaskFilter/context.tsx b/packages/ui-app/app/_features/TaskFilter/context.tsx
index 82e7d8ed..9f9dd26f 100644
--- a/packages/ui-app/app/_features/TaskFilter/context.tsx
+++ b/packages/ui-app/app/_features/TaskFilter/context.tsx
@@ -35,6 +35,7 @@ interface ITaskFilterFields {
point: string
priority: TaskPriority | 'ALL'
assigneeIds: string[]
+ statusIds: string[]
status: 'TODO' | 'INPROCESS' | 'DONE' | 'ALL'
}
@@ -74,6 +75,7 @@ const TaskFilterContext = createContext
({
point: 'INFINITE',
priority: 'ALL',
assigneeIds: [],
+ statusIds: ['ALL'],
status: 'ALL'
},
setFilter: () => {
@@ -94,6 +96,7 @@ const defaultFilter: ITaskFilterFields = {
point: '-1',
priority: 'ALL',
assigneeIds: ['ALL'],
+ statusIds: ['ALL'],
status: 'ALL'
}
diff --git a/packages/ui-app/app/_features/TaskFilter/index.tsx b/packages/ui-app/app/_features/TaskFilter/index.tsx
index 99a69638..755d312b 100644
--- a/packages/ui-app/app/_features/TaskFilter/index.tsx
+++ b/packages/ui-app/app/_features/TaskFilter/index.tsx
@@ -12,6 +12,8 @@ import { ETaskFilterGroupByType, useTaskFilter } from './context'
import './style.css'
import { useProjectViewList } from '../ProjectView/useProjectViewList'
import { ProjectViewType } from '@prisma/client'
+import StatusSelect from '@/components/StatusSelect'
+import StatusSelectMultiple from '@/components/StatusSelectMultiple'
let timeout = 0
interface ITaskFilterProps {
@@ -37,7 +39,8 @@ export default function TaskFilter({
endDate,
point,
priority,
- assigneeIds
+ assigneeIds,
+ statusIds
} = filter
const isDateRange = date === 'date-range'
@@ -143,6 +146,10 @@ export default function TaskFilter({
/>
) : null}
+ {isCalendarMode ? {
+ setFilterValue('statusIds', val)
+ }} /> : null}
+
{
+ console.log('task get by cond', query)
return httpGet(`/api/project/task/query`, {
params: query,
signal: signal