feat: implement Phase 12.3 - Project Export/Import

Added full export/import functionality for projects:

Export Features:
- Export button for each project in Projects dialog
- Downloads project as JSON file with all data
- Includes tracks, audio buffers, effects, automation, settings
- Filename format: {project_name}_{timestamp}.json

Import Features:
- Import button in Projects dialog header
- File picker for .json files
- Automatically generates new project ID to avoid conflicts
- Appends "(Imported)" to project name
- Preserves all project data

This enables:
- Backup of projects outside the browser
- Sharing projects with collaborators
- Migration between computers/browsers
- Version snapshots at different stages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-19 10:25:06 +01:00
parent 9ad504478d
commit a626427142
3 changed files with 150 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
'use client';
import * as React from 'react';
import { X, Plus, Trash2, Copy, FolderOpen } from 'lucide-react';
import { X, Plus, Trash2, Copy, FolderOpen, Download, Upload } from 'lucide-react';
import { Button } from '@/components/ui/Button';
import type { ProjectMetadata } from '@/lib/storage/db';
import { formatDuration } from '@/lib/audio/decoder';
@@ -14,6 +14,8 @@ export interface ProjectsDialogProps {
onLoadProject: (projectId: string) => void;
onDeleteProject: (projectId: string) => void;
onDuplicateProject: (projectId: string) => void;
onExportProject: (projectId: string) => void;
onImportProject: () => void;
}
export function ProjectsDialog({
@@ -24,6 +26,8 @@ export function ProjectsDialog({
onLoadProject,
onDeleteProject,
onDuplicateProject,
onExportProject,
onImportProject,
}: ProjectsDialogProps) {
if (!open) return null;
@@ -44,6 +48,15 @@ export function ProjectsDialog({
<div className="flex items-center justify-between p-6 border-b border-border">
<h2 className="text-lg font-semibold text-foreground">Projects</h2>
<div className="flex items-center gap-2">
<Button
onClick={onImportProject}
variant="outline"
size="sm"
className="gap-2"
>
<Upload className="h-4 w-4" />
Import
</Button>
<Button
onClick={onNewProject}
variant="default"
@@ -111,6 +124,13 @@ export function ProjectsDialog({
>
Open
</button>
<button
onClick={() => onExportProject(project.id)}
className="p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors"
title="Export project"
>
<Download className="h-4 w-4" />
</button>
<button
onClick={() => onDuplicateProject(project.id)}
className="p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors"