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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pytorch_connectomics/
.coverage
coverage.xml
dist/
.env
.env.*

*.log
.github/workflows/docker-test.yml
86 changes: 86 additions & 0 deletions COPILOT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
**Project Summary**
- **Name:** pytc-client — Desktop client and services for Pytorch Connectomics
- **Purpose:** Electron + React desktop client that interacts with FastAPI backend services and the `pytorch_connectomics` library for connectomics workflows.

**Top-level Structure**
- **`client/`**: Electron + React frontend (CRA). Important files:
- `client/package.json` — frontend scripts (`start`, `build`, `electron`).
- `client/main.js` — Electron entrypoint.
- `client/src/` — React source; components in `client/src/components/`.
- **`server_api/`**: FastAPI application (API server)
- `server_api/main.py` — API entrypoint.
- `server_api/requirements.txt` — Python deps for API.
- **`server_pytc/`**: PyTC worker service used for model inference or background tasks
- `server_pytc/main.py` — worker entrypoint.
- **`pytorch_connectomics/`**: Library (local package) with models, configs, and utilities used by the worker.
- `pytorch_connectomics/setup.py` — library install entry.
- `pytorch_connectomics/configs/` — example YAML config files.
- **`docker/`**: Docker resources for containerized backend; root `docker-compose.yaml` / `Dockerfile` exist.
- **`scripts/`**: Helper scripts
- `scripts/bootstrap.sh` / `scripts/bootstrap.ps1` — one-time install/bootstrap
- `start.sh` / `start.bat` — start the full stack (servers + Electron client)
- **`docs/`, `notebooks/`, `tests/`**: documentation, Jupyter notebooks, and unit tests respectively.

**Important Root Files**
- `package.json` (root): convenience npm scripts added to operate on the `client/` folder from repository root.
- `README.md`: project setup and running instructions.

**Common Developer Commands**
- Bootstrap (one-time):
```bash
./scripts/bootstrap.sh # macOS / Linux
scripts\bootstrap.ps1 # Windows PowerShell
```
- Start full stack (desktop + services):
```bash
./start.sh # macOS / Linux
start.bat # Windows CMD
```
- Build frontend from repo root (convenience scripts added):
```bash
npm run client:install # install dependencies inside `client/`
npm run client:build # build production frontend in `client/build`
npm run client:dev # run frontend dev server (react-scripts start)
npm run client:electron # run Electron (`electron .`) from `client/`
```
- Manual backend run (dev):
```bash
python -m venv .venv
# activate venv
source .venv/bin/activate # macOS / Linux
.\.venv\Scripts\activate # Windows PowerShell
pip install -r server_api/requirements.txt
python server_api/main.py
python server_pytc/main.py
```
- Tests:
```bash
pytest -q
```
- Docker backend (build & run):
```bash
docker compose build backend
docker compose up backend
docker compose down
```

**Where to Make Changes**
- Frontend UI / components: edit `client/src/` and update `client/package.json` scripts as needed.
- Electron behavior: edit `client/main.js` and electron-specific code.
- API endpoints & backend logic: edit `server_api/` (FastAPI) and `server_pytc/` for worker behavior.
- Models/configs: `pytorch_connectomics/` contains models, configs, and experiment YAMLs.

**CI / Automation Tips**
- CI jobs can call `npm --prefix client run build` (same as `npm run client:build`) to build frontend from repo root.
- For parallel dev workflows (backend + frontend concurrently), consider adding `concurrently` or `npm-run-all` as dev dependencies and a `dev` script in root.

**Notes & Recommendations**
- Root `package.json` now includes `client:*` convenience scripts that use `npm --prefix client` to be cross-platform.
- `client/package.json` uses `react-scripts` and defines `build` and `electron` scripts; keep those in sync when modifying frontend tooling.
- Use `start.sh` / `start.bat` for the supported, repository-provided startup flow when possible.

**Contact / Reference**
- See `README.md` for more detailed setup and video demo link.
- Use `tests/` for examples of expected behavior and for regression checks.

(Generated by Copilot assistant for developer reference.)
95 changes: 95 additions & 0 deletions DEVLOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# DEVLOG.md — pytc-client Development Log

This file records the major development steps, design decisions, and UI/UX changes made to the pytc-client project. It is formatted for easy reading by humans and AI agents.

---

## Project Context
- **Repo:** PytorchConnectomics/pytc-client
- **Frontend:** React + Electron (Ant Design)
- **Backend:** FastAPI (Python), local user management for prototype

---

## Major Features & Changes

### [2025-11-21] Backend User Management
* **Backend Auth**: Integrated FastAPI with `python-jose` (JWT) and `passlib` (bcrypt) for secure authentication.
* **Database**: Added SQLite database (`sql_app.db`) with SQLAlchemy models for Users.
* **Frontend Integration**: Updated `UserContext` to communicate with backend endpoints (`/register`, `/token`, `/users/me`) instead of local storage.
* **Dependencies**: Added `python-jose`, `passlib`, `sqlalchemy` to requirements.

### [2025-11-21] Advanced File Management & UI Polish
* **Manual Sign Out**: Added a sign-out button to the header, allowing users to return to the Welcome screen.
* **File Previews**: Implemented a preview modal for files (images and text) triggered by double-click or context menu.
* **Multi-Select & Drag Selection**: Added drag selection box and keyboard shortcuts (Ctrl/Shift) for selecting multiple files.
* **Enhanced Drag & Drop**: Enabled moving multiple selected files/folders at once, including within the same parent directory.
* **Context Menu Enhancements**: Updated context menu to handle multiple selections (bulk Copy/Delete) and hide "Preview" for multi-select.
* **Bug Fixes**: Resolved issues with drag selection (single item) and Electron path handling on Windows.

