From 47212e412448ba02c62c56666815c020e69ac606 Mon Sep 17 00:00:00 2001 From: "Thierry CH." Date: Thu, 14 Nov 2024 23:35:52 +0200 Subject: [PATCH] change position of 'Delete this plan' button (#3322) --- apps/web/lib/features/user-profile-plans.tsx | 141 ++++++++++--------- 1 file changed, 76 insertions(+), 65 deletions(-) diff --git a/apps/web/lib/features/user-profile-plans.tsx b/apps/web/lib/features/user-profile-plans.tsx index fae576c33..e9c8a5153 100644 --- a/apps/web/lib/features/user-profile-plans.tsx +++ b/apps/web/lib/features/user-profile-plans.tsx @@ -58,7 +58,16 @@ export function UserProfilePlans() { const t = useTranslations(); const profile = useUserProfilePage(); - const { todayPlan, futurePlans, pastPlans, outstandingPlans, sortedPlans, profileDailyPlans } = useDailyPlan(); + const { + todayPlan, + futurePlans, + pastPlans, + outstandingPlans, + sortedPlans, + profileDailyPlans, + deleteDailyPlan, + deleteDailyPlanLoading + } = useDailyPlan(); const fullWidth = useAtomValue(fullWidthState); const [currentOutstanding, setCurrentOutstanding] = useLocalStorageState('outstanding', 'ALL'); const [currentTab, setCurrentTab] = useLocalStorageState('daily-plan-tab', 'Today Tasks'); @@ -85,6 +94,8 @@ export function UserProfilePlans() { const { hasPlan } = useTimer(); const { activeTeam } = useTeamTasks(); const requirePlan = useMemo(() => activeTeam?.requirePlanToTrack, [activeTeam?.requirePlanToTrack]); + const [popupOpen, setPopupOpen] = useState(false); + const canSeeActivity = useCanSeeActivityScreen(); // Set the tab plan tab to outstanding if user has no daily plan and there are outstanding tasks (on first load) useEffect(() => { @@ -132,7 +143,7 @@ export function UserProfilePlans() { {profileDailyPlans?.items?.length > 0 ? (
-
+
{Object.keys(tabsScreens).map((filter, i) => (
{i !== 0 && } @@ -173,6 +184,66 @@ export function UserProfilePlans() { ))}
+ {currentTab === 'Today Tasks' && todayPlan[0] && ( + <> + {canSeeActivity ? ( +
+ { + setPopupOpen((prev) => !prev); + }} + variant="outline" + className="px-4 py-2 text-sm font-medium text-red-600 border border-red-600 rounded-md bg-light--theme-light dark:!bg-dark--theme-light" + > + {t('common.plan.DELETE_THIS_PLAN')} + + } + > + {/*button confirm*/} + + {/*button cancel*/} + + +
+ ) : ( + <> + )} + + )} {currentTab === 'Outstanding' && (