Files
t3code/apps/web/src/components/chat/folderDrop.ts
T
Dara AdedejiandDevin AI d1a6448971 fix(web): dropped folders become path chips on the local environment and are refused on remote ones (#12001)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-16 13:28:28 -07:00

25 lines
679 B
TypeScript

import type { EnvironmentId } from "@t3tools/contracts";
export function folderDropTarget(input: {
localEnvironmentDisabled: boolean;
environmentId: EnvironmentId;
primaryEnvironmentId: EnvironmentId | null;
}): "local" | "remote" {
if (
input.localEnvironmentDisabled ||
input.primaryEnvironmentId === null ||
input.environmentId !== input.primaryEnvironmentId
) {
return "remote";
}
return "local";
}
export function resolveDroppedFolderPath(
folder: File,
getPathForFile: ((file: File) => string) | undefined,
): string | null {
const path = getPathForFile?.(folder);
return typeof path === "string" && path.length > 0 ? path : null;
}