Skip to content

Feature : Multi projects tab - #357

Open
bertinma wants to merge 8 commits into
gpxstudio:mainfrom
bertinma:feature/multi-tab
Open

bertinma wants to merge 8 commits into
gpxstudio:mainfrom
bertinma:feature/multi-tab

Conversation

@bertinma

@bertinma bertinma commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • Each project gets its own isolated Dexie IndexedDB (gpxstudio-{projectId})
  • A registry DB (gpxstudio-registry) stores project metadata (name, createdAt, updatedAt)
  • Shared overpass tile cache extracted to a dedicated gpxstudio-shared DB (preserved across projects)
  • Tab bar above the menu: create, rename (double-click or right-click), delete (with confirmation if project has files), switch — max 10 projects
  • Map camera position (center, zoom, bearing, pitch) saved per-project and restored on tab switch
  • One-time migration from the legacy Database IndexedDB to gpxstudio-project-0 on first run
  • FileActionManager gains reconnectToDatabase() / disconnectFromDatabase() for clean DB swapping

Test plan

  • App loads with "Project 1" tab and existing files visible
  • Click + → "Project 2" created, empty file list
  • Add a GPX to Project 2, switch to Project 1 → file not visible
  • Switch back to Project 2 → file still there
  • Undo/redo history is independent per project
  • Map camera restores per-project on tab switch
  • Double-click tab → inline rename, persists on reload
  • Right-click tab → Rename / Delete context menu
  • Delete tab with files → confirmation dialog appears
  • Delete tab without files → immediate, no dialog
  • Deleting an inactive tab does not switch active tab
  • Overpass POI cache shared across tabs (no re-fetch on switch)
  • Existing users: data migrated from old DB automatically

bertinma and others added 8 commits June 4, 2026 23:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…db.ts

Move overpasstiles/overpassdata to SharedDatabase (gpxstudio-shared).
Refactor Database to accept name param, add createProjectDatabase() factory.
Update overpass-layer.ts to use sharedDb.
Adds project-registry.ts with Dexie-backed registry DB, liveQuery store,
CRUD helpers, and one-time migration from legacy Database IndexedDB.
Save liveQuery subscription handles and add disconnectFromDatabase() and
reconnectToDatabase() methods to support database switching.
Adds active-project.ts with currentDb store, camera persistence helpers
(saveMapCamera/restoreMapCamera), and switchToProject which orchestrates
DB swapping across all state managers when the user changes tabs.
Horizontal tab strip for switching between projects with inline rename,
right-click context menu, delete confirmation dialog, and + button.
…able hash

- Replace static db import with initializeProjects() + currentDb
- Add ProjectTabBar above Menu
- Pass hash={false} to Map component
- Save camera on destroy via saveMapCamera
- Add project.* i18n keys to en.json
- CRITICAL: reconnect fileActionManager on initial load (data loss fix)
- CRITICAL: check correct project DB when deciding to show delete confirm
- IMPORTANT: only switch active tab when deleting the active project
- IMPORTANT: add re-entrancy guard to switchToProject
- IMPORTANT: fix i18n key cancel → project.cancel in AlertDialog

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant