Unify frontend UI styling between karaoke-gen and lyrics-transcriber
- Add Nomad Karaoke logo to both frontend headers - Fix SVG viewBox to display logo at correct size - Implement working dark/light mode toggle for both UIs - Make karaoke-gen layout full-width to match lyrics-transcriber - Standardize header height (70px) across both UIs - Use lucide-react icons (Sun/Moon) for theme toggle in both UIs - Add CSS variables for theme-aware styling in karaoke-gen - Refactor lyrics-transcriber theme system for dynamic switching 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
No files matched your search
@@ -214,7 +214,7 @@ karaoke-gen-remote \
|
||||
|----------|-------------|---------|
|
||||
| `KARAOKE_GEN_URL` | Backend service URL | Required |
|
||||
| `KARAOKE_GEN_AUTH_TOKEN` | Admin auth token (for protected endpoints) | Optional |
|
||||
| `REVIEW_UI_URL` | Lyrics review UI URL | `https://lyrics.nomadkaraoke.com` |
|
||||
| `REVIEW_UI_URL` | Lyrics review UI URL | `https://gen.nomadkaraoke.com/lyrics/` |
|
||||
| `POLL_INTERVAL` | Seconds between status polls | `5` |
|
||||
|
||||
**Note:** The `REVIEW_UI_URL` defaults to the hosted lyrics review UI. For local development, set it to `http://localhost:5173` if you're running the frontend dev server.
|
||||
|
||||
@@ -249,7 +249,7 @@ This section provides a comprehensive comparison of all CLI parameters between `
|
||||
| # | Parameter | Local | Remote | Description |
|
||||
|---|-----------|-------|--------|-------------|
|
||||
| R1 | `--service-url` | N/A | 🔹 | **Backend service URL.** URL of the karaoke-gen cloud backend. Can also be set via `KARAOKE_GEN_URL` environment variable. Required for remote mode. |
|
||||
| R2 | `--review-ui-url` | N/A | 🔹 | **Lyrics review UI URL.** URL of the hosted lyrics review web application. Default: `https://lyrics.nomadkaraoke.com`. |
|
||||
| R2 | `--review-ui-url` | N/A | 🔹 | **Lyrics review UI URL.** URL of the hosted lyrics review web application. Default: `https://gen.nomadkaraoke.com/lyrics/`. |
|
||||
| R3 | `--poll-interval` | N/A | 🔹 | **Status poll frequency.** Seconds between job status checks while monitoring. Default: 5 seconds. |
|
||||
| R4 | `--environment` | N/A | 🔹 | **Job environment tag.** Tag jobs with environment label (test/production/development) for filtering and cleanup. Sent as `X-Environment` header. |
|
||||
| R5 | `--client-id` | N/A | 🔹 | **Client identifier tag.** Tag jobs with client/user identifier for filtering. Sent as `X-Client-ID` header. |
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
:root {
|
||||
/* Matching instrumental review UI color scheme */
|
||||
/* Dark theme (default) - Matching instrumental review UI color scheme */
|
||||
--bg: #0f0f0f;
|
||||
--card: #1a1a1a;
|
||||
--card-border: #2a2a2a;
|
||||
@@ -41,6 +41,25 @@
|
||||
--radius: 0.5rem;
|
||||
}
|
||||
|
||||
:root.light {
|
||||
/* Light theme */
|
||||
--bg: #f8fafc;
|
||||
--card: #ffffff;
|
||||
--card-border: #e2e8f0;
|
||||
--waveform-bg: #f1f5f9;
|
||||
--text: #1e293b;
|
||||
--text-muted: #64748b;
|
||||
--primary: #3b82f6;
|
||||
--primary-hover: #2563eb;
|
||||
--secondary: #f1f5f9;
|
||||
--secondary-hover: #e2e8f0;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--pink: #ec4899;
|
||||
--blue: #60a5fa;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
--font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
|
||||
|
||||
@@ -3,20 +3,15 @@ import type { Metadata } from "next"
|
||||
import "./globals.css"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Karaoke Generator - Nomad Karaoke",
|
||||
title: "Nomad Karaoke: Generator",
|
||||
description: "Generate professional karaoke videos with AI-powered vocal separation and synchronized lyrics",
|
||||
icons: {
|
||||
icon: [
|
||||
{
|
||||
url: "/icon-light-32x32.png",
|
||||
media: "(prefers-color-scheme: light)",
|
||||
},
|
||||
{
|
||||
url: "/icon-dark-32x32.png",
|
||||
media: "(prefers-color-scheme: dark)",
|
||||
},
|
||||
{ url: "/favicon.ico", sizes: "any" },
|
||||
{ url: "/favicon-16x16.png", sizes: "16x16", type: "image/png" },
|
||||
{ url: "/favicon-32x32.png", sizes: "32x32", type: "image/png" },
|
||||
],
|
||||
apple: "/apple-icon.png",
|
||||
apple: "/apple-touch-icon.png",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ import { api, Job, getAccessToken } from "@/lib/api"
|
||||
import { useAutoMode, getAutoModeFromUrl } from "@/lib/auto-mode"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Music2, RefreshCw, Loader2, Zap, ZapOff, KeyRound } from "lucide-react"
|
||||
import { Music2, RefreshCw, Loader2, Zap, ZapOff, KeyRound, Moon, Sun } from "lucide-react"
|
||||
import { JobCard } from "@/components/job"
|
||||
import { JobSubmission } from "@/components/job/JobSubmission"
|
||||
import { AuthStatus } from "@/components/auth"
|
||||
import { AutoProcessor } from "@/components/AutoProcessor"
|
||||
import { useTheme } from "@/lib/theme"
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -22,6 +23,7 @@ export default function HomePage() {
|
||||
const [isLoadingJobs, setIsLoadingJobs] = useState(true)
|
||||
const [isAuthenticated, setIsAuthenticated] = useState(false)
|
||||
const { enabled: autoModeEnabled, setEnabled: setAutoMode, toggle: toggleAutoMode } = useAutoMode()
|
||||
const { isDarkMode, toggleTheme, mounted } = useTheme()
|
||||
|
||||
// Check auth status on mount
|
||||
useEffect(() => {
|
||||
@@ -67,18 +69,17 @@ export default function HomePage() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-slate-950 via-slate-900 to-slate-950">
|
||||
<div className="min-h-screen" style={{ background: 'var(--bg)' }}>
|
||||
{/* AutoProcessor - handles non-interactive mode */}
|
||||
<AutoProcessor jobs={jobs} onJobsChanged={loadJobs} />
|
||||
|
||||
{/* Header */}
|
||||
<header className="border-b border-slate-800 bg-slate-950/50 backdrop-blur-sm sticky top-0 z-10">
|
||||
<div className="container mx-auto px-4 py-4 flex items-center justify-between">
|
||||
<header className="border-b backdrop-blur-sm sticky top-0 z-10" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<div className="px-4 py-3 flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<Music2 className="w-8 h-8 text-amber-500" />
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-10" />
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-white">Karaoke Generator</h1>
|
||||
<p className="text-xs text-slate-400">by Nomad Karaoke</p>
|
||||
<h1 className="text-xl font-bold" style={{ color: 'var(--text)' }}>Karaoke Generator</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -89,11 +90,8 @@ export default function HomePage() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={toggleAutoMode}
|
||||
className={`${
|
||||
autoModeEnabled
|
||||
? "text-amber-400 hover:text-amber-300 bg-amber-500/10"
|
||||
: "text-slate-400 hover:text-white"
|
||||
}`}
|
||||
className={autoModeEnabled ? "text-amber-400 hover:text-amber-300 bg-amber-500/10" : ""}
|
||||
style={!autoModeEnabled ? { color: 'var(--text-muted)' } : undefined}
|
||||
>
|
||||
{autoModeEnabled ? (
|
||||
<Zap className="w-4 h-4 mr-2" />
|
||||
@@ -107,7 +105,7 @@ export default function HomePage() {
|
||||
<p className="font-medium">
|
||||
{autoModeEnabled ? "Auto Mode Enabled" : "Auto Mode Disabled"}
|
||||
</p>
|
||||
<p className="text-xs text-slate-400 mt-1">
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
{autoModeEnabled
|
||||
? "Jobs will auto-complete review and select clean instrumental (like -y flag)"
|
||||
: "Click to enable non-interactive mode"}
|
||||
@@ -120,17 +118,40 @@ export default function HomePage() {
|
||||
size="sm"
|
||||
onClick={loadJobs}
|
||||
disabled={isLoadingJobs || !isAuthenticated}
|
||||
className="text-slate-400 hover:text-white"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<RefreshCw className={`w-4 h-4 mr-2 ${isLoadingJobs ? 'animate-spin' : ''}`} />
|
||||
Refresh
|
||||
</Button>
|
||||
<AuthStatus />
|
||||
{mounted && (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={toggleTheme}
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
{isDarkMode ? (
|
||||
<Sun className="w-4 h-4" />
|
||||
) : (
|
||||
<Moon className="w-4 h-4" />
|
||||
)}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">
|
||||
<p>{isDarkMode ? "Switch to light mode" : "Switch to dark mode"}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="container mx-auto px-4 py-8 max-w-5xl space-y-6">
|
||||
<main className="px-4 py-8 space-y-6">
|
||||
{/* Auto Mode Banner */}
|
||||
{autoModeEnabled && (
|
||||
<div className="bg-amber-500/10 border border-amber-500/30 rounded-lg p-4 flex items-center gap-3">
|
||||
@@ -156,8 +177,8 @@ export default function HomePage() {
|
||||
{!isAuthenticated && (
|
||||
<div className="bg-amber-500/10 border border-amber-500/30 rounded-lg p-6 text-center">
|
||||
<KeyRound className="w-8 h-8 text-amber-400 mx-auto mb-3" />
|
||||
<h3 className="text-lg font-medium text-white mb-2">Authentication Required</h3>
|
||||
<p className="text-sm text-slate-400 mb-4">
|
||||
<h3 className="text-lg font-medium mb-2" style={{ color: 'var(--text)' }}>Authentication Required</h3>
|
||||
<p className="text-sm mb-4" style={{ color: 'var(--text-muted)' }}>
|
||||
Click the Login button in the header to enter your access token
|
||||
</p>
|
||||
</div>
|
||||
@@ -165,10 +186,10 @@ export default function HomePage() {
|
||||
|
||||
<div className="grid lg:grid-cols-2 gap-8">
|
||||
{/* Submit Job Card */}
|
||||
<Card className="border-slate-800 bg-slate-900/50 backdrop-blur">
|
||||
<Card className="backdrop-blur" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-white">Create Karaoke Video</CardTitle>
|
||||
<CardDescription className="text-slate-400">
|
||||
<CardTitle style={{ color: 'var(--text)' }}>Create Karaoke Video</CardTitle>
|
||||
<CardDescription style={{ color: 'var(--text-muted)' }}>
|
||||
Upload an audio file, provide a YouTube URL, or search for audio by artist & title
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
@@ -178,19 +199,19 @@ export default function HomePage() {
|
||||
</Card>
|
||||
|
||||
{/* Jobs List Card */}
|
||||
<Card className="border-slate-800 bg-slate-900/50 backdrop-blur">
|
||||
<Card className="backdrop-blur" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-white flex items-center justify-between">
|
||||
<CardTitle className="flex items-center justify-between" style={{ color: 'var(--text)' }}>
|
||||
Recent Jobs
|
||||
{isLoadingJobs && <Loader2 className="w-4 h-4 animate-spin text-slate-400" />}
|
||||
{isLoadingJobs && <Loader2 className="w-4 h-4 animate-spin" style={{ color: 'var(--text-muted)' }} />}
|
||||
</CardTitle>
|
||||
<CardDescription className="text-slate-400">
|
||||
<CardDescription style={{ color: 'var(--text-muted)' }}>
|
||||
{jobs.length} job{jobs.length !== 1 ? 's' : ''} found
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{jobs.length === 0 ? (
|
||||
<div className="text-center py-8 text-slate-500">
|
||||
<div className="text-center py-8" style={{ color: 'var(--text-muted)' }}>
|
||||
<Music2 className="w-12 h-12 mx-auto mb-3 opacity-50" />
|
||||
<p>No jobs yet. Create one to get started!</p>
|
||||
</div>
|
||||
@@ -207,8 +228,8 @@ export default function HomePage() {
|
||||
</main>
|
||||
|
||||
{/* Footer */}
|
||||
<footer className="border-t border-slate-800 mt-12 py-6">
|
||||
<div className="container mx-auto px-4 text-center text-sm text-slate-500">
|
||||
<footer className="border-t mt-12 py-6" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="px-4 text-center text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
<p>
|
||||
Powered by{" "}
|
||||
<a href="https://github.com/nomadkaraoke/karaoke-gen" className="text-amber-500 hover:underline">
|
||||
|
||||
@@ -143,12 +143,15 @@ describe('JobCard', () => {
|
||||
})
|
||||
|
||||
it('shows lyrics review link for awaiting_review status', () => {
|
||||
const reviewJob = { ...mockJob, status: 'awaiting_review' }
|
||||
const reviewJob = { ...mockJob, status: 'awaiting_review', review_token: 'test-token-123' }
|
||||
render(<JobCard job={reviewJob} onRefresh={mockOnRefresh} />)
|
||||
|
||||
const reviewLink = screen.getByText('Review Lyrics')
|
||||
expect(reviewLink).toBeInTheDocument()
|
||||
expect(reviewLink.closest('a')).toHaveAttribute('href', expect.stringContaining('lyrics.nomadkaraoke.com'))
|
||||
const href = reviewLink.closest('a')?.getAttribute('href') || ''
|
||||
expect(href).toContain('gen.nomadkaraoke.com/lyrics')
|
||||
expect(href).toContain('baseApiUrl=')
|
||||
expect(href).toContain('reviewToken=test-token-123')
|
||||
})
|
||||
|
||||
it('shows audio search button for awaiting_audio_selection status', () => {
|
||||
|
||||
@@ -141,7 +141,22 @@ export function JobCard({ job, onRefresh }: JobCardProps) {
|
||||
<>
|
||||
{job.status === "awaiting_review" && (
|
||||
<a
|
||||
href={`https://lyrics.nomadkaraoke.com/?job=${job.job_id}`}
|
||||
href={(() => {
|
||||
// Construct the review URL with proper baseApiUrl and reviewToken
|
||||
// Always use cloud backend URL since the review UI will call it directly
|
||||
const backendUrl = process.env.NEXT_PUBLIC_API_URL || 'https://api.nomadkaraoke.com'
|
||||
const reviewUiUrl = process.env.NEXT_PUBLIC_REVIEW_UI_URL || 'https://gen.nomadkaraoke.com/lyrics/'
|
||||
const baseApiUrl = `${backendUrl}/api/review/${job.job_id}`
|
||||
const encodedApiUrl = encodeURIComponent(baseApiUrl)
|
||||
let url = `${reviewUiUrl}/?baseApiUrl=${encodedApiUrl}`
|
||||
if (job.audio_hash) {
|
||||
url += `&audioHash=${encodeURIComponent(job.audio_hash)}`
|
||||
}
|
||||
if (job.review_token) {
|
||||
url += `&reviewToken=${encodeURIComponent(job.review_token)}`
|
||||
}
|
||||
return url
|
||||
})()}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-orange-600 hover:bg-orange-500 text-white"
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Example E2E test demonstrating the API fixture system
|
||||
*
|
||||
* This test shows how to use the fixture system to run tests against
|
||||
* mock data instead of a real backend.
|
||||
*
|
||||
* Run in recording mode to capture new fixtures:
|
||||
* RECORD_FIXTURES=true npm run test:e2e -- fixtures-example.spec.ts
|
||||
*
|
||||
* Then review and approve fixtures:
|
||||
* npm run fixtures:review
|
||||
*/
|
||||
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { setupApiFixtures, setupMocks, setAuthToken } from './fixtures';
|
||||
|
||||
test.describe('API Fixtures Example', () => {
|
||||
test('shows empty state when no jobs exist', async ({ page }) => {
|
||||
// Set up mock API responses (frontend uses /api/jobs, not /api/v1/jobs)
|
||||
await setupMocks(page, [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/api/jobs',
|
||||
response: { body: [] },
|
||||
},
|
||||
]);
|
||||
|
||||
// Set auth token before navigating
|
||||
await setAuthToken(page, 'test-token');
|
||||
|
||||
await page.goto('/');
|
||||
|
||||
// Verify the empty state message
|
||||
await expect(page.getByText(/No jobs yet/i)).toBeVisible();
|
||||
});
|
||||
|
||||
test('shows jobs when they exist', async ({ page }) => {
|
||||
// Set up mock with sample job data (frontend uses /api/jobs)
|
||||
await setupMocks(page, [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/api/jobs',
|
||||
response: {
|
||||
body: [
|
||||
{
|
||||
job_id: 'job-123',
|
||||
title: 'Test Song',
|
||||
artist: 'Test Artist',
|
||||
status: 'completed',
|
||||
created_at: '2024-01-15T10:00:00Z',
|
||||
updated_at: '2024-01-15T10:05:00Z',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
await setAuthToken(page, 'test-token');
|
||||
await page.goto('/');
|
||||
|
||||
// Verify job is displayed
|
||||
await expect(page.getByText('Test Song')).toBeVisible();
|
||||
await expect(page.getByText('Test Artist')).toBeVisible();
|
||||
});
|
||||
|
||||
test.skip('shows error when API fails', async ({ page }) => {
|
||||
// NOTE: Currently the frontend doesn't display API errors visibly
|
||||
// This test is skipped until error handling UI is added
|
||||
await setupMocks(page, [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/api/jobs',
|
||||
response: {
|
||||
status: 500,
|
||||
body: { detail: 'Internal server error' },
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
await setAuthToken(page, 'test-token');
|
||||
await page.goto('/');
|
||||
|
||||
// This would require the frontend to display API errors
|
||||
await expect(page.getByText(/error/i)).toBeVisible();
|
||||
});
|
||||
|
||||
test('shows login prompt when not authenticated', async ({ page }) => {
|
||||
// No mock needed - just don't set auth token
|
||||
await page.goto('/');
|
||||
|
||||
// Verify login prompt is shown (actual UI text)
|
||||
await expect(page.getByText(/Authentication Required/i)).toBeVisible();
|
||||
});
|
||||
|
||||
test.skip('records real API responses when RECORD_FIXTURES=true', async ({ page }) => {
|
||||
// This test only runs in recording mode
|
||||
// It will capture actual API responses for review
|
||||
|
||||
const api = await setupApiFixtures(page, {
|
||||
testFile: 'fixtures-example.spec.ts',
|
||||
});
|
||||
|
||||
if (!api.isRecording) {
|
||||
test.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
await setAuthToken(page, process.env.TEST_ACCESS_TOKEN || 'your-token');
|
||||
await page.goto('/');
|
||||
|
||||
// Perform actions that trigger API calls
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Stop recording and show captured fixtures
|
||||
const fixtures = api.stopRecording();
|
||||
console.log(`Captured ${fixtures.length} API calls`);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,162 @@
|
||||
# API Fixtures for E2E Testing
|
||||
|
||||
This module provides tools for recording and replaying API fixtures to enable deterministic E2E testing without requiring a running backend.
|
||||
|
||||
## Overview
|
||||
|
||||
The fixture system has two modes:
|
||||
|
||||
1. **Recording Mode**: Intercepts real API calls during test runs and saves them for review
|
||||
2. **Mock Mode**: Replays approved fixtures instead of making real API calls
|
||||
|
||||
## Workflow
|
||||
|
||||
### Step 1: Record API Responses
|
||||
|
||||
Run E2E tests in recording mode to capture real API responses:
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm run test:e2e:record
|
||||
```
|
||||
|
||||
This will:
|
||||
- Run all E2E tests against the real backend
|
||||
- Intercept and save all API calls to `e2e/fixtures/data/recordings/`
|
||||
- Each session creates a new JSON file with all captured requests
|
||||
|
||||
### Step 2: Review and Approve Fixtures
|
||||
|
||||
Review each captured fixture before approving it:
|
||||
|
||||
```bash
|
||||
npm run fixtures:review
|
||||
```
|
||||
|
||||
The review CLI will:
|
||||
- Show each captured request/response pair
|
||||
- Let you approve, skip, or edit each fixture
|
||||
- Save approved fixtures to `e2e/fixtures/data/approved/`
|
||||
|
||||
For each fixture, you can:
|
||||
- **Approve (a)**: Save the fixture as-is
|
||||
- **Edit (e)**: Add a description or notes before approving
|
||||
- **Skip (s)**: Don't save this fixture
|
||||
- **Quit (q)**: Exit the review session
|
||||
|
||||
### Step 3: Use Fixtures in Tests
|
||||
|
||||
Once you have approved fixtures, update your tests to use them:
|
||||
|
||||
```typescript
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { setupApiFixtures } from './fixtures';
|
||||
|
||||
test('shows job list', async ({ page }) => {
|
||||
// Set up mock server with approved fixtures
|
||||
const api = await setupApiFixtures(page, {
|
||||
useApprovedFixtures: true,
|
||||
});
|
||||
|
||||
await page.goto('/');
|
||||
|
||||
// Test runs against mock data - no real backend needed
|
||||
await expect(page.getByText('My Jobs')).toBeVisible();
|
||||
|
||||
// Verify all requests were handled
|
||||
api.assertAllHandled();
|
||||
});
|
||||
```
|
||||
|
||||
## Test Helper API
|
||||
|
||||
### setupApiFixtures(page, options)
|
||||
|
||||
Main function for setting up API fixtures in a test.
|
||||
|
||||
**Options:**
|
||||
- `fixtureSet?: string` - Load a named fixture set from `data/sets/`
|
||||
- `useApprovedFixtures?: boolean` - Load all approved fixtures from `data/approved/`
|
||||
- `mocks?: Array<{method, path, response}>` - Add inline mock responses
|
||||
- `testFile?: string` - Test file name (used in recording mode)
|
||||
|
||||
**Returns:** `ApiTestContext` with:
|
||||
- `isRecording: boolean` - Whether in recording mode
|
||||
- `assertAllHandled()` - Throws if any requests weren't mocked
|
||||
- `getUnmatchedRequests()` - Returns list of unhandled requests
|
||||
- `stopRecording()` - Stop recording and return captured fixtures
|
||||
|
||||
### Convenience Functions
|
||||
|
||||
```typescript
|
||||
// Quick inline mocks
|
||||
await setupMocks(page, [
|
||||
{ method: 'GET', path: '/api/v1/jobs', response: { body: [] } },
|
||||
]);
|
||||
|
||||
// Pre-configured scenarios
|
||||
await setupAuthenticatedUser(page);
|
||||
await setupUnauthenticatedUser(page);
|
||||
|
||||
// Auth helpers
|
||||
await setAuthToken(page, 'my-token');
|
||||
await clearAuthToken(page);
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
e2e/fixtures/
|
||||
├── data/
|
||||
│ ├── recordings/ # Temporary recording sessions (gitignored content)
|
||||
│ ├── approved/ # Approved fixtures (committed to repo)
|
||||
│ └── sets/ # Named fixture sets for specific scenarios
|
||||
├── types.ts # TypeScript interfaces
|
||||
├── recorder.ts # Recording logic
|
||||
├── mock-server.ts # Mock server logic
|
||||
├── test-helper.ts # Test utilities
|
||||
├── review-cli.ts # CLI for reviewing fixtures
|
||||
└── index.ts # Module exports
|
||||
```
|
||||
|
||||
## Fixture Format
|
||||
|
||||
Each approved fixture is a JSON file:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "get-api-v1-jobs",
|
||||
"description": "GET /api/v1/jobs - List all jobs",
|
||||
"capturedAt": "2024-01-15T10:30:00.000Z",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "http://localhost:8000/api/v1/jobs",
|
||||
"path": "/api/v1/jobs",
|
||||
"headers": { "authorization": "[REDACTED]" }
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"statusText": "OK",
|
||||
"body": []
|
||||
},
|
||||
"reviewed": true,
|
||||
"reviewNotes": "Empty job list for new user"
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Review every fixture**: Don't blindly approve all recordings. Check that responses are correct and don't contain sensitive data.
|
||||
|
||||
2. **Add descriptions**: Edit fixtures to add meaningful descriptions that explain what scenario the fixture represents.
|
||||
|
||||
3. **Keep fixtures minimal**: Only approve the fixtures you actually need for tests. Don't capture unnecessary API calls.
|
||||
|
||||
4. **Update fixtures when API changes**: If the backend API changes, re-record and review fixtures to ensure tests use correct data.
|
||||
|
||||
5. **Use fixture sets for scenarios**: Group related fixtures into sets for complex test scenarios (e.g., "user-with-jobs", "empty-state").
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `RECORD_FIXTURES=true` - Enable recording mode
|
||||
- `NEXT_PUBLIC_API_URL` - Backend API URL (default: http://localhost:8000)
|
||||
@@ -0,0 +1,3 @@
|
||||
# This directory contains approved API fixtures
|
||||
# Each fixture is a JSON file representing a single API request/response pair
|
||||
# These fixtures are used by the mock server during E2E tests
|
||||
@@ -0,0 +1,4 @@
|
||||
# Ignore recording session files (temporary, should be reviewed and approved)
|
||||
*.json
|
||||
# But keep the gitkeep
|
||||
!.gitkeep
|
||||
@@ -0,0 +1,3 @@
|
||||
# This directory contains temporary recording sessions
|
||||
# Recordings are created when running tests with RECORD_FIXTURES=true
|
||||
# After review, approved fixtures are moved to the 'approved' directory
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* API Fixtures Module
|
||||
*
|
||||
* This module provides tools for recording and replaying API fixtures
|
||||
* to enable deterministic E2E testing without a real backend.
|
||||
*
|
||||
* @example Recording mode (capture real API responses):
|
||||
* ```bash
|
||||
* RECORD_FIXTURES=true npm run test:e2e
|
||||
* npm run fixtures:review # Review and approve captured fixtures
|
||||
* ```
|
||||
*
|
||||
* @example Mock mode (use approved fixtures):
|
||||
* ```typescript
|
||||
* import { setupApiFixtures } from './fixtures';
|
||||
*
|
||||
* test('my test', async ({ page }) => {
|
||||
* await setupApiFixtures(page, { useApprovedFixtures: true });
|
||||
* // Test runs against mock data
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
|
||||
export * from './types';
|
||||
export * from './recorder';
|
||||
export * from './mock-server';
|
||||
export * from './test-helper';
|
||||
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* API Fixture Mock Server
|
||||
*
|
||||
* Uses Playwright route interception to replay recorded API fixtures.
|
||||
* This provides deterministic test behavior without needing a real backend.
|
||||
*/
|
||||
|
||||
import { Page, Route, Request } from '@playwright/test';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { ApiFixture, FixtureSet } from './types';
|
||||
|
||||
const FIXTURES_DIR = path.join(__dirname, 'data');
|
||||
// In E2E tests, API calls go through Next.js rewrites to /api/* on the same origin
|
||||
// So we need to match **/api/** to intercept regardless of host
|
||||
const API_PATH_PATTERN = '**/api/**';
|
||||
|
||||
/**
|
||||
* Match a request URL path to a fixture pattern
|
||||
* Supports simple wildcards like /api/v1/jobs/* matching /api/v1/jobs/123
|
||||
*/
|
||||
function matchPath(pattern: string, actualPath: string): boolean {
|
||||
// Exact match
|
||||
if (pattern === actualPath) return true;
|
||||
|
||||
// Wildcard match: /api/v1/jobs/* matches /api/v1/jobs/anything
|
||||
if (pattern.endsWith('/*')) {
|
||||
const prefix = pattern.slice(0, -2);
|
||||
return actualPath.startsWith(prefix) && actualPath.split('/').length === pattern.split('/').length;
|
||||
}
|
||||
|
||||
// Pattern with :param placeholders
|
||||
const patternParts = pattern.split('/');
|
||||
const actualParts = actualPath.split('/');
|
||||
|
||||
if (patternParts.length !== actualParts.length) return false;
|
||||
|
||||
return patternParts.every((part, i) => {
|
||||
if (part.startsWith(':')) return true; // Matches any value
|
||||
return part === actualParts[i];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a fixture set from disk
|
||||
*/
|
||||
export function loadFixtureSet(name: string): FixtureSet | null {
|
||||
const filePath = path.join(FIXTURES_DIR, 'sets', `${name}.json`);
|
||||
if (!fs.existsSync(filePath)) {
|
||||
console.warn(`Fixture set not found: ${filePath}`);
|
||||
return null;
|
||||
}
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
return JSON.parse(content) as FixtureSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all approved fixtures from the approved directory
|
||||
*/
|
||||
export function loadApprovedFixtures(): Record<string, ApiFixture> {
|
||||
const approvedDir = path.join(FIXTURES_DIR, 'approved');
|
||||
const fixtures: Record<string, ApiFixture> = {};
|
||||
|
||||
if (!fs.existsSync(approvedDir)) {
|
||||
console.warn(`Approved fixtures directory not found: ${approvedDir}`);
|
||||
return fixtures;
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(approvedDir).filter(f => f.endsWith('.json'));
|
||||
for (const file of files) {
|
||||
const content = fs.readFileSync(path.join(approvedDir, file), 'utf-8');
|
||||
const fixture = JSON.parse(content) as ApiFixture;
|
||||
// Key by method + path for lookup
|
||||
const key = `${fixture.request.method}:${fixture.request.path}`;
|
||||
fixtures[key] = fixture;
|
||||
}
|
||||
|
||||
return fixtures;
|
||||
}
|
||||
|
||||
/**
|
||||
* API Mock Server class for replaying fixtures in tests
|
||||
*/
|
||||
export class ApiMockServer {
|
||||
private fixtures: Record<string, ApiFixture> = {};
|
||||
private fixtureSet: FixtureSet | null = null;
|
||||
private unmatchedRequests: Array<{ method: string; url: string }> = [];
|
||||
|
||||
/**
|
||||
* Load fixtures from a named fixture set
|
||||
*/
|
||||
loadFixtureSet(name: string): this {
|
||||
this.fixtureSet = loadFixtureSet(name);
|
||||
if (this.fixtureSet) {
|
||||
for (const [pattern, fixture] of Object.entries(this.fixtureSet.fixtures)) {
|
||||
this.fixtures[pattern] = fixture;
|
||||
}
|
||||
console.log(`📦 Loaded fixture set: ${name} (${Object.keys(this.fixtureSet.fixtures).length} fixtures)`);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all approved fixtures
|
||||
*/
|
||||
loadApprovedFixtures(): this {
|
||||
const approved = loadApprovedFixtures();
|
||||
for (const [key, fixture] of Object.entries(approved)) {
|
||||
this.fixtures[key] = fixture;
|
||||
}
|
||||
console.log(`✅ Loaded ${Object.keys(approved).length} approved fixtures`);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a single fixture manually
|
||||
*/
|
||||
addFixture(fixture: ApiFixture): this {
|
||||
const key = `${fixture.request.method}:${fixture.request.path}`;
|
||||
this.fixtures[key] = fixture;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an inline fixture for a specific route
|
||||
*/
|
||||
mockRoute(
|
||||
method: string,
|
||||
path: string,
|
||||
response: { status?: number; body: any }
|
||||
): this {
|
||||
const fixture: ApiFixture = {
|
||||
id: `inline-${method}-${path.replace(/\//g, '-')}`,
|
||||
description: `Inline mock for ${method} ${path}`,
|
||||
capturedAt: new Date().toISOString(),
|
||||
request: { method, url: path, path },
|
||||
response: {
|
||||
status: response.status || 200,
|
||||
statusText: response.status === 200 ? 'OK' : 'Error',
|
||||
body: response.body,
|
||||
},
|
||||
reviewed: true,
|
||||
};
|
||||
this.addFixture(fixture);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the mock server on a Playwright page
|
||||
*/
|
||||
async install(page: Page): Promise<void> {
|
||||
await page.route(API_PATH_PATTERN, async (route: Route, request: Request) => {
|
||||
const url = request.url();
|
||||
const method = request.method();
|
||||
const urlObj = new URL(url);
|
||||
const urlPath = urlObj.pathname;
|
||||
|
||||
// Try exact match first
|
||||
let fixture = this.fixtures[`${method}:${urlPath}`];
|
||||
|
||||
// Then try pattern matching
|
||||
if (!fixture) {
|
||||
for (const [pattern, f] of Object.entries(this.fixtures)) {
|
||||
const [fMethod, fPath] = pattern.includes(':')
|
||||
? pattern.split(':')
|
||||
: [f.request.method, pattern];
|
||||
|
||||
if (fMethod === method && matchPath(fPath, urlPath)) {
|
||||
fixture = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fixture) {
|
||||
console.log(`🎭 [MOCK] ${method} ${urlPath} -> ${fixture.response.status}`);
|
||||
await route.fulfill({
|
||||
status: fixture.response.status,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify(fixture.response.body),
|
||||
});
|
||||
} else {
|
||||
console.warn(`⚠️ [MOCK] No fixture for ${method} ${urlPath}`);
|
||||
this.unmatchedRequests.push({ method, url });
|
||||
|
||||
// Return a clear error response
|
||||
await route.fulfill({
|
||||
status: 501,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
error: 'No fixture available',
|
||||
message: `No mock fixture found for ${method} ${urlPath}`,
|
||||
hint: 'Run tests with RECORD_FIXTURES=true to capture this endpoint',
|
||||
}),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`🎭 Mock server installed with ${Object.keys(this.fixtures).length} fixtures`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of requests that had no matching fixture
|
||||
*/
|
||||
getUnmatchedRequests(): Array<{ method: string; url: string }> {
|
||||
return this.unmatchedRequests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all requests were handled
|
||||
*/
|
||||
allRequestsHandled(): boolean {
|
||||
return this.unmatchedRequests.length === 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a mock server with common test fixtures pre-loaded
|
||||
*/
|
||||
export function createMockServer(): ApiMockServer {
|
||||
return new ApiMockServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick helper to mock common auth scenarios
|
||||
*/
|
||||
export function createAuthenticatedMock(): ApiMockServer {
|
||||
return new ApiMockServer()
|
||||
.mockRoute('GET', '/api/v1/me', {
|
||||
body: { authenticated: true, user: { id: 'test-user' } },
|
||||
})
|
||||
.mockRoute('GET', '/api/v1/jobs', {
|
||||
body: [],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick helper for unauthenticated scenario
|
||||
*/
|
||||
export function createUnauthenticatedMock(): ApiMockServer {
|
||||
return new ApiMockServer()
|
||||
.mockRoute('GET', '/api/v1/me', {
|
||||
status: 401,
|
||||
body: { detail: 'Not authenticated' },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* API Fixture Recorder
|
||||
*
|
||||
* Intercepts API calls during E2E tests and records them for review.
|
||||
* Run with RECORD_FIXTURES=true to capture new fixtures.
|
||||
*/
|
||||
|
||||
import { Page, Route, Request } from '@playwright/test';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { ApiFixture, RecordingSession } from './types';
|
||||
|
||||
const FIXTURES_DIR = path.join(__dirname, 'data');
|
||||
// In E2E tests, API calls go through Next.js rewrites to /api/* on the same origin
|
||||
const API_PATH_PATTERN = '**/api/**';
|
||||
|
||||
/**
|
||||
* Generate a unique ID for a fixture based on method and path
|
||||
*/
|
||||
function generateFixtureId(method: string, urlPath: string): string {
|
||||
const sanitizedPath = urlPath
|
||||
.replace(/^\/api\/v1\//, '')
|
||||
.replace(/\//g, '-')
|
||||
.replace(/[^a-zA-Z0-9-]/g, '_');
|
||||
return `${method.toLowerCase()}-${sanitizedPath}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract path and query from URL
|
||||
*/
|
||||
function parseUrl(url: string): { path: string; query: Record<string, string> } {
|
||||
const urlObj = new URL(url);
|
||||
const query: Record<string, string> = {};
|
||||
urlObj.searchParams.forEach((value, key) => {
|
||||
query[key] = value;
|
||||
});
|
||||
return {
|
||||
path: urlObj.pathname,
|
||||
query: Object.keys(query).length > 0 ? query : undefined as any,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Redact sensitive information from headers
|
||||
*/
|
||||
function redactHeaders(headers: Record<string, string>): Record<string, string> {
|
||||
const redacted = { ...headers };
|
||||
const sensitiveKeys = ['authorization', 'x-access-token', 'cookie', 'set-cookie'];
|
||||
for (const key of sensitiveKeys) {
|
||||
if (redacted[key]) {
|
||||
redacted[key] = '[REDACTED]';
|
||||
}
|
||||
}
|
||||
return redacted;
|
||||
}
|
||||
|
||||
/**
|
||||
* API Recorder class for capturing API calls during tests
|
||||
*/
|
||||
export class ApiRecorder {
|
||||
private session: RecordingSession;
|
||||
private isRecording: boolean = false;
|
||||
private outputFile: string;
|
||||
|
||||
constructor(testFile?: string) {
|
||||
this.session = {
|
||||
sessionId: `session-${Date.now()}`,
|
||||
startedAt: new Date().toISOString(),
|
||||
testFile,
|
||||
calls: [],
|
||||
};
|
||||
this.outputFile = path.join(
|
||||
FIXTURES_DIR,
|
||||
'recordings',
|
||||
`${this.session.sessionId}.json`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start recording API calls for a page
|
||||
*/
|
||||
async startRecording(page: Page): Promise<void> {
|
||||
if (this.isRecording) {
|
||||
console.warn('Recording already in progress');
|
||||
return;
|
||||
}
|
||||
|
||||
this.isRecording = true;
|
||||
|
||||
// Ensure recordings directory exists
|
||||
const recordingsDir = path.dirname(this.outputFile);
|
||||
if (!fs.existsSync(recordingsDir)) {
|
||||
fs.mkdirSync(recordingsDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Intercept all API calls
|
||||
await page.route(API_PATH_PATTERN, async (route: Route, request: Request) => {
|
||||
const url = request.url();
|
||||
const method = request.method();
|
||||
const { path: urlPath, query } = parseUrl(url);
|
||||
|
||||
console.log(`📡 [RECORDING] ${method} ${urlPath}`);
|
||||
|
||||
// Let the request proceed and capture the response
|
||||
const response = await route.fetch();
|
||||
const status = response.status();
|
||||
const statusText = response.statusText();
|
||||
|
||||
let body: any;
|
||||
try {
|
||||
const text = await response.text();
|
||||
body = text ? JSON.parse(text) : null;
|
||||
} catch {
|
||||
body = await response.text();
|
||||
}
|
||||
|
||||
// Create fixture entry
|
||||
const fixture: ApiFixture = {
|
||||
id: generateFixtureId(method, urlPath),
|
||||
description: `${method} ${urlPath}`,
|
||||
capturedAt: new Date().toISOString(),
|
||||
request: {
|
||||
method,
|
||||
url,
|
||||
path: urlPath,
|
||||
query,
|
||||
body: request.postDataJSON() || undefined,
|
||||
headers: redactHeaders(request.headers()),
|
||||
},
|
||||
response: {
|
||||
status,
|
||||
statusText,
|
||||
body,
|
||||
},
|
||||
reviewed: false,
|
||||
};
|
||||
|
||||
this.session.calls.push(fixture);
|
||||
|
||||
// Save after each call for safety
|
||||
this.saveSession();
|
||||
|
||||
// Fulfill with the actual response
|
||||
await route.fulfill({
|
||||
status,
|
||||
headers: response.headers(),
|
||||
body: typeof body === 'string' ? body : JSON.stringify(body),
|
||||
});
|
||||
});
|
||||
|
||||
console.log(`🎬 Started recording API calls to ${this.outputFile}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop recording and save the session
|
||||
*/
|
||||
stopRecording(): RecordingSession {
|
||||
this.isRecording = false;
|
||||
this.saveSession();
|
||||
console.log(`🛑 Stopped recording. Captured ${this.session.calls.length} API calls.`);
|
||||
console.log(`📁 Recording saved to: ${this.outputFile}`);
|
||||
return this.session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the current session to disk
|
||||
*/
|
||||
private saveSession(): void {
|
||||
fs.writeFileSync(
|
||||
this.outputFile,
|
||||
JSON.stringify(this.session, null, 2),
|
||||
'utf-8'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all recorded calls
|
||||
*/
|
||||
getCalls(): ApiFixture[] {
|
||||
return this.session.calls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output file path
|
||||
*/
|
||||
getOutputFile(): string {
|
||||
return this.outputFile;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to check if we should record fixtures
|
||||
*/
|
||||
export function shouldRecordFixtures(): boolean {
|
||||
return process.env.RECORD_FIXTURES === 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a recorder if in recording mode, otherwise return null
|
||||
*/
|
||||
export function createRecorderIfNeeded(testFile?: string): ApiRecorder | null {
|
||||
if (shouldRecordFixtures()) {
|
||||
return new ApiRecorder(testFile);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
#!/usr/bin/env npx ts-node
|
||||
/**
|
||||
* CLI tool for reviewing and approving recorded API fixtures
|
||||
*
|
||||
* Usage:
|
||||
* npx ts-node e2e/fixtures/review-cli.ts
|
||||
*
|
||||
* Or add to package.json scripts:
|
||||
* "fixtures:review": "ts-node e2e/fixtures/review-cli.ts"
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as readline from 'readline';
|
||||
import { ApiFixture, RecordingSession } from './types';
|
||||
|
||||
const FIXTURES_DIR = path.join(__dirname, 'data');
|
||||
const RECORDINGS_DIR = path.join(FIXTURES_DIR, 'recordings');
|
||||
const APPROVED_DIR = path.join(FIXTURES_DIR, 'approved');
|
||||
|
||||
// Ensure directories exist
|
||||
[FIXTURES_DIR, RECORDINGS_DIR, APPROVED_DIR].forEach((dir) => {
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
function prompt(question: string): Promise<string> {
|
||||
return new Promise((resolve) => {
|
||||
rl.question(question, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function printFixture(fixture: ApiFixture, index: number, total: number): void {
|
||||
console.log('\n' + '='.repeat(80));
|
||||
console.log(`📋 Fixture ${index + 1}/${total}: ${fixture.id}`);
|
||||
console.log('='.repeat(80));
|
||||
|
||||
console.log('\n📤 REQUEST:');
|
||||
console.log(` Method: ${fixture.request.method}`);
|
||||
console.log(` Path: ${fixture.request.path}`);
|
||||
if (fixture.request.query && Object.keys(fixture.request.query).length > 0) {
|
||||
console.log(` Query: ${JSON.stringify(fixture.request.query)}`);
|
||||
}
|
||||
if (fixture.request.body) {
|
||||
console.log(` Body: ${JSON.stringify(fixture.request.body, null, 2).split('\n').join('\n ')}`);
|
||||
}
|
||||
|
||||
console.log('\n📥 RESPONSE:');
|
||||
console.log(` Status: ${fixture.response.status} ${fixture.response.statusText}`);
|
||||
console.log(` Body:`);
|
||||
|
||||
const bodyStr = JSON.stringify(fixture.response.body, null, 2);
|
||||
const lines = bodyStr.split('\n');
|
||||
if (lines.length > 30) {
|
||||
// Truncate long responses
|
||||
console.log(lines.slice(0, 25).map((l) => ` ${l}`).join('\n'));
|
||||
console.log(` ... (${lines.length - 25} more lines)`);
|
||||
} else {
|
||||
console.log(lines.map((l) => ` ${l}`).join('\n'));
|
||||
}
|
||||
|
||||
console.log(`\n⏰ Captured: ${fixture.capturedAt}`);
|
||||
}
|
||||
|
||||
async function reviewFixture(fixture: ApiFixture): Promise<'approve' | 'skip' | 'edit' | 'quit'> {
|
||||
console.log('\nOptions:');
|
||||
console.log(' [a] Approve - Save this fixture for use in tests');
|
||||
console.log(' [s] Skip - Do not approve this fixture');
|
||||
console.log(' [e] Edit - Add notes/description before approving');
|
||||
console.log(' [q] Quit - Exit review session');
|
||||
|
||||
const answer = await prompt('\nYour choice (a/s/e/q): ');
|
||||
|
||||
switch (answer.toLowerCase().trim()) {
|
||||
case 'a':
|
||||
return 'approve';
|
||||
case 's':
|
||||
return 'skip';
|
||||
case 'e':
|
||||
return 'edit';
|
||||
case 'q':
|
||||
return 'quit';
|
||||
default:
|
||||
console.log('Invalid choice, please try again.');
|
||||
return reviewFixture(fixture);
|
||||
}
|
||||
}
|
||||
|
||||
async function editFixture(fixture: ApiFixture): Promise<ApiFixture> {
|
||||
console.log('\nEditing fixture...');
|
||||
|
||||
const description = await prompt(`Description (current: "${fixture.description}"): `);
|
||||
if (description.trim()) {
|
||||
fixture.description = description.trim();
|
||||
}
|
||||
|
||||
const notes = await prompt('Review notes (optional): ');
|
||||
if (notes.trim()) {
|
||||
fixture.reviewNotes = notes.trim();
|
||||
}
|
||||
|
||||
return fixture;
|
||||
}
|
||||
|
||||
function saveApprovedFixture(fixture: ApiFixture): string {
|
||||
fixture.reviewed = true;
|
||||
|
||||
// Generate filename from fixture ID
|
||||
const filename = `${fixture.id}.json`;
|
||||
const filepath = path.join(APPROVED_DIR, filename);
|
||||
|
||||
// Check for existing fixture with same ID
|
||||
if (fs.existsSync(filepath)) {
|
||||
const timestamp = Date.now();
|
||||
const backupPath = path.join(APPROVED_DIR, `${fixture.id}.backup-${timestamp}.json`);
|
||||
fs.renameSync(filepath, backupPath);
|
||||
console.log(` ⚠️ Existing fixture backed up to: ${path.basename(backupPath)}`);
|
||||
}
|
||||
|
||||
fs.writeFileSync(filepath, JSON.stringify(fixture, null, 2), 'utf-8');
|
||||
return filepath;
|
||||
}
|
||||
|
||||
async function reviewSession(sessionFile: string): Promise<void> {
|
||||
const content = fs.readFileSync(sessionFile, 'utf-8');
|
||||
const session: RecordingSession = JSON.parse(content);
|
||||
|
||||
console.log('\n' + '🎬'.repeat(40));
|
||||
console.log(`\n📁 Reviewing recording session: ${session.sessionId}`);
|
||||
console.log(` Started: ${session.startedAt}`);
|
||||
console.log(` Test file: ${session.testFile || 'N/A'}`);
|
||||
console.log(` Total API calls: ${session.calls.length}`);
|
||||
console.log('\n' + '🎬'.repeat(40));
|
||||
|
||||
let approved = 0;
|
||||
let skipped = 0;
|
||||
|
||||
for (let i = 0; i < session.calls.length; i++) {
|
||||
let fixture = session.calls[i];
|
||||
|
||||
printFixture(fixture, i, session.calls.length);
|
||||
|
||||
const action = await reviewFixture(fixture);
|
||||
|
||||
switch (action) {
|
||||
case 'approve':
|
||||
const savedPath = saveApprovedFixture(fixture);
|
||||
console.log(` ✅ Approved and saved: ${path.basename(savedPath)}`);
|
||||
approved++;
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
fixture = await editFixture(fixture);
|
||||
const editedPath = saveApprovedFixture(fixture);
|
||||
console.log(` ✅ Approved and saved: ${path.basename(editedPath)}`);
|
||||
approved++;
|
||||
break;
|
||||
|
||||
case 'skip':
|
||||
console.log(' ⏭️ Skipped');
|
||||
skipped++;
|
||||
break;
|
||||
|
||||
case 'quit':
|
||||
console.log('\n👋 Exiting review session...');
|
||||
console.log(` Approved: ${approved}, Skipped: ${skipped}, Remaining: ${session.calls.length - i}`);
|
||||
rl.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n' + '='.repeat(80));
|
||||
console.log('📊 Review Summary:');
|
||||
console.log(` ✅ Approved: ${approved}`);
|
||||
console.log(` ⏭️ Skipped: ${skipped}`);
|
||||
console.log('='.repeat(80));
|
||||
|
||||
// Ask if user wants to delete the recording
|
||||
const deleteRecording = await prompt('\nDelete the processed recording file? (y/n): ');
|
||||
if (deleteRecording.toLowerCase().trim() === 'y') {
|
||||
fs.unlinkSync(sessionFile);
|
||||
console.log(' 🗑️ Recording file deleted');
|
||||
}
|
||||
|
||||
rl.close();
|
||||
}
|
||||
|
||||
async function listRecordings(): Promise<string[]> {
|
||||
if (!fs.existsSync(RECORDINGS_DIR)) {
|
||||
return [];
|
||||
}
|
||||
return fs.readdirSync(RECORDINGS_DIR)
|
||||
.filter((f) => f.endsWith('.json'))
|
||||
.map((f) => path.join(RECORDINGS_DIR, f));
|
||||
}
|
||||
|
||||
async function main(): Promise<void> {
|
||||
console.log('\n🔍 API Fixture Review Tool');
|
||||
console.log('='.repeat(40));
|
||||
|
||||
const recordings = await listRecordings();
|
||||
|
||||
if (recordings.length === 0) {
|
||||
console.log('\n📭 No recordings found to review.');
|
||||
console.log('\nTo capture new recordings:');
|
||||
console.log(' RECORD_FIXTURES=true npm run test:e2e');
|
||||
rl.close();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`\n📁 Found ${recordings.length} recording(s):\n`);
|
||||
recordings.forEach((file, i) => {
|
||||
const content = JSON.parse(fs.readFileSync(file, 'utf-8')) as RecordingSession;
|
||||
console.log(` ${i + 1}. ${path.basename(file)}`);
|
||||
console.log(` └─ ${content.calls.length} API calls, captured ${content.startedAt}`);
|
||||
});
|
||||
|
||||
const choice = await prompt(`\nSelect recording to review (1-${recordings.length}), or 'q' to quit: `);
|
||||
|
||||
if (choice.toLowerCase() === 'q') {
|
||||
console.log('\n👋 Goodbye!');
|
||||
rl.close();
|
||||
return;
|
||||
}
|
||||
|
||||
const index = parseInt(choice, 10) - 1;
|
||||
if (isNaN(index) || index < 0 || index >= recordings.length) {
|
||||
console.log('Invalid selection.');
|
||||
rl.close();
|
||||
return;
|
||||
}
|
||||
|
||||
await reviewSession(recordings[index]);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error('Error:', err);
|
||||
rl.close();
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* Test Helper for API Fixtures
|
||||
*
|
||||
* Provides a unified interface for tests to work with API fixtures.
|
||||
* Automatically switches between recording mode and mock mode based on environment.
|
||||
*
|
||||
* Usage in tests:
|
||||
*
|
||||
* ```typescript
|
||||
* import { test } from '@playwright/test';
|
||||
* import { setupApiFixtures } from './fixtures/test-helper';
|
||||
*
|
||||
* test('my test', async ({ page }) => {
|
||||
* const api = await setupApiFixtures(page, {
|
||||
* fixtureSet: 'authenticated-user', // or use inline mocks
|
||||
* });
|
||||
*
|
||||
* // Test code here...
|
||||
*
|
||||
* // Optionally check for unhandled requests
|
||||
* api.assertAllHandled();
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { ApiRecorder, shouldRecordFixtures, createRecorderIfNeeded } from './recorder';
|
||||
import { ApiMockServer, createMockServer } from './mock-server';
|
||||
import { ApiFixture } from './types';
|
||||
|
||||
export interface SetupOptions {
|
||||
/** Name of fixture set to load */
|
||||
fixtureSet?: string;
|
||||
/** Load all approved fixtures */
|
||||
useApprovedFixtures?: boolean;
|
||||
/** Additional inline mocks */
|
||||
mocks?: Array<{
|
||||
method: string;
|
||||
path: string;
|
||||
response: { status?: number; body: any };
|
||||
}>;
|
||||
/** Test file name (for recording mode) */
|
||||
testFile?: string;
|
||||
}
|
||||
|
||||
export interface ApiTestContext {
|
||||
/** The mock server (if in mock mode) */
|
||||
mockServer: ApiMockServer | null;
|
||||
/** The recorder (if in recording mode) */
|
||||
recorder: ApiRecorder | null;
|
||||
/** Whether we're in recording mode */
|
||||
isRecording: boolean;
|
||||
/** Assert all API requests were handled (mock mode only) */
|
||||
assertAllHandled: () => void;
|
||||
/** Get unmatched requests (mock mode only) */
|
||||
getUnmatchedRequests: () => Array<{ method: string; url: string }>;
|
||||
/** Stop recording and get results (recording mode only) */
|
||||
stopRecording: () => ApiFixture[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up API fixtures for a test
|
||||
*
|
||||
* In recording mode (RECORD_FIXTURES=true):
|
||||
* - Intercepts real API calls and records them
|
||||
* - Saves recordings to fixtures/data/recordings/
|
||||
*
|
||||
* In mock mode (default):
|
||||
* - Intercepts API calls and returns fixture data
|
||||
* - No real backend requests are made
|
||||
*/
|
||||
export async function setupApiFixtures(
|
||||
page: Page,
|
||||
options: SetupOptions = {}
|
||||
): Promise<ApiTestContext> {
|
||||
const isRecording = shouldRecordFixtures();
|
||||
|
||||
if (isRecording) {
|
||||
// Recording mode: capture real API responses
|
||||
const recorder = new ApiRecorder(options.testFile);
|
||||
await recorder.startRecording(page);
|
||||
|
||||
return {
|
||||
mockServer: null,
|
||||
recorder,
|
||||
isRecording: true,
|
||||
assertAllHandled: () => {
|
||||
// No-op in recording mode
|
||||
},
|
||||
getUnmatchedRequests: () => [],
|
||||
stopRecording: () => {
|
||||
const session = recorder.stopRecording();
|
||||
return session.calls;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Mock mode: replay fixtures
|
||||
const mockServer = createMockServer();
|
||||
|
||||
// Load fixture set if specified
|
||||
if (options.fixtureSet) {
|
||||
mockServer.loadFixtureSet(options.fixtureSet);
|
||||
}
|
||||
|
||||
// Load approved fixtures if requested
|
||||
if (options.useApprovedFixtures) {
|
||||
mockServer.loadApprovedFixtures();
|
||||
}
|
||||
|
||||
// Add inline mocks
|
||||
if (options.mocks) {
|
||||
for (const mock of options.mocks) {
|
||||
mockServer.mockRoute(mock.method, mock.path, mock.response);
|
||||
}
|
||||
}
|
||||
|
||||
await mockServer.install(page);
|
||||
|
||||
return {
|
||||
mockServer,
|
||||
recorder: null,
|
||||
isRecording: false,
|
||||
assertAllHandled: () => {
|
||||
const unmatched = mockServer.getUnmatchedRequests();
|
||||
if (unmatched.length > 0) {
|
||||
const details = unmatched
|
||||
.map((r) => ` - ${r.method} ${r.url}`)
|
||||
.join('\n');
|
||||
throw new Error(
|
||||
`Some API requests had no matching fixture:\n${details}\n\n` +
|
||||
'Run with RECORD_FIXTURES=true to capture these endpoints.'
|
||||
);
|
||||
}
|
||||
},
|
||||
getUnmatchedRequests: () => mockServer.getUnmatchedRequests(),
|
||||
stopRecording: () => [],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for tests that only need simple inline mocks
|
||||
*/
|
||||
export async function setupMocks(
|
||||
page: Page,
|
||||
mocks: Array<{
|
||||
method: string;
|
||||
path: string;
|
||||
response: { status?: number; body: any };
|
||||
}>
|
||||
): Promise<ApiTestContext> {
|
||||
return setupApiFixtures(page, { mocks });
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for authenticated user scenario
|
||||
*/
|
||||
export async function setupAuthenticatedUser(page: Page): Promise<ApiTestContext> {
|
||||
return setupApiFixtures(page, {
|
||||
mocks: [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/api/jobs',
|
||||
response: { body: [] },
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for unauthenticated user scenario
|
||||
* Note: The frontend checks localStorage for auth token before making API calls,
|
||||
* so no mock is needed for the unauthenticated state.
|
||||
*/
|
||||
export async function setupUnauthenticatedUser(page: Page): Promise<ApiTestContext> {
|
||||
return setupApiFixtures(page, { mocks: [] });
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to set authentication token in localStorage before page navigation
|
||||
*/
|
||||
export async function setAuthToken(page: Page, token: string): Promise<void> {
|
||||
await page.addInitScript((t) => {
|
||||
localStorage.setItem('karaoke_access_token', t);
|
||||
}, token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to clear authentication token
|
||||
*/
|
||||
export async function clearAuthToken(page: Page): Promise<void> {
|
||||
await page.addInitScript(() => {
|
||||
localStorage.removeItem('karaoke_access_token');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Types for API fixture recording and playback
|
||||
*/
|
||||
|
||||
export interface ApiFixture {
|
||||
/** Unique identifier for this fixture */
|
||||
id: string;
|
||||
/** Human-readable description of what this fixture represents */
|
||||
description: string;
|
||||
/** When this fixture was captured */
|
||||
capturedAt: string;
|
||||
/** The request that was made */
|
||||
request: {
|
||||
method: string;
|
||||
url: string;
|
||||
/** URL path without query string */
|
||||
path: string;
|
||||
/** Query parameters */
|
||||
query?: Record<string, string>;
|
||||
/** Request body (for POST/PUT/PATCH) */
|
||||
body?: any;
|
||||
/** Relevant headers (auth token redacted) */
|
||||
headers?: Record<string, string>;
|
||||
};
|
||||
/** The response received */
|
||||
response: {
|
||||
status: number;
|
||||
statusText: string;
|
||||
headers?: Record<string, string>;
|
||||
body: any;
|
||||
};
|
||||
/** Optional notes from reviewer */
|
||||
reviewNotes?: string;
|
||||
/** Whether this fixture has been reviewed and approved */
|
||||
reviewed: boolean;
|
||||
}
|
||||
|
||||
export interface RecordingSession {
|
||||
/** Session identifier */
|
||||
sessionId: string;
|
||||
/** When recording started */
|
||||
startedAt: string;
|
||||
/** Test file that generated this recording */
|
||||
testFile?: string;
|
||||
/** All API calls captured in this session */
|
||||
calls: ApiFixture[];
|
||||
}
|
||||
|
||||
export interface FixtureSet {
|
||||
/** Name of this fixture set (e.g., "authenticated-user", "empty-jobs") */
|
||||
name: string;
|
||||
/** Description of the scenario this fixture set represents */
|
||||
description: string;
|
||||
/** Fixtures in this set, keyed by a route pattern */
|
||||
fixtures: Record<string, ApiFixture>;
|
||||
}
|
||||
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 386 KiB |
|
After Width: | Height: | Size: 390 KiB |
|
After Width: | Height: | Size: 511 KiB |
|
After Width: | Height: | Size: 298 KiB |
|
After Width: | Height: | Size: 513 KiB |
|
After Width: | Height: | Size: 200 KiB |
|
After Width: | Height: | Size: 293 KiB |
|
After Width: | Height: | Size: 202 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 333 KiB |
|
After Width: | Height: | Size: 338 KiB |
|
After Width: | Height: | Size: 336 KiB |
@@ -60,6 +60,8 @@ export interface Job {
|
||||
progress?: number;
|
||||
message?: string;
|
||||
}>;
|
||||
review_token?: string;
|
||||
audio_hash?: string;
|
||||
}
|
||||
|
||||
export interface UploadJobResponse {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect, useCallback } from "react"
|
||||
|
||||
const THEME_STORAGE_KEY = "nomad-karaoke-theme"
|
||||
|
||||
export type Theme = "dark" | "light"
|
||||
|
||||
export function useTheme() {
|
||||
const [theme, setThemeState] = useState<Theme>("dark")
|
||||
const [mounted, setMounted] = useState(false)
|
||||
|
||||
// Load theme from localStorage on mount
|
||||
useEffect(() => {
|
||||
setMounted(true)
|
||||
const stored = localStorage.getItem(THEME_STORAGE_KEY) as Theme | null
|
||||
if (stored === "light" || stored === "dark") {
|
||||
setThemeState(stored)
|
||||
applyTheme(stored)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const applyTheme = (newTheme: Theme) => {
|
||||
const root = document.documentElement
|
||||
if (newTheme === "light") {
|
||||
root.classList.add("light")
|
||||
} else {
|
||||
root.classList.remove("light")
|
||||
}
|
||||
}
|
||||
|
||||
const setTheme = useCallback((newTheme: Theme) => {
|
||||
setThemeState(newTheme)
|
||||
localStorage.setItem(THEME_STORAGE_KEY, newTheme)
|
||||
applyTheme(newTheme)
|
||||
}, [])
|
||||
|
||||
const toggleTheme = useCallback(() => {
|
||||
const newTheme = theme === "dark" ? "light" : "dark"
|
||||
setTheme(newTheme)
|
||||
}, [theme, setTheme])
|
||||
|
||||
const isDarkMode = theme === "dark"
|
||||
|
||||
return {
|
||||
theme,
|
||||
setTheme,
|
||||
toggleTheme,
|
||||
isDarkMode,
|
||||
mounted,
|
||||
}
|
||||
}
|
||||
@@ -72,10 +72,12 @@
|
||||
"@types/node": "^22",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"concurrently": "^9.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"postcss": "^8.5",
|
||||
"tailwindcss": "^4.1.9",
|
||||
"ts-node": "^10.9.2",
|
||||
"tw-animate-css": "1.3.3",
|
||||
"typescript": "^5"
|
||||
}
|
||||
@@ -625,6 +627,30 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@date-fns/tz": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@date-fns/tz/-/tz-1.2.0.tgz",
|
||||
@@ -3434,6 +3460,34 @@
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/node10": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",
|
||||
"integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
||||
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/aria-query": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
|
||||
@@ -3850,6 +3904,13 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
@@ -4431,6 +4492,47 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/concurrently": {
|
||||
"version": "9.2.1",
|
||||
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz",
|
||||
"integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "4.1.2",
|
||||
"rxjs": "7.8.2",
|
||||
"shell-quote": "1.8.3",
|
||||
"supports-color": "8.1.1",
|
||||
"tree-kill": "1.2.2",
|
||||
"yargs": "17.7.2"
|
||||
},
|
||||
"bin": {
|
||||
"conc": "dist/bin/concurrently.js",
|
||||
"concurrently": "dist/bin/concurrently.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/open-cli-tools/concurrently?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/concurrently/node_modules/supports-color": {
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
|
||||
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/convert-source-map": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||
@@ -4460,6 +4562,13 @@
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
@@ -4828,6 +4937,16 @@
|
||||
"integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/diff": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/diff-sequences": {
|
||||
"version": "29.6.3",
|
||||
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz",
|
||||
@@ -7448,6 +7567,13 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/makeerror": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz",
|
||||
@@ -8498,6 +8624,16 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/rxjs": {
|
||||
"version": "7.8.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"tslib": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-regex-test": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz",
|
||||
@@ -8657,6 +8793,19 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/shell-quote": {
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz",
|
||||
"integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||
@@ -9085,6 +9234,60 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/tree-kill": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz",
|
||||
"integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"tree-kill": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/ts-node": {
|
||||
"version": "10.9.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
|
||||
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"ts-node": "dist/bin.js",
|
||||
"ts-node-cwd": "dist/bin-cwd.js",
|
||||
"ts-node-esm": "dist/bin-esm.js",
|
||||
"ts-node-script": "dist/bin-script.js",
|
||||
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||
"ts-script": "dist/bin-script-deprecated.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": ">=1.2.50",
|
||||
"@swc/wasm": ">=1.2.50",
|
||||
"@types/node": "*",
|
||||
"typescript": ">=2.7"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@swc/wasm": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
@@ -9248,6 +9451,13 @@
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/v8-to-istanbul": {
|
||||
"version": "9.3.0",
|
||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
|
||||
@@ -9569,6 +9779,16 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/yocto-queue": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
"scripts": {
|
||||
"build": "next build",
|
||||
"dev": "next dev",
|
||||
"dev:with-lyrics": "concurrently -n karaoke,lyrics -c blue,green \"npm run dev\" \"npm run dev:lyrics\"",
|
||||
"dev:lyrics": "cd ../lyrics_transcriber_temp/lyrics_transcriber/frontend && npm run dev",
|
||||
"lint": "eslint .",
|
||||
"start": "next start",
|
||||
"test": "jest --watch",
|
||||
@@ -15,7 +17,9 @@
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:debug": "playwright test --debug",
|
||||
"test:e2e:headed": "playwright test --headed",
|
||||
"test:all": "npm run test:unit && npm run test:e2e"
|
||||
"test:e2e:record": "RECORD_FIXTURES=true playwright test",
|
||||
"test:all": "npm run test:unit && npm run test:e2e",
|
||||
"fixtures:review": "npx ts-node e2e/fixtures/review-cli.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
@@ -82,10 +86,12 @@
|
||||
"@types/node": "^22",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"concurrently": "^9.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"postcss": "^8.5",
|
||||
"tailwindcss": "^4.1.9",
|
||||
"ts-node": "^10.9.2",
|
||||
"tw-animate-css": "1.3.3",
|
||||
"typescript": "^5"
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 604 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 585 B |
|
Before Width: | Height: | Size: 566 B |
@@ -1,26 +0,0 @@
|
||||
<svg width="180" height="180" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
@media (prefers-color-scheme: light) {
|
||||
.background { fill: black; }
|
||||
.foreground { fill: white; }
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.background { fill: white; }
|
||||
.foreground { fill: black; }
|
||||
}
|
||||
</style>
|
||||
<g clip-path="url(#clip0_7960_43945)">
|
||||
<rect class="background" width="180" height="180" rx="37" />
|
||||
<g style="transform: scale(95%); transform-origin: center">
|
||||
<path class="foreground"
|
||||
d="M101.141 53H136.632C151.023 53 162.689 64.6662 162.689 79.0573V112.904H148.112V79.0573C148.112 78.7105 148.098 78.3662 148.072 78.0251L112.581 112.898C112.701 112.902 112.821 112.904 112.941 112.904H148.112V126.672H112.941C98.5504 126.672 86.5638 114.891 86.5638 100.5V66.7434H101.141V100.5C101.141 101.15 101.191 101.792 101.289 102.422L137.56 66.7816C137.255 66.7563 136.945 66.7434 136.632 66.7434H101.141V53Z" />
|
||||
<path class="foreground"
|
||||
d="M65.2926 124.136L14 66.7372H34.6355L64.7495 100.436V66.7372H80.1365V118.47C80.1365 126.278 70.4953 129.958 65.2926 124.136Z" />
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_7960_43945">
|
||||
<rect width="180" height="180" fill="white" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="45 60 255 135">
|
||||
<g data-v-70b83f88="" fill="#ff7acc" class="basesvg" transform="translate(48.368003845214844,62.62239074707031)"><g fill-rule="" class="tp-name" transform="translate(0,0)"><g transform="scale(1.4000000000000004)"><g stroke="#ff7acc" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" paint-order="stroke" data-gra-attr="stroke" fill-opacity="0"><path d="M1.4-33.44L1.4 0C31.48 0 3.96 0 34.04 0L34.04-32.64 17.81-32.64 17.81-20.61 1.4-33.44ZM52.21-33.76C42.6-33.76 34.81-25.97 34.81-16.37 34.81-6.76 42.6 1.03 52.21 1.03 61.81 1.03 69.6-6.76 69.6-16.37 69.6-25.97 61.81-33.76 52.21-33.76ZM70.7 0L103.34 0 103.25-33.9 86.93-21.54 70.61-33.9 70.7 0ZM102.34 0C138.2 0 107.52 0 143.56 0L122.95-34.93 102.34 0ZM158.84 0.05C167.84 0.05 175.16-7.27 175.16-16.27 175.16-25.27 167.84-32.64 158.84-32.64L142.52-32.64C142.52 0.75 142.52-33.34 142.52 0.05L158.84 0.05Z" transform="translate(-1.399999976158142, 34.93000030517578)"></path></g><g transform="translate(0,38.959999084472656)"><g stroke="#ff7acc" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" paint-order="stroke" data-gra-attr="stroke" fill="#ff7acc" fill-opacity="0" transform="scale(1.02719)"><path d="M24.43 0L17.67 0 7.98-11.87 7.98 0 2.63 0 2.63-26.64 7.98-26.64 7.98-14.69 17.67-26.64 24.12-26.64 13.13-13.44 24.43 0ZM45.03 0L43.27-5.08 32.66-5.08 30.91 0 25.3 0 34.88-26.68 41.1-26.68 50.68 0 45.03 0ZM34.11-9.35L41.82-9.35 37.97-20.5 34.11-9.35ZM73.19 0L67.01 0 61.13-10.38 58.61-10.38 58.61 0 53.27 0 53.27-26.64 63.27-26.64Q66.36-26.64 68.53-25.55 70.71-24.47 71.8-22.61 72.89-20.76 72.89-18.47L72.89-18.47Q72.89-15.84 71.36-13.72 69.83-11.6 66.82-10.8L66.82-10.8 73.19 0ZM58.61-22.21L58.61-14.39 63.08-14.39Q65.25-14.39 66.32-15.44 67.39-16.49 67.39-18.36L67.39-18.36Q67.39-20.19 66.32-21.2 65.25-22.21 63.08-22.21L63.08-22.21 58.61-22.21ZM94.82 0L93.07-5.08 82.46-5.08 80.7 0 75.09 0 84.67-26.68 90.89-26.68 100.47 0 94.82 0ZM83.91-9.35L91.62-9.35 87.76-20.5 83.91-9.35ZM115.43 0.27Q111.69 0.27 108.56-1.49 105.43-3.24 103.6-6.35 101.76-9.47 101.76-13.4L101.76-13.4Q101.76-17.29 103.6-20.4 105.43-23.51 108.56-25.27 111.69-27.02 115.43-27.02L115.43-27.02Q119.21-27.02 122.32-25.27 125.43-23.51 127.24-20.4 129.05-17.29 129.05-13.4L129.05-13.4Q129.05-9.47 127.24-6.35 125.43-3.24 122.3-1.49 119.17 0.27 115.43 0.27L115.43 0.27ZM115.43-4.5Q117.83-4.5 119.66-5.59 121.5-6.68 122.53-8.7 123.56-10.73 123.56-13.4L123.56-13.4Q123.56-16.07 122.53-18.07 121.5-20.08 119.66-21.15 117.83-22.21 115.43-22.21L115.43-22.21Q113.02-22.21 111.17-21.15 109.32-20.08 108.29-18.07 107.26-16.07 107.26-13.4L107.26-13.4Q107.26-10.73 108.29-8.7 109.32-6.68 111.17-5.59 113.02-4.5 115.43-4.5L115.43-4.5ZM153.82 0L147.06 0 137.37-11.87 137.37 0 132.02 0 132.02-26.64 137.37-26.64 137.37-14.69 147.06-26.64 153.51-26.64 142.52-13.44 153.82 0ZM171.79-22.33L161.67-22.33 161.67-15.65 170.64-15.65 170.64-11.41 161.67-11.41 161.67-4.35 171.79-4.35 171.79 0 156.33 0 156.33-26.68 171.79-26.68 171.79-22.33Z" transform="translate(-2.630000114440918, 27.020000457763672)"></path></g></g></g></g> <g data-gra="path-slogan" fill-rule="" class="tp-slogan" fill="#ffdf6b" transform="translate(5,111.788818359375)"><rect x="0" height="1" y="5.9832000732421875" width="14.278396606445312"></rect> <rect height="1" y="5.9832000732421875" width="14.278396606445312" x="218.985595703125"></rect> <g transform="translate(17.278396606445312,0)"><g transform="scale(1.2800000000000002)"><path d="M10.21-8.38L12.02-8.38L9.68 0L7.70 0L6.13-5.96L4.49 0L2.52 0.01L0.26-8.38L2.06-8.38L3.54-1.87L5.24-8.38L7.12-8.38L8.72-1.91L10.21-8.38ZM18.38-8.38L20.06-8.38L20.06 0L18.38 0L18.38-3.56L14.80-3.56L14.80 0L13.12 0L13.12-8.38L14.80-8.38L14.80-4.93L18.38-4.93L18.38-8.38ZM26.58-7.02L23.40-7.02L23.40-4.92L26.22-4.92L26.22-3.59L23.40-3.59L23.40-1.37L26.58-1.37L26.58 0L21.72 0L21.72-8.39L26.58-8.39L26.58-7.02ZM34.37 0L32.42 0L30.58-3.26L29.78-3.26L29.78 0L28.10 0L28.10-8.38L31.25-8.38Q32.22-8.38 32.90-8.03Q33.59-7.69 33.93-7.11Q34.27-6.53 34.27-5.81L34.27-5.81Q34.27-4.98 33.79-4.31Q33.31-3.65 32.36-3.40L32.36-3.40L34.37 0ZM29.78-6.98L29.78-4.52L31.19-4.52Q31.87-4.52 32.21-4.85Q32.54-5.18 32.54-5.77L32.54-5.77Q32.54-6.35 32.21-6.67Q31.87-6.98 31.19-6.98L31.19-6.98L29.78-6.98ZM40.66-7.02L37.48-7.02L37.48-4.92L40.30-4.92L40.30-3.59L37.48-3.59L37.48-1.37L40.66-1.37L40.66 0L35.80 0L35.80-8.39L40.66-8.39L40.66-7.02ZM47.92-8.38L49.70-8.38L46.63 0L44.59 0L41.52-8.38L43.32-8.38L45.62-1.72L47.92-8.38ZM55.57-7.02L52.39-7.02L52.39-4.92L55.21-4.92L55.21-3.59L52.39-3.59L52.39-1.37L55.57-1.37L55.57 0L50.71 0L50.71-8.39L55.57-8.39L55.57-7.02ZM63.36 0L61.42 0L59.57-3.26L58.78-3.26L58.78 0L57.10 0L57.10-8.38L60.24-8.38Q61.21-8.38 61.90-8.03Q62.58-7.69 62.92-7.11Q63.26-6.53 63.26-5.81L63.26-5.81Q63.26-4.98 62.78-4.31Q62.30-3.65 61.36-3.40L61.36-3.40L63.36 0ZM58.78-6.98L58.78-4.52L60.18-4.52Q60.86-4.52 61.20-4.85Q61.54-5.18 61.54-5.77L61.54-5.77Q61.54-6.35 61.20-6.67Q60.86-6.98 60.18-6.98L60.18-6.98L58.78-6.98ZM72.43-8.38L74.30-8.38L71.47-2.92L71.47 0L69.Line truncated
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 568 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="215" height="48" fill="none"><path fill="#000" d="M57.588 9.6h6L73.828 38h-5.2l-2.36-6.88h-11.36L52.548 38h-5.2l10.24-28.4Zm7.16 17.16-4.16-12.16-4.16 12.16h8.32Zm23.694-2.24c-.186-1.307-.706-2.32-1.56-3.04-.853-.72-1.866-1.08-3.04-1.08-1.68 0-2.986.613-3.92 1.84-.906 1.227-1.36 2.947-1.36 5.16s.454 3.933 1.36 5.16c.934 1.227 2.24 1.84 3.92 1.84 1.254 0 2.307-.373 3.16-1.12.854-.773 1.387-1.867 1.6-3.28l5.12.24c-.186 1.68-.733 3.147-1.64 4.4-.906 1.227-2.08 2.173-3.52 2.84-1.413.667-2.986 1-4.72 1-2.08 0-3.906-.453-5.48-1.36-1.546-.907-2.76-2.2-3.64-3.88-.853-1.68-1.28-3.627-1.28-5.84 0-2.24.427-4.187 1.28-5.84.88-1.68 2.094-2.973 3.64-3.88 1.574-.907 3.4-1.36 5.48-1.36 1.68 0 3.227.32 4.64.96 1.414.64 2.56 1.56 3.44 2.76.907 1.2 1.454 2.6 1.64 4.2l-5.12.28Zm11.486-7.72.12 3.4c.534-1.227 1.307-2.173 2.32-2.84 1.04-.693 2.267-1.04 3.68-1.04 1.494 0 2.76.387 3.8 1.16 1.067.747 1.827 1.813 2.28 3.2.507-1.44 1.294-2.52 2.36-3.24 1.094-.747 2.414-1.12 3.96-1.12 1.414 0 2.64.307 3.68.92s1.84 1.52 2.4 2.72c.56 1.2.84 2.667.84 4.4V38h-4.96V25.92c0-1.813-.293-3.187-.88-4.12-.56-.96-1.413-1.44-2.56-1.44-.906 0-1.68.213-2.32.64-.64.427-1.133 1.053-1.48 1.88-.32.827-.48 1.84-.48 3.04V38h-4.56V25.92c0-1.2-.133-2.213-.4-3.04-.24-.827-.626-1.453-1.16-1.88-.506-.427-1.133-.64-1.88-.64-.906 0-1.68.227-2.32.68-.64.427-1.133 1.053-1.48 1.88-.32.827-.48 1.827-.48 3V38h-4.96V16.8h4.48Zm26.723 10.6c0-2.24.427-4.187 1.28-5.84.854-1.68 2.067-2.973 3.64-3.88 1.574-.907 3.4-1.36 5.48-1.36 1.84 0 3.494.413 4.96 1.24 1.467.827 2.64 2.08 3.52 3.76.88 1.653 1.347 3.693 1.4 6.12v1.32h-15.08c.107 1.813.614 3.227 1.52 4.24.907.987 2.134 1.48 3.68 1.48.987 0 1.88-.253 2.68-.76a4.803 4.803 0 0 0 1.84-2.2l5.08.36c-.64 2.027-1.84 3.64-3.6 4.84-1.733 1.173-3.733 1.76-6 1.76-2.08 0-3.906-.453-5.48-1.36-1.573-.907-2.786-2.2-3.64-3.88-.853-1.68-1.28-3.627-1.28-5.84Zm15.16-2.04c-.213-1.733-.76-3.013-1.64-3.84-.853-.827-1.893-1.24-3.12-1.24-1.44 0-2.6.453-3.48 1.36-.88.88-1.44 2.12-1.68 3.72h9.92ZM163.139 9.6V38h-5.04V9.6h5.04Zm8.322 7.2.24 5.88-.64-.36c.32-2.053 1.094-3.56 2.32-4.52 1.254-.987 2.787-1.48 4.6-1.48 2.32 0 4.107.733 5.36 2.2 1.254 1.44 1.88 3.387 1.88 5.84V38h-4.96V25.92c0-1.253-.12-2.28-.36-3.08-.24-.8-.64-1.413-1.2-1.84-.533-.427-1.253-.64-2.16-.64-1.44 0-2.573.48-3.4 1.44-.8.933-1.2 2.307-1.2 4.12V38h-4.96V16.8h4.48Zm30.003 7.72c-.186-1.307-.706-2.32-1.56-3.04-.853-.72-1.866-1.08-3.04-1.08-1.68 0-2.986.613-3.92 1.84-.906 1.227-1.36 2.947-1.36 5.16s.454 3.933 1.36 5.16c.934 1.227 2.24 1.84 3.92 1.84 1.254 0 2.307-.373 3.16-1.12.854-.773 1.387-1.867 1.6-3.28l5.12.24c-.186 1.68-.733 3.147-1.64 4.4-.906 1.227-2.08 2.173-3.52 2.84-1.413.667-2.986 1-4.72 1-2.08 0-3.906-.453-5.48-1.36-1.546-.907-2.76-2.2-3.64-3.88-.853-1.68-1.28-3.627-1.28-5.84 0-2.24.427-4.187 1.28-5.84.88-1.68 2.094-2.973 3.64-3.88 1.574-.907 3.4-1.36 5.48-1.36 1.68 0 3.227.32 4.64.96 1.414.64 2.56 1.56 3.44 2.76.907 1.2 1.454 2.6 1.64 4.2l-5.12.28Zm11.443 8.16V38h-5.6v-5.32h5.6Z"/><path fill="#171717" fill-rule="evenodd" d="m7.839 40.783 16.03-28.054L20 6 0 40.783h7.839Zm8.214 0H40L27.99 19.894l-4.02 7.032 3.976 6.914H20.02l-3.967 6.943Z" clip-rule="evenodd"/></svg>
|
||||
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1200" fill="none"><rect width="1200" height="1200" fill="#EAEAEA" rx="3"/><g opacity=".5"><g opacity=".5"><path fill="#FAFAFA" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/></g><path stroke="url(#a)" stroke-width="2.418" d="M0-1.209h553.581" transform="scale(1 -1) rotate(45 1163.11 91.165)"/><path stroke="url(#b)" stroke-width="2.418" d="M404.846 598.671h391.726"/><path stroke="url(#c)" stroke-width="2.418" d="M599.5 795.742V404.017"/><path stroke="url(#d)" stroke-width="2.418" d="m795.717 796.597-391.441-391.44"/><path fill="#fff" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/><g clip-path="url(#e)"><path fill="#666" fill-rule="evenodd" d="M616.426 586.58h-31.434v16.176l3.553-3.554.531-.531h9.068l.074-.074 8.463-8.463h2.565l7.18 7.181V586.58Zm-15.715 14.654 3.698 3.699 1.283 1.282-2.565 2.565-1.282-1.283-5.2-5.199h-6.066l-5.514 5.514-.073.073v2.876a2.418 2.418 0 0 0 2.418 2.418h26.598a2.418 2.418 0 0 0 2.418-2.418v-8.317l-8.463-8.463-7.181 7.181-.071.072Zm-19.347 5.442v4.085a6.045 6.045 0 0 0 6.046 6.045h26.598a6.044 6.044 0 0 0 6.045-6.045v-7.108l1.356-1.355-1.282-1.283-.074-.073v-17.989h-38.689v23.43l-.146.146.146.147Z" clip-rule="evenodd"/></g><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/></g><defs><linearGradient id="a" x1="554.061" x2="-.48" y1=".083" y2=".087" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="b" x1="796.912" x2="404.507" y1="599.963" y2="599.965" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="c" x1="600.792" x2="600.794" y1="403.677" y2="796.082" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="d" x1="404.85" x2="796.972" y1="403.903" y2="796.02" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><clipPath id="e"><path fill="#fff" d="M581.364 580.535h38.689v38.689h-38.689z"/></clipPath></defs></svg>
|
||||
|
Before Width: | Height: | Size: 3.2 KiB |
@@ -320,7 +320,7 @@ async def async_main():
|
||||
# Check if user provided a custom value (not the default hosted URL)
|
||||
default_hosted_urls = [
|
||||
'https://gen.nomadkaraoke.com/lyrics',
|
||||
'https://lyrics.nomadkaraoke.com'
|
||||
'https://gen.nomadkaraoke.com/lyrics/'
|
||||
]
|
||||
if args.review_ui_url.rstrip('/') not in [url.rstrip('/') for url in default_hosted_urls]:
|
||||
# User explicitly wants a specific URL (e.g., Vite dev server)
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- Load Inter font to match karaoke-gen styling -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||
@@ -9,7 +13,7 @@
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png" />
|
||||
<link rel="icon" type="image/png" sizes="512x512" href="/android-chrome-512x512.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Nomad Karaoke: Lyrics Review</title>
|
||||
<title>Nomad Karaoke: Lyrics Transcription Review</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@mui/icons-material": "^6.3.0",
|
||||
"@mui/material": "^6.3.0",
|
||||
"@mui/system": "^6.4.3",
|
||||
"lucide-react": "^0.562.0",
|
||||
"nanoid": "^5.0.9",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="45 60 255 135">
|
||||
<g data-v-70b83f88="" fill="#ff7acc" class="basesvg" transform="translate(48.368003845214844,62.62239074707031)"><g fill-rule="" class="tp-name" transform="translate(0,0)"><g transform="scale(1.4000000000000004)"><g stroke="#ff7acc" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" paint-order="stroke" data-gra-attr="stroke" fill-opacity="0"><path d="M1.4-33.44L1.4 0C31.48 0 3.96 0 34.04 0L34.04-32.64 17.81-32.64 17.81-20.61 1.4-33.44ZM52.21-33.76C42.6-33.76 34.81-25.97 34.81-16.37 34.81-6.76 42.6 1.03 52.21 1.03 61.81 1.03 69.6-6.76 69.6-16.37 69.6-25.97 61.81-33.76 52.21-33.76ZM70.7 0L103.34 0 103.25-33.9 86.93-21.54 70.61-33.9 70.7 0ZM102.34 0C138.2 0 107.52 0 143.56 0L122.95-34.93 102.34 0ZM158.84 0.05C167.84 0.05 175.16-7.27 175.16-16.27 175.16-25.27 167.84-32.64 158.84-32.64L142.52-32.64C142.52 0.75 142.52-33.34 142.52 0.05L158.84 0.05Z" transform="translate(-1.399999976158142, 34.93000030517578)"></path></g><g transform="translate(0,38.959999084472656)"><g stroke="#ff7acc" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" paint-order="stroke" data-gra-attr="stroke" fill="#ff7acc" fill-opacity="0" transform="scale(1.02719)"><path d="M24.43 0L17.67 0 7.98-11.87 7.98 0 2.63 0 2.63-26.64 7.98-26.64 7.98-14.69 17.67-26.64 24.12-26.64 13.13-13.44 24.43 0ZM45.03 0L43.27-5.08 32.66-5.08 30.91 0 25.3 0 34.88-26.68 41.1-26.68 50.68 0 45.03 0ZM34.11-9.35L41.82-9.35 37.97-20.5 34.11-9.35ZM73.19 0L67.01 0 61.13-10.38 58.61-10.38 58.61 0 53.27 0 53.27-26.64 63.27-26.64Q66.36-26.64 68.53-25.55 70.71-24.47 71.8-22.61 72.89-20.76 72.89-18.47L72.89-18.47Q72.89-15.84 71.36-13.72 69.83-11.6 66.82-10.8L66.82-10.8 73.19 0ZM58.61-22.21L58.61-14.39 63.08-14.39Q65.25-14.39 66.32-15.44 67.39-16.49 67.39-18.36L67.39-18.36Q67.39-20.19 66.32-21.2 65.25-22.21 63.08-22.21L63.08-22.21 58.61-22.21ZM94.82 0L93.07-5.08 82.46-5.08 80.7 0 75.09 0 84.67-26.68 90.89-26.68 100.47 0 94.82 0ZM83.91-9.35L91.62-9.35 87.76-20.5 83.91-9.35ZM115.43 0.27Q111.69 0.27 108.56-1.49 105.43-3.24 103.6-6.35 101.76-9.47 101.76-13.4L101.76-13.4Q101.76-17.29 103.6-20.4 105.43-23.51 108.56-25.27 111.69-27.02 115.43-27.02L115.43-27.02Q119.21-27.02 122.32-25.27 125.43-23.51 127.24-20.4 129.05-17.29 129.05-13.4L129.05-13.4Q129.05-9.47 127.24-6.35 125.43-3.24 122.3-1.49 119.17 0.27 115.43 0.27L115.43 0.27ZM115.43-4.5Q117.83-4.5 119.66-5.59 121.5-6.68 122.53-8.7 123.56-10.73 123.56-13.4L123.56-13.4Q123.56-16.07 122.53-18.07 121.5-20.08 119.66-21.15 117.83-22.21 115.43-22.21L115.43-22.21Q113.02-22.21 111.17-21.15 109.32-20.08 108.29-18.07 107.26-16.07 107.26-13.4L107.26-13.4Q107.26-10.73 108.29-8.7 109.32-6.68 111.17-5.59 113.02-4.5 115.43-4.5L115.43-4.5ZM153.82 0L147.06 0 137.37-11.87 137.37 0 132.02 0 132.02-26.64 137.37-26.64 137.37-14.69 147.06-26.64 153.51-26.64 142.52-13.44 153.82 0ZM171.79-22.33L161.67-22.33 161.67-15.65 170.64-15.65 170.64-11.41 161.67-11.41 161.67-4.35 171.79-4.35 171.79 0 156.33 0 156.33-26.68 171.79-26.68 171.79-22.33Z" transform="translate(-2.630000114440918, 27.020000457763672)"></path></g></g></g></g> <g data-gra="path-slogan" fill-rule="" class="tp-slogan" fill="#ffdf6b" transform="translate(5,111.788818359375)"><rect x="0" height="1" y="5.9832000732421875" width="14.278396606445312"></rect> <rect height="1" y="5.9832000732421875" width="14.278396606445312" x="218.985595703125"></rect> <g transform="translate(17.278396606445312,0)"><g transform="scale(1.2800000000000002)"><path d="M10.21-8.38L12.02-8.38L9.68 0L7.70 0L6.13-5.96L4.49 0L2.52 0.01L0.26-8.38L2.06-8.38L3.54-1.87L5.24-8.38L7.12-8.38L8.72-1.91L10.21-8.38ZM18.38-8.38L20.06-8.38L20.06 0L18.38 0L18.38-3.56L14.80-3.56L14.80 0L13.12 0L13.12-8.38L14.80-8.38L14.80-4.93L18.38-4.93L18.38-8.38ZM26.58-7.02L23.40-7.02L23.40-4.92L26.22-4.92L26.22-3.59L23.40-3.59L23.40-1.37L26.58-1.37L26.58 0L21.72 0L21.72-8.39L26.58-8.39L26.58-7.02ZM34.37 0L32.42 0L30.58-3.26L29.78-3.26L29.78 0L28.10 0L28.10-8.38L31.25-8.38Q32.22-8.38 32.90-8.03Q33.59-7.69 33.93-7.11Q34.27-6.53 34.27-5.81L34.27-5.81Q34.27-4.98 33.79-4.31Q33.31-3.65 32.36-3.40L32.36-3.40L34.37 0ZM29.78-6.98L29.78-4.52L31.19-4.52Q31.87-4.52 32.21-4.85Q32.54-5.18 32.54-5.77L32.54-5.77Q32.54-6.35 32.21-6.67Q31.87-6.98 31.19-6.98L31.19-6.98L29.78-6.98ZM40.66-7.02L37.48-7.02L37.48-4.92L40.30-4.92L40.30-3.59L37.48-3.59L37.48-1.37L40.66-1.37L40.66 0L35.80 0L35.80-8.39L40.66-8.39L40.66-7.02ZM47.92-8.38L49.70-8.38L46.63 0L44.59 0L41.52-8.38L43.32-8.38L45.62-1.72L47.92-8.38ZM55.57-7.02L52.39-7.02L52.39-4.92L55.21-4.92L55.21-3.59L52.39-3.59L52.39-1.37L55.57-1.37L55.57 0L50.71 0L50.71-8.39L55.57-8.39L55.57-7.02ZM63.36 0L61.42 0L59.57-3.26L58.78-3.26L58.78 0L57.10 0L57.10-8.38L60.24-8.38Q61.21-8.38 61.90-8.03Q62.58-7.69 62.92-7.11Q63.26-6.53 63.26-5.81L63.26-5.81Q63.26-4.98 62.78-4.31Q62.30-3.65 61.36-3.40L61.36-3.40L63.36 0ZM58.78-6.98L58.78-4.52L60.18-4.52Q60.86-4.52 61.20-4.85Q61.54-5.18 61.54-5.77L61.54-5.77Q61.54-6.35 61.20-6.67Q60.86-6.98 60.18-6.98L60.18-6.98L58.78-6.98ZM72.43-8.38L74.30-8.38L71.47-2.92L71.47 0L69.Line truncated
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.0 KiB |
@@ -1,12 +1,23 @@
|
||||
import UploadFileIcon from '@mui/icons-material/UploadFile'
|
||||
import { Alert, Box, Button, Modal, Typography } from '@mui/material'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { ThemeProvider } from '@mui/material/styles'
|
||||
import CssBaseline from '@mui/material/CssBaseline'
|
||||
import { useEffect, useState, useMemo } from 'react'
|
||||
import { ApiClient, FileOnlyClient, LiveApiClient } from './api'
|
||||
import CorrectionMetrics from './components/CorrectionMetrics'
|
||||
import LyricsAnalyzer from './components/LyricsAnalyzer'
|
||||
import AppHeader from './components/AppHeader'
|
||||
import { CorrectionData } from './types'
|
||||
import { createAppTheme } from './theme'
|
||||
|
||||
const THEME_STORAGE_KEY = 'nomad-karaoke-lyrics-theme'
|
||||
|
||||
export default function App() {
|
||||
const [isDarkMode, setIsDarkMode] = useState(() => {
|
||||
// Initialize from localStorage
|
||||
const stored = localStorage.getItem(THEME_STORAGE_KEY)
|
||||
return stored !== 'light' // Default to dark
|
||||
})
|
||||
const [data, setData] = useState<CorrectionData | null>(null)
|
||||
const [showMetadata, setShowMetadata] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
@@ -14,6 +25,16 @@ export default function App() {
|
||||
const [isReadOnly, setIsReadOnly] = useState(true)
|
||||
const [audioHash, setAudioHash] = useState<string>('')
|
||||
|
||||
// Create theme based on mode
|
||||
const theme = useMemo(() => createAppTheme(isDarkMode ? 'dark' : 'light'), [isDarkMode])
|
||||
|
||||
// Handle theme toggle
|
||||
const handleToggleTheme = () => {
|
||||
const newIsDark = !isDarkMode
|
||||
setIsDarkMode(newIsDark)
|
||||
localStorage.setItem(THEME_STORAGE_KEY, newIsDark ? 'dark' : 'light')
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
// Parse query parameters
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
@@ -145,70 +166,78 @@ export default function App() {
|
||||
|
||||
if (!data) {
|
||||
return (
|
||||
<Box sx={{ p: 3 }}>
|
||||
{error && (
|
||||
<Alert severity="error" sx={{ mb: 2 }} onClose={() => setError(null)}>
|
||||
{error}
|
||||
</Alert>
|
||||
)}
|
||||
{isReadOnly ? (
|
||||
<>
|
||||
<Alert severity="info" sx={{ mb: 2 }}>
|
||||
Running in read-only mode. Connect to an API to enable editing.
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<AppHeader isDarkMode={isDarkMode} onToggleTheme={handleToggleTheme} />
|
||||
<Box sx={{ p: 3 }}>
|
||||
{error && (
|
||||
<Alert severity="error" sx={{ mb: 2 }} onClose={() => setError(null)}>
|
||||
{error}
|
||||
</Alert>
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
|
||||
<Typography variant="h4">
|
||||
Lyrics Correction Review
|
||||
)}
|
||||
{isReadOnly ? (
|
||||
<>
|
||||
<Alert severity="info" sx={{ mb: 2 }}>
|
||||
Running in read-only mode. Connect to an API to enable editing.
|
||||
</Alert>
|
||||
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 3 }}>
|
||||
<Typography variant="h4">
|
||||
Lyrics Correction Review
|
||||
</Typography>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<UploadFileIcon />}
|
||||
onClick={handleFileLoad}
|
||||
>
|
||||
Load File
|
||||
</Button>
|
||||
</Box>
|
||||
<Box sx={{ mb: 3 }}>
|
||||
<CorrectionMetrics />
|
||||
</Box>
|
||||
</>
|
||||
) : (
|
||||
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||
<Typography variant="h6" color="text.secondary">
|
||||
Loading Lyrics Transcription Review...
|
||||
</Typography>
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<UploadFileIcon />}
|
||||
onClick={handleFileLoad}
|
||||
>
|
||||
Load File
|
||||
</Button>
|
||||
</Box>
|
||||
<Box sx={{ mb: 3 }}>
|
||||
<CorrectionMetrics />
|
||||
</Box>
|
||||
</>
|
||||
) : (
|
||||
<Box sx={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||
<Typography variant="h6" color="text.secondary">
|
||||
Loading Lyrics Correction Review...
|
||||
</Typography>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</ThemeProvider>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Box sx={{
|
||||
p: 1.5,
|
||||
pb: 3,
|
||||
maxWidth: '100%',
|
||||
overflowX: 'hidden'
|
||||
}}>
|
||||
{error && (
|
||||
<Alert severity="error" sx={{ mb: 1 }} onClose={() => setError(null)}>
|
||||
{error}
|
||||
</Alert>
|
||||
)}
|
||||
{isReadOnly && (
|
||||
<Alert severity="info" sx={{ mb: 1 }}>
|
||||
Running in read-only mode. Connect to an API to enable editing.
|
||||
</Alert>
|
||||
)}
|
||||
<LyricsAnalyzer
|
||||
data={data}
|
||||
onFileLoad={handleFileLoad}
|
||||
onShowMetadata={() => setShowMetadata(true)}
|
||||
apiClient={apiClient}
|
||||
isReadOnly={isReadOnly}
|
||||
audioHash={audioHash}
|
||||
/>
|
||||
{renderMetadataModal()}
|
||||
</Box>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<AppHeader isDarkMode={isDarkMode} onToggleTheme={handleToggleTheme} />
|
||||
<Box sx={{
|
||||
p: 1.5,
|
||||
pb: 3,
|
||||
maxWidth: '100%',
|
||||
overflowX: 'hidden'
|
||||
}}>
|
||||
{error && (
|
||||
<Alert severity="error" sx={{ mb: 1 }} onClose={() => setError(null)}>
|
||||
{error}
|
||||
</Alert>
|
||||
)}
|
||||
{isReadOnly && (
|
||||
<Alert severity="info" sx={{ mb: 1 }}>
|
||||
Running in read-only mode. Connect to an API to enable editing.
|
||||
</Alert>
|
||||
)}
|
||||
<LyricsAnalyzer
|
||||
data={data}
|
||||
onFileLoad={handleFileLoad}
|
||||
onShowMetadata={() => setShowMetadata(true)}
|
||||
apiClient={apiClient}
|
||||
isReadOnly={isReadOnly}
|
||||
audioHash={audioHash}
|
||||
/>
|
||||
{renderMetadataModal()}
|
||||
</Box>
|
||||
</ThemeProvider>
|
||||
)
|
||||
}
|
||||
@@ -15,19 +15,28 @@ export const AIFeedbackModal: React.FC<Props> = ({ isOpen, onClose, onSubmit, su
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
// Dark theme colors matching karaoke-gen
|
||||
const colors = {
|
||||
background: '#1a1a1a', // slate-800
|
||||
text: '#f8fafc', // slate-50
|
||||
textSecondary: '#888888', // slate-400
|
||||
border: '#2a2a2a', // slate-700
|
||||
inputBg: '#0f0f0f', // slate-900
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.5)", display: "flex", alignItems: "center", justifyContent: "center" }}>
|
||||
<div style={{ background: "#fff", padding: 16, width: 480, borderRadius: 8 }}>
|
||||
<h3>AI Suggestion</h3>
|
||||
<p style={{ marginTop: 8 }}>
|
||||
<div style={{ position: "fixed", inset: 0, background: "rgba(0,0,0,0.7)", display: "flex", alignItems: "center", justifyContent: "center", zIndex: 1300 }}>
|
||||
<div style={{ background: colors.background, padding: 16, width: 480, borderRadius: 8, border: `1px solid ${colors.border}`, color: colors.text }}>
|
||||
<h3 style={{ color: colors.text, margin: 0 }}>AI Suggestion</h3>
|
||||
<p style={{ marginTop: 8, color: colors.text }}>
|
||||
{suggestion?.text ?? "No suggestion"}
|
||||
{suggestion?.confidence != null ? ` (confidence ${Math.round((suggestion.confidence || 0) * 100)}%)` : null}
|
||||
</p>
|
||||
{suggestion?.reasoning ? <small>{suggestion.reasoning}</small> : null}
|
||||
{suggestion?.reasoning ? <small style={{ color: colors.textSecondary }}>{suggestion.reasoning}</small> : null}
|
||||
|
||||
<div style={{ marginTop: 12 }}>
|
||||
<label>Action</label>
|
||||
<select value={reviewerAction} onChange={(e) => setAction(e.target.value)} style={{ marginLeft: 8 }}>
|
||||
<label style={{ color: colors.text }}>Action</label>
|
||||
<select value={reviewerAction} onChange={(e) => setAction(e.target.value)} style={{ marginLeft: 8, background: colors.inputBg, color: colors.text, border: `1px solid ${colors.border}`, borderRadius: 4, padding: '4px 8px' }}>
|
||||
<option value="ACCEPT">Accept</option>
|
||||
<option value="REJECT">Reject</option>
|
||||
<option value="MODIFY">Modify</option>
|
||||
@@ -36,14 +45,14 @@ export const AIFeedbackModal: React.FC<Props> = ({ isOpen, onClose, onSubmit, su
|
||||
|
||||
{reviewerAction === "MODIFY" ? (
|
||||
<div style={{ marginTop: 12 }}>
|
||||
<label>Final Text</label>
|
||||
<input value={finalText} onChange={(e) => setFinalText(e.target.value)} style={{ marginLeft: 8, width: "100%" }} />
|
||||
<label style={{ color: colors.text }}>Final Text</label>
|
||||
<input value={finalText} onChange={(e) => setFinalText(e.target.value)} style={{ marginLeft: 8, width: "100%", background: colors.inputBg, color: colors.text, border: `1px solid ${colors.border}`, borderRadius: 4, padding: '4px 8px' }} />
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div style={{ marginTop: 12 }}>
|
||||
<label>Reason</label>
|
||||
<select value={reasonCategory} onChange={(e) => setReason(e.target.value)} style={{ marginLeft: 8 }}>
|
||||
<label style={{ color: colors.text }}>Reason</label>
|
||||
<select value={reasonCategory} onChange={(e) => setReason(e.target.value)} style={{ marginLeft: 8, background: colors.inputBg, color: colors.text, border: `1px solid ${colors.border}`, borderRadius: 4, padding: '4px 8px' }}>
|
||||
<option value="AI_CORRECT">AI_CORRECT</option>
|
||||
<option value="AI_INCORRECT">AI_INCORRECT</option>
|
||||
<option value="AI_SUBOPTIMAL">AI_SUBOPTIMAL</option>
|
||||
@@ -53,16 +62,17 @@ export const AIFeedbackModal: React.FC<Props> = ({ isOpen, onClose, onSubmit, su
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: 12 }}>
|
||||
<label>Details</label>
|
||||
<textarea value={reasonDetail} onChange={(e) => setDetail(e.target.value)} style={{ marginLeft: 8, width: "100%" }} />
|
||||
<label style={{ color: colors.text }}>Details</label>
|
||||
<textarea value={reasonDetail} onChange={(e) => setDetail(e.target.value)} style={{ marginLeft: 8, width: "100%", background: colors.inputBg, color: colors.text, border: `1px solid ${colors.border}`, borderRadius: 4, padding: '4px 8px' }} />
|
||||
</div>
|
||||
|
||||
<div style={{ display: "flex", gap: 8, justifyContent: "flex-end", marginTop: 16 }}>
|
||||
<button onClick={onClose}>Cancel</button>
|
||||
<button onClick={onClose} style={{ background: colors.border, color: colors.text, border: 'none', borderRadius: 4, padding: '6px 12px', cursor: 'pointer' }}>Cancel</button>
|
||||
<button
|
||||
onClick={() =>
|
||||
onSubmit({ reviewerAction, finalText: finalText || undefined, reasonCategory, reasonDetail: reasonDetail || undefined })
|
||||
}
|
||||
style={{ background: '#f97316', color: '#fff', border: 'none', borderRadius: 4, padding: '6px 12px', cursor: 'pointer' }}
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import { Box, IconButton, Tooltip, Typography, useTheme } from '@mui/material'
|
||||
import { Sun, Moon } from 'lucide-react'
|
||||
|
||||
interface AppHeaderProps {
|
||||
isDarkMode?: boolean
|
||||
onToggleTheme?: () => void
|
||||
}
|
||||
|
||||
export default function AppHeader({ isDarkMode = true, onToggleTheme }: AppHeaderProps) {
|
||||
const theme = useTheme()
|
||||
|
||||
return (
|
||||
<Box
|
||||
component="header"
|
||||
sx={{
|
||||
borderBottom: `1px solid ${theme.palette.divider}`,
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
backdropFilter: 'blur(8px)',
|
||||
position: 'sticky',
|
||||
top: 0,
|
||||
zIndex: 1100,
|
||||
px: 2,
|
||||
py: 1.5,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
}}
|
||||
>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5 }}>
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" style={{ height: 40 }} />
|
||||
<Typography
|
||||
variant="h6"
|
||||
sx={{
|
||||
fontWeight: 'bold',
|
||||
color: theme.palette.text.primary,
|
||||
fontSize: '1.1rem',
|
||||
lineHeight: 1,
|
||||
m: 0,
|
||||
}}
|
||||
>
|
||||
Lyrics Transcription Review
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
{onToggleTheme && (
|
||||
<Tooltip title={isDarkMode ? 'Switch to light mode' : 'Switch to dark mode'}>
|
||||
<IconButton
|
||||
onClick={onToggleTheme}
|
||||
sx={{
|
||||
color: theme.palette.text.secondary,
|
||||
'&:hover': {
|
||||
color: theme.palette.text.primary,
|
||||
backgroundColor: theme.palette.action.hover,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{isDarkMode ? <Sun className="w-5 h-5" /> : <Moon className="w-5 h-5" />}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
@@ -42,7 +42,7 @@ const WordContainer = styled(Box, {
|
||||
'50%': { opacity: 0.5 }
|
||||
},
|
||||
'&:hover': {
|
||||
backgroundColor: '#c8e6c9'
|
||||
backgroundColor: 'rgba(34, 197, 94, 0.35)' // green tint hover for dark mode
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -51,7 +51,7 @@ const OriginalWordLabel = styled(Box)({
|
||||
top: '-14px',
|
||||
left: '0',
|
||||
fontSize: '0.6rem',
|
||||
color: '#666',
|
||||
color: '#888888', // slate-400 for dark mode
|
||||
textDecoration: 'line-through',
|
||||
opacity: 0.7,
|
||||
whiteSpace: 'nowrap',
|
||||
@@ -71,10 +71,10 @@ const ActionButton = styled(IconButton)(({ theme }) => ({
|
||||
minHeight: '20px',
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
||||
border: '1px solid rgba(0, 0, 0, 0.1)',
|
||||
backgroundColor: 'rgba(30, 41, 59, 0.9)', // slate-800 with opacity for dark mode
|
||||
border: '1px solid rgba(248, 250, 252, 0.1)', // light border for dark mode
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(255, 255, 255, 1)',
|
||||
backgroundColor: 'rgba(51, 65, 85, 1)', // slate-700 for dark mode
|
||||
transform: 'scale(1.1)'
|
||||
},
|
||||
'& .MuiSvgIcon-root': {
|
||||
|
||||
@@ -30,7 +30,7 @@ const SegmentTimeline = styled(Box)({
|
||||
const TimelineRuler = styled(Box)({
|
||||
position: 'relative',
|
||||
height: '20px',
|
||||
borderBottom: '1px solid #ccc',
|
||||
borderBottom: '1px solid #2a2a2a', // slate-700 for dark mode
|
||||
marginBottom: '4px'
|
||||
})
|
||||
|
||||
@@ -38,14 +38,14 @@ const TimelineMark = styled(Box)({
|
||||
position: 'absolute',
|
||||
width: '1px',
|
||||
height: '8px',
|
||||
backgroundColor: '#999',
|
||||
backgroundColor: '#666666', // slate-500 for dark mode
|
||||
bottom: 0
|
||||
})
|
||||
|
||||
const TimelineLabel = styled(Typography)({
|
||||
position: 'absolute',
|
||||
fontSize: '0.65rem',
|
||||
color: '#666',
|
||||
color: '#888888', // slate-400 for dark mode
|
||||
bottom: '10px',
|
||||
transform: 'translateX(-50%)',
|
||||
whiteSpace: 'nowrap'
|
||||
@@ -58,7 +58,7 @@ const WordsBar = styled(Box)({
|
||||
alignItems: 'stretch',
|
||||
minWidth: '100%',
|
||||
touchAction: 'pan-y', // Better mobile scrolling
|
||||
backgroundColor: '#f5f5f5',
|
||||
backgroundColor: '#0f0f0f', // slate-900 for dark mode
|
||||
borderRadius: '4px',
|
||||
marginBottom: '8px'
|
||||
})
|
||||
@@ -84,7 +84,7 @@ const WordBar = styled(Box, {
|
||||
? COLORS.corrected
|
||||
: isGap
|
||||
? COLORS.uncorrectedGap
|
||||
: '#e0e0e0',
|
||||
: '#2a2a2a', // slate-700 for dark mode default
|
||||
border: isLong ? '2px solid #f44336' : 'none',
|
||||
boxShadow: isLong ? '0 0 4px rgba(244, 67, 54, 0.5)' : 'none',
|
||||
'&:hover': {
|
||||
@@ -101,13 +101,13 @@ const WordBar = styled(Box, {
|
||||
|
||||
const OriginalWordLabel = styled(Typography)({
|
||||
fontSize: '0.65rem',
|
||||
color: '#888',
|
||||
color: '#888888', // slate-400 for dark mode
|
||||
lineHeight: 1.1,
|
||||
marginBottom: '3px',
|
||||
textDecoration: 'line-through',
|
||||
opacity: 0.85,
|
||||
fontWeight: 500,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
||||
backgroundColor: 'rgba(15, 23, 42, 0.8)', // slate-900 with opacity for dark mode
|
||||
padding: '1px 3px',
|
||||
borderRadius: '2px'
|
||||
})
|
||||
@@ -226,7 +226,7 @@ export default function DurationTimelineView({
|
||||
whiteSpace: 'nowrap',
|
||||
width: '100%',
|
||||
textAlign: 'center',
|
||||
color: correction ? '#1b5e20' : 'inherit'
|
||||
color: correction ? '#4ade80' : '#e5e5e5' // green-400 or slate-50 for dark mode
|
||||
}}
|
||||
>
|
||||
{word.text}
|
||||
@@ -235,7 +235,7 @@ export default function DurationTimelineView({
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: '0.6rem',
|
||||
color: 'rgba(0,0,0,0.6)',
|
||||
color: 'rgba(248, 250, 252, 0.6)', // slate-50 with opacity for dark mode
|
||||
lineHeight: 1,
|
||||
marginTop: '3px',
|
||||
fontWeight: 600
|
||||
|
||||
@@ -624,7 +624,7 @@ export default function EditModal({
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
||||
backgroundColor: 'rgba(30, 41, 59, 0.95)', // slate-800 with opacity for dark mode
|
||||
zIndex: 10
|
||||
}}>
|
||||
<CircularProgress size={60} thickness={4} />
|
||||
|
||||
@@ -312,7 +312,7 @@ export default function EditWordList({
|
||||
width: '8px',
|
||||
},
|
||||
'&::-webkit-scrollbar-thumb': {
|
||||
backgroundColor: 'rgba(0,0,0,0.2)',
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.2)', // slate-50 for dark mode
|
||||
borderRadius: '4px',
|
||||
},
|
||||
scrollbarWidth: 'thin',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Box, Button, Typography, useMediaQuery, useTheme, Switch, FormControlLabel, Tooltip, Paper, IconButton, Chip } from '@mui/material'
|
||||
import { Box, Button, Typography, useMediaQuery, useTheme, Switch, FormControlLabel, Tooltip, Paper, IconButton } from '@mui/material'
|
||||
import LockIcon from '@mui/icons-material/Lock'
|
||||
import UploadFileIcon from '@mui/icons-material/UploadFile'
|
||||
import FindReplaceIcon from '@mui/icons-material/FindReplace'
|
||||
@@ -129,50 +129,19 @@ export default function Header({
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
gap: 1,
|
||||
justifyContent: 'space-between',
|
||||
alignItems: isMobile ? 'stretch' : 'center',
|
||||
mb: 1
|
||||
}}>
|
||||
<Typography variant="h4" sx={{ fontSize: isMobile ? '1.3rem' : '1.5rem' }}>
|
||||
Nomad Karaoke: Lyrics Transcription Review
|
||||
</Typography>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
{!isReadOnly && onAnnotationsToggle && (
|
||||
<Tooltip title={annotationsEnabled
|
||||
? "Click to disable annotation prompts when editing"
|
||||
: "Click to enable annotation prompts when editing"
|
||||
}>
|
||||
<Chip
|
||||
icon={<RateReviewIcon />}
|
||||
label={annotationsEnabled ? "Feedback On" : "Feedback Off"}
|
||||
onClick={() => onAnnotationsToggle(!annotationsEnabled)}
|
||||
color={annotationsEnabled ? "primary" : "default"}
|
||||
variant={annotationsEnabled ? "filled" : "outlined"}
|
||||
size="small"
|
||||
sx={{
|
||||
cursor: 'pointer',
|
||||
'& .MuiChip-icon': { fontSize: '1rem' }
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{isReadOnly && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
startIcon={<UploadFileIcon />}
|
||||
onClick={onFileLoad}
|
||||
fullWidth={isMobile}
|
||||
>
|
||||
Load File
|
||||
</Button>
|
||||
)}
|
||||
{isReadOnly && (
|
||||
<Box sx={{ display: 'flex', justifyContent: 'flex-end', mb: 1 }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
startIcon={<UploadFileIcon />}
|
||||
onClick={onFileLoad}
|
||||
fullWidth={isMobile}
|
||||
>
|
||||
Load File
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
@@ -387,10 +356,10 @@ export default function Header({
|
||||
Timing Offset
|
||||
</Button>
|
||||
{timingOffsetMs !== 0 && (
|
||||
<Typography
|
||||
variant="body2"
|
||||
sx={{
|
||||
ml: 1,
|
||||
<Typography
|
||||
variant="body2"
|
||||
sx={{
|
||||
ml: 1,
|
||||
fontWeight: 'bold',
|
||||
color: theme.palette.secondary.main
|
||||
}}
|
||||
@@ -400,6 +369,23 @@ export default function Header({
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
{!isReadOnly && onAnnotationsToggle && (
|
||||
<Tooltip title={annotationsEnabled
|
||||
? "Click to disable annotation prompts when editing"
|
||||
: "Click to enable annotation prompts when editing"
|
||||
}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
onClick={() => onAnnotationsToggle(!annotationsEnabled)}
|
||||
startIcon={<RateReviewIcon />}
|
||||
color={annotationsEnabled ? "primary" : "inherit"}
|
||||
sx={{ minWidth: 'fit-content', height: '32px' }}
|
||||
>
|
||||
{annotationsEnabled ? "Feedback On" : "Feedback Off"}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
<AudioPlayer
|
||||
apiClient={apiClient}
|
||||
onTimeUpdate={onTimeUpdate}
|
||||
|
||||
@@ -33,16 +33,17 @@ const CANVAS_PADDING = 8
|
||||
const TEXT_ABOVE_BLOCK = 14
|
||||
const RESIZE_HANDLE_SIZE = 8
|
||||
const RESIZE_HANDLE_HITAREA = 12
|
||||
const PLAYHEAD_COLOR = '#ffffff'
|
||||
const WORD_BLOCK_COLOR = '#d32f2f'
|
||||
const WORD_BLOCK_SELECTED_COLOR = '#b71c1c'
|
||||
const WORD_BLOCK_CURRENT_COLOR = '#f44336'
|
||||
const WORD_TEXT_CURRENT_COLOR = '#d32f2f'
|
||||
const UPCOMING_WORD_BG = '#fff9c4'
|
||||
const UPCOMING_WORD_TEXT = '#000000'
|
||||
const TIME_BAR_BG = '#f5f5f5'
|
||||
const TIME_BAR_TEXT = '#666666'
|
||||
const TIMELINE_BG = '#e0e0e0'
|
||||
// Dark theme colors matching karaoke-gen
|
||||
const PLAYHEAD_COLOR = '#f97316' // orange-500 for better visibility
|
||||
const WORD_BLOCK_COLOR = '#dc2626' // red-600 for dark mode
|
||||
const WORD_BLOCK_SELECTED_COLOR = '#b91c1c' // red-700 for dark mode
|
||||
const WORD_BLOCK_CURRENT_COLOR = '#ef4444' // red-500 for dark mode
|
||||
const WORD_TEXT_CURRENT_COLOR = '#fca5a5' // red-300 for dark mode
|
||||
const UPCOMING_WORD_BG = '#2a2a2a' // slate-700 for dark mode
|
||||
const UPCOMING_WORD_TEXT = '#e5e5e5' // slate-50 for dark mode
|
||||
const TIME_BAR_BG = '#1a1a1a' // slate-800 for dark mode
|
||||
const TIME_BAR_TEXT = '#888888' // slate-400 for dark mode
|
||||
const TIMELINE_BG = '#0f0f0f' // slate-900 for dark mode
|
||||
|
||||
// Drag modes
|
||||
type DragMode = 'none' | 'selection' | 'resize' | 'move'
|
||||
@@ -268,7 +269,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
const x = timeToX(t)
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = '#999999'
|
||||
ctx.strokeStyle = '#64748b' // slate-500 for dark mode
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(x, TIME_BAR_HEIGHT - 6)
|
||||
ctx.lineTo(x, TIME_BAR_HEIGHT)
|
||||
@@ -280,7 +281,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
}
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = '#cccccc'
|
||||
ctx.strokeStyle = '#2a2a2a' // slate-700 for dark mode
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(0, TIME_BAR_HEIGHT)
|
||||
ctx.lineTo(canvasWidth, TIME_BAR_HEIGHT)
|
||||
@@ -314,20 +315,20 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
|
||||
// Draw selection border
|
||||
if (isSelected) {
|
||||
ctx.strokeStyle = '#ffffff'
|
||||
ctx.strokeStyle = '#f97316' // orange-500 for dark mode selection
|
||||
ctx.lineWidth = 2
|
||||
ctx.strokeRect(bounds.startX, bounds.y, bounds.blockWidth, WORD_BLOCK_HEIGHT)
|
||||
|
||||
// Draw resize handle (white dot on right edge) for selected words when hovered
|
||||
|
||||
// Draw resize handle (orange dot on right edge) for selected words when hovered
|
||||
if (isHovered || selectedWordIds.size === 1) {
|
||||
const handleX = bounds.startX + bounds.blockWidth - RESIZE_HANDLE_SIZE / 2
|
||||
const handleY = bounds.y + WORD_BLOCK_HEIGHT / 2
|
||||
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.fillStyle = '#ffffff'
|
||||
ctx.fillStyle = '#f97316' // orange-500 for dark mode
|
||||
ctx.arc(handleX, handleY, RESIZE_HANDLE_SIZE / 2, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
ctx.strokeStyle = '#666666'
|
||||
ctx.strokeStyle = '#0f0f0f' // slate-900 for dark mode
|
||||
ctx.lineWidth = 1
|
||||
ctx.stroke()
|
||||
}
|
||||
@@ -368,7 +369,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
|
||||
if (textStartX < canvasWidth - 10) {
|
||||
const isCurrent = word.id === currentWordId
|
||||
ctx.fillStyle = isCurrent ? WORD_TEXT_CURRENT_COLOR : '#333333'
|
||||
ctx.fillStyle = isCurrent ? WORD_TEXT_CURRENT_COLOR : '#f8fafc' // slate-50 for dark mode
|
||||
ctx.fillText(word.text, textStartX, textY)
|
||||
rightmostTextEnd = textStartX + textWidth
|
||||
}
|
||||
@@ -405,7 +406,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.fillStyle = PLAYHEAD_COLOR
|
||||
ctx.strokeStyle = '#333333'
|
||||
ctx.strokeStyle = '#0f0f0f' // slate-900 for dark mode
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(playheadX - 6, 2)
|
||||
ctx.lineTo(playheadX + 6, 2)
|
||||
@@ -422,7 +423,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
ctx.stroke()
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = 'rgba(0,0,0,0.4)'
|
||||
ctx.strokeStyle = 'rgba(0,0,0,0.6)' // Darker shadow for dark mode visibility
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(playheadX + 1, TIME_BAR_HEIGHT)
|
||||
ctx.lineTo(playheadX + 1, height)
|
||||
|
||||
@@ -221,7 +221,7 @@ export default function ReferenceView({
|
||||
width: '100%',
|
||||
mb: 0,
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.03)'
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.04)' // slate-50 hover for dark mode
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -182,7 +182,7 @@ export default function TranscriptionView({
|
||||
width: '100%',
|
||||
mb: 0,
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.03)'
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.04)' // slate-50 hover for dark mode
|
||||
}
|
||||
}}>
|
||||
<SegmentControls>
|
||||
|
||||
@@ -18,7 +18,7 @@ interface WordDividerProps {
|
||||
}
|
||||
|
||||
const buttonTextStyle = {
|
||||
color: 'rgba(0, 0, 0, 0.6)',
|
||||
color: 'rgba(248, 250, 252, 0.8)', // slate-50 with opacity for dark mode
|
||||
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
||||
fontWeight: 400,
|
||||
fontSize: '0.7rem',
|
||||
@@ -58,7 +58,7 @@ export default function WordDivider({
|
||||
height: '20px',
|
||||
my: -0.5,
|
||||
width: '50%',
|
||||
backgroundColor: '#fff',
|
||||
backgroundColor: '#1a1a1a', // slate-800 for dark mode
|
||||
...sx
|
||||
}}
|
||||
>
|
||||
@@ -66,7 +66,7 @@ export default function WordDivider({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 1,
|
||||
backgroundColor: '#fff',
|
||||
backgroundColor: '#1a1a1a', // slate-800 for dark mode
|
||||
padding: '0 8px',
|
||||
zIndex: 1
|
||||
}}>
|
||||
|
||||
@@ -41,14 +41,14 @@ export const WordComponent = React.memo(function Word({
|
||||
borderRadius: '2px',
|
||||
color: isCurrentlyPlaying ? '#ffffff' : 'inherit',
|
||||
textDecoration: correction ? 'underline dotted' : 'none',
|
||||
textDecorationColor: correction ? '#666' : 'inherit',
|
||||
textDecorationColor: correction ? '#666666' : 'inherit', // slate-500 for dark mode
|
||||
textUnderlineOffset: '2px',
|
||||
fontSize: '0.85rem',
|
||||
lineHeight: 1.2
|
||||
}}
|
||||
sx={{
|
||||
'&:hover': {
|
||||
backgroundColor: '#e0e0e0'
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.08)' // slate-50 hover for dark mode
|
||||
}
|
||||
}}
|
||||
onClick={onClick}
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
import { keyframes } from '@mui/system'
|
||||
|
||||
// Dark theme colors matching karaoke-gen globals.css
|
||||
export const COLORS = {
|
||||
anchor: '#e3f2fd', // Pale blue
|
||||
corrected: '#e8f5e9', // Pale green
|
||||
uncorrectedGap: '#fff3e0', // Pale orange
|
||||
highlighted: '#ffeb3b', // or any color you prefer for highlighting
|
||||
playing: '#1976d2', // Blue
|
||||
anchor: 'rgba(59, 130, 246, 0.25)', // Blue tint for dark mode
|
||||
corrected: 'rgba(34, 197, 94, 0.25)', // Green tint for dark mode
|
||||
uncorrectedGap: 'rgba(249, 115, 22, 0.25)', // Orange tint for dark mode
|
||||
highlighted: 'rgba(251, 191, 36, 0.4)', // Amber highlight for dark mode
|
||||
playing: '#3b82f6', // Blue-500
|
||||
// Text colors (matching karaoke-gen)
|
||||
textPrimary: '#e5e5e5', // matches karaoke-gen --text
|
||||
textSecondary: '#888888', // matches karaoke-gen --text-muted
|
||||
textMuted: '#666666',
|
||||
// Background colors (matching karaoke-gen globals.css)
|
||||
background: '#0f0f0f', // matches karaoke-gen --bg
|
||||
backgroundPaper: '#1a1a1a', // matches karaoke-gen --card
|
||||
backgroundElevated: '#252525', // matches karaoke-gen --secondary
|
||||
border: '#2a2a2a', // matches karaoke-gen --card-border
|
||||
} as const
|
||||
|
||||
export const flashAnimation = keyframes`
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import { ThemeProvider } from '@mui/material/styles'
|
||||
import CssBaseline from '@mui/material/CssBaseline'
|
||||
import App from './App'
|
||||
import theme from './theme'
|
||||
// Import version from package.json
|
||||
import packageJson from '../package.json'
|
||||
|
||||
@@ -10,8 +7,5 @@ import packageJson from '../package.json'
|
||||
console.log(`🎵 Lyrics Transcriber Frontend v${packageJson.version}`)
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
<App />
|
||||
</ThemeProvider>
|
||||
<App />
|
||||
)
|
||||
@@ -1,177 +1,379 @@
|
||||
import { createTheme } from '@mui/material/styles';
|
||||
import { createTheme, Theme } from '@mui/material/styles';
|
||||
|
||||
// Create a theme with smaller typography and spacing
|
||||
const theme = createTheme({
|
||||
typography: {
|
||||
// Scale down all typography by about 20%
|
||||
fontSize: 14, // Default is 16
|
||||
h1: {
|
||||
fontSize: '2.5rem', // Default is ~3rem
|
||||
},
|
||||
h2: {
|
||||
fontSize: '2rem', // Default is ~2.5rem
|
||||
},
|
||||
h3: {
|
||||
fontSize: '1.5rem', // Default is ~1.75rem
|
||||
},
|
||||
h4: {
|
||||
fontSize: '1.2rem', // Default is ~1.5rem
|
||||
marginBottom: '0.5rem',
|
||||
},
|
||||
h5: {
|
||||
fontSize: '1rem', // Default is ~1.25rem
|
||||
},
|
||||
h6: {
|
||||
fontSize: '0.9rem', // Default is ~1.1rem
|
||||
marginBottom: '0.5rem',
|
||||
},
|
||||
body1: {
|
||||
fontSize: '0.85rem', // Default is ~1rem
|
||||
},
|
||||
body2: {
|
||||
fontSize: '0.75rem', // Default is ~0.875rem
|
||||
},
|
||||
button: {
|
||||
fontSize: '0.8rem', // Default is ~0.875rem
|
||||
},
|
||||
caption: {
|
||||
fontSize: '0.7rem', // Default is ~0.75rem
|
||||
},
|
||||
// Dark theme colors (matching karaoke-gen's globals.css)
|
||||
const darkColors = {
|
||||
background: {
|
||||
default: '#0f0f0f',
|
||||
paper: '#1a1a1a',
|
||||
elevated: '#252525',
|
||||
},
|
||||
components: {
|
||||
MuiButton: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '3px 10px', // Further reduced from 4px 12px
|
||||
minHeight: '30px', // Further reduced from 32px
|
||||
},
|
||||
sizeSmall: {
|
||||
padding: '1px 6px', // Further reduced from 2px 8px
|
||||
minHeight: '24px', // Further reduced from 28px
|
||||
},
|
||||
},
|
||||
text: {
|
||||
primary: '#f8fafc',
|
||||
secondary: '#94a3b8',
|
||||
disabled: '#64748b',
|
||||
},
|
||||
divider: '#2a2a2a',
|
||||
action: {
|
||||
active: '#f8fafc',
|
||||
hover: 'rgba(248, 250, 252, 0.08)',
|
||||
selected: 'rgba(249, 115, 22, 0.16)',
|
||||
disabled: '#64748b',
|
||||
disabledBackground: 'rgba(100, 116, 139, 0.12)',
|
||||
},
|
||||
};
|
||||
|
||||
// Light theme colors
|
||||
const lightColors = {
|
||||
background: {
|
||||
default: '#f8fafc',
|
||||
paper: '#ffffff',
|
||||
elevated: '#f1f5f9',
|
||||
},
|
||||
text: {
|
||||
primary: '#1e293b',
|
||||
secondary: '#64748b',
|
||||
disabled: '#94a3b8',
|
||||
},
|
||||
divider: '#e2e8f0',
|
||||
action: {
|
||||
active: '#1e293b',
|
||||
hover: 'rgba(30, 41, 59, 0.08)',
|
||||
selected: 'rgba(249, 115, 22, 0.16)',
|
||||
disabled: '#94a3b8',
|
||||
disabledBackground: 'rgba(148, 163, 184, 0.12)',
|
||||
},
|
||||
};
|
||||
|
||||
// Shared colors
|
||||
const sharedColors = {
|
||||
primary: {
|
||||
main: '#f97316',
|
||||
light: '#fb923c',
|
||||
dark: '#ea580c',
|
||||
contrastText: '#ffffff',
|
||||
},
|
||||
secondary: {
|
||||
main: '#6366f1',
|
||||
light: '#818cf8',
|
||||
dark: '#4f46e5',
|
||||
contrastText: '#ffffff',
|
||||
},
|
||||
error: {
|
||||
main: '#ef4444',
|
||||
light: '#f87171',
|
||||
dark: '#dc2626',
|
||||
},
|
||||
warning: {
|
||||
main: '#f59e0b',
|
||||
light: '#fbbf24',
|
||||
dark: '#d97706',
|
||||
},
|
||||
success: {
|
||||
main: '#22c55e',
|
||||
light: '#4ade80',
|
||||
dark: '#16a34a',
|
||||
},
|
||||
info: {
|
||||
main: '#3b82f6',
|
||||
light: '#60a5fa',
|
||||
dark: '#2563eb',
|
||||
},
|
||||
};
|
||||
|
||||
// Create theme based on mode
|
||||
export function createAppTheme(mode: 'dark' | 'light'): Theme {
|
||||
const colors = mode === 'dark' ? darkColors : lightColors;
|
||||
|
||||
return createTheme({
|
||||
palette: {
|
||||
mode,
|
||||
background: colors.background,
|
||||
text: colors.text,
|
||||
primary: sharedColors.primary,
|
||||
secondary: sharedColors.secondary,
|
||||
error: sharedColors.error,
|
||||
warning: sharedColors.warning,
|
||||
success: sharedColors.success,
|
||||
info: sharedColors.info,
|
||||
divider: colors.divider,
|
||||
action: colors.action,
|
||||
},
|
||||
MuiIconButton: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '4px', // Further reduced from 6px
|
||||
},
|
||||
sizeSmall: {
|
||||
padding: '2px', // Further reduced from 4px
|
||||
},
|
||||
},
|
||||
typography: {
|
||||
fontFamily: '"Inter", "system-ui", "sans-serif"',
|
||||
fontSize: 14,
|
||||
h1: { fontSize: '2.5rem', fontWeight: 600, color: colors.text.primary },
|
||||
h2: { fontSize: '2rem', fontWeight: 600, color: colors.text.primary },
|
||||
h3: { fontSize: '1.5rem', fontWeight: 600, color: colors.text.primary },
|
||||
h4: { fontSize: '1.2rem', fontWeight: 600, marginBottom: '0.5rem', color: colors.text.primary },
|
||||
h5: { fontSize: '1rem', fontWeight: 600, color: colors.text.primary },
|
||||
h6: { fontSize: '0.9rem', fontWeight: 600, marginBottom: '0.5rem', color: colors.text.primary },
|
||||
body1: { fontSize: '0.85rem', color: colors.text.primary },
|
||||
body2: { fontSize: '0.75rem', color: colors.text.secondary },
|
||||
button: { fontSize: '0.8rem', fontWeight: 500, textTransform: 'none' },
|
||||
caption: { fontSize: '0.7rem', color: colors.text.secondary },
|
||||
},
|
||||
MuiTextField: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
'& .MuiInputBase-root': {
|
||||
minHeight: '32px', // Further reduced from 36px
|
||||
shape: { borderRadius: 8 },
|
||||
components: {
|
||||
MuiCssBaseline: {
|
||||
styleOverrides: {
|
||||
body: {
|
||||
backgroundColor: colors.background.default,
|
||||
color: colors.text.primary,
|
||||
scrollbarColor: `${colors.background.elevated} ${colors.background.default}`,
|
||||
'&::-webkit-scrollbar': { width: '8px', height: '8px' },
|
||||
'&::-webkit-scrollbar-track': { background: colors.background.default },
|
||||
'&::-webkit-scrollbar-thumb': { background: colors.background.elevated, borderRadius: '4px' },
|
||||
'&::-webkit-scrollbar-thumb:hover': { background: mode === 'dark' ? '#475569' : '#94a3b8' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialog: {
|
||||
styleOverrides: {
|
||||
paper: {
|
||||
padding: '8px', // Further reduced from 12px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialogTitle: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '8px 12px', // Further reduced from 12px 16px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialogContent: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '6px 12px', // Further reduced from 8px 16px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialogActions: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '6px 12px', // Further reduced from 8px 16px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiPaper: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '8px', // Further reduced from 12px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiList: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '2px 0', // Further reduced from 4px 0
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiListItem: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '2px 8px', // Further reduced from 4px 12px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiTableCell: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '4px 8px', // Further reduced from 8px 12px
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiCard: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '8px',
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiCardContent: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '8px',
|
||||
'&:last-child': {
|
||||
paddingBottom: '8px',
|
||||
MuiButton: {
|
||||
styleOverrides: {
|
||||
root: { padding: '3px 10px', minHeight: '30px', borderRadius: '6px' },
|
||||
sizeSmall: { padding: '1px 6px', minHeight: '24px' },
|
||||
contained: { boxShadow: 'none', '&:hover': { boxShadow: 'none' } },
|
||||
containedPrimary: {
|
||||
backgroundColor: sharedColors.primary.main,
|
||||
'&:hover': { backgroundColor: sharedColors.primary.dark },
|
||||
},
|
||||
outlined: {
|
||||
borderColor: colors.divider,
|
||||
'&:hover': {
|
||||
borderColor: sharedColors.primary.main,
|
||||
backgroundColor: 'rgba(249, 115, 22, 0.08)',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiCardHeader: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '8px',
|
||||
MuiIconButton: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '4px',
|
||||
color: colors.text.secondary,
|
||||
'&:hover': { backgroundColor: colors.action.hover, color: colors.text.primary },
|
||||
},
|
||||
sizeSmall: { padding: '2px' },
|
||||
},
|
||||
},
|
||||
MuiTextField: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
'& .MuiInputBase-root': { minHeight: '32px', backgroundColor: colors.background.default },
|
||||
'& .MuiOutlinedInput-root': {
|
||||
'& fieldset': { borderColor: colors.divider },
|
||||
'&:hover fieldset': { borderColor: colors.text.secondary },
|
||||
'&.Mui-focused fieldset': { borderColor: sharedColors.primary.main },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiInputBase: {
|
||||
styleOverrides: {
|
||||
root: { color: colors.text.primary },
|
||||
input: { '&::placeholder': { color: colors.text.disabled, opacity: 1 } },
|
||||
},
|
||||
},
|
||||
MuiDialog: {
|
||||
styleOverrides: {
|
||||
paper: {
|
||||
padding: '8px',
|
||||
backgroundColor: colors.background.paper,
|
||||
backgroundImage: 'none',
|
||||
border: `1px solid ${colors.divider}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialogTitle: {
|
||||
styleOverrides: { root: { padding: '8px 12px', color: colors.text.primary } },
|
||||
},
|
||||
MuiDialogContent: {
|
||||
styleOverrides: { root: { padding: '6px 12px' } },
|
||||
},
|
||||
MuiDialogActions: {
|
||||
styleOverrides: { root: { padding: '6px 12px' } },
|
||||
},
|
||||
MuiPaper: {
|
||||
styleOverrides: {
|
||||
root: { padding: '8px', backgroundColor: colors.background.paper, backgroundImage: 'none' },
|
||||
outlined: { borderColor: colors.divider },
|
||||
},
|
||||
},
|
||||
MuiList: {
|
||||
styleOverrides: { root: { padding: '2px 0' } },
|
||||
},
|
||||
MuiListItem: {
|
||||
styleOverrides: { root: { padding: '2px 8px' } },
|
||||
},
|
||||
MuiListItemButton: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
'&:hover': { backgroundColor: colors.action.hover },
|
||||
'&.Mui-selected': {
|
||||
backgroundColor: colors.action.selected,
|
||||
'&:hover': { backgroundColor: 'rgba(249, 115, 22, 0.24)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiTableCell: {
|
||||
styleOverrides: {
|
||||
root: { padding: '4px 8px', borderBottomColor: colors.divider },
|
||||
head: { backgroundColor: colors.background.elevated, color: colors.text.primary, fontWeight: 600 },
|
||||
},
|
||||
},
|
||||
MuiTableRow: {
|
||||
styleOverrides: {
|
||||
root: { '&:hover': { backgroundColor: mode === 'dark' ? 'rgba(248, 250, 252, 0.04)' : 'rgba(30, 41, 59, 0.04)' } },
|
||||
},
|
||||
},
|
||||
MuiCard: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '8px',
|
||||
backgroundColor: colors.background.paper,
|
||||
backgroundImage: 'none',
|
||||
border: `1px solid ${colors.divider}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiCardContent: {
|
||||
styleOverrides: { root: { padding: '8px', '&:last-child': { paddingBottom: '8px' } } },
|
||||
},
|
||||
MuiCardHeader: {
|
||||
styleOverrides: {
|
||||
root: { padding: '8px' },
|
||||
title: { color: colors.text.primary },
|
||||
subheader: { color: colors.text.secondary },
|
||||
},
|
||||
},
|
||||
MuiCardActions: {
|
||||
styleOverrides: { root: { padding: '4px 8px' } },
|
||||
},
|
||||
MuiChip: {
|
||||
styleOverrides: {
|
||||
root: { backgroundColor: colors.background.elevated, color: colors.text.primary, borderColor: colors.divider },
|
||||
filled: {
|
||||
'&.MuiChip-colorPrimary': { backgroundColor: sharedColors.primary.main, color: sharedColors.primary.contrastText },
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiAlert: {
|
||||
styleOverrides: {
|
||||
root: { borderRadius: '8px' },
|
||||
standardError: { backgroundColor: 'rgba(239, 68, 68, 0.15)', color: sharedColors.error.light },
|
||||
standardWarning: { backgroundColor: 'rgba(245, 158, 11, 0.15)', color: sharedColors.warning.light },
|
||||
standardSuccess: { backgroundColor: 'rgba(34, 197, 94, 0.15)', color: sharedColors.success.light },
|
||||
standardInfo: { backgroundColor: 'rgba(59, 130, 246, 0.15)', color: sharedColors.info.light },
|
||||
},
|
||||
},
|
||||
MuiTooltip: {
|
||||
styleOverrides: {
|
||||
tooltip: {
|
||||
backgroundColor: colors.background.elevated,
|
||||
color: colors.text.primary,
|
||||
border: `1px solid ${colors.divider}`,
|
||||
fontSize: '0.75rem',
|
||||
},
|
||||
arrow: { color: colors.background.elevated },
|
||||
},
|
||||
},
|
||||
MuiMenu: {
|
||||
styleOverrides: {
|
||||
paper: { backgroundColor: colors.background.paper, border: `1px solid ${colors.divider}` },
|
||||
},
|
||||
},
|
||||
MuiMenuItem: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
'&:hover': { backgroundColor: colors.action.hover },
|
||||
'&.Mui-selected': {
|
||||
backgroundColor: colors.action.selected,
|
||||
'&:hover': { backgroundColor: 'rgba(249, 115, 22, 0.24)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDivider: {
|
||||
styleOverrides: { root: { borderColor: colors.divider } },
|
||||
},
|
||||
MuiTabs: {
|
||||
styleOverrides: { indicator: { backgroundColor: sharedColors.primary.main } },
|
||||
},
|
||||
MuiTab: {
|
||||
styleOverrides: {
|
||||
root: { color: colors.text.secondary, '&.Mui-selected': { color: sharedColors.primary.main } },
|
||||
},
|
||||
},
|
||||
MuiSlider: {
|
||||
styleOverrides: {
|
||||
root: { color: sharedColors.primary.main },
|
||||
track: { backgroundColor: sharedColors.primary.main },
|
||||
rail: { backgroundColor: colors.background.elevated },
|
||||
thumb: { backgroundColor: sharedColors.primary.main },
|
||||
},
|
||||
},
|
||||
MuiSwitch: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
'& .MuiSwitch-switchBase.Mui-checked': {
|
||||
color: sharedColors.primary.main,
|
||||
'& + .MuiSwitch-track': { backgroundColor: sharedColors.primary.main },
|
||||
},
|
||||
},
|
||||
track: { backgroundColor: colors.background.elevated },
|
||||
},
|
||||
},
|
||||
MuiCheckbox: {
|
||||
styleOverrides: {
|
||||
root: { color: colors.text.secondary, '&.Mui-checked': { color: sharedColors.primary.main } },
|
||||
},
|
||||
},
|
||||
MuiRadio: {
|
||||
styleOverrides: {
|
||||
root: { color: colors.text.secondary, '&.Mui-checked': { color: sharedColors.primary.main } },
|
||||
},
|
||||
},
|
||||
MuiLinearProgress: {
|
||||
styleOverrides: {
|
||||
root: { backgroundColor: colors.background.elevated, borderRadius: '4px' },
|
||||
bar: { backgroundColor: sharedColors.primary.main, borderRadius: '4px' },
|
||||
},
|
||||
},
|
||||
MuiCircularProgress: {
|
||||
styleOverrides: { root: { color: sharedColors.primary.main } },
|
||||
},
|
||||
MuiSelect: {
|
||||
styleOverrides: {
|
||||
select: { backgroundColor: colors.background.default },
|
||||
icon: { color: colors.text.secondary },
|
||||
},
|
||||
},
|
||||
MuiAccordion: {
|
||||
styleOverrides: {
|
||||
root: { backgroundColor: colors.background.paper, '&:before': { backgroundColor: colors.divider } },
|
||||
},
|
||||
},
|
||||
MuiAccordionSummary: {
|
||||
styleOverrides: { root: { '&:hover': { backgroundColor: colors.action.hover } } },
|
||||
},
|
||||
MuiBadge: {
|
||||
styleOverrides: { colorPrimary: { backgroundColor: sharedColors.primary.main } },
|
||||
},
|
||||
MuiAppBar: {
|
||||
styleOverrides: {
|
||||
root: { backgroundColor: colors.background.paper, backgroundImage: 'none', borderBottom: `1px solid ${colors.divider}` },
|
||||
},
|
||||
},
|
||||
MuiDrawer: {
|
||||
styleOverrides: {
|
||||
paper: { backgroundColor: colors.background.paper, backgroundImage: 'none', borderColor: colors.divider },
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiCardActions: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
padding: '4px 8px',
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiGrid: {
|
||||
styleOverrides: {
|
||||
container: {
|
||||
marginTop: '-4px',
|
||||
marginLeft: '-4px',
|
||||
width: 'calc(100% + 8px)',
|
||||
},
|
||||
item: {
|
||||
paddingTop: '4px',
|
||||
paddingLeft: '4px',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
spacing: (factor: number) => `${0.6 * factor}rem`, // Further reduced from 0.8 * factor
|
||||
});
|
||||
spacing: (factor: number) => `${0.6 * factor}rem`,
|
||||
});
|
||||
}
|
||||
|
||||
export default theme;
|
||||
// Default dark theme for backwards compatibility
|
||||
const theme = createAppTheme('dark');
|
||||
export default theme;
|
||||
@@ -4,6 +4,11 @@ import react from '@vitejs/plugin-react'
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 5173,
|
||||
// Allow connections from karaoke-gen frontend running on different port
|
||||
cors: true,
|
||||
},
|
||||
build: {
|
||||
minify: false,
|
||||
sourcemap: true,
|
||||
|
||||
@@ -110,7 +110,7 @@ class ReviewServer:
|
||||
allowed_origins = (
|
||||
[f"http://localhost:{port}" for port in range(3000, 5174)]
|
||||
+ [f"http://127.0.0.1:{port}" for port in range(3000, 5174)]
|
||||
+ ["https://lyrics.nomadkaraoke.com"]
|
||||
+ ["https://gen.nomadkaraoke.com"]
|
||||
)
|
||||
|
||||
# Also allow custom review UI URL if set
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.75.60"
|
||||
version = "0.75.61"
|
||||
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
|
||||
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -2780,7 +2780,7 @@ class TestRemoteClientContentType:
|
||||
"""Provide a valid Config instance."""
|
||||
return Config(
|
||||
service_url='https://api.nomadkaraoke.com',
|
||||
review_ui_url='https://lyrics.nomadkaraoke.com',
|
||||
review_ui_url='https://gen.nomadkaraoke.com/lyrics/',
|
||||
poll_interval=5,
|
||||
output_dir='/tmp/output'
|
||||
)
|
||||
@@ -2834,7 +2834,7 @@ class TestRemoteClientSessionSetup:
|
||||
"""Provide a Config instance with auth token."""
|
||||
return Config(
|
||||
service_url='https://api.nomadkaraoke.com',
|
||||
review_ui_url='https://lyrics.nomadkaraoke.com',
|
||||
review_ui_url='https://gen.nomadkaraoke.com/lyrics/',
|
||||
poll_interval=5,
|
||||
output_dir='/tmp/output',
|
||||
auth_token='test-token-123',
|
||||
|
||||