⚡ 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
chore: merge upstream/main into feat/add-testing
Tin523e5c45b53f
diff --cc apps/api/src/index.tsindex e5623fa97,a1747b559..d84341484--- a/apps/api/src/index.ts+++ b/apps/api/src/index.ts@@@ -91,7 -76,7 +96,7 @@@ function buildContentDisposition(filena.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[\\/]/g, "-")-- .replace(/[^\x20-\x7E]+/g, "_")++ .replace(/[^\x20-\u7E]+/g, "_").replace(/\s+/g, " ").trim() || "file";const encodedFilename = encodeURIComponent(safeFilename).replace(@@@ -102,408 -87,376 +107,437 @@@return `inline; filename="${asciiFallback}"; filename*=UTF-8''${encodedFilename}`;}-const app = new Hono<{- Variables: {- user: User | null;- session: Session | null;- userId: string;- apiKey?: ApiKey;- };-}>();--const corsOrigins = process.env.CORS_ORIGINS- ? process.env.CORS_ORIGINS.split(",").map((origin) => origin.trim())- : undefined;--app.use(- "*",- cors({- credentials: true,- origin: (origin) => {- if (!corsOrigins) {- return origin || "*";- }+export function createApp() {+ const app = new Hono<AppVariables>();+ const corsOrigins = process.env.CORS_ORIGINS+ ? process.env.CORS_ORIGINS.split(",").map((origin) => origin.trim())+ : undefined;++ app.use(+ "*",+ cors({+ credentials: true,+ origin: (origin) => {+ if (!corsOrigins) {+ return origin || "*";+ }++ if (!origin) {+ return null;+ }++ return corsOrigins.includes(origin) ? origin : null;+ },+ }),+ );- if (!origin) {- return null;- }+ const api = new Hono<ApiVariables>();- return corsOrigins.includes(origin) ? origin : null;- },- }),-);+ api.get("/health", (c) => {+ return c.json({ status: "ok" });+ });-const api = new Hono<{- Variables: {- user: User | null;- session: Session | null;- userId: string;- userEmail: string;- apiKey?: ApiKey;- };-}>();--api.get("/health", (c) => {- return c.json({ status: "ok" });-});--const publicProjectApi = api.get("/public-project/:id", async (c) => {- const { id } = c.req.param();- const project = await getPublicProject(id);-- return c.json(project);-});--api.post("/github-integration/webhook", handleGithubWebhookRoute);--api.post("/gitea-integration/webhook/:integrationId", handleGiteaWebhookRoute);--const invitationPublicApi = api.get("/invitation/public/:id", async (c) => {- const { id } = c.req.param();- const result = await getInvitationDetails(id);- return c.json(result);-});--api.get(- "/auth/get-session",- describeRoute({- operationId: "getSession",- tags: ["Authentication"],- description: "Get the current authenticated session",- security: [],- responses: {- 200: {- description: "Current session details or null when unauthenticated",- content: {- "application/json": { schema: resolver(v.any()) },+ const publicProjectApi = api.get("/public-project/:id", async (c) => {+ const { id } = c.req.param();+ const project = await getPublicProject(id);++ return c.json(project);+ });++ api.post("/github-integration/webhook", handleGithubWebhookRoute);+++ api.post(++ "/gitea-integration/webhook/:integrationId",++ handleGiteaWebhookRoute,++ );+++ const invitationPublicApi = api.get("/invitation/public/:id", async (c) => {+ const { id } = c.req.param();+ const result = await getInvitationDetails(id);+ return c.json(result);+ });++ api.get(+ "/auth/get-session",+ describeRoute({+ operationId: "getSession",+ tags: ["Authentication"],+ description: "Get the current authenticated session",+ security: [],+ responses: {+ 200: {+ description: "Current session details or null when unauthenticated",+ content: {+ "application/json": { schema: resolver(v.any()) },+ },},},+ }),+ async (c) => {+ const session = await auth.api.getSession({ headers: c.req.raw.headers });+ return c.json(session ?? null);},- }),- async (c) => {- const session = await auth.api.getSession({ headers: c.req.raw.headers });- return c.json(session ?? null);- },-);--api.get(- "/asset/:id",- describeRoute({- operationId: "getAsset",- tags: ["Assets"],- description: "Download an uploaded asset by ID",- security: [],- responses: {- 200: {- description: "The requested asset binary stream",- content: {- "*/*": { schema: resolver(v.any()) },+ );++ api.get(+ "/asset/:id",+ describeRoute({+ operationId: "getAsset",+ tags: ["Assets"],+ description: "Download an uploaded asset by ID",+ security: [],+ responses: {+ 200: {+ description: "The requested asset binary stream",+ content: {+ "*/*": { schema: resolver(v.any()) },+ },},},- },- }),- validator("param", v.object({ id: v.string() })),- async (c) => {- const { id } = c.req.param();- const [asset] = await db- .select({- id: schema.assetTable.id,- objectKey: schema.assetTable.objectKey,- mimeType: schema.assetTable.mimeType,- filename: schema.assetTable.filename,- workspaceId: schema.assetTable.workspaceId,- isPublic: schema.projectTable.isPublic,- })- .from(schema.assetTable)- .innerJoin(- schema.projectTable,- eq(schema.assetTable.projectId, schema.projectTable.id),- )- .where(eq(schema.assetTable.id, id))- .limit(1);-- if (!asset) {- throw new HTTPException(404, { message: "Asset not found" });- }+ }),+ validator("param", v.object({ id: v.string() })),+ async (c) => {+ const { id } = c.req.param();+ const [asset] = await db+ .select({+ id: schema.assetTable.id,+ objectKey: schema.assetTable.objectKey,+ mimeType: schema.assetTable.mimeType,+ filename: schema.assetTable.filename,+ workspaceId: schema.assetTable.workspaceId,+ isPublic: schema.projectTable.isPublic,+ })+ .from(schema.assetTable)+ .innerJoin(+ schema.projectTable,+ eq(schema.assetTable.projectId, schema.projectTable.id),+ )+ .where(eq(schema.assetTable.id, id))+ .limit(1);++ if (!asset) {+ throw new HTTPException(404, { message: "Asset not found" });+ }- const authHeader = c.req.header("Authorization");- const bearerToken = authHeader?.startsWith("Bearer ")- ? authHeader.substring(7).replace(/\s+/g, "").trim()- : null;+ const authHeader = c.req.header("Authorization");+ const bearerToken = authHeader?.startsWith("Bearer ")+ ? authHeader.substring(7).replace(/\s+/g, "").trim()+ : null;- let userId = "";- let apiKeyId: string | undefined;+ let userId = "";+ let apiKeyId: string | undefined;- if (bearerToken) {- const result = await verifyApiKey(bearerToken);+ if (bearerToken) {+ const result = await verifyApiKey(bearerToken);- if (result?.valid && result.key) {- userId = result.key.userId;- apiKeyId = result.key.id;+ if (result?.valid && result.key) {+ userId = result.key.userId;+ apiKeyId = result.key.id;+ } else {+ throw new HTTPException(401, { message: "Invalid API key" });+ }} else {- throw new HTTPException(401, { message: "Invalid API key" });+ const session = await auth.api.getSession({+ headers: c.req.raw.headers,+ });+ userId = session?.user?.id || "";}- } else {- const session = await auth.api.getSession({ headers: c.req.raw.headers });- userId = session?.user?.id || "";- }- if (userId) {- await validateWorkspaceAccess(userId, asset.workspaceId, apiKeyId);- } else if (!asset.isPublic) {- throw new HTTPException(401, { message: "Unauthorized" });- }+ if (userId) {+ await validateWorkspaceAccess(userId, asset.workspaceId, apiKeyId);+ } else if (!asset.isPublic) {+ throw new HTTPException(401, { message: "Unauthorized" });+ }- try {- const object = await getPrivateObject(asset.objectKey);-- return new Response(object.body as BodyInit, {- headers: {- "Cache-Control": asset.isPublic- ? "public, max-age=300"- : "private, max-age=120",- "Content-Disposition": buildContentDisposition(asset.filename),- "Content-Length": object.contentLength?.toString() || "",- "Content-Type": object.contentType || asset.mimeType,- ETag: object.etag || "",- "Last-Modified": object.lastModified?.toUTCString() || "",- },- });- } catch (error) {- console.error("Failed to stream asset:", error);- throw new HTTPException(404, { message: "Asset object not found" });- }- },-);--const configApi = api.route("/config", config);--const honoOpenApiHandler = openAPIRouteHandler(api, {- documentation: {- openapi: "3.0.3",- info: {- title: "Kaneo API",- version: "1.0.0",- description:- "Kaneo Project Management API - Manage projects, tasks, labels, and more",+ try {+ const object = await getPrivateObject(asset.objectKey);++ return new Response(object.body as BodyInit, {+ headers: {+ "Cache-Control": asset.isPublic+ ? "public, max-age=300"+ : "private, max-age=120",+ "Content-Disposition": buildContentDisposition(asset.filename),+ "Content-Length": object.contentLength?.toString() || "",+ "Content-Type": object.contentType || asset.mimeType,+ ETag: object.etag || "",+ "Last-Modified": object.lastModified?.toUTCString() || "",+ },+ });+ } catch (error) {+ console.error("Failed to stream asset:", error);+ throw new HTTPException(404, { message: "Asset object not found" });+ }},- servers: [- {- url: normalizeApiServerUrl(- process.env.KANEO_API_URL || "https://cloud.kaneo.app",- ),- description: "Kaneo API Server",+ );++ const configApi = api.route("/config", config);++ const honoOpenApiHandler = openAPIRouteHandler(api, {+ documentation: {+ openapi: "3.0.3",+ info: {+ title: "Kaneo API",+ version: "1.0.0",+ description:+ "Kaneo Project Management API - Manage projects, tasks, labels, and more",},- ],- components: {- securitySchemes: {- bearerAuth: {- type: "http",- scheme: "bearer",- description: "API Key authentication",+ servers: [+ {+ url: normalizeApiServerUrl(+ process.env.KANEO_API_URL || "https://cloud.kaneo.app",+ ),+ description: "Kaneo API Server",+ },+ ],+ components: {+ securitySchemes: {+ bearerAuth: {+ type: "http",+ scheme: "bearer",+ description: "API Key authentication",+ },},},+ security: [{ bearerAuth: [] }],},- security: [{ bearerAuth: [] }],- },-});+ });-api.get("/openapi", async (c) => {- const maybeResponse = await honoOpenApiHandler(c, async () => {});- const honoSpecResponse = maybeResponse ?? c.res;- const honoSpec = (await honoSpecResponse.json()) as Record<string, unknown>;+ api.get("/openapi", async (c) => {+ const maybeResponse = await honoOpenApiHandler(c, async () => {});+ const honoSpecResponse = maybeResponse ?? c.res;+ const honoSpec = (await honoSpecResponse.json()) as Record<string, unknown>;- let authSpec: Record<string, unknown> = {};- try {- authSpec = (await auth.api.generateOpenAPISchema()) as Record<- string,- unknown- >;- } catch (error) {- console.error("Failed to generate Better Auth OpenAPI schema:", error);- }+ let authSpec: Record<string, unknown> = {};+ try {+ authSpec = (await auth.api.generateOpenAPISchema()) as Record<+ string,+ unknown+ >;+ } catch (error) {+ console.error("Failed to generate Better Auth OpenAPI schema:", error);+ }- const normalizedAuthSpec = normalizeOrganizationAuthOperations(authSpec);- return c.json(- ensureOperationSummaries(- dedupeOperationIds(- markOptionalSchemaFieldsNullable(- normalizeNullableSchemasForOpenApi30(- normalizeEmptyRequiredArrays(- mergeOpenApiSpecs(honoSpec, normalizedAuthSpec),+ const normalizedAuthSpec = normalizeOrganizationAuthOperations(authSpec);+ return c.json(+ ensureOperationSummaries(+ dedupeOperationIds(+ markOptionalSchemaFieldsNullable(+ normalizeNullableSchemasForOpenApi30(+ normalizeEmptyRequiredArrays(+ mergeOpenApiSpecs(honoSpec, normalizedAuthSpec),+ ),),),),),- ),- );-});+ );+ });-api.on(["POST", "GET", "PUT", "DELETE"], "/auth/*", (c) => {- const authHeader = c.req.header("Authorization");+ api.on(["POST", "GET", "PUT", "DELETE"], "/auth/*", (c) => {+ const authHeader = c.req.header("Authorization");- if (authHeader?.startsWith("Bearer ")) {- const apiKey = authHeader.substring(7).replace(/\s+/g, "").trim();- const headers = new Headers(c.req.raw.headers);+ if (authHeader?.startsWith("Bearer ")) {+ const apiKey = authHeader.substring(7).replace(/\s+/g, "").trim();+ const headers = new Headers(c.req.raw.headers);- // Better Auth API key plugin validates from x-api-key by default.- if (!headers.get("x-api-key")) {- headers.set("x-api-key", apiKey);- }+ // Better Auth API key plugin validates from x-api-key by default.+ if (!headers.get("x-api-key")) {+ headers.set("x-api-key", apiKey);+ }- return auth.handler(- new Request(c.req.raw, {- headers,- }),- );- }+ return auth.handler(+ new Request(c.req.raw, {+ headers,+ }),+ );+ }- return auth.handler(c.req.raw);-});+ return auth.handler(c.req.raw);+ });-api.use("*", async (c, next) => {- const authHeader = c.req.header("Authorization");- if (authHeader?.startsWith("Bearer ")) {- const apiKey = authHeader.substring(7).replace(/\s+/g, "").trim();+ api.use("*", async (c, next) => {+ const authHeader = c.req.header("Authorization");+ if (authHeader?.startsWith("Bearer ")) {+ const apiKey = authHeader.substring(7).replace(/\s+/g, "").trim();++ try {+ const result = await verifyApiKey(apiKey);++ if (result?.valid && result.key) {+ c.set("userId", result.key.userId);+ c.set("user", null);+ c.set("session", null);+ c.set("apiKey", {+ id: result.key.id,+ userId: result.key.userId,+ enabled: result.key.enabled,+ });+ return next();+ }- try {- const result = await verifyApiKey(apiKey);-- if (result?.valid && result.key) {- c.set("userId", result.key.userId);- c.set("user", null);- c.set("session", null);- c.set("apiKey", {- id: result.key.id,- userId: result.key.userId,- enabled: result.key.enabled,+ throw new HTTPException(401, { message: "Invalid API key" });+ } catch (error) {+ if (error instanceof HTTPException) {+ throw error;+ }+ console.error("API key verification failed:", error);+ throw new HTTPException(401, {+ message: "API key verification failed",});- return next();}+ }- throw new HTTPException(401, { message: "Invalid API key" });- } catch (error) {- if (error instanceof HTTPException) {- throw error;- }- console.error("API key verification failed:", error);- throw new HTTPException(401, { message: "API key verification failed" });+ const session = await auth.api.getSession({ headers: c.req.raw.headers });+ c.set("user", session?.user || null);+ c.set("session", session?.session || null);+ c.set("userId", session?.user?.id || "");+ c.set("userEmail", session?.user?.email || "");++ if (!session?.user) {+ throw new HTTPException(401, { message: "Unauthorized" });}- }- const session = await auth.api.getSession({ headers: c.req.raw.headers });- c.set("user", session?.user || null);- c.set("session", session?.session || null);- c.set("userId", session?.user?.id || "");- c.set("userEmail", session?.user?.email || "");+ return next();+ });++ const projectApi = api.route("/project", project);+ const taskApi = api.route("/task", task);+ const columnApi = api.route("/column", column);+ const activityApi = api.route("/activity", activity);+ const commentApi = api.route("/comment", comment);+ const timeEntryApi = api.route("/time-entry", timeEntry);+ const labelApi = api.route("/label", label);+ const notificationApi = api.route("/notification", notification);+ const searchApi = api.route("/search", search);+ const githubIntegrationApi = api.route(+ "/github-integration",+ githubIntegration,+ );++ const giteaIntegrationApi = api.route("/gitea-integration", giteaIntegration);++ const genericWebhookIntegrationApi = api.route(++ "/generic-webhook-integration",++ genericWebhookIntegration,++ );++ const discordIntegrationApi = api.route(++ "/discord-integration",++ discordIntegration,++ );++ const slackIntegrationApi = api.route("/slack-integration", slackIntegration);++ const telegramIntegrationApi = api.route(++ "/telegram-integration",++ telegramIntegration,++ );+ const taskRelationApi = api.route("/task-relation", taskRelation);+ const externalLinkApi = api.route("/external-link", externalLink);+ const workflowRuleApi = api.route("/workflow-rule", workflowRule);+ const invitationApi = api.route("/invitation", invitation);+ const workspaceApi = api.route("/workspace", workspace);++ app.route("/api", api);++ return {+ app,+ api,+ activityApi,+ columnApi,+ commentApi,+ configApi,++ discordIntegrationApi,+ externalLinkApi,++ genericWebhookIntegrationApi,+ githubIntegrationApi,++ giteaIntegrationApi,+ invitationApi,+ invitationPublicApi,+ labelApi,+ notificationApi,+ projectApi,+ publicProjectApi,+ searchApi,++ slackIntegrationApi,+ taskApi,+ taskRelationApi,++ telegramIntegrationApi,+ timeEntryApi,+ workflowRuleApi,+ workspaceApi,+ };+}- if (!session?.user) {- throw new HTTPException(401, { message: "Unauthorized" });- }+export async function runStartupTasks() {+ await migrateWorkspaceUserEmail();+ await migrateSessionColumn();+ await migrateApiKeyReferenceId();- return next();-});--const projectApi = api.route("/project", project);-const taskApi = api.route("/task", task);-const columnApi = api.route("/column", column);-const activityApi = api.route("/activity", activity);-const commentApi = api.route("/comment", comment);-const timeEntryApi = api.route("/time-entry", timeEntry);-const labelApi = api.route("/label", label);-const notificationApi = api.route("/notification", notification);-const searchApi = api.route("/search", search);-const githubIntegrationApi = api.route(- "/github-integration",- githubIntegration,-);-const giteaIntegrationApi = api.route("/gitea-integration", giteaIntegration);-const genericWebhookIntegrationApi = api.route(- "/generic-webhook-integration",- genericWebhookIntegration,-);-const discordIntegrationApi = api.route(- "/discord-integration",- discordIntegration,-);-const slackIntegrationApi = api.route("/slack-integration", slackIntegration);-const telegramIntegrationApi = api.route(- "/telegram-integration",- telegramIntegration,-);-const taskRelationApi = api.route("/task-relation", taskRelation);-const externalLinkApi = api.route("/external-link", externalLink);-const workflowRuleApi = api.route("/workflow-rule", workflowRule);-const invitationApi = api.route("/invitation", invitation);-const workspaceApi = api.route("/workspace", workspace);--app.route("/api", api);--(async () => {- try {- await migrateWorkspaceUserEmail();- await migrateSessionColumn();- await migrateApiKeyReferenceId();+ console.log("🔄 Migrating database...");+ await migrate(db, {+ migrationsFolder: `${process.cwd()}/drizzle`,+ });+ console.log("✅ Database migrated successfully!");- console.log("🔄 Migrating database...");- await migrate(db, {- migrationsFolder: `${process.cwd()}/drizzle`,- });- console.log("✅ Database migrated successfully!");+ await migrateGitHubIntegration();+ await migrateColumns();- await migrateGitHubIntegration();- await migrateColumns();+ initializePlugins();+}- initializePlugins();+export async function startServer(port = 1337) {+ try {+ await runStartupTasks();} catch (error) {console.error("❌ Database migration failed!", error);process.exit(1);}-})();--serve(- {- fetch: app.fetch,- port: 1337,- },- () => {- console.log(- `⚡ API is running at ${process.env.KANEO_API_URL || "http://localhost:1337"}`,- );- },-);++ serve(+ {+ fetch: app.fetch,+ port,+ },+ () => {+ console.log(+ `⚡ API is running at ${process.env.KANEO_API_URL || "http://localhost:1337"}`,+ );+ },+ );+}++const createdApp = createApp();+const {+ app,+ activityApi,+ columnApi,+ commentApi,+ configApi,++ discordIntegrationApi,+ externalLinkApi,++ genericWebhookIntegrationApi,+ githubIntegrationApi,++ giteaIntegrationApi,+ invitationApi,+ invitationPublicApi,+ labelApi,+ notificationApi,+ projectApi,+ publicProjectApi,+ searchApi,++ slackIntegrationApi,+ taskApi,+ taskRelationApi,++ telegramIntegrationApi,+ timeEntryApi,+ workflowRuleApi,+ workspaceApi,+} = createdApp;++const isMainModule =+ Boolean(process.argv[1]) &&+ import.meta.url === pathToFileURL(process.argv[1]).href;++if (isMainModule) {+ void startServer();+}export type AppType =| typeof configApidiff --cc apps/web/src/components/task/task-move-popover.tsxindex 000000000,d98371bb5..ae3671642mode 000000,100644..100644--- a/apps/web/src/components/task/task-move-popover.tsx+++ b/apps/web/src/components/task/task-move-popover.tsx@@@ -1,0 -1,239 +1,239 @@@+ 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 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,+ isLoading: isProjectLoading,+ isError: isProjectError,+ } = 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.slug === task.status,+ );+ const fallbackStatus = destinationColumns[0]?.slug ?? "";+ const effectiveStatus = canKeepCurrentStatus+ ? task.status+ : selectedStatus || fallbackStatus;++ const selectedStatusLabel = useMemo(() => {+ if (!effectiveStatus || destinationColumns.length === 0) return null;+ const column = destinationColumns.find((c) => c.slug === 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,+ });++ setOpen(false);+ startTransition(() => {+ navigate({+ to: "/dashboard/workspace/$workspaceId/project/$projectId/task/$taskId",+ params: {+ workspaceId,+ projectId: result.task.projectId,+ taskId: task.id,+ },+ });+ });+ } catch {+ // toast is handled by useMoveTask's onError+ }+ };++ 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 || undefined}+ 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 && isProjectLoading && (+ <div className="flex items-center justify-center py-2">+ <span className="text-xs text-muted-foreground">+ {t("tasks:move.statusLabel")}…+ </span>+ </div>+ )}++ {selectedProjectId && isProjectError && (+ <p className="text-xs text-destructive">{t("tasks:move.error")}</p>+ )}++ {selectedProjectId &&+ !isProjectLoading &&+ !isProjectError &&+ destinationColumns.length > 0 && (+ <div className="flex flex-col gap-1.5">+ <Label className="text-xs text-muted-foreground">- {t("tasks:move.statusLabel")}++ {t("tasks:move.statusLabel")}+ </Label>+ <Select+ value={effectiveStatus || undefined}+ 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.slug}>+ {getStatusLabel(column.slug) || 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 ||+ isProjectLoading ||+ isProjectError+ }+ className="w-full font-medium"+ >+ {t("tasks:move.action")}+ </Button>+ </div>+ </PopoverContent>+ </Popover>+ );+ }