⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(web): move-task popover on task toolbar with readable select labels
Tin7b747eb97b73
diff --git a/apps/api/src/task/controllers/move-task.ts b/apps/api/src/task/controllers/move-task.tsnew file mode 100644index 000000000..fe16d0a27--- /dev/null+++ b/apps/api/src/task/controllers/move-task.ts@@ -0,0 +1,189 @@+import { and, asc, eq, max } from "drizzle-orm";+import { HTTPException } from "hono/http-exception";+import db from "../../database";+import {+ activityTable,+ assetTable,+ columnTable,+ projectTable,+ taskTable,+} from "../../database/schema";+import getNextTaskNumber from "./get-next-task-number";++function isSameProjectMove(+ sourceProjectId: string,+ destinationProjectId: string,+) {+ return sourceProjectId === destinationProjectId;+}++async function resolveDestinationStatus(+ destinationProjectId: string,+ currentStatus: string,+ requestedStatus?: string,+) {+ const destinationColumns = await db+ .select({+ id: columnTable.id,+ slug: columnTable.slug,+ position: columnTable.position,+ })+ .from(columnTable)+ .where(eq(columnTable.projectId, destinationProjectId))+ .orderBy(asc(columnTable.position));++ if (destinationColumns.length === 0) {+ throw new HTTPException(400, {+ message: "Destination project does not have a workflow",+ });+ }++ const requestedColumn = requestedStatus+ ? destinationColumns.find((column) => column.slug === requestedStatus)+ : null;++ if (requestedStatus && !requestedColumn) {+ throw new HTTPException(400, {+ message: "Selected status is not valid for the destination project",+ });+ }++ const matchingCurrentColumn = destinationColumns.find(+ (column) => column.slug === currentStatus,+ );++ return requestedColumn ?? matchingCurrentColumn ?? destinationColumns[0];+}++async function getNextTaskPosition(+ projectId: string,+ status: string,+ columnId: string,+) {+ const [maxPositionResult] = await db+ .select({ maxPosition: max(taskTable.position) })+ .from(taskTable)+ .where(+ and(+ eq(taskTable.projectId, projectId),+ eq(taskTable.status, status),+ eq(taskTable.columnId, columnId),+ ),+ );++ return (maxPositionResult?.maxPosition ?? 0) + 1;+}++async function moveTask({+ taskId,+ destinationProjectId,+ destinationStatus,+ userId,+}: {+ taskId: string;+ destinationProjectId: string;+ destinationStatus?: string;+ userId: string;+}) {+ const existingTask = await db.query.taskTable.findFirst({+ where: eq(taskTable.id, taskId),+ });++ if (!existingTask) {+ throw new HTTPException(404, {+ message: "Task not found",+ });+ }++ if (isSameProjectMove(existingTask.projectId, destinationProjectId)) {+ throw new HTTPException(400, {+ message: "Task is already in that project",+ });+ }++ const [sourceProject, destinationProject] = await Promise.all([+ db.query.projectTable.findFirst({+ where: eq(projectTable.id, existingTask.projectId),+ }),+ db.query.projectTable.findFirst({+ where: eq(projectTable.id, destinationProjectId),+ }),+ ]);++ if (!sourceProject || !destinationProject) {+ throw new HTTPException(404, {+ message: "Project not found",+ });+ }++ if (sourceProject.workspaceId !== destinationProject.workspaceId) {+ throw new HTTPException(400, {+ message: "Tasks can only be moved within the same workspace",+ });+ }++ const resolvedColumn = await resolveDestinationStatus(+ destinationProjectId,+ existingTask.status,+ destinationStatus,+ );++ const [nextTaskNumber, nextPosition] = await Promise.all([+ getNextTaskNumber(destinationProjectId),+ getNextTaskPosition(+ destinationProjectId,+ resolvedColumn.slug,+ resolvedColumn.id,+ ),+ ]);++ const movedTask = await db.transaction(async (tx) => {+ const [updatedTask] = await tx+ .update(taskTable)+ .set({+ projectId: destinationProjectId,+ status: resolvedColumn.slug,+ columnId: resolvedColumn.id,+ number: nextTaskNumber + 1,+ position: nextPosition,+ })+ .where(eq(taskTable.id, taskId))+ .returning();++ if (!updatedTask) {+ throw new HTTPException(500, {+ message: "Failed to move task",+ });+ }++ await tx+ .update(assetTable)+ .set({ projectId: destinationProjectId })+ .where(eq(assetTable.taskId, taskId));++ await tx.insert(activityTable).values({+ taskId,+ type: "task",+ userId,+ content: `Moved task from ${sourceProject.name} to ${destinationProject.name}`,+ eventData: {+ fromProjectId: sourceProject.id,+ fromProjectName: sourceProject.name,+ toProjectId: destinationProject.id,+ toProjectName: destinationProject.name,+ oldStatus: existingTask.status,+ newStatus: resolvedColumn.slug,+ },+ });++ return updatedTask;+ });++ return {+ task: movedTask,+ sourceProjectId: sourceProject.id,+ destinationProjectId: destinationProject.id,+ };+}++export default moveTask;diff --git a/apps/api/src/task/index.ts b/apps/api/src/task/index.tsindex adcdaac94..93d22f5bb 100644--- a/apps/api/src/task/index.ts+++ b/apps/api/src/task/index.ts@@ -27,6 +27,7 @@ import exportTasks from "./controllers/export-tasks";import getTask from "./controllers/get-task";import getTasks from "./controllers/get-tasks";import importTasks from "./controllers/import-tasks";+import moveTask from "./controllers/move-task";import updateTask from "./controllers/update-task";import updateTaskAssignee from "./controllers/update-task-assignee";import updateTaskDescription from "./controllers/update-task-description";@@ -237,6 +238,53 @@ const task = new Hono<{return c.json(task);},)+ .put(+ "/move/:id",+ describeRoute({+ operationId: "moveTask",+ tags: ["Tasks"],+ description: "Move a task to another project",+ responses: {+ 200: {+ description: "Task moved successfully",+ content: {+ "application/json": {+ schema: resolver(+ v.object({+ task: taskSchema,+ sourceProjectId: v.string(),+ destinationProjectId: v.string(),+ }),+ ),+ },+ },+ },+ },+ }),+ validator("param", v.object({ id: v.string() })),+ validator(+ "json",+ v.object({+ destinationProjectId: v.string(),+ destinationStatus: v.optional(v.string()),+ }),+ ),+ workspaceAccess.fromTask(),+ async (c) => {+ const { id } = c.req.valid("param");+ const { destinationProjectId, destinationStatus } = c.req.valid("json");+ const userId = c.get("userId");++ const result = await moveTask({+ taskId: id,+ destinationProjectId,+ destinationStatus,+ userId,+ });++ return c.json(result);+ },+ ).put("/:id",describeRoute({diff --git a/apps/web/src/components/task/task-details-sheet.tsx b/apps/web/src/components/task/task-details-sheet.tsxindex aa3e5ce88..7f3f44479 100644--- a/apps/web/src/components/task/task-details-sheet.tsx+++ b/apps/web/src/components/task/task-details-sheet.tsx@@ -115,7 +115,7 @@ export default function TaskDetailsSheet({compact={true}/>- <div className="flex-1 overflow-y-auto">+ <div className="flex-1 overflow-y-auto min-h-0"><div className="px-4 py-4"><TaskDetailsContenttaskId={currentTaskId}diff --git a/apps/web/src/components/task/task-move-popover.tsx b/apps/web/src/components/task/task-move-popover.tsxnew file mode 100644index 000000000..0e3c25357--- /dev/null+++ b/apps/web/src/components/task/task-move-popover.tsx@@ -0,0 +1,222 @@+import { useNavigate } from "@tanstack/react-router";+import { ArrowRightLeft } from "lucide-react";+import { useEffect, useMemo, useState, useTransition } from "react";+import { useTranslation } from "react-i18next";+import { Button } from "@/components/ui/button";+import { Label } from "@/components/ui/label";+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { useMoveTask } from "@/hooks/mutations/task/use-move-task";+import useGetProjects from "@/hooks/queries/project/use-get-projects";+import { useGetTasks } from "@/hooks/queries/task/use-get-tasks";+import { cn } from "@/lib/cn";+import { getStatusLabel } from "@/lib/i18n/domain";+import { toast } from "@/lib/toast";+import type Task from "@/types/task";++type TaskMovePopoverProps = {+ task: Task;+ workspaceId: string;+ triggerClassName?: string;+};++export default function TaskMovePopover({+ task,+ workspaceId,+ triggerClassName,+}: TaskMovePopoverProps) {+ const { t } = useTranslation();+ const navigate = useNavigate();+ const [open, setOpen] = useState(false);+ const [isPending, startTransition] = useTransition();+ const [selectedProjectId, setSelectedProjectId] = useState("");+ const [selectedStatus, setSelectedStatus] = useState("");+ const { data: projects = [] } = useGetProjects({ workspaceId });+ const { mutateAsync: moveTask, isPending: isMovePending } = useMoveTask();+ const destinationProjectId = selectedProjectId || "";+ const { data: destinationProject } = useGetTasks(destinationProjectId);++ const destinationProjects = useMemo(+ () => projects.filter((project) => project.id !== task.projectId),+ [projects, task.projectId],+ );++ const selectedProject = useMemo(+ () => destinationProjects.find((p) => p.id === selectedProjectId),+ [destinationProjects, selectedProjectId],+ );++ const destinationColumns = destinationProject?.columns ?? [];+ const canKeepCurrentStatus = destinationColumns.some(+ (column) => column.id === task.status,+ );+ const fallbackStatus = destinationColumns[0]?.id ?? "";+ const effectiveStatus = canKeepCurrentStatus+ ? task.status+ : selectedStatus || fallbackStatus;++ const selectedStatusLabel = useMemo(() => {+ if (!effectiveStatus || destinationColumns.length === 0) return null;+ const column = destinationColumns.find((c) => c.id === effectiveStatus);+ return getStatusLabel(effectiveStatus) || column?.name || null;+ }, [destinationColumns, effectiveStatus]);++ useEffect(() => {+ if (!open) {+ setSelectedProjectId("");+ setSelectedStatus("");+ }+ }, [open]);++ useEffect(() => {+ if (!selectedProjectId) {+ setSelectedStatus("");+ return;+ }++ if (canKeepCurrentStatus) {+ setSelectedStatus(task.status);+ return;+ }++ setSelectedStatus(fallbackStatus);+ }, [canKeepCurrentStatus, fallbackStatus, selectedProjectId, task.status]);++ const handleMove = async () => {+ if (!selectedProjectId || !effectiveStatus) return;++ try {+ const result = await moveTask({+ taskId: task.id,+ destinationProjectId: selectedProjectId,+ destinationStatus: effectiveStatus,+ });++ toast.success(t("tasks:move.success"));+ setOpen(false);+ startTransition(() => {+ navigate({+ to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",+ params: {+ workspaceId,+ projectId: result.task.projectId,+ taskId: task.id,+ },+ });+ });+ } catch (error) {+ toast.error(+ error instanceof Error ? error.message : t("tasks:move.error"),+ );+ }+ };++ if (destinationProjects.length === 0) {+ return null;+ }++ return (+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild nativeButton={false}>+ <Button+ type="button"+ variant="outline"+ size="sm"+ className={cn("text-foreground", triggerClassName)}+ title={t("tasks:move.title")}+ aria-label={t("tasks:move.title")}+ >+ <ArrowRightLeft className="size-4" />+ </Button>+ </PopoverTrigger>+ <PopoverContent className="w-80 p-3" align="end" sideOffset={4}>+ <div className="flex flex-col gap-3">+ <p className="text-sm font-medium text-foreground">+ {t("tasks:move.title")}+ </p>++ <div className="flex flex-col gap-1.5">+ <Label className="text-xs text-muted-foreground">+ {t("tasks:move.projectLabel")}+ </Label>+ <Select+ value={selectedProjectId || null}+ onValueChange={(value) =>+ setSelectedProjectId(String(value ?? ""))+ }+ >+ <SelectTrigger className="w-full">+ <SelectValue placeholder={t("tasks:move.projectPlaceholder")}>+ {selectedProject?.name}+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {destinationProjects.map((project) => (+ <SelectItem key={project.id} value={project.id}>+ {project.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>++ {selectedProjectId && destinationColumns.length > 0 && (+ <div className="flex flex-col gap-1.5">+ <Label className="text-xs text-muted-foreground">+ {t("tasks:move.statusLabel")}+ </Label>+ <Select+ value={effectiveStatus || null}+ onValueChange={(value) =>+ setSelectedStatus(String(value ?? ""))+ }+ disabled={canKeepCurrentStatus}+ >+ <SelectTrigger className="w-full">+ <SelectValue>{selectedStatusLabel}</SelectValue>+ </SelectTrigger>+ <SelectContent>+ {destinationColumns.map((column) => (+ <SelectItem key={column.id} value={column.id}>+ {getStatusLabel(column.id) || column.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <p className="text-xs text-muted-foreground">+ {canKeepCurrentStatus+ ? t("tasks:move.statusHintKeep")+ : t("tasks:move.statusHintAdjust")}+ </p>+ </div>+ )}++ <Button+ variant="outline"+ size="sm"+ onClick={() => void handleMove()}+ disabled={+ !selectedProjectId ||+ !effectiveStatus ||+ isMovePending ||+ isPending+ }+ className="w-full font-medium"+ >+ {t("tasks:move.action")}+ </Button>+ </div>+ </PopoverContent>+ </Popover>+ );+}diff --git a/apps/web/src/components/task/task-properties-sidebar.tsx b/apps/web/src/components/task/task-properties-sidebar.tsxindex 9fd4854c4..fbc11cb84 100644--- a/apps/web/src/components/task/task-properties-sidebar.tsx+++ b/apps/web/src/components/task/task-properties-sidebar.tsx@@ -23,8 +23,10 @@ import useGetGiteaIntegration from "@/hooks/queries/gitea-integration/use-get-giimport useGetGithubIntegration from "@/hooks/queries/github-integration/use-get-github-integration";import useGetLabelsByTask from "@/hooks/queries/label/use-get-labels-by-task";import useGetProject from "@/hooks/queries/project/use-get-project";+import useGetProjects from "@/hooks/queries/project/use-get-projects";import useGetTask from "@/hooks/queries/task/use-get-task";import { useGetActiveWorkspaceUsers } from "@/hooks/queries/workspace-users/use-get-active-workspace-users";+import { cn } from "@/lib/cn";import { getColumnIcon } from "@/lib/column";import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";import { formatDateShort } from "@/lib/format";@@ -34,6 +36,7 @@ import { toast } from "@/lib/toast";import TaskAssigneePopover from "./task-assignee-popover";import TaskDueDatePopover from "./task-due-date-popover";import TaskLabelsPopover from "./task-labels-popover";+import TaskMovePopover from "./task-move-popover";import TaskPriorityPopover from "./task-priority-popover";import TaskStartDatePopover from "./task-start-date-popover";import TaskStatusPopover from "./task-status-popover";@@ -82,6 +85,9 @@ export default function TaskPropertiesSidebar({const { data: taskLabels = [] } = useGetLabelsByTask(taskId ?? "");const { data: githubIntegration } = useGetGithubIntegration(projectId);const { data: giteaIntegration } = useGetGiteaIntegration(projectId);+ const { data: workspaceProjects = [] } = useGetProjects({ workspaceId });+ const canMoveTask =+ Boolean(task) && workspaceProjects.some((p) => p.id !== task?.projectId);const projectSlug = project?.slug;const taskNumber = task?.number;@@ -114,191 +120,28 @@ export default function TaskPropertiesSidebar({return (<div className={className}>- {/* Compact mode: properties + icons in one row */}- {compact && (- <div className="flex flex-row-reverse gap-2 w-full border-b border-border">- <div className="flex px-3 py-2">- <TooltipProvider>- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="outline"- size="sm"- className="text-foreground rounded-r-none border-r-0"- onClick={() => handleCopyTaskLink()}- >- <Copy className="size-4" />- </Button>- </TooltipTrigger>- <TooltipContent>- <KbdSequence- keys={["Ctrl", "Shift", "C"]}- description={t("tasks:properties.copyTaskLink")}- separator=""- />- </TooltipContent>- </Tooltip>- </TooltipProvider>-- <TooltipProvider>- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="outline"- size="sm"- className="text-foreground rounded-l-none"- onClick={() => handleCopyTaskBranch()}- >- <GitBranch className="size-4" />- </Button>- </TooltipTrigger>- <TooltipContent>- <KbdSequence- keys={["Ctrl", "Shift", "G"]}- description={t("tasks:properties.copyTaskBranch")}- separator=""- />- </TooltipContent>- </Tooltip>- </TooltipProvider>- </div>-- <div className="flex flex-row flex-wrap gap-1 items-center p-2 w-full">- {task && (- <TaskStatusPopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5"- >- {getColumnIcon(task.status ?? "", false)}- <span className="text-xs font-semibold truncate">- {getStatusLabel(task.status ?? "")}- </span>- </Button>- </TaskStatusPopover>- )}- {task && (- <TaskPriorityPopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5"- >- {getPriorityIcon(task.priority ?? "")}- <span className="text-xs font-semibold truncate">- {getPriorityLabel(task.priority ?? "")}- </span>- </Button>- </TaskPriorityPopover>- )}- {task && (- <TaskAssigneePopover task={task} workspaceId={workspaceId}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5"- >- {task.userId ? (- <Avatar className="h-[16px] w-[16px]">- <AvatarImage- src={assignee?.user?.image ?? ""}- alt={assignee?.user?.name || ""}- />- <AvatarFallback className="text-[9px] font-medium border border-border/30 flex-shrink-0 h-[16px] w-[16px]">- {assignee?.user?.name?.charAt(0).toUpperCase()}- </AvatarFallback>- </Avatar>- ) : (- <div- className="w-[16px] h-[16px] rounded-full bg-muted border border-border flex items-center justify-center flex-shrink-0"- title={t("tasks:popover.assignee.unassigned")}- >- <span className="text-[8px] font-medium">?</span>- </div>- )}- <span className="text-xs font-semibold truncate max-w-[100px]">- {assignee?.user?.name ||- task.assigneeName ||- t("tasks:popover.assignee.unassigned")}- </span>- </Button>- </TaskAssigneePopover>- )}- {task && (- <TaskStartDatePopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5"- >- <CalendarDays className="w-3.5 h-3.5 text-muted-foreground" />- <span- className={`text-xs font-semibold ${task.startDate ? "" : "text-muted-foreground"}`}- >- {task.startDate- ? formatDateShort(task.startDate)- : t("tasks:properties.start")}- </span>- </Button>- </TaskStartDatePopover>- )}- {task && (- <TaskDueDatePopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5"- >- {task.dueDate ? (- <>- {getDueDateStatus(task.dueDate) === "overdue" && (- <CalendarX- className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}- />- )}- {getDueDateStatus(task.dueDate) === "due-soon" && (- <CalendarClock- className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}- />- )}- {(getDueDateStatus(task.dueDate) === "far-future" ||- getDueDateStatus(task.dueDate) === "no-due-date") && (- <Calendar- className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}- />- )}- <span className="text-xs font-semibold">- {formatDateShort(task.dueDate)}- </span>- </>- ) : (- <>- <Calendar className="w-3.5 h-3.5 text-muted-foreground" />- <span className="text-xs font-semibold text-muted-foreground">- {t("tasks:properties.noDate")}- </span>- </>- )}- </Button>- </TaskDueDatePopover>- )}- </div>- </div>- )}-- {!compact && (- <>- {/* Mobile: Compact-style layout */}- <div className="flex flex-row-reverse gap-2 w-full border-b border-border lg:hidden">+ <div className="flex min-h-0 min-w-0 flex-1 flex-col gap-2">+ {/* Compact mode: properties + icons in one row */}+ {compact && (+ <div className="flex flex-row-reverse gap-2 w-full border-b border-border"><div className="flex px-3 py-2">+ {task && canMoveTask && (+ <TaskMovePopover+ task={task}+ workspaceId={workspaceId}+ triggerClassName="rounded-l-md rounded-r-none border-r-0"+ />+ )}<TooltipProvider><Tooltip><TooltipTrigger asChild><Buttonvariant="outline"size="sm"- className="text-foreground rounded-r-none border-r-0"+ className={cn(+ "text-foreground border-r-0",+ canMoveTask ? "rounded-none" : "rounded-r-none",+ )}onClick={() => handleCopyTaskLink()}><Copy className="size-4" />@@ -379,13 +222,13 @@ export default function TaskPropertiesSidebar({src={assignee?.user?.image ?? ""}alt={assignee?.user?.name || ""}/>- <AvatarFallback className="text-[9px] font-medium border border-border/30 shrink-0 h-[16px] w-[16px]">+ <AvatarFallback className="text-[9px] font-medium border border-border/30 flex-shrink-0 h-[16px] w-[16px]">{assignee?.user?.name?.charAt(0).toUpperCase()}</AvatarFallback></Avatar>) : (<div- className="w-[16px] h-[16px] rounded-full bg-muted border border-border flex items-center justify-center shrink-0"+ className="w-[16px] h-[16px] rounded-full bg-muted border border-border flex items-center justify-center flex-shrink-0"title={t("tasks:popover.assignee.unassigned")}><span className="text-[8px] font-medium">?</span>@@ -459,21 +302,30 @@ export default function TaskPropertiesSidebar({)}</div></div>+ )}- {/* Desktop: Title + stacked properties */}- <div className="hidden lg:block">- <div className="flex items-center justify-between px-3 py-2 border-b border-border lg:border-none">- <p className="text-sm font-medium text-foreground/70 flex-1">- {t("tasks:properties.title")}- </p>- <div className="flex">+ {!compact && (+ <>+ {/* Mobile: Compact-style layout */}+ <div className="flex flex-row-reverse gap-2 w-full border-b border-border lg:hidden">+ <div className="flex px-3 py-2">+ {task && canMoveTask && (+ <TaskMovePopover+ task={task}+ workspaceId={workspaceId}+ triggerClassName="rounded-l-md rounded-r-none border-r-0"+ />+ )}<TooltipProvider><Tooltip><TooltipTrigger asChild><Buttonvariant="outline"size="sm"- className="text-foreground rounded-r-none border-r-0"+ className={cn(+ "text-foreground border-r-0",+ canMoveTask ? "rounded-none" : "rounded-r-none",+ )}onClick={() => handleCopyTaskLink()}><Copy className="size-4" />@@ -511,181 +363,369 @@ export default function TaskPropertiesSidebar({</Tooltip></TooltipProvider></div>++ <div className="flex flex-row flex-wrap gap-1 items-center p-2 w-full">+ {task && (+ <TaskStatusPopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5"+ >+ {getColumnIcon(task.status ?? "", false)}+ <span className="text-xs font-semibold truncate">+ {getStatusLabel(task.status ?? "")}+ </span>+ </Button>+ </TaskStatusPopover>+ )}+ {task && (+ <TaskPriorityPopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5"+ >+ {getPriorityIcon(task.priority ?? "")}+ <span className="text-xs font-semibold truncate">+ {getPriorityLabel(task.priority ?? "")}+ </span>+ </Button>+ </TaskPriorityPopover>+ )}+ {task && (+ <TaskAssigneePopover task={task} workspaceId={workspaceId}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5"+ >+ {task.userId ? (+ <Avatar className="h-[16px] w-[16px]">+ <AvatarImage+ src={assignee?.user?.image ?? ""}+ alt={assignee?.user?.name || ""}+ />+ <AvatarFallback className="text-[9px] font-medium border border-border/30 shrink-0 h-[16px] w-[16px]">+ {assignee?.user?.name?.charAt(0).toUpperCase()}+ </AvatarFallback>+ </Avatar>+ ) : (+ <div+ className="w-[16px] h-[16px] rounded-full bg-muted border border-border flex items-center justify-center shrink-0"+ title={t("tasks:popover.assignee.unassigned")}+ >+ <span className="text-[8px] font-medium">?</span>+ </div>+ )}+ <span className="text-xs font-semibold truncate max-w-[100px]">+ {assignee?.user?.name ||+ task.assigneeName ||+ t("tasks:popover.assignee.unassigned")}+ </span>+ </Button>+ </TaskAssigneePopover>+ )}+ {task && (+ <TaskStartDatePopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5"+ >+ <CalendarDays className="w-3.5 h-3.5 text-muted-foreground" />+ <span+ className={`text-xs font-semibold ${task.startDate ? "" : "text-muted-foreground"}`}+ >+ {task.startDate+ ? formatDateShort(task.startDate)+ : t("tasks:properties.start")}+ </span>+ </Button>+ </TaskStartDatePopover>+ )}+ {task && (+ <TaskDueDatePopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5"+ >+ {task.dueDate ? (+ <>+ {getDueDateStatus(task.dueDate) === "overdue" && (+ <CalendarX+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}+ />+ )}+ {getDueDateStatus(task.dueDate) === "due-soon" && (+ <CalendarClock+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}+ />+ )}+ {(getDueDateStatus(task.dueDate) === "far-future" ||+ getDueDateStatus(task.dueDate) ===+ "no-due-date") && (+ <Calendar+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}+ />+ )}+ <span className="text-xs font-semibold">+ {formatDateShort(task.dueDate)}+ </span>+ </>+ ) : (+ <>+ <Calendar className="w-3.5 h-3.5 text-muted-foreground" />+ <span className="text-xs font-semibold text-muted-foreground">+ {t("tasks:properties.noDate")}+ </span>+ </>+ )}+ </Button>+ </TaskDueDatePopover>+ )}+ </div></div>- <div className="flex flex-col gap-2 px-3 py-3">- {task && (- <TaskStatusPopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5 w-full"- >- {getColumnIcon(task.status ?? "", false)}- <span className="text-xs font-semibold truncate">- {getStatusLabel(task.status ?? "")}- </span>- </Button>- </TaskStatusPopover>- )}- {task && (- <TaskPriorityPopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5 w-full"- >- {getPriorityIcon(task.priority ?? "")}- <span className="text-xs font-semibold truncate">- {getPriorityLabel(task.priority ?? "")}- </span>- </Button>- </TaskPriorityPopover>- )}- {task && (- <TaskAssigneePopover task={task} workspaceId={workspaceId}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5 w-full"- >- {task.userId ? (- <Avatar className="h-[16px] w-[16px]">- <AvatarImage- src={assignee?.user?.image ?? ""}- alt={assignee?.user?.name || ""}+ {/* Desktop: Title + stacked properties */}+ <div className="hidden lg:block">+ <div className="flex items-center justify-between px-3 py-2 border-b border-border lg:border-none">+ <p className="text-sm font-medium text-foreground/70 flex-1">+ {t("tasks:properties.title")}+ </p>+ <div className="flex">+ {task && canMoveTask && (+ <TaskMovePopover+ task={task}+ workspaceId={workspaceId}+ triggerClassName="rounded-l-md rounded-r-none border-r-0"+ />+ )}+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="outline"+ size="sm"+ className={cn(+ "text-foreground border-r-0",+ canMoveTask ? "rounded-none" : "rounded-r-none",+ )}+ onClick={() => handleCopyTaskLink()}+ >+ <Copy className="size-4" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ <KbdSequence+ keys={["Ctrl", "Shift", "C"]}+ description={t("tasks:properties.copyTaskLink")}+ separator=""/>- <AvatarFallback className="text-[9px] font-medium border border-border/30 shrink-0 h-[16px] w-[16px]">- {assignee?.user?.name?.charAt(0).toUpperCase()}- </AvatarFallback>- </Avatar>- ) : (- <div- className="w-[16px] h-[16px] rounded-full bg-muted border border-border flex items-center justify-center shrink-0"- title={t("tasks:popover.assignee.unassigned")}+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="outline"+ size="sm"+ className="text-foreground rounded-l-none"+ onClick={() => handleCopyTaskBranch()}+ >+ <GitBranch className="size-4" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ <KbdSequence+ keys={["Ctrl", "Shift", "G"]}+ description={t("tasks:properties.copyTaskBranch")}+ separator=""+ />+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>++ <div className="flex flex-col gap-2 px-3 py-3">+ {task && (+ <TaskStatusPopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5 w-full"+ >+ {getColumnIcon(task.status ?? "", false)}+ <span className="text-xs font-semibold truncate">+ {getStatusLabel(task.status ?? "")}+ </span>+ </Button>+ </TaskStatusPopover>+ )}+ {task && (+ <TaskPriorityPopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5 w-full"+ >+ {getPriorityIcon(task.priority ?? "")}+ <span className="text-xs font-semibold truncate">+ {getPriorityLabel(task.priority ?? "")}+ </span>+ </Button>+ </TaskPriorityPopover>+ )}+ {task && (+ <TaskAssigneePopover task={task} workspaceId={workspaceId}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5 w-full"+ >+ {task.userId ? (+ <Avatar className="h-[16px] w-[16px]">+ <AvatarImage+ src={assignee?.user?.image ?? ""}+ alt={assignee?.user?.name || ""}+ />+ <AvatarFallback className="text-[9px] font-medium border border-border/30 shrink-0 h-[16px] w-[16px]">+ {assignee?.user?.name?.charAt(0).toUpperCase()}+ </AvatarFallback>+ </Avatar>+ ) : (+ <div+ className="w-[16px] h-[16px] rounded-full bg-muted border border-border flex items-center justify-center shrink-0"+ title={t("tasks:popover.assignee.unassigned")}+ >+ <span className="text-[8px] font-medium">?</span>+ </div>+ )}+ <span className="text-xs font-semibold truncate max-w-[100px]">+ {assignee?.user?.name ||+ task.assigneeName ||+ t("tasks:popover.assignee.unassigned")}+ </span>+ </Button>+ </TaskAssigneePopover>+ )}+ {task && (+ <TaskStartDatePopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5 w-full"+ >+ <CalendarDays className="w-3.5 h-3.5 text-muted-foreground" />+ <span+ className={`text-xs font-semibold ${task.startDate ? "" : "text-muted-foreground"}`}>- <span className="text-[8px] font-medium">?</span>- </div>- )}- <span className="text-xs font-semibold truncate max-w-[100px]">- {assignee?.user?.name ||- task.assigneeName ||- t("tasks:popover.assignee.unassigned")}- </span>- </Button>- </TaskAssigneePopover>- )}- {task && (- <TaskStartDatePopover task={task}>- <Button- variant="ghost"- size="sm"- className="justify-start h-7 px-1.5 gap-1.5 w-full"- >- <CalendarDays className="w-3.5 h-3.5 text-muted-foreground" />- <span- className={`text-xs font-semibold ${task.startDate ? "" : "text-muted-foreground"}`}+ {task.startDate+ ? formatDateShort(task.startDate)+ : t("tasks:properties.startDate")}+ </span>+ </Button>+ </TaskStartDatePopover>+ )}+ {task && (+ <TaskDueDatePopover task={task}>+ <Button+ variant="ghost"+ size="sm"+ className="justify-start h-7 px-1.5 gap-1.5 w-full">- {task.startDate- ? formatDateShort(task.startDate)- : t("tasks:properties.startDate")}- </span>- </Button>- </TaskStartDatePopover>- )}+ {task.dueDate ? (+ <>+ {getDueDateStatus(task.dueDate) === "overdue" && (+ <CalendarX+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}+ />+ )}+ {getDueDateStatus(task.dueDate) === "due-soon" && (+ <CalendarClock+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}+ />+ )}+ {(getDueDateStatus(task.dueDate) === "far-future" ||+ getDueDateStatus(task.dueDate) ===+ "no-due-date") && (+ <Calendar+ className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}+ />+ )}+ <span className="text-xs font-semibold">+ {formatDateShort(task.dueDate)}+ </span>+ </>+ ) : (+ <>+ <Calendar className="w-3.5 h-3.5 text-muted-foreground" />+ <span className="text-xs font-semibold text-muted-foreground">+ {t("tasks:properties.noDate")}+ </span>+ </>+ )}+ </Button>+ </TaskDueDatePopover>+ )}+ </div>+ </div>+ </>+ )}++ <div className="hidden lg:flex px-3 flex-col gap-3 p-2">+ <div className="flex flex-col gap-1">+ <span className="text-xs font-medium text-foreground/70 px-2">+ {t("tasks:properties.labels")}+ </span>+ <div className="flex flex-wrap items-center gap-1.5 px-2">+ {task &&+ taskLabels.length > 0 &&+ taskLabels.map(+ (label: { id: string; name: string; color: string }) => (+ <TaskLabelsPopover+ key={`edit-${label.id}`}+ task={task}+ workspaceId={workspaceId}+ triggerNativeButton={false}+ >+ <Badge+ variant="outline"+ className="flex items-center gap-1 px-1.5 py-0.5 cursor-pointer hover:bg-accent/50 transition-colors text-[10px]"+ >+ <span+ className="w-1.5 h-1.5 rounded-full flex-shrink-0"+ style={{+ backgroundColor:+ labelColors.find((c) => c.value === label.color)+ ?.color || "var(--color-neutral-400)",+ }}+ />+ <span className="truncate max-w-[60px]">+ {label.name}+ </span>+ </Badge>+ </TaskLabelsPopover>+ ),+ )}+{task && (- <TaskDueDatePopover task={task}>+ <TaskLabelsPopover task={task} workspaceId={workspaceId}><Buttonvariant="ghost"size="sm"- className="justify-start h-7 px-1.5 gap-1.5 w-full"+ className="h-5 w-5 p-0 rounded-full">- {task.dueDate ? (- <>- {getDueDateStatus(task.dueDate) === "overdue" && (- <CalendarX- className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}- />- )}- {getDueDateStatus(task.dueDate) === "due-soon" && (- <CalendarClock- className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}- />- )}- {(getDueDateStatus(task.dueDate) === "far-future" ||- getDueDateStatus(task.dueDate) === "no-due-date") && (- <Calendar- className={`w-3.5 h-3.5 ${dueDateStatusColors[getDueDateStatus(task.dueDate)]}`}- />- )}- <span className="text-xs font-semibold">- {formatDateShort(task.dueDate)}- </span>- </>- ) : (- <>- <Calendar className="w-3.5 h-3.5 text-muted-foreground" />- <span className="text-xs font-semibold text-muted-foreground">- {t("tasks:properties.noDate")}- </span>- </>- )}+ <Plus className="h-3 w-3" /></Button>- </TaskDueDatePopover>+ </TaskLabelsPopover>)}</div></div>- </>- )}-- <div className="hidden lg:flex px-3 flex-col gap-3 p-2">- <div className="flex flex-col gap-1">- <span className="text-xs font-medium text-foreground/70 px-2">- {t("tasks:properties.labels")}- </span>- <div className="flex flex-wrap items-center gap-1.5 px-2">- {task &&- taskLabels.length > 0 &&- taskLabels.map(- (label: { id: string; name: string; color: string }) => (- <TaskLabelsPopover- key={`edit-${label.id}`}- task={task}- workspaceId={workspaceId}- triggerNativeButton={false}- >- <Badge- variant="outline"- className="flex items-center gap-1 px-1.5 py-0.5 cursor-pointer hover:bg-accent/50 transition-colors text-[10px]"- >- <span- className="w-1.5 h-1.5 rounded-full flex-shrink-0"- style={{- backgroundColor:- labelColors.find((c) => c.value === label.color)- ?.color || "var(--color-neutral-400)",- }}- />- <span className="relative max-w-20 truncate -top-0.5">- {label.name}- </span>- </Badge>- </TaskLabelsPopover>- ),- )}-- {task && (- <TaskLabelsPopover task={task} workspaceId={workspaceId}>- <Button- variant="ghost"- size="sm"- className="h-5 w-5 p-0 rounded-full"- >- <Plus className="h-3 w-3" />- </Button>- </TaskLabelsPopover>- )}- </div></div></div></div>diff --git a/apps/web/src/fetchers/task/move-task.ts b/apps/web/src/fetchers/task/move-task.tsnew file mode 100644index 000000000..bbc5090e0--- /dev/null+++ b/apps/web/src/fetchers/task/move-task.ts@@ -0,0 +1,28 @@+import { client } from "@kaneo/libs";++async function moveTask({+ taskId,+ destinationProjectId,+ destinationStatus,+}: {+ taskId: string;+ destinationProjectId: string;+ destinationStatus?: string;+}) {+ const response = await client.task.move[":id"].$put({+ param: { id: taskId },+ json: {+ destinationProjectId,+ destinationStatus,+ },+ });++ if (!response.ok) {+ const error = await response.text();+ throw new Error(error);+ }++ return response.json();+}++export default moveTask;diff --git a/apps/web/src/hooks/mutations/task/use-move-task.ts b/apps/web/src/hooks/mutations/task/use-move-task.tsnew file mode 100644index 000000000..de67dc960--- /dev/null+++ b/apps/web/src/hooks/mutations/task/use-move-task.ts@@ -0,0 +1,30 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";+import moveTask from "@/fetchers/task/move-task";++export function useMoveTask() {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: moveTask,+ onSuccess: (result, variables) => {+ queryClient.invalidateQueries({+ queryKey: ["task", variables.taskId],+ });+ queryClient.invalidateQueries({+ queryKey: ["tasks", result.sourceProjectId],+ });+ queryClient.invalidateQueries({+ queryKey: ["tasks", result.destinationProjectId],+ });+ queryClient.invalidateQueries({+ queryKey: ["projects"],+ });+ queryClient.invalidateQueries({+ queryKey: ["activities", variables.taskId],+ });+ queryClient.invalidateQueries({+ queryKey: ["notifications"],+ });+ },+ });+}diff --git a/i18n/de-DE.json b/i18n/de-DE.jsonindex d9a8a03c0..c10fd522b 100644--- a/i18n/de-DE.json+++ b/i18n/de-DE.json@@ -1326,6 +1326,17 @@"startDate": "Startdatum","noDate": "Kein Datum"},+ "move": {+ "title": "Aufgabe verschieben",+ "projectLabel": "Zielprojekt",+ "projectPlaceholder": "Projekt auswählen",+ "statusLabel": "Zielstatus",+ "statusHintKeep": "Der aktuelle Status wird im Zielprojekt bereits unterstützt.",+ "statusHintAdjust": "Wähle den Status für das Zielprojekt aus.",+ "action": "Aufgabe verschieben",+ "success": "Aufgabe erfolgreich verschoben",+ "error": "Aufgabe konnte nicht verschoben werden"+ },"popover": {"assignee": {"unassigned": "Nicht zugewiesen",diff --git a/i18n/el-GR.json b/i18n/el-GR.jsonindex 81e96641d..fefb9bb3f 100644--- a/i18n/el-GR.json+++ b/i18n/el-GR.json@@ -1130,6 +1130,17 @@"startDate": "Ημερομηνία έναρξης","noDate": "Χωρίς ημερομηνία"},+ "move": {+ "title": "Μετακίνηση εργασίας",+ "projectLabel": "Έργο προορισμού",+ "projectPlaceholder": "Επιλέξτε έργο",+ "statusLabel": "Κατάσταση προορισμού",+ "statusHintKeep": "Η τρέχουσα κατάσταση υποστηρίζεται ήδη στο έργο προορισμού.",+ "statusHintAdjust": "Επιλέξτε την κατάσταση που θα χρησιμοποιηθεί στο έργο προορισμού.",+ "action": "Μετακίνηση εργασίας",+ "success": "Η εργασία μετακινήθηκε με επιτυχία",+ "error": "Αποτυχία μετακίνησης εργασίας"+ },"popover": {"assignee": {"unassigned": "Χωρίς ανάθεση",diff --git a/i18n/en-US.json b/i18n/en-US.jsonindex dfe415b50..211576ce5 100644--- a/i18n/en-US.json+++ b/i18n/en-US.json@@ -1326,6 +1326,17 @@"startDate": "Start date","noDate": "No date"},+ "move": {+ "title": "Move task",+ "projectLabel": "Destination project",+ "projectPlaceholder": "Select a project",+ "statusLabel": "Destination status",+ "statusHintKeep": "This project's workflow already supports the current status.",+ "statusHintAdjust": "Choose the status to use in the destination project.",+ "action": "Move task",+ "success": "Task moved successfully",+ "error": "Failed to move task"+ },"popover": {"assignee": {"unassigned": "Unassigned",diff --git a/i18n/fr-FR.json b/i18n/fr-FR.jsonindex becd0be6e..2a682d109 100644--- a/i18n/fr-FR.json+++ b/i18n/fr-FR.json@@ -1130,6 +1130,17 @@"startDate": "Date de début","noDate": "Pas de date"},+ "move": {+ "title": "Déplacer la tâche",+ "projectLabel": "Projet de destination",+ "projectPlaceholder": "Sélectionner un projet",+ "statusLabel": "Statut de destination",+ "statusHintKeep": "Le statut actuel est déjà disponible dans ce projet.",+ "statusHintAdjust": "Choisissez le statut à utiliser dans le projet de destination.",+ "action": "Déplacer la tâche",+ "success": "Tâche déplacée avec succès",+ "error": "Échec du déplacement de la tâche"+ },"popover": {"assignee": {"unassigned": "Non assigné",diff --git a/i18n/mk-MK.json b/i18n/mk-MK.jsonindex aced8e7aa..c9fe7d77b 100644--- a/i18n/mk-MK.json+++ b/i18n/mk-MK.json@@ -1130,6 +1130,17 @@"startDate": "Почетен датум","noDate": "Без датум"},+ "move": {+ "title": "Премести задача",+ "projectLabel": "Целен проект",+ "projectPlaceholder": "Избери проект",+ "statusLabel": "Целен статус",+ "statusHintKeep": "Тековниот статус веќе е поддржан во целниот проект.",+ "statusHintAdjust": "Избери статус што ќе се користи во целниот проект.",+ "action": "Премести задача",+ "success": "Задачата е успешно преместена",+ "error": "Неуспешно преместување на задача"+ },"popover": {"assignee": {"unassigned": "Недоделен",