diff --git a/src/webui/app/routes/app/workspace/big-plans/$id/inbox-tasks/new.tsx b/src/webui/app/routes/app/workspace/big-plans/$id/inbox-tasks/new.tsx index c921a5f8d..51449e244 100644 --- a/src/webui/app/routes/app/workspace/big-plans/$id/inbox-tasks/new.tsx +++ b/src/webui/app/routes/app/workspace/big-plans/$id/inbox-tasks/new.tsx @@ -61,7 +61,9 @@ const ParamsSchema = z.object({ }); const QuerySchema = z.object({ - timePlanReason: z.literal("for-time-plan").optional(), + timePlanReason: z + .union([z.literal("for-time-plan"), z.literal("for-time-plan-only")]) + .optional(), timePlanRefId: z.string().optional(), parentTimePlanActivityRefId: z.string().optional(), }); @@ -96,7 +98,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) { const timePlanReason = query.timePlanReason || "standard"; let associatedTimePlan = null; - if (timePlanReason === "for-time-plan") { + if ( + timePlanReason === "for-time-plan" || + timePlanReason === "for-time-plan-only" + ) { if (!query.timePlanRefId) { throw new Response("Missing Time Plan Id", { status: 500 }); } @@ -132,9 +137,9 @@ export async function action({ request, params }: ActionFunctionArgs) { big_plan_ref_id: bigPlanId, name: form.name, time_plan_ref_id: - timePlanReason === "standard" - ? undefined - : (query.timePlanRefId as string), + timePlanReason === "for-time-plan" + ? (query.timePlanRefId as string) + : undefined, time_plan_activity_kind: form.timePlanActivityKind, time_plan_activity_feasability: form.timePlanActivityFeasability, is_key: form.isKey, @@ -156,6 +161,11 @@ export async function action({ request, params }: ActionFunctionArgs) { `/app/workspace/time-plans/${query.timePlanRefId}/${query.parentTimePlanActivityRefId}`, ); + case "for-time-plan-only": + return redirect( + `/app/workspace/time-plans/${query.timePlanRefId}`, + ); + case "standard": return redirect( `/app/workspace/big-plans/${bigPlanId}/inbox-tasks/${result.new_inbox_task.ref_id}`, @@ -190,7 +200,12 @@ export default function BigPlanNewInboxTask() { key="big-plan-inbox-tasks/new" isLeaflet fakeKey="big-plan-inbox-tasks/new" - returnLocation={`/app/workspace/big-plans/${bigPlanId}`} + returnLocation={ + loaderData.timePlanReason === "for-time-plan-only" && + loaderData.associatedTimePlan + ? `/app/workspace/time-plans/${loaderData.associatedTimePlan.ref_id}` + : `/app/workspace/big-plans/${bigPlanId}` + } inputsEnabled={inputsEnabled} > @@ -267,7 +282,8 @@ export default function BigPlanNewInboxTask() { label="actionableDate" inputsEnabled={inputsEnabled} defaultValue={ - loaderData.timePlanReason === "for-time-plan" + loaderData.timePlanReason === "for-time-plan" || + loaderData.timePlanReason === "for-time-plan-only" ? (loaderData.associatedTimePlan as TimePlan).start_date : (loaderData.bigPlan.actionable_date ?? undefined) } @@ -290,7 +306,8 @@ export default function BigPlanNewInboxTask() { label="dueDate" inputsEnabled={inputsEnabled} defaultValue={ - loaderData.timePlanReason === "for-time-plan" + loaderData.timePlanReason === "for-time-plan" || + loaderData.timePlanReason === "for-time-plan-only" ? (loaderData.associatedTimePlan as TimePlan).end_date : (loaderData.bigPlan.due_date ?? undefined) } diff --git a/src/webui/app/routes/app/workspace/time-plans/$id/$activityId.tsx b/src/webui/app/routes/app/workspace/time-plans/$id/$activityId.tsx index 3a5448181..c24131845 100644 --- a/src/webui/app/routes/app/workspace/time-plans/$id/$activityId.tsx +++ b/src/webui/app/routes/app/workspace/time-plans/$id/$activityId.tsx @@ -797,6 +797,10 @@ export default function TimePlanActivity() { link: `/app/workspace/big-plans/${loaderData.targetBigPlan.ref_id}/inbox-tasks/new?timePlanReason=for-time-plan&timePlanRefId=${id}&parentTimePlanActivityRefId=${activityId}`, highlight: true, }), + NavSingle({ + text: "New Inbox Task (From Time Plan, Big Plan Only)", + link: `/app/workspace/big-plans/${loaderData.targetBigPlan.ref_id}/inbox-tasks/new?timePlanReason=for-time-plan-only&timePlanRefId=${id}`, + }), NavSingle({ text: "From Current Inbox Tasks", link: `/app/workspace/time-plans/${id}/add-from-current-inbox-tasks?bigPlanReason=for-big-plan&bigPlanRefId=${loaderData.targetBigPlan.ref_id}&timePlanActivityRefId=${activityId}`,