Merge branch 'main' of https://github.com/mazeincoding/AppCut
This commit is contained in:
@ -1,30 +1,43 @@
|
|||||||
FROM oven/bun:latest AS base
|
FROM oven/bun:alpine AS base
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies and build the application
|
||||||
FROM base AS deps
|
|
||||||
WORKDIR /app
|
|
||||||
COPY package.json bun.lock ./
|
|
||||||
RUN bun install --frozen-lockfile
|
|
||||||
|
|
||||||
# Build the application
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
COPY . .
|
COPY package.json package.json
|
||||||
|
COPY bun.lock bun.lock
|
||||||
|
COPY turbo.json turbo.json
|
||||||
|
|
||||||
|
COPY apps/web/package.json apps/web/package.json
|
||||||
|
COPY packages/db/package.json packages/db/package.json
|
||||||
|
COPY packages/auth/package.json packages/auth/package.json
|
||||||
|
|
||||||
|
RUN bun install
|
||||||
|
|
||||||
|
COPY apps/web/ apps/web/
|
||||||
|
COPY packages/db/ packages/db/
|
||||||
|
COPY packages/auth/ packages/auth/
|
||||||
|
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
WORKDIR /app/apps/web
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
# Production image
|
# Production image
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
|
||||||
|
|
||||||
|
RUN chown nextjs:nodejs apps
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
@ -33,4 +46,4 @@ EXPOSE 3000
|
|||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV HOSTNAME="0.0.0.0"
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
|
||||||
CMD ["bun", "server.js"]
|
CMD ["bun", "apps/web/server.js"]
|
@ -13,7 +13,7 @@ if (!process.env.DATABASE_URL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
schema: "./src/lib/db/schema.ts",
|
schema: "../../packages/db/src/schema.ts",
|
||||||
dialect: "postgresql",
|
dialect: "postgresql",
|
||||||
dbCredentials: {
|
dbCredentials: {
|
||||||
url: process.env.DATABASE_URL,
|
url: process.env.DATABASE_URL,
|
||||||
|
@ -6,6 +6,7 @@ const nextConfig: NextConfig = {
|
|||||||
},
|
},
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
productionBrowserSourceMaps: true,
|
productionBrowserSourceMaps: true,
|
||||||
|
output: "standalone",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
"@hookform/resolvers": "^3.9.1",
|
"@hookform/resolvers": "^3.9.1",
|
||||||
"@opencut/auth": "workspace:*",
|
"@opencut/auth": "workspace:*",
|
||||||
"@opencut/db": "workspace:*",
|
"@opencut/db": "workspace:*",
|
||||||
"@types/pg": "^8.15.4",
|
|
||||||
"@upstash/ratelimit": "^2.0.5",
|
"@upstash/ratelimit": "^2.0.5",
|
||||||
"@upstash/redis": "^1.35.0",
|
"@upstash/redis": "^1.35.0",
|
||||||
"@vercel/analytics": "^1.4.1",
|
"@vercel/analytics": "^1.4.1",
|
||||||
@ -57,6 +56,7 @@
|
|||||||
"zustand": "^5.0.2"
|
"zustand": "^5.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/pg": "^8.15.4",
|
||||||
"@types/bun": "latest",
|
"@types/bun": "latest",
|
||||||
"@types/react": "^18.2.48",
|
"@types/react": "^18.2.48",
|
||||||
"@types/react-dom": "^18.2.18",
|
"@types/react-dom": "^18.2.18",
|
||||||
|
File diff suppressed because one or more lines are too long
BIN
apps/web/public/opengraph-image.jpg
Normal file
BIN
apps/web/public/opengraph-image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
5
apps/web/src/app/api/health/route.ts
Normal file
5
apps/web/src/app/api/health/route.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { NextRequest } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(request: NextRequest) {
|
||||||
|
return new Response("OK", { status: 200 });
|
||||||
|
}
|
@ -16,6 +16,35 @@ export const metadata: Metadata = {
|
|||||||
title: "OpenCut",
|
title: "OpenCut",
|
||||||
description:
|
description:
|
||||||
"A simple but powerful video editor that gets the job done. In your browser.",
|
"A simple but powerful video editor that gets the job done. In your browser.",
|
||||||
|
openGraph: {
|
||||||
|
title: "OpenCut",
|
||||||
|
description:
|
||||||
|
"A simple but powerful video editor that gets the job done. In your browser.",
|
||||||
|
url: "https://opencut.app",
|
||||||
|
siteName: "OpenCut",
|
||||||
|
locale: "en_US",
|
||||||
|
type: "website",
|
||||||
|
images: [
|
||||||
|
{
|
||||||
|
url: "https://opencut.app/opengraph-image.jpg",
|
||||||
|
width: 1200,
|
||||||
|
height: 630,
|
||||||
|
alt: "OpenCut",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
twitter: {
|
||||||
|
card: "summary_large_image",
|
||||||
|
title: "OpenCut",
|
||||||
|
description:
|
||||||
|
"A simple but powerful video editor that gets the job done. In your browser.",
|
||||||
|
creator: "@opencutapp",
|
||||||
|
images: ["/opengraph-image.jpg"],
|
||||||
|
},
|
||||||
|
robots: {
|
||||||
|
index: true,
|
||||||
|
follow: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
|
@ -6,6 +6,7 @@ import { ChevronLeft, Download } from "lucide-react";
|
|||||||
import { useProjectStore } from "@/stores/project-store";
|
import { useProjectStore } from "@/stores/project-store";
|
||||||
import { useTimelineStore } from "@/stores/timeline-store";
|
import { useTimelineStore } from "@/stores/timeline-store";
|
||||||
import { HeaderBase } from "./header-base";
|
import { HeaderBase } from "./header-base";
|
||||||
|
import { ProjectNameEditor } from "./editor/project-name-editor";
|
||||||
|
|
||||||
export function EditorHeader() {
|
export function EditorHeader() {
|
||||||
const { activeProject } = useProjectStore();
|
const { activeProject } = useProjectStore();
|
||||||
@ -24,13 +25,15 @@ export function EditorHeader() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const leftContent = (
|
const leftContent = (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
<Link
|
<Link
|
||||||
href="/"
|
href="/"
|
||||||
className="font-medium tracking-tight flex items-center gap-2 hover:opacity-80 transition-opacity"
|
className="font-medium tracking-tight flex items-center gap-2 hover:opacity-80 transition-opacity"
|
||||||
>
|
>
|
||||||
<ChevronLeft className="h-4 w-4" />
|
<ChevronLeft className="h-4 w-4" />
|
||||||
<span className="text-sm">{activeProject?.name || "Loading..."}</span>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
<ProjectNameEditor />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const centerContent = (
|
const centerContent = (
|
||||||
|
115
apps/web/src/components/editor/audio-waveform.tsx
Normal file
115
apps/web/src/components/editor/audio-waveform.tsx
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
import WaveSurfer from 'wavesurfer.js';
|
||||||
|
|
||||||
|
interface AudioWaveformProps {
|
||||||
|
audioUrl: string;
|
||||||
|
height?: number;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AudioWaveform: React.FC<AudioWaveformProps> = ({
|
||||||
|
audioUrl,
|
||||||
|
height = 32,
|
||||||
|
className = ''
|
||||||
|
}) => {
|
||||||
|
const waveformRef = useRef<HTMLDivElement>(null);
|
||||||
|
const wavesurfer = useRef<WaveSurfer | null>(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
const [error, setError] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let mounted = true;
|
||||||
|
|
||||||
|
const initWaveSurfer = async () => {
|
||||||
|
if (!waveformRef.current || !audioUrl) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Clean up any existing instance
|
||||||
|
if (wavesurfer.current) {
|
||||||
|
try {
|
||||||
|
wavesurfer.current.destroy();
|
||||||
|
} catch (e) {
|
||||||
|
// Silently ignore destroy errors
|
||||||
|
}
|
||||||
|
wavesurfer.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
wavesurfer.current = WaveSurfer.create({
|
||||||
|
container: waveformRef.current,
|
||||||
|
waveColor: 'rgba(255, 255, 255, 0.6)',
|
||||||
|
progressColor: 'rgba(255, 255, 255, 0.9)',
|
||||||
|
cursorColor: 'transparent',
|
||||||
|
barWidth: 2,
|
||||||
|
barGap: 1,
|
||||||
|
height: height,
|
||||||
|
normalize: true,
|
||||||
|
interact: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Event listeners
|
||||||
|
wavesurfer.current.on('ready', () => {
|
||||||
|
if (mounted) {
|
||||||
|
setIsLoading(false);
|
||||||
|
setError(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
wavesurfer.current.on('error', (err) => {
|
||||||
|
console.error('WaveSurfer error:', err);
|
||||||
|
if (mounted) {
|
||||||
|
setError(true);
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await wavesurfer.current.load(audioUrl);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to initialize WaveSurfer:', err);
|
||||||
|
if (mounted) {
|
||||||
|
setError(true);
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
initWaveSurfer();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
mounted = false;
|
||||||
|
if (wavesurfer.current) {
|
||||||
|
try {
|
||||||
|
wavesurfer.current.destroy();
|
||||||
|
} catch (e) {
|
||||||
|
// Silently ignore destroy errors
|
||||||
|
}
|
||||||
|
wavesurfer.current = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [audioUrl, height]);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return (
|
||||||
|
<div className={`flex items-center justify-center ${className}`} style={{ height }}>
|
||||||
|
<span className="text-xs text-foreground/60">Audio unavailable</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`relative ${className}`}>
|
||||||
|
{isLoading && (
|
||||||
|
<div className="absolute inset-0 flex items-center justify-center">
|
||||||
|
<span className="text-xs text-foreground/60">Loading...</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div
|
||||||
|
ref={waveformRef}
|
||||||
|
className={`w-full transition-opacity duration-200 ${isLoading ? 'opacity-0' : 'opacity-100'}`}
|
||||||
|
style={{ height }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AudioWaveform;
|
@ -84,11 +84,14 @@ export function MediaPanel() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const filtered = mediaItems.filter((item) => {
|
const filtered = mediaItems.filter((item) => {
|
||||||
if (mediaFilter && mediaFilter !== 'all' && item.type !== mediaFilter) {
|
if (mediaFilter && mediaFilter !== "all" && item.type !== mediaFilter) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchQuery && !item.name.toLowerCase().includes(searchQuery.toLowerCase())) {
|
if (
|
||||||
|
searchQuery &&
|
||||||
|
!item.name.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,17 +236,22 @@ export function MediaPanel() {
|
|||||||
size="sm"
|
size="sm"
|
||||||
onClick={handleFileSelect}
|
onClick={handleFileSelect}
|
||||||
disabled={isProcessing}
|
disabled={isProcessing}
|
||||||
className="flex-none min-w-[80px] whitespace-nowrap"
|
className="flex-none min-w-[30px] whitespace-nowrap overflow-hidden px-2 justify-center items-center"
|
||||||
>
|
>
|
||||||
{isProcessing ? (
|
{isProcessing ? (
|
||||||
<>
|
<>
|
||||||
<Upload className="h-4 w-4 mr-2 animate-spin" />
|
<Upload className="h-4 w-4 animate-spin" />
|
||||||
Processing...
|
<span className="hidden md:inline ml-2">Processing...</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Plus className="h-4 w-4" />
|
<Plus className="h-4 w-4" />
|
||||||
|
<span
|
||||||
|
className="hidden sm:inline ml-2"
|
||||||
|
aria-label="Add file"
|
||||||
|
>
|
||||||
Add
|
Add
|
||||||
|
</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@ -276,7 +284,15 @@ export function MediaPanel() {
|
|||||||
<AspectRatio ratio={item.aspectRatio}>
|
<AspectRatio ratio={item.aspectRatio}>
|
||||||
{renderPreview(item)}
|
{renderPreview(item)}
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
<span className="text-xs truncate px-1">{item.name}</span>
|
<span
|
||||||
|
className="text-xs truncate px-1 max-w-full"
|
||||||
|
aria-label={item.name}
|
||||||
|
title={item.name}
|
||||||
|
>
|
||||||
|
{item.name.length > 8
|
||||||
|
? `${item.name.slice(0, 4)}...${item.name.slice(-3)}`
|
||||||
|
: item.name}
|
||||||
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* Show remove button on hover */}
|
{/* Show remove button on hover */}
|
||||||
|
@ -5,16 +5,17 @@ import { useMediaStore } from "@/stores/media-store";
|
|||||||
import { usePlaybackStore } from "@/stores/playback-store";
|
import { usePlaybackStore } from "@/stores/playback-store";
|
||||||
import { VideoPlayer } from "@/components/ui/video-player";
|
import { VideoPlayer } from "@/components/ui/video-player";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Play, Pause } from "lucide-react";
|
import { Play, Pause, Volume2, VolumeX } from "lucide-react";
|
||||||
import { useState, useRef } from "react";
|
import { useState, useRef } from "react";
|
||||||
|
|
||||||
// Debug flag - set to false to hide active clips info
|
// Debug flag - set to false to hide active clips info
|
||||||
const SHOW_DEBUG_INFO = process.env.NODE_ENV === 'development';
|
const SHOW_DEBUG_INFO = process.env.NODE_ENV === "development";
|
||||||
|
|
||||||
export function PreviewPanel() {
|
export function PreviewPanel() {
|
||||||
const { tracks } = useTimelineStore();
|
const { tracks } = useTimelineStore();
|
||||||
const { mediaItems } = useMediaStore();
|
const { mediaItems } = useMediaStore();
|
||||||
const { isPlaying, toggle, currentTime } = usePlaybackStore();
|
const { isPlaying, toggle, currentTime, muted, toggleMute, volume } =
|
||||||
|
usePlaybackStore();
|
||||||
const [canvasSize, setCanvasSize] = useState({ width: 1920, height: 1080 });
|
const [canvasSize, setCanvasSize] = useState({ width: 1920, height: 1080 });
|
||||||
const [showDebug, setShowDebug] = useState(SHOW_DEBUG_INFO);
|
const [showDebug, setShowDebug] = useState(SHOW_DEBUG_INFO);
|
||||||
const previewRef = useRef<HTMLDivElement>(null);
|
const previewRef = useRef<HTMLDivElement>(null);
|
||||||
@ -30,10 +31,12 @@ export function PreviewPanel() {
|
|||||||
tracks.forEach((track) => {
|
tracks.forEach((track) => {
|
||||||
track.clips.forEach((clip) => {
|
track.clips.forEach((clip) => {
|
||||||
const clipStart = clip.startTime;
|
const clipStart = clip.startTime;
|
||||||
const clipEnd = clip.startTime + (clip.duration - clip.trimStart - clip.trimEnd);
|
const clipEnd =
|
||||||
|
clip.startTime + (clip.duration - clip.trimStart - clip.trimEnd);
|
||||||
|
|
||||||
if (currentTime >= clipStart && currentTime < clipEnd) {
|
if (currentTime >= clipStart && currentTime < clipEnd) {
|
||||||
const mediaItem = clip.mediaId === "test"
|
const mediaItem =
|
||||||
|
clip.mediaId === "test"
|
||||||
? { type: "test", name: clip.name, url: "", thumbnailUrl: "" }
|
? { type: "test", name: clip.name, url: "", thumbnailUrl: "" }
|
||||||
: mediaItems.find((item) => item.id === clip.mediaId);
|
: mediaItems.find((item) => item.id === clip.mediaId);
|
||||||
|
|
||||||
@ -134,13 +137,19 @@ export function PreviewPanel() {
|
|||||||
<select
|
<select
|
||||||
value={`${canvasSize.width}x${canvasSize.height}`}
|
value={`${canvasSize.width}x${canvasSize.height}`}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const preset = canvasPresets.find(p => `${p.width}x${p.height}` === e.target.value);
|
const preset = canvasPresets.find(
|
||||||
if (preset) setCanvasSize({ width: preset.width, height: preset.height });
|
(p) => `${p.width}x${p.height}` === e.target.value
|
||||||
|
);
|
||||||
|
if (preset)
|
||||||
|
setCanvasSize({ width: preset.width, height: preset.height });
|
||||||
}}
|
}}
|
||||||
className="bg-background border rounded px-2 py-1 text-xs"
|
className="bg-background border rounded px-2 py-1 text-xs"
|
||||||
>
|
>
|
||||||
{canvasPresets.map(preset => (
|
{canvasPresets.map((preset) => (
|
||||||
<option key={preset.name} value={`${preset.width}x${preset.height}`}>
|
<option
|
||||||
|
key={preset.name}
|
||||||
|
value={`${preset.width}x${preset.height}`}
|
||||||
|
>
|
||||||
{preset.name} ({preset.width}×{preset.height})
|
{preset.name} ({preset.width}×{preset.height})
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
@ -154,12 +163,30 @@ export function PreviewPanel() {
|
|||||||
onClick={() => setShowDebug(!showDebug)}
|
onClick={() => setShowDebug(!showDebug)}
|
||||||
className="text-xs"
|
className="text-xs"
|
||||||
>
|
>
|
||||||
Debug {showDebug ? 'ON' : 'OFF'}
|
Debug {showDebug ? "ON" : "OFF"}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Button variant="outline" size="sm" onClick={toggle} className="ml-auto">
|
<Button
|
||||||
{isPlaying ? <Pause className="h-3 w-3 mr-1" /> : <Play className="h-3 w-3 mr-1" />}
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={toggleMute}
|
||||||
|
className="ml-auto"
|
||||||
|
>
|
||||||
|
{muted || volume === 0 ? (
|
||||||
|
<VolumeX className="h-3 w-3 mr-1" />
|
||||||
|
) : (
|
||||||
|
<Volume2 className="h-3 w-3 mr-1" />
|
||||||
|
)}
|
||||||
|
{muted || volume === 0 ? "Unmute" : "Mute"}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button variant="outline" size="sm" onClick={toggle}>
|
||||||
|
{isPlaying ? (
|
||||||
|
<Pause className="h-3 w-3 mr-1" />
|
||||||
|
) : (
|
||||||
|
<Play className="h-3 w-3 mr-1" />
|
||||||
|
)}
|
||||||
{isPlaying ? "Pause" : "Play"}
|
{isPlaying ? "Pause" : "Play"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@ -177,7 +204,9 @@ export function PreviewPanel() {
|
|||||||
>
|
>
|
||||||
{activeClips.length === 0 ? (
|
{activeClips.length === 0 ? (
|
||||||
<div className="absolute inset-0 flex items-center justify-center text-white/50">
|
<div className="absolute inset-0 flex items-center justify-center text-white/50">
|
||||||
{tracks.length === 0 ? "Drop media to start editing" : "No clips at current time"}
|
{tracks.length === 0
|
||||||
|
? "Drop media to start editing"
|
||||||
|
: "No clips at current time"}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
activeClips.map((clipData, index) => renderClip(clipData, index))
|
activeClips.map((clipData, index) => renderClip(clipData, index))
|
||||||
@ -188,7 +217,9 @@ export function PreviewPanel() {
|
|||||||
{/* Debug Info Panel - Conditionally rendered */}
|
{/* Debug Info Panel - Conditionally rendered */}
|
||||||
{showDebug && (
|
{showDebug && (
|
||||||
<div className="border-t bg-background p-2 flex-shrink-0">
|
<div className="border-t bg-background p-2 flex-shrink-0">
|
||||||
<div className="text-xs font-medium mb-1">Debug: Active Clips ({activeClips.length})</div>
|
<div className="text-xs font-medium mb-1">
|
||||||
|
Debug: Active Clips ({activeClips.length})
|
||||||
|
</div>
|
||||||
<div className="flex gap-2 overflow-x-auto">
|
<div className="flex gap-2 overflow-x-auto">
|
||||||
{activeClips.map((clipData, index) => (
|
{activeClips.map((clipData, index) => (
|
||||||
<div
|
<div
|
||||||
@ -199,7 +230,9 @@ export function PreviewPanel() {
|
|||||||
{index + 1}
|
{index + 1}
|
||||||
</span>
|
</span>
|
||||||
<span>{clipData.clip.name}</span>
|
<span>{clipData.clip.name}</span>
|
||||||
<span className="text-muted-foreground">({clipData.mediaItem?.type || 'test'})</span>
|
<span className="text-muted-foreground">
|
||||||
|
({clipData.mediaItem?.type || "test"})
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{activeClips.length === 0 && (
|
{activeClips.length === 0 && (
|
||||||
|
110
apps/web/src/components/editor/project-name-editor.tsx
Normal file
110
apps/web/src/components/editor/project-name-editor.tsx
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState, useRef, useEffect } from "react";
|
||||||
|
import { Input } from "../ui/input";
|
||||||
|
import { useProjectStore } from "@/stores/project-store";
|
||||||
|
import { Edit2, Check, X } from "lucide-react";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
|
|
||||||
|
interface ProjectNameEditorProps {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ProjectNameEditor({ className }: ProjectNameEditorProps) {
|
||||||
|
const { activeProject, updateProjectName } = useProjectStore();
|
||||||
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
|
const [editValue, setEditValue] = useState("");
|
||||||
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (activeProject) {
|
||||||
|
setEditValue(activeProject.name);
|
||||||
|
}
|
||||||
|
}, [activeProject]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEditing && inputRef.current) {
|
||||||
|
inputRef.current.focus();
|
||||||
|
inputRef.current.select();
|
||||||
|
}
|
||||||
|
}, [isEditing]);
|
||||||
|
|
||||||
|
const handleStartEdit = () => {
|
||||||
|
if (activeProject) {
|
||||||
|
setEditValue(activeProject.name);
|
||||||
|
setIsEditing(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
if (editValue.trim()) {
|
||||||
|
updateProjectName(editValue.trim());
|
||||||
|
setIsEditing(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
if (activeProject) {
|
||||||
|
setEditValue(activeProject.name);
|
||||||
|
}
|
||||||
|
setIsEditing(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
handleSave();
|
||||||
|
} else if (e.key === "Escape") {
|
||||||
|
handleCancel();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!activeProject) {
|
||||||
|
return <span className="text-sm text-muted-foreground">Loading...</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEditing) {
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Input
|
||||||
|
ref={inputRef}
|
||||||
|
value={editValue}
|
||||||
|
onChange={(e) => setEditValue(e.target.value)}
|
||||||
|
onKeyDown={handleKeyDown}
|
||||||
|
className="h-7 text-sm px-3 py-1 min-w-[200px]"
|
||||||
|
size={1}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="text"
|
||||||
|
onClick={handleSave}
|
||||||
|
className="h-7 w-7 p-0"
|
||||||
|
disabled={!editValue.trim()}
|
||||||
|
>
|
||||||
|
<Check className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="text"
|
||||||
|
onClick={handleCancel}
|
||||||
|
className="h-7 w-7 p-0"
|
||||||
|
>
|
||||||
|
<X className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-1 group">
|
||||||
|
<span className="text-sm font-medium">{activeProject.name}</span>
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
variant="text"
|
||||||
|
onClick={handleStartEdit}
|
||||||
|
className="h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity"
|
||||||
|
>
|
||||||
|
<Edit2 className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -35,6 +35,7 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "../ui/select";
|
} from "../ui/select";
|
||||||
|
import AudioWaveform from "./audio-waveform";
|
||||||
|
|
||||||
export function Timeline() {
|
export function Timeline() {
|
||||||
// Timeline shows all tracks (video, audio, effects) and their clips.
|
// Timeline shows all tracks (video, audio, effects) and their clips.
|
||||||
@ -221,7 +222,7 @@ export function Timeline() {
|
|||||||
const clipLeft = clip.startTime * 50 * zoomLevel;
|
const clipLeft = clip.startTime * 50 * zoomLevel;
|
||||||
const clipTop = trackIdx * 60;
|
const clipTop = trackIdx * 60;
|
||||||
const clipBottom = clipTop + 60;
|
const clipBottom = clipTop + 60;
|
||||||
const clipRight = clipLeft + clipWidth;
|
const clipRight = clipLeft + 60; // Set a fixed width for time display
|
||||||
if (
|
if (
|
||||||
bx1 < clipRight &&
|
bx1 < clipRight &&
|
||||||
bx2 > clipLeft &&
|
bx2 > clipLeft &&
|
||||||
@ -566,15 +567,6 @@ export function Timeline() {
|
|||||||
onMouseLeave={() => setIsInTimeline(false)}
|
onMouseLeave={() => setIsInTimeline(false)}
|
||||||
onWheel={handleWheel}
|
onWheel={handleWheel}
|
||||||
>
|
>
|
||||||
{/* Show overlay when dragging media over the timeline */}
|
|
||||||
{isDragOver && (
|
|
||||||
<div className="absolute inset-0 z-20 flex items-center justify-center pointer-events-none backdrop-blur-lg">
|
|
||||||
<div>
|
|
||||||
Drop media here to add to timeline
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Toolbar */}
|
{/* Toolbar */}
|
||||||
<div className="border-b flex items-center px-2 py-1 gap-1">
|
<div className="border-b flex items-center px-2 py-1 gap-1">
|
||||||
<TooltipProvider delayDuration={500}>
|
<TooltipProvider delayDuration={500}>
|
||||||
@ -602,15 +594,16 @@ export function Timeline() {
|
|||||||
<div className="w-px h-6 bg-border mx-1" />
|
<div className="w-px h-6 bg-border mx-1" />
|
||||||
|
|
||||||
{/* Time Display */}
|
{/* Time Display */}
|
||||||
<div className="text-xs text-muted-foreground font-mono px-2">
|
<div className="text-xs text-muted-foreground font-mono px-2"
|
||||||
{Math.floor(currentTime * 10) / 10}s /{" "}
|
style={{ minWidth: '18ch', textAlign: 'center' }}
|
||||||
{Math.floor(duration * 10) / 10}s
|
>
|
||||||
|
{currentTime.toFixed(1)}s / {duration.toFixed(1)}s
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-px h-6 bg-border mx-1" />
|
|
||||||
|
|
||||||
{/* Test Clip Button - for debugging */}
|
{/* Test Clip Button - for debugging */}
|
||||||
{tracks.length === 0 && (
|
{tracks.length === 0 && (
|
||||||
|
<>
|
||||||
|
<div className="w-px h-6 bg-border mx-1" />
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
@ -634,6 +627,7 @@ export function Timeline() {
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>Add a test clip to try playback</TooltipContent>
|
<TooltipContent>Add a test clip to try playback</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="w-px h-6 bg-border mx-1" />
|
<div className="w-px h-6 bg-border mx-1" />
|
||||||
@ -951,6 +945,17 @@ export function Timeline() {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{isDragOver && (
|
||||||
|
<div
|
||||||
|
className="absolute left-0 right-0 border-2 border-dashed border-accent flex items-center justify-center text-muted-foreground"
|
||||||
|
style={{
|
||||||
|
top: `${tracks.length * 60}px`,
|
||||||
|
height: "60px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>Drop media here to add a new track</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1624,7 +1629,21 @@ function TimelineTrackContent({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback for audio or videos without thumbnails
|
if (mediaItem.type === "audio") {
|
||||||
|
return (
|
||||||
|
<div className="w-full h-full flex items-center gap-2">
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<AudioWaveform
|
||||||
|
audioUrl={mediaItem.url}
|
||||||
|
height={24}
|
||||||
|
className="w-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback for videos without thumbnails
|
||||||
return (
|
return (
|
||||||
<span className="text-xs text-foreground/80 truncate">{clip.name}</span>
|
<span className="text-xs text-foreground/80 truncate">{clip.name}</span>
|
||||||
);
|
);
|
||||||
|
@ -20,14 +20,15 @@ export function VideoPlayer({
|
|||||||
clipStartTime,
|
clipStartTime,
|
||||||
trimStart,
|
trimStart,
|
||||||
trimEnd,
|
trimEnd,
|
||||||
clipDuration
|
clipDuration,
|
||||||
}: VideoPlayerProps) {
|
}: VideoPlayerProps) {
|
||||||
const videoRef = useRef<HTMLVideoElement>(null);
|
const videoRef = useRef<HTMLVideoElement>(null);
|
||||||
const { isPlaying, currentTime, volume, speed } = usePlaybackStore();
|
const { isPlaying, currentTime, volume, speed, muted } = usePlaybackStore();
|
||||||
|
|
||||||
// Calculate if we're within this clip's timeline range
|
// Calculate if we're within this clip's timeline range
|
||||||
const clipEndTime = clipStartTime + (clipDuration - trimStart - trimEnd);
|
const clipEndTime = clipStartTime + (clipDuration - trimStart - trimEnd);
|
||||||
const isInClipRange = currentTime >= clipStartTime && currentTime < clipEndTime;
|
const isInClipRange =
|
||||||
|
currentTime >= clipStartTime && currentTime < clipEndTime;
|
||||||
|
|
||||||
// Sync playback events
|
// Sync playback events
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -37,20 +38,26 @@ export function VideoPlayer({
|
|||||||
const handleSeekEvent = (e: CustomEvent) => {
|
const handleSeekEvent = (e: CustomEvent) => {
|
||||||
// Always update video time, even if outside clip range
|
// Always update video time, even if outside clip range
|
||||||
const timelineTime = e.detail.time;
|
const timelineTime = e.detail.time;
|
||||||
const videoTime = Math.max(trimStart, Math.min(
|
const videoTime = Math.max(
|
||||||
|
trimStart,
|
||||||
|
Math.min(
|
||||||
clipDuration - trimEnd,
|
clipDuration - trimEnd,
|
||||||
timelineTime - clipStartTime + trimStart
|
timelineTime - clipStartTime + trimStart
|
||||||
));
|
)
|
||||||
|
);
|
||||||
video.currentTime = videoTime;
|
video.currentTime = videoTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateEvent = (e: CustomEvent) => {
|
const handleUpdateEvent = (e: CustomEvent) => {
|
||||||
// Always update video time, even if outside clip range
|
// Always update video time, even if outside clip range
|
||||||
const timelineTime = e.detail.time;
|
const timelineTime = e.detail.time;
|
||||||
const targetTime = Math.max(trimStart, Math.min(
|
const targetTime = Math.max(
|
||||||
|
trimStart,
|
||||||
|
Math.min(
|
||||||
clipDuration - trimEnd,
|
clipDuration - trimEnd,
|
||||||
timelineTime - clipStartTime + trimStart
|
timelineTime - clipStartTime + trimStart
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (Math.abs(video.currentTime - targetTime) > 0.5) {
|
if (Math.abs(video.currentTime - targetTime) > 0.5) {
|
||||||
video.currentTime = targetTime;
|
video.currentTime = targetTime;
|
||||||
@ -62,13 +69,25 @@ export function VideoPlayer({
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("playback-seek", handleSeekEvent as EventListener);
|
window.addEventListener("playback-seek", handleSeekEvent as EventListener);
|
||||||
window.addEventListener("playback-update", handleUpdateEvent as EventListener);
|
window.addEventListener(
|
||||||
|
"playback-update",
|
||||||
|
handleUpdateEvent as EventListener
|
||||||
|
);
|
||||||
window.addEventListener("playback-speed", handleSpeed as EventListener);
|
window.addEventListener("playback-speed", handleSpeed as EventListener);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener("playback-seek", handleSeekEvent as EventListener);
|
window.removeEventListener(
|
||||||
window.removeEventListener("playback-update", handleUpdateEvent as EventListener);
|
"playback-seek",
|
||||||
window.removeEventListener("playback-speed", handleSpeed as EventListener);
|
handleSeekEvent as EventListener
|
||||||
|
);
|
||||||
|
window.removeEventListener(
|
||||||
|
"playback-update",
|
||||||
|
handleUpdateEvent as EventListener
|
||||||
|
);
|
||||||
|
window.removeEventListener(
|
||||||
|
"playback-speed",
|
||||||
|
handleSpeed as EventListener
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}, [clipStartTime, trimStart, trimEnd, clipDuration, isInClipRange]);
|
}, [clipStartTime, trimStart, trimEnd, clipDuration, isInClipRange]);
|
||||||
|
|
||||||
@ -78,7 +97,7 @@ export function VideoPlayer({
|
|||||||
if (!video) return;
|
if (!video) return;
|
||||||
|
|
||||||
if (isPlaying && isInClipRange) {
|
if (isPlaying && isInClipRange) {
|
||||||
video.play().catch(() => { });
|
video.play().catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
video.pause();
|
video.pause();
|
||||||
}
|
}
|
||||||
@ -90,8 +109,9 @@ export function VideoPlayer({
|
|||||||
if (!video) return;
|
if (!video) return;
|
||||||
|
|
||||||
video.volume = volume;
|
video.volume = volume;
|
||||||
|
video.muted = muted;
|
||||||
video.playbackRate = speed;
|
video.playbackRate = speed;
|
||||||
}, [volume, speed]);
|
}, [volume, speed, muted]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<video
|
<video
|
||||||
@ -104,7 +124,7 @@ export function VideoPlayer({
|
|||||||
controls={false}
|
controls={false}
|
||||||
disablePictureInPicture
|
disablePictureInPicture
|
||||||
disableRemotePlayback
|
disableRemotePlayback
|
||||||
style={{ pointerEvents: 'none' }}
|
style={{ pointerEvents: "none" }}
|
||||||
onContextMenu={(e) => e.preventDefault()}
|
onContextMenu={(e) => e.preventDefault()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -19,13 +19,21 @@ const startTimer = (store: any) => {
|
|||||||
const delta = (now - lastUpdate) / 1000; // Convert to seconds
|
const delta = (now - lastUpdate) / 1000; // Convert to seconds
|
||||||
lastUpdate = now;
|
lastUpdate = now;
|
||||||
|
|
||||||
const newTime = state.currentTime + (delta * state.speed);
|
const newTime = state.currentTime + delta * state.speed;
|
||||||
if (newTime >= state.duration) {
|
if (newTime >= state.duration) {
|
||||||
|
// When video completes, pause and reset playhead to start
|
||||||
state.pause();
|
state.pause();
|
||||||
|
state.setCurrentTime(0);
|
||||||
|
// Notify video elements to sync with reset
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("playback-seek", { detail: { time: 0 } })
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
state.setCurrentTime(newTime);
|
state.setCurrentTime(newTime);
|
||||||
// Notify video elements to sync
|
// Notify video elements to sync
|
||||||
window.dispatchEvent(new CustomEvent('playback-update', { detail: { time: newTime } }));
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("playback-update", { detail: { time: newTime } })
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playbackTimer = requestAnimationFrame(updateTime);
|
playbackTimer = requestAnimationFrame(updateTime);
|
||||||
@ -47,6 +55,8 @@ export const usePlaybackStore = create<PlaybackStore>((set, get) => ({
|
|||||||
currentTime: 0,
|
currentTime: 0,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
volume: 1,
|
volume: 1,
|
||||||
|
muted: false,
|
||||||
|
previousVolume: 1,
|
||||||
speed: 1.0,
|
speed: 1.0,
|
||||||
|
|
||||||
play: () => {
|
play: () => {
|
||||||
@ -73,21 +83,52 @@ export const usePlaybackStore = create<PlaybackStore>((set, get) => ({
|
|||||||
const clampedTime = Math.max(0, Math.min(duration, time));
|
const clampedTime = Math.max(0, Math.min(duration, time));
|
||||||
set({ currentTime: clampedTime });
|
set({ currentTime: clampedTime });
|
||||||
|
|
||||||
// Notify video elements to seek
|
const event = new CustomEvent("playback-seek", {
|
||||||
const event = new CustomEvent('playback-seek', { detail: { time: clampedTime } });
|
detail: { time: clampedTime },
|
||||||
|
});
|
||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setVolume: (volume: number) => set({ volume: Math.max(0, Math.min(1, volume)) }),
|
setVolume: (volume: number) =>
|
||||||
|
set((state) => ({
|
||||||
|
volume: Math.max(0, Math.min(1, volume)),
|
||||||
|
muted: volume === 0,
|
||||||
|
previousVolume: volume > 0 ? volume : state.previousVolume,
|
||||||
|
})),
|
||||||
|
|
||||||
setSpeed: (speed: number) => {
|
setSpeed: (speed: number) => {
|
||||||
const newSpeed = Math.max(0.1, Math.min(2.0, speed));
|
const newSpeed = Math.max(0.1, Math.min(2.0, speed));
|
||||||
set({ speed: newSpeed });
|
set({ speed: newSpeed });
|
||||||
|
|
||||||
const event = new CustomEvent('playback-speed', { detail: { speed: newSpeed } });
|
const event = new CustomEvent("playback-speed", {
|
||||||
|
detail: { speed: newSpeed },
|
||||||
|
});
|
||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setDuration: (duration: number) => set({ duration }),
|
setDuration: (duration: number) => set({ duration }),
|
||||||
setCurrentTime: (time: number) => set({ currentTime: time }),
|
setCurrentTime: (time: number) => set({ currentTime: time }),
|
||||||
|
|
||||||
|
mute: () => {
|
||||||
|
const { volume, previousVolume } = get();
|
||||||
|
set({
|
||||||
|
muted: true,
|
||||||
|
previousVolume: volume > 0 ? volume : previousVolume,
|
||||||
|
volume: 0,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
unmute: () => {
|
||||||
|
const { previousVolume } = get();
|
||||||
|
set({ muted: false, volume: previousVolume ?? 1 });
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleMute: () => {
|
||||||
|
const { muted } = get();
|
||||||
|
if (muted) {
|
||||||
|
get().unmute();
|
||||||
|
} else {
|
||||||
|
get().mute();
|
||||||
|
}
|
||||||
|
},
|
||||||
}));
|
}));
|
@ -7,6 +7,7 @@ interface ProjectStore {
|
|||||||
// Actions
|
// Actions
|
||||||
createNewProject: (name: string) => void;
|
createNewProject: (name: string) => void;
|
||||||
closeProject: () => void;
|
closeProject: () => void;
|
||||||
|
updateProjectName: (name: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useProjectStore = create<ProjectStore>((set) => ({
|
export const useProjectStore = create<ProjectStore>((set) => ({
|
||||||
@ -25,4 +26,16 @@ export const useProjectStore = create<ProjectStore>((set) => ({
|
|||||||
closeProject: () => {
|
closeProject: () => {
|
||||||
set({ activeProject: null });
|
set({ activeProject: null });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateProjectName: (name: string) => {
|
||||||
|
set((state) => ({
|
||||||
|
activeProject: state.activeProject
|
||||||
|
? {
|
||||||
|
...state.activeProject,
|
||||||
|
name,
|
||||||
|
updatedAt: new Date(),
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
}));
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
@ -4,6 +4,8 @@ export interface PlaybackState {
|
|||||||
duration: number;
|
duration: number;
|
||||||
volume: number;
|
volume: number;
|
||||||
speed: number;
|
speed: number;
|
||||||
|
muted: boolean;
|
||||||
|
previousVolume?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlaybackControls {
|
export interface PlaybackControls {
|
||||||
@ -13,4 +15,7 @@ export interface PlaybackControls {
|
|||||||
setVolume: (volume: number) => void;
|
setVolume: (volume: number) => void;
|
||||||
setSpeed: (speed: number) => void;
|
setSpeed: (speed: number) => void;
|
||||||
toggle: () => void;
|
toggle: () => void;
|
||||||
|
mute: () => void;
|
||||||
|
unmute: () => void;
|
||||||
|
toggleMute: () => void;
|
||||||
}
|
}
|
3
bun.lock
3
bun.lock
@ -4,6 +4,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"next": "^15.3.4",
|
"next": "^15.3.4",
|
||||||
|
"wavesurfer.js": "^7.9.8",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"turbo": "^2.5.4",
|
"turbo": "^2.5.4",
|
||||||
@ -902,6 +903,8 @@
|
|||||||
|
|
||||||
"victory-vendor": ["victory-vendor@36.9.2", "", { "dependencies": { "@types/d3-array": "^3.0.3", "@types/d3-ease": "^3.0.0", "@types/d3-interpolate": "^3.0.1", "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/d3-time": "^3.0.0", "@types/d3-timer": "^3.0.0", "d3-array": "^3.1.6", "d3-ease": "^3.0.1", "d3-interpolate": "^3.0.1", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", "d3-time": "^3.0.0", "d3-timer": "^3.0.1" } }, "sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ=="],
|
"victory-vendor": ["victory-vendor@36.9.2", "", { "dependencies": { "@types/d3-array": "^3.0.3", "@types/d3-ease": "^3.0.0", "@types/d3-interpolate": "^3.0.1", "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/d3-time": "^3.0.0", "@types/d3-timer": "^3.0.0", "d3-array": "^3.1.6", "d3-ease": "^3.0.1", "d3-interpolate": "^3.0.1", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", "d3-time": "^3.0.0", "d3-timer": "^3.0.1" } }, "sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ=="],
|
||||||
|
|
||||||
|
"wavesurfer.js": ["wavesurfer.js@7.9.8", "", {}, "sha512-Mxz6qRwkSmuWVxLzp0XQ6EzSv1FTvQgMEUJTirLN1Ox76sn0YeyQlI99WuE+B0IuxShPHXIhvEuoBSJdaQs7tA=="],
|
||||||
|
|
||||||
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
|
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
|
||||||
|
|
||||||
"wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
|
"wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", "strip-ansi": "^7.0.1" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
|
||||||
|
@ -48,7 +48,7 @@ services:
|
|||||||
start_period: 10s
|
start_period: 10s
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: ./apps/web
|
context: .
|
||||||
dockerfile: ./apps/web/Dockerfile
|
dockerfile: ./apps/web/Dockerfile
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"format": "turbo run format"
|
"format": "turbo run format"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"next": "^15.3.4"
|
"next": "^15.3.4",
|
||||||
|
"wavesurfer.js": "^7.9.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user