Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

folderDrop.ts

24 lines679 Bytes

1import type { EnvironmentId } from "@t3tools/contracts";
2​
3export function folderDropTarget(input: {
4 localEnvironmentDisabled: boolean;
5 environmentId: EnvironmentId;
6 primaryEnvironmentId: EnvironmentId | null;
7}): "local" | "remote" {
8 if (
9 input.localEnvironmentDisabled ||
10 input.primaryEnvironmentId === null ||
11 input.environmentId !== input.primaryEnvironmentId
12 ) {
13 return "remote";
14 }
15 return "local";
17​
18export function resolveDroppedFolderPath(
19 folder: File,
20 getPathForFile: ((file: File) => string) | undefined,
21): string | null {
22 const path = getPathForFile?.(folder);
23 return typeof path === "string" && path.length > 0 ? path : null;