### 1. Welcome Page
- Added a full-screen Welcome page as the app's entry point.
- Includes project name, intro, and warm message.
- Two buttons: "Sign in" and "Sign up".
- Styled to resemble cursor.com (modern, clean, gradient background).
- Welcome page is always shown on app start (automatic sign out).

### 2. Backend User Management (New)
- Replaced local storage with production-ready backend auth.
- Users are stored in `server_api/sql_app.db` (SQLite).
- Passwords are hashed with bcrypt.
- JWT tokens used for session management (stored in localStorage).

### 3. Main App Navigation
- After login, user sees main app view (tabs: Visualization, Model Training, Model Inference, Tensorboard, Files).
- "Welcome" tab removed from main menu after login.
- Navigation to Welcome page is blocked after login.

### 4. Files Tab (Google Drive-like)
- Files tab shows three file slots per user.
- Each slot displays file info (name, size, type) or "Empty".
- Upload, rename, and delete actions for each slot (Ant Design components).
- Upload is local only; rename uses modal; delete clears slot.

### 5. Debugging & Build Process
- Debug banners/messages added and removed for troubleshooting.
- Reminder: Electron app uses static build (`client/build/`), so `npm run build` is required after code changes.
- Hot reload only works in browser dev mode (`npm start`).

---

## Known Issues & Fixes
- [x] Welcome page not showing: fixed by auto sign out on app start.
- [x] "Welcome" tab visible after login: removed from menu.
- [x] Debug messages visible: removed.
- [x] Modals not working in Electron: fixed after proper build/restart.
- [x] Drag selection not selecting single items: fixed.
- [x] Electron "ERR_FILE_NOT_FOUND": fixed path separator in main.js.

---

## Next Steps / TODOs
- [x] Add multi-file support or previews in Files tab.
- [x] Add manual sign-out button in main app view.
- [x] Integrate backend user management (FastAPI, JWT, etc.) for production.
- [ ] Add user profile editing and avatar upload.
- [ ] Improve file upload to support actual file storage (not just metadata).

---

## How to Develop & Test
- Make code changes in `client/src/`.
- Run `npm --prefix client run build` to update the Electron app.
- Start the app with `./start.bat`.
- For live development, use `npm start` (browser only).

---

## AI Agent Notes
- All major UI/UX changes, context, and user flows are documented here.
- Use this file to bootstrap further development, onboarding, or automation.
- For backend integration, see FastAPI endpoints and user model notes above.

---

_Last updated: 2025-11-21_
29 changes: 29 additions & 0 deletions bash.exe.stackdump
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Stack trace:
Frame Function Args
0007FFFFBBB0 00021006118E (00021028DEE8, 000210272B3E, 0007FFFFBBB0, 0007FFFFAAB0) msys-2.0.dll+0x2118E
0007FFFFBBB0 0002100469BA (000000000000, 000000000000, 000000000000, 0007FFFFBE88) msys-2.0.dll+0x69BA
0007FFFFBBB0 0002100469F2 (00021028DF99, 0007FFFFBA68, 0007FFFFBBB0, 000000000000) msys-2.0.dll+0x69F2
0007FFFFBBB0 00021006A41E (000000000000, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x2A41E
0007FFFFBBB0 00021006A545 (0007FFFFBBC0, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x2A545
0007FFFFBE90 00021006B9A5 (0007FFFFBBC0, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x2B9A5
End of stack trace
Loaded modules:
000100400000 bash.exe
7FFA3F430000 ntdll.dll
7FFA3E6F0000 KERNEL32.DLL
7FFA3CF90000 KERNELBASE.dll
7FFA3EDD0000 USER32.dll
7FFA3D290000 win32u.dll
000210040000 msys-2.0.dll
7FFA3D510000 GDI32.dll
7FFA3CE70000 gdi32full.dll
7FFA3CAC0000 msvcp_win.dll
7FFA3CB60000 ucrtbase.dll
7FFA3D450000 advapi32.dll
7FFA3D8B0000 msvcrt.dll
7FFA3D730000 sechost.dll
7FFA3E4E0000 RPCRT4.dll
7FFA3CE40000 bcrypt.dll
7FFA3C2A0000 CRYPTBASE.DLL
7FFA3D370000 bcryptPrimitives.dll
7FFA3EC80000 IMM32.DLL
6 changes: 4 additions & 2 deletions client/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
REACT_APP_API_PROTOCOL=http
REACT_APP_API_URL=localhost:4242
SKIP_PREFLIGHT_CHECK=true
REACT_APP_SERVER_PROTOCOL=http
REACT_APP_SERVER_URL=localhost:4242
PORT=3001
8 changes: 5 additions & 3 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ require('electron-reload')(__dirname, {

let mainWindow

function createWindow () {
function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
contextIsolation: false,
webSecurity: false, // Allow loading iframes from localhost
allowRunningInsecureContent: true
}
})

mainWindow.loadURL(url.format({
pathname: path.join(__dirname, './build/index.html'),
pathname: path.join(__dirname, 'build', 'index.html'),
protocol: 'file:',
slashes: true
}))
Expand Down
86 changes: 78 additions & 8 deletions client/package-lock.json

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

Loading