-
+
diff --git a/apps/web/lib/features/task/task-filters.tsx b/apps/web/lib/features/task/task-filters.tsx
index f098f23fc..5027dd22c 100644
--- a/apps/web/lib/features/task/task-filters.tsx
+++ b/apps/web/lib/features/task/task-filters.tsx
@@ -187,9 +187,9 @@ export function useTaskFilter(profile: I_UserProfilePage) {
.every((k) => {
return k === 'label'
? intersection(
- statusFilters[k],
- task['tags'].map((item) => item.name)
- ).length === statusFilters[k].length
+ statusFilters[k],
+ task['tags'].map((item) => item.name)
+ ).length === statusFilters[k].length
: statusFilters[k].includes(task[k]);
});
});
@@ -247,9 +247,9 @@ export function TaskFilter({ className, hook, profile }: IClassName & Props) {
leaveFrom="transform scale-100 opacity-100"
leaveTo="transform scale-95 opacity-0 ease-out"
className="w-full"
- ref={hook.outclickFilterCard.targetEl}
+ ref={hook.tab !== 'dailyplan' ? hook.outclickFilterCard.targetEl : null}
>
- {/* {hook.filterType !== undefined &&
} */}
+ {hook.filterType !== undefined &&
}
{hook.filterType === 'status' && (
)}
@@ -372,7 +372,7 @@ function InputFilters({ hook, profile }: Props) {
}
}, [tasks, members]);
-
+
const osSpecificAssignTaskTooltipLabel = 'A';
return (
@@ -634,11 +634,11 @@ export function TaskStatusFilter({ hook, employeeId }: { hook: I_TaskFilter; emp
const [key, setKey] = useState(0);
const t = useTranslations();
const [dailyPlanTab, setDailyPlanTab] = useState(window.localStorage.getItem('daily-plan-tab') || 'Future Tasks');
- const { date, setDate } = useDateRange(dailyPlanTab);
+ const { date, setDate, data } = useDateRange(dailyPlanTab);
useEffect(() => {
setDailyPlanTab(window.localStorage.getItem('daily-plan-tab') || 'Future Tasks');
- }, [dailyPlanTab]);
+ }, [dailyPlanTab, date]);
return (
@@ -672,7 +672,7 @@ export function TaskStatusFilter({ hook, employeeId }: { hook: I_TaskFilter; emp
{hook.tab === 'dailyplan' &&
}
{['Future Tasks', 'Past Tasks', 'All Tasks'].includes(dailyPlanTab) && (
-
setDate(range)} label="Planned date" />
+ setDate(range)} label="Planned date" />
)}
diff --git a/apps/web/lib/features/task/task-status.tsx b/apps/web/lib/features/task/task-status.tsx
index df23da5ab..72d78f1f1 100644
--- a/apps/web/lib/features/task/task-status.tsx
+++ b/apps/web/lib/features/task/task-status.tsx
@@ -775,18 +775,18 @@ export function TaskStatus({
isEpic
}: PropsWithChildren<
TStatusItem &
- IClassName & {
- active?: boolean;
- issueType?: 'status' | 'issue';
- showIssueLabels?: boolean;
- forDetails?: boolean;
- titleClassName?: string;
- cheched?: boolean;
- sidebarUI?: boolean;
- value?: string;
- isVersion?: boolean;
- isEpic?: boolean;
- }
+ IClassName & {
+ active?: boolean;
+ issueType?: 'status' | 'issue';
+ showIssueLabels?: boolean;
+ forDetails?: boolean;
+ titleClassName?: string;
+ cheched?: boolean;
+ sidebarUI?: boolean;
+ value?: string;
+ isVersion?: boolean;
+ isEpic?: boolean;
+ }
>) {
const { theme } = useTheme();
const readableColorHex = readableColor(backgroundColor || (theme === 'light' ? '#FFF' : '#000'));
@@ -839,8 +839,8 @@ export function TaskStatus({
style={
isVersion || isEpic
? {
- color: theme === 'light' ? '#000' : '#FFF'
- }
+ color: theme === 'light' ? '#000' : '#FFF'
+ }
: {}
}
>
@@ -996,7 +996,7 @@ export function StatusDropdown({
sidebarUI && ['text-xs'],
'text-dark dark:text-white bg-[#F2F2F2] dark:bg-dark--theme-light',
forDetails &&
- 'bg-transparent border dark:border-[#FFFFFF33] dark:bg-[#1B1D22]',
+ 'bg-transparent border dark:border-[#FFFFFF33] dark:bg-[#1B1D22]',
taskStatusClassName
)}
name={
diff --git a/apps/web/lib/features/user-profile-plans.tsx b/apps/web/lib/features/user-profile-plans.tsx
index 6f1c70bf2..0e6faa0f6 100644
--- a/apps/web/lib/features/user-profile-plans.tsx
+++ b/apps/web/lib/features/user-profile-plans.tsx
@@ -1,11 +1,12 @@
'use client';
import { useEffect, useState } from 'react';
-import { useRecoilValue } from 'recoil';
+import { useRecoilState, useRecoilValue } from 'recoil';
import { useCanSeeActivityScreen, useDailyPlan, useUserProfilePage } from '@app/hooks';
import { TaskCard } from './task/task-card';
import { IDailyPlan } from '@app/interfaces';
import { AlertPopup, Container, HorizontalSeparator, NoData, ProgressBar, VerticalSeparator } from 'lib/components';
import { clsxm } from '@app/utils';
+import { dataDailyPlanState } from '@app/stores';
import { fullWidthState } from '@app/stores/fullWidth';
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@components/ui/accordion';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@components/ui/select';
@@ -19,9 +20,10 @@ import { IoCalendarOutline } from 'react-icons/io5';
import ViewsHeaderTabs from './task/daily-plan/views-header-tabs';
import { dailyPlanViewHeaderTabs } from '@app/stores/header-tabs';
import TaskBlockCard from './task/task-block-card';
-import { useFilterDateRange } from '@app/hooks/useFilterDateRange';
+import { filterDailyPlan } from '@app/hooks/useFilterDateRange';
import { handleDragAndDrop } from '@app/helpers/drag-and-drop';
import { DragDropContext, Droppable, Draggable, DroppableProvided, DroppableStateSnapshot } from 'react-beautiful-dnd';
+import { useDateRange } from '@app/hooks/useDateRange';
export type FilterTabs = 'Today Tasks' | 'Future Tasks' | 'Past Tasks' | 'All Tasks' | 'Outstanding';
type FilterOutstanding = 'ALL' | 'DATE';
@@ -43,9 +45,11 @@ export function UserProfilePlans() {
const [currentTab, setCurrentTab] = useState(defaultTab || 'Today Tasks');
const [currentOutstanding, setCurrentOutstanding] = useState(defaultOutstanding || 'ALL');
- const { filteredFuturePlanData: filterFuturePlanData } = useFilterDateRange(futurePlans, 'future');
- const { filteredPastPlanData: filterPastPlanData } = useFilterDateRange(pastPlans, 'past');
- const { filteredAllPlanData: filterAllPlanData } = useFilterDateRange(sortedPlans, 'all');
+
+ const [currentDataDailyPlan, setCurrentDataDailyPlan] = useRecoilState(dataDailyPlanState)
+ const { setDate, date } = useDateRange(currentTab);
+
+
const screenOutstanding = {
ALL: ,
@@ -58,10 +62,27 @@ export function UserProfilePlans() {
'All Tasks': ,
Outstanding:
};
+ const [filterFuturePlanData, setFilterFuturePlanData] = useState(futurePlans);
+ const [filterPastPlanData, setFilteredPastPlanData] = useState(pastPlans);
+ const [filterAllPlanData, setFilterAllPlanData] = useState(sortedPlans);
+
useEffect(() => {
window.localStorage.setItem('daily-plan-tab', currentTab);
- }, [currentTab]);
+ if (!currentDataDailyPlan) return;
+ if (currentTab === 'All Tasks') {
+ setCurrentDataDailyPlan(sortedPlans)
+ setFilterAllPlanData(filterDailyPlan(date as any, sortedPlans))
+ } else if (currentTab === 'Past Tasks') {
+ setCurrentDataDailyPlan(pastPlans)
+ setFilteredPastPlanData(filterDailyPlan(date as any, pastPlans))
+ } else if (currentTab === 'Future Tasks') {
+ setCurrentDataDailyPlan(futurePlans)
+ setFilterFuturePlanData(filterDailyPlan(date as any, futurePlans))
+ }
+
+ }, [currentTab, setCurrentDataDailyPlan, setDate, date]);
+
useEffect(() => {
window.localStorage.setItem('outstanding', currentOutstanding);
@@ -83,7 +104,10 @@ export function UserProfilePlans() {
'text-gray-500 flex gap-2 items-center',
currentTab == filter && 'text-blue-600 dark:text-white font-medium'
)}
- onClick={() => setCurrentTab(filter as FilterTabs)}
+ onClick={() => {
+ setDate(undefined)
+ setCurrentTab(filter as FilterTabs)
+ }}
>
{filter}
@@ -149,16 +174,20 @@ function AllPlans({ profile, currentTab = 'All Tasks' }: { profile: any; current
const { deleteDailyPlan, deleteDailyPlanLoading, sortedPlans, todayPlan } = useDailyPlan();
const [popupOpen, setPopupOpen] = useState(false);
const [currentDeleteIndex, setCurrentDeleteIndex] = useState(0);
+ const { setDate, date } = useDateRange(currentTab);
filteredPlans = sortedPlans;
if (currentTab === 'Today Tasks') filteredPlans = todayPlan;
const canSeeActivity = useCanSeeActivityScreen();
- const { filteredAllPlanData: filterAllPlanData } = useFilterDateRange(filteredPlans, 'all');
- const filterPlans: IDailyPlan[] = currentTab === 'All Tasks' ? filterAllPlanData : filteredPlans;
+ // const { filteredAllPlanData: filterAllPlanData } = useFilterDateRange(filteredPlans, 'all');
+ // const filterPlans: IDailyPlan[] = currentTab === 'All Tasks' ? : filteredPlans;
const view = useRecoilValue(dailyPlanViewHeaderTabs);
- const [plans, setPlans] = useState
(filterPlans);
+ const [plans, setPlans] = useState(filteredPlans);
+ useEffect(() => {
+ setPlans(filterDailyPlan(date as any, filteredPlans))
+ }, [date, setDate])
return (
{Array.isArray(plans) && plans?.length > 0 ? (
diff --git a/apps/web/lib/layout/main-layout.tsx b/apps/web/lib/layout/main-layout.tsx
index 6f5ec8c2f..26aba60d5 100644
--- a/apps/web/lib/layout/main-layout.tsx
+++ b/apps/web/lib/layout/main-layout.tsx
@@ -30,7 +30,7 @@ export function MainLayout({
}: Props) {
const fullWidth = useRecoilValue(fullWidthState);
return (
-