Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+9
-83
@@ -2,9 +2,12 @@
|
||||
// options + optional entity pre-fill (when opened as the "new task" CTA from an
|
||||
// entity detail view). Action creates the task, audits, logs activity, redirects
|
||||
// to the detail. Missing tasks.write -> 404.
|
||||
//
|
||||
// Interim-UI (AD-28): renders the ~/ui preview screen TaskNewPage; the form posts to
|
||||
// this route action. Final Subframe optics land as a tracked design-nachzug once
|
||||
// David's D-P4 delta ships.
|
||||
|
||||
import { type ActionFunctionArgs, type LoaderFunctionArgs, redirect, useLoaderData } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { badRequestResponse, loadTasksContext, notFoundResponse, requireTasksPermission } from "~/utils/integrations/taskAccess.server";
|
||||
import {
|
||||
@@ -17,6 +20,7 @@ import {
|
||||
} from "~/utils/integrations/taskService.server";
|
||||
import { auditTaskEvent, logTaskActivity } from "~/utils/integrations/taskAudit.server";
|
||||
import { tasksDetailPath, tasksListPath } from "~/utils/integrations/taskRoutePaths";
|
||||
import { TaskNewPage, TASK_CREATOR_ASSIGNEE } from "~/components/screens/tasks/TaskNewPage";
|
||||
import ServerError from "~/components/ui/errors/ServerError";
|
||||
|
||||
const TASK_PRIORITIES: TaskPriority[] = ["low", "normal", "high", "urgent"];
|
||||
@@ -73,7 +77,9 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
|
||||
const priority = (TASK_PRIORITIES.includes(priorityRaw as TaskPriority) ? priorityRaw : "normal") as TaskPriority;
|
||||
const deadlineRaw = String(formData.get("deadline") ?? "").trim();
|
||||
const assigneeType = String(formData.get("assigneeType") ?? "");
|
||||
const assigneeId = String(formData.get("assigneeId") ?? "").trim();
|
||||
const rawAssigneeId = String(formData.get("assigneeId") ?? "").trim();
|
||||
// The creator-default sentinel maps back to "no explicit assignee".
|
||||
const assigneeId = rawAssigneeId === TASK_CREATOR_ASSIGNEE ? "" : rawAssigneeId;
|
||||
const entityTypeRaw = String(formData.get("entityType") ?? "").trim();
|
||||
const entityId = String(formData.get("entityId") ?? "").trim();
|
||||
const linkedEntityType = entityTypeRaw && TASK_ENTITY_TYPES.includes(entityTypeRaw as TaskEntityType) ? (entityTypeRaw as TaskEntityType) : null;
|
||||
@@ -108,88 +114,8 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
|
||||
};
|
||||
|
||||
export default function TaskCreateRoute() {
|
||||
const { t } = useTranslation();
|
||||
const { assignableUsers, assignableGroups, prefill, cancelHref } = useLoaderData<LoaderData>();
|
||||
|
||||
return (
|
||||
<main className="mx-auto max-w-2xl px-4 py-10" data-ui-id="ui.tasks.new">
|
||||
<h1 className="text-foreground text-xl font-semibold">{t("tasks.new.title")}</h1>
|
||||
<form method="post" className="mt-6 grid gap-3">
|
||||
<label className="text-sm">
|
||||
<span className="text-muted-foreground block text-xs">{t("tasks.detail.field.title")}</span>
|
||||
<input name="title" required className="border-muted-foreground/40 w-full rounded border px-2 py-1" data-ui-id="ui.tasks.new.title" />
|
||||
</label>
|
||||
<label className="text-sm">
|
||||
<span className="text-muted-foreground block text-xs">{t("tasks.detail.field.description")}</span>
|
||||
<textarea name="description" className="border-muted-foreground/40 w-full rounded border px-2 py-1" />
|
||||
</label>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<label className="text-sm">
|
||||
<span className="text-muted-foreground block text-xs">{t("tasks.detail.field.priority")}</span>
|
||||
<select name="priority" defaultValue="normal" className="border-muted-foreground/40 rounded border px-2 py-1">
|
||||
{TASK_PRIORITIES.map((priority) => (
|
||||
<option key={priority} value={priority}>
|
||||
{t(`tasks.priority.${priority}`)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-sm">
|
||||
<span className="text-muted-foreground block text-xs">{t("tasks.detail.field.deadline")}</span>
|
||||
<input type="date" name="deadline" className="border-muted-foreground/40 rounded border px-2 py-1" />
|
||||
</label>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-end gap-2">
|
||||
<label className="text-sm">
|
||||
<span className="text-muted-foreground block text-xs">{t("tasks.detail.field.assigneeType")}</span>
|
||||
<select name="assigneeType" defaultValue="user" className="border-muted-foreground/40 rounded border px-2 py-1">
|
||||
<option value="user">{t("tasks.detail.assignee.user")}</option>
|
||||
<option value="group">{t("tasks.detail.assignee.group")}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-sm">
|
||||
<span className="text-muted-foreground block text-xs">{t("tasks.detail.field.assignee")}</span>
|
||||
<select name="assigneeId" className="border-muted-foreground/40 rounded border px-2 py-1">
|
||||
<option value="">{t("tasks.new.assignee.default")}</option>
|
||||
<optgroup label={t("tasks.detail.assignee.user")}>
|
||||
{assignableUsers.map((user) => (
|
||||
<option key={`u-${user.id}`} value={user.id}>
|
||||
{user.label}
|
||||
</option>
|
||||
))}
|
||||
</optgroup>
|
||||
<optgroup label={t("tasks.detail.assignee.group")}>
|
||||
{assignableGroups.map((group) => (
|
||||
<option key={`g-${group.id}`} value={group.id}>
|
||||
{group.label}
|
||||
</option>
|
||||
))}
|
||||
</optgroup>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{prefill ? (
|
||||
<>
|
||||
<input type="hidden" name="entityType" value={prefill.entityType} />
|
||||
<input type="hidden" name="entityId" value={prefill.entityId} />
|
||||
<p className="text-muted-foreground text-xs" data-ui-id="ui.tasks.new.prefill">
|
||||
{t(`tasks.entity.${prefill.entityType}`)} · {prefill.entityId}
|
||||
</p>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
<div className="mt-2 flex gap-3">
|
||||
<button type="submit" className="text-theme-600 font-medium" data-ui-id="ui.tasks.new.submit">
|
||||
{t("tasks.new.actions.create")}
|
||||
</button>
|
||||
<a href={cancelHref} className="text-muted-foreground" data-ui-id="ui.tasks.new.cancel">
|
||||
{t("tasks.new.actions.cancel")}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
);
|
||||
return <TaskNewPage assignableUsers={assignableUsers} assignableGroups={assignableGroups} prefill={prefill} cancelHref={cancelHref} />;
|
||||
}
|
||||
|
||||
export function ErrorBoundary() {
|
||||
|
||||
Reference in new issue
Block a user