Skip to content
Merged
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
99 changes: 65 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ On certain operating systems, you may need to install these dependencies if they
- openssl-sys: https://docs.rs/crate/openssl-sys/0.9.19
- libclang 5.0: https://rust-lang.github.io/rust-bindgen/requirements.html

Rust must be between versions 1.81 and 1.85.1.
Rust must be version 1.85.1.

```bash
# Clone the repo.

git clone --recurse-submodules git@github.com:hyperware-ai/hyperdrive.git
git clone --recurse-submodules https://github.com/hyperware-ai/hyperdrive

# Install Rust and some `cargo` tools so we can build the runtime and Wasm.

Expand Down
11 changes: 9 additions & 2 deletions hyperdrive/packages/file-explorer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useEffect, useRef, useState } from 'react';
import { FileInfo, unshare_file, delete_file, delete_directory } from '../../lib/api';
import { FileExplorer } from '../../lib/api';
import useFileExplorerStore from '../../store/fileExplorer';
import './ContextMenu.css';

interface ContextMenuProps {
position: { x: number; y: number };
file: FileInfo;
file: FileExplorer.FileInfo;
onClose: () => void;
onShare: () => void;
onDelete: () => void;
Expand Down Expand Up @@ -84,7 +84,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({ position, file, onClose, onSh

const handleUnshare = async () => {
try {
await unshare_file(file.path);
await FileExplorer.unshare_file(file.path);
removeSharedLink(file.path);
onClose();
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import useFileExplorerStore from '../../store/fileExplorer';
import { list_directory, create_directory, create_file, delete_file, delete_directory, FileInfo, get_current_directory } from '../../lib/api';
import { FileExplorer as FileExplorerAPI } from '../../lib/api';
import FileList from './FileList';
import Breadcrumb from './Breadcrumb';
import Toolbar from './Toolbar';
Expand Down Expand Up @@ -43,7 +43,7 @@ const FileExplorer: React.FC = () => {
try {
setLoading(true);
setError(null);
const fileList = await list_directory(path);
const fileList = await FileExplorerAPI.list_directory(path);

// Backend returns files for the requested directory with 2 levels of depth
// We need to include all files so the tree structure works, but we'll filter
Expand All @@ -64,9 +64,9 @@ const FileExplorer: React.FC = () => {
}
};

const loadSubdirectory = async (path: string): Promise<FileInfo[]> => {
const loadSubdirectory = async (path: string): Promise<FileExplorerAPI.FileInfo[]> => {
try {
const fileList = await list_directory(path);
const fileList = await FileExplorerAPI.list_directory(path);

// Filter out the directory itself and return only its contents
const filteredFiles = fileList.filter(file => {
Expand All @@ -85,7 +85,7 @@ const FileExplorer: React.FC = () => {
useEffect(() => {
const initializeDirectory = async () => {
try {
const cwd = await get_current_directory();
const cwd = await FileExplorerAPI.get_current_directory();
setCurrentPath(cwd);
} catch (err) {
// If getting cwd fails, fall back to root
Expand Down Expand Up @@ -119,7 +119,7 @@ const FileExplorer: React.FC = () => {
: `${currentPath}/${folderName}`;

try {
await create_directory(newPath);
await FileExplorerAPI.create_directory(newPath);
await loadDirectory(currentPath);
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to create folder');
Expand All @@ -137,7 +137,7 @@ const FileExplorer: React.FC = () => {

try {
// Create an empty file
await create_file(newPath, []);
await FileExplorerAPI.create_file(newPath, []);
await loadDirectory(currentPath);
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to create file');
Expand All @@ -153,9 +153,9 @@ const FileExplorer: React.FC = () => {
for (const path of selectedFiles) {
const file = files.find(f => f.path === path);
if (file?.is_directory) {
await delete_directory(path);
await FileExplorerAPI.delete_directory(path);
} else {
await delete_file(path);
await FileExplorerAPI.delete_file(path);
}
}
clearSelection();
Expand Down
Loading