Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions services/runner/images/sandbox/daytona/build_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def main() -> None:
"RUN npm install -g typescript@5 ts-node@10 "
"&& python3 --version "
"&& echo 'const v: number = 1; console.log(v)' > /tmp/v.ts "
"&& ts-node /tmp/v.ts && rm /tmp/v.ts",
f"RUN curl -fsSL -o /usr/local/bin/geesefs {GEESEFS_URL} "
"&& ts-node /tmp/v.ts && rm /tmp/v.ts",
f"RUN curl -fsSL --retry 5 --retry-delay 2 --retry-all-errors -o /usr/local/bin/geesefs {GEESEFS_URL} "
"&& chmod +x /usr/local/bin/geesefs",
"USER sandbox",
# Replace the base image's private Pi adapter. sandbox-agent resolves this launcher
Expand Down
26 changes: 18 additions & 8 deletions web/oss/src/components/Drives/useDriveDrop.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import {useCallback, useEffect, useRef, useState} from "react"

import {type DroppedFile, readDroppedFiles} from "./dropEntries"

/**
* Drag-and-drop upload behaviour shared by the drive's tree and grid: highlight the folder under
* the cursor, spring-load into it after a short hover (drill to a nested destination without
* dropping), and upload on drop — into the hovered folder, or the current folder for a background
* drop. The views wire the returned handler props onto folder targets and their container.
*
* Every drop reads its files through {@link readDroppedFiles}, which walks dropped directories into
* their contents; each file carries the path it should keep under the destination folder.
*/

const SPRING_MS = 700
Expand Down Expand Up @@ -38,7 +43,7 @@ export function useDriveDrop({
}: {
/** False leaves the hook mounted but inert — no window listeners, nothing to hover. */
enabled?: boolean
onUpload: (files: File[], folder: string) => void
onUpload: (files: DroppedFile[], folder: string) => void
onNavigate: (folder: string) => void
}): DriveDrop {
const [dragging, setDragging] = useState(false)
Expand Down Expand Up @@ -120,8 +125,9 @@ export function useDriveDrop({
if (!isFileDrag(e)) return
e.preventDefault()
e.stopPropagation()
const files = Array.from(e.dataTransfer.files)
if (files.length) onUpload(files, path)
void readDroppedFiles(e.dataTransfer).then((files) => {
if (files.length) onUpload(files, path)
})
setHoverPath(null)
clearSpring()
},
Expand All @@ -142,8 +148,9 @@ export function useDriveDrop({
onDrop: (e: React.DragEvent) => {
if (!isFileDrag(e)) return
e.preventDefault()
const files = Array.from(e.dataTransfer.files)
if (files.length) onUpload(files, currentFolder)
void readDroppedFiles(e.dataTransfer).then((files) => {
if (files.length) onUpload(files, currentFolder)
})
setHoverPath(null)
clearSpring()
},
Expand All @@ -167,7 +174,9 @@ export type FileDropProps = Pick<
* destination is chosen). Pass a falsy `onFiles` to disable (e.g. no writable mount) — then `dropProps`
* is empty and nothing highlights.
*/
export function useStageDrop(onFiles: ((files: File[]) => void) | false | null | undefined): {
export function useStageDrop(
onFiles: ((files: DroppedFile[]) => void) | false | null | undefined,
): {
dropActive: boolean
dropProps: FileDropProps
} {
Expand All @@ -186,8 +195,9 @@ export function useStageDrop(onFiles: ((files: File[]) => void) | false | null |
if (!isFileDrag(e)) return
e.preventDefault()
setDropActive(false)
const files = Array.from(e.dataTransfer.files)
if (files.length) onFiles(files)
void readDroppedFiles(e.dataTransfer).then((files) => {
if (files.length) onFiles(files)
})
},
},
}
Expand Down
Loading