Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f661b6a27b | ||
|
|
3f02122cad | ||
|
|
16e8c25d22 | ||
|
|
8e602a8173 |
No files matched your search
@@ -18,6 +18,8 @@
|
||||
| Dev setup & testing | `docs/DEVELOPMENT.md` |
|
||||
| API reference | `docs/API.md` |
|
||||
| Past learnings | `docs/LESSONS-LEARNED.md` |
|
||||
| **Product communication** | `docs/PRODUCT-COMMUNICATION-GUIDE.md` |
|
||||
| Brand style guide | `docs/BRAND-STYLE-GUIDE.md` |
|
||||
|
||||
## Tech Stack
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ from backend.services.user_service import get_user_service, UserService, USERS_C
|
||||
from backend.services.job_manager import JobManager
|
||||
from backend.services.flacfetch_client import get_flacfetch_client, FlacfetchServiceError
|
||||
from backend.models.job import JobStatus
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -651,10 +652,14 @@ async def get_job_completion_message(
|
||||
)
|
||||
|
||||
# Build subject: "NOMAD-1178: Artist - Title (Your karaoke video is ready!)"
|
||||
if brand_code and job.artist and job.title:
|
||||
subject = f"{brand_code}: {job.artist} - {job.title} (Your karaoke video is ready!)"
|
||||
elif job.artist and job.title:
|
||||
subject = f"{job.artist} - {job.title} (Your karaoke video is ready!)"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
# that cause email header encoding issues (MIME headers use latin-1)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else None
|
||||
safe_title = sanitize_filename(job.title) if job.title else None
|
||||
if brand_code and safe_artist and safe_title:
|
||||
subject = f"{brand_code}: {safe_artist} - {safe_title} (Your karaoke video is ready!)"
|
||||
elif safe_artist and safe_title:
|
||||
subject = f"{safe_artist} - {safe_title} (Your karaoke video is ready!)"
|
||||
else:
|
||||
subject = "Your karaoke video is ready!"
|
||||
|
||||
|
||||
@@ -18,9 +18,10 @@ import tempfile
|
||||
from typing import Optional, List, Dict, Any, Tuple
|
||||
|
||||
from fastapi import APIRouter, HTTPException, BackgroundTasks, Request, Depends
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, validator
|
||||
|
||||
from backend.models.job import JobCreate, JobStatus
|
||||
from karaoke_gen.utils import normalize_text
|
||||
from backend.services.job_manager import JobManager
|
||||
from backend.services.storage_service import StorageService
|
||||
from backend.services.worker_service import get_worker_service
|
||||
@@ -124,6 +125,13 @@ class AudioSearchRequest(BaseModel):
|
||||
# Non-interactive mode
|
||||
non_interactive: bool = Field(False, description="Skip interactive steps (lyrics review, instrumental selection)")
|
||||
|
||||
@validator('artist', 'title', 'lyrics_artist', 'lyrics_title', 'display_artist', 'display_title')
|
||||
def normalize_text_fields(cls, v):
|
||||
"""Normalize text fields to standardize Unicode characters."""
|
||||
if v is not None and isinstance(v, str):
|
||||
return normalize_text(v)
|
||||
return v
|
||||
|
||||
|
||||
class AudioSearchResultResponse(BaseModel):
|
||||
"""A single audio search result.
|
||||
|
||||
@@ -227,6 +227,7 @@ async def check_encoding_worker_status() -> Dict[str, Any]:
|
||||
"active_jobs": health.get("active_jobs", 0),
|
||||
"queue_length": health.get("queue_length", 0),
|
||||
"ffmpeg_version": health.get("ffmpeg_version"),
|
||||
"wheel_version": health.get("wheel_version"),
|
||||
}
|
||||
except Exception as e:
|
||||
return {
|
||||
@@ -237,6 +238,39 @@ async def check_encoding_worker_status() -> Dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
@router.get("/health/encoding-worker")
|
||||
async def encoding_worker_health() -> Dict[str, Any]:
|
||||
"""
|
||||
Lightweight endpoint to check encoding worker status.
|
||||
|
||||
Returns minimal info for frontend footer display.
|
||||
No authentication required.
|
||||
"""
|
||||
status = await check_encoding_worker_status()
|
||||
|
||||
# Return simplified response for frontend
|
||||
if not status.get("configured"):
|
||||
return {
|
||||
"available": False,
|
||||
"status": "not_configured",
|
||||
}
|
||||
|
||||
if not status.get("available"):
|
||||
return {
|
||||
"available": False,
|
||||
"status": "offline",
|
||||
"error": status.get("error"),
|
||||
}
|
||||
|
||||
return {
|
||||
"available": True,
|
||||
"status": "ok",
|
||||
"version": status.get("wheel_version"),
|
||||
"active_jobs": status.get("active_jobs", 0),
|
||||
"queue_length": status.get("queue_length", 0),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/health/detailed")
|
||||
async def detailed_health_check() -> Dict[str, Any]:
|
||||
"""
|
||||
|
||||
@@ -1164,21 +1164,11 @@ async def download_file(
|
||||
content_type = content_types.get(ext, 'application/octet-stream')
|
||||
|
||||
# Build proper filename: "Artist - Title (Final Karaoke Lossy 4k).mp4"
|
||||
# Sanitize artist/title to remove filesystem-unsafe characters
|
||||
def sanitize_filename_part(s: str) -> str:
|
||||
if not s:
|
||||
return ""
|
||||
# Remove/replace characters unsafe for filesystems: / \ : * ? " < > |
|
||||
unsafe_chars = r'[/\\:*?"<>|]'
|
||||
import re
|
||||
sanitized = re.sub(unsafe_chars, '', s)
|
||||
# Collapse multiple spaces and trim
|
||||
sanitized = ' '.join(sanitized.split())
|
||||
# Limit length to prevent overly long filenames
|
||||
return sanitized[:100].strip()
|
||||
|
||||
artist_clean = sanitize_filename_part(job.artist) if job.artist else None
|
||||
title_clean = sanitize_filename_part(job.title) if job.title else None
|
||||
# Use sanitize_filename to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
# that cause HTTP header encoding issues (Content-Disposition uses latin-1)
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
artist_clean = sanitize_filename(job.artist) if job.artist else None
|
||||
title_clean = sanitize_filename(job.title) if job.title else None
|
||||
base_name = f"{artist_clean} - {title_clean}" if artist_clean and title_clean else None
|
||||
|
||||
if base_name and file_key in DOWNLOAD_FILENAME_SUFFIXES:
|
||||
|
||||
@@ -9,6 +9,8 @@ from datetime import datetime
|
||||
from enum import Enum
|
||||
from pydantic import BaseModel, Field, validator
|
||||
|
||||
from karaoke_gen.utils import normalize_text
|
||||
|
||||
|
||||
class JobStatus(str, Enum):
|
||||
"""
|
||||
@@ -485,13 +487,29 @@ class JobCreate(BaseModel):
|
||||
- custom_headers: All X-* headers
|
||||
"""
|
||||
|
||||
@validator('url', 'artist', 'title')
|
||||
def validate_inputs(cls, v):
|
||||
"""Validate string inputs are not empty."""
|
||||
@validator('url')
|
||||
def validate_url(cls, v):
|
||||
"""Validate URL is not empty."""
|
||||
if v is not None and isinstance(v, str) and not v.strip():
|
||||
raise ValueError("Field cannot be empty string")
|
||||
return v.strip() if isinstance(v, str) else v
|
||||
|
||||
@validator('artist', 'title')
|
||||
def normalize_artist_title(cls, v):
|
||||
"""Normalize artist/title text to standardize Unicode characters.
|
||||
|
||||
This ensures consistent data storage by converting:
|
||||
- Curly quotes -> straight quotes
|
||||
- Various dashes -> hyphen
|
||||
- Unusual whitespace -> regular space
|
||||
"""
|
||||
if v is not None and isinstance(v, str):
|
||||
if not v.strip():
|
||||
raise ValueError("Field cannot be empty string")
|
||||
# normalize_text handles stripping and Unicode normalization
|
||||
return normalize_text(v)
|
||||
return v
|
||||
|
||||
|
||||
class JobResponse(BaseModel):
|
||||
"""Job response model."""
|
||||
|
||||
@@ -566,11 +566,21 @@ async def get_job_status(job_id: str, _auth: bool = Depends(verify_api_key)) ->
|
||||
async def health_check():
|
||||
# Health check endpoint
|
||||
active_jobs = sum(1 for j in jobs.values() if j["status"] == "running")
|
||||
|
||||
# Get karaoke-gen wheel version if installed
|
||||
wheel_version = None
|
||||
try:
|
||||
from importlib.metadata import version as get_version
|
||||
wheel_version = get_version("karaoke-gen")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return {
|
||||
"status": "ok",
|
||||
"active_jobs": active_jobs,
|
||||
"queue_length": sum(1 for j in jobs.values() if j["status"] == "pending"),
|
||||
"ffmpeg_version": subprocess.run(["ffmpeg", "-version"], capture_output=True, text=True).stdout.split("\n")[0],
|
||||
"wheel_version": wheel_version,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import os
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from backend.config import get_settings
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -253,7 +254,10 @@ class GoogleDriveService:
|
||||
Returns:
|
||||
Dictionary mapping category to uploaded file ID
|
||||
"""
|
||||
filename_base = f"{brand_code} - {base_name}"
|
||||
# Sanitize base_name to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
# that could cause issues with Google Drive API queries and file naming
|
||||
safe_base_name = sanitize_filename(base_name) if base_name else base_name
|
||||
filename_base = f"{brand_code} - {safe_base_name}"
|
||||
uploaded_files = {}
|
||||
|
||||
logger.info(
|
||||
|
||||
@@ -54,7 +54,7 @@ DEFAULT_ACTION_NEEDED_LYRICS_TEMPLATE = """Hi {name},
|
||||
|
||||
Your karaoke video for "{artist} - {title}" is ready for lyrics review!
|
||||
|
||||
The AI has transcribed and synchronized the lyrics, but they may need some corrections. Please review and approve them so we can finish generating your video.
|
||||
Our system has transcribed and synchronized the lyrics, but they may need some corrections. Please review and make any corrections necessary so we can finish generating your video.
|
||||
|
||||
Review your lyrics here:
|
||||
{review_url}
|
||||
@@ -62,7 +62,7 @@ Review your lyrics here:
|
||||
This usually takes just a few minutes.
|
||||
|
||||
Thanks!
|
||||
-Nomad Karaoke
|
||||
-Andrew
|
||||
"""
|
||||
|
||||
DEFAULT_ACTION_NEEDED_INSTRUMENTAL_TEMPLATE = """Hi {name},
|
||||
@@ -75,7 +75,7 @@ Select your instrumental here:
|
||||
{instrumental_url}
|
||||
|
||||
Thanks!
|
||||
-Nomad Karaoke
|
||||
-Andrew
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,522 @@
|
||||
"""
|
||||
Comprehensive tests for Unicode and special character handling.
|
||||
|
||||
This test file verifies that artist/title with Unicode characters (curly quotes,
|
||||
em dashes, non-ASCII characters) are properly sanitized throughout the codebase
|
||||
to prevent:
|
||||
1. HTTP header encoding failures (Content-Disposition, email subjects)
|
||||
2. API query failures (Google Drive)
|
||||
3. Filename encoding issues (Modal API, filesystem)
|
||||
|
||||
The root cause was job d49efab1 which had title "Mama Says (You Can't Back Down)"
|
||||
with a curly apostrophe (U+2019) that caused the audio separation to fail because
|
||||
the Modal API couldn't handle the non-latin-1 character in HTTP headers.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from karaoke_gen.utils import (
|
||||
sanitize_filename,
|
||||
normalize_text,
|
||||
UNICODE_REPLACEMENTS,
|
||||
TEXT_NORMALIZATIONS,
|
||||
APOSTROPHE_REPLACEMENTS,
|
||||
DOUBLE_QUOTE_REPLACEMENTS,
|
||||
DASH_REPLACEMENTS,
|
||||
WHITESPACE_REPLACEMENTS,
|
||||
)
|
||||
|
||||
|
||||
class TestSanitizeFilename:
|
||||
"""Test the sanitize_filename function handles all edge cases."""
|
||||
|
||||
def test_curly_single_quotes(self):
|
||||
"""Test that curly single quotes are converted to straight quotes."""
|
||||
# The exact character that caused job d49efab1 to fail
|
||||
assert sanitize_filename("Can't") == "Can't"
|
||||
assert sanitize_filename("It's") == "It's"
|
||||
# Left single quote
|
||||
assert sanitize_filename("'Hello'") == "'Hello'"
|
||||
|
||||
def test_curly_double_quotes(self):
|
||||
"""Test that curly double quotes are converted to underscores.
|
||||
|
||||
Note: Double quotes are filesystem-unsafe so they become underscores."""
|
||||
# Curly quotes first become straight, then straight quotes become underscore
|
||||
assert sanitize_filename("\u201cHello\u201d") == "_Hello_"
|
||||
|
||||
def test_em_dash(self):
|
||||
"""Test that em dashes are converted to regular hyphens."""
|
||||
assert sanitize_filename("Artist — Title") == "Artist - Title"
|
||||
assert sanitize_filename("Song—Name") == "Song-Name"
|
||||
|
||||
def test_en_dash(self):
|
||||
"""Test that en dashes are converted to regular hyphens."""
|
||||
assert sanitize_filename("1990–2000") == "1990-2000"
|
||||
|
||||
def test_ellipsis(self):
|
||||
"""Test that horizontal ellipsis is converted to three dots."""
|
||||
# Note: The ellipsis becomes "..." but trailing dots are stripped
|
||||
assert sanitize_filename("Wait\u2026") == "Wait"
|
||||
# But in the middle of a string they're preserved
|
||||
assert sanitize_filename("Wait\u2026Here") == "Wait...Here"
|
||||
|
||||
def test_non_breaking_space(self):
|
||||
"""Test that non-breaking spaces are converted to regular spaces."""
|
||||
# U+00A0 is non-breaking space
|
||||
assert sanitize_filename("Hello\u00A0World") == "Hello World"
|
||||
|
||||
def test_filesystem_unsafe_characters(self):
|
||||
"""Test that filesystem-unsafe characters are replaced."""
|
||||
assert sanitize_filename("file/name") == "file_name"
|
||||
assert sanitize_filename("file\\name") == "file_name"
|
||||
assert sanitize_filename("file:name") == "file_name"
|
||||
assert sanitize_filename("file*name") == "file_name"
|
||||
assert sanitize_filename("file?name") == "file_name"
|
||||
assert sanitize_filename('file"name') == "file_name"
|
||||
assert sanitize_filename("file<name") == "file_name"
|
||||
assert sanitize_filename("file>name") == "file_name"
|
||||
assert sanitize_filename("file|name") == "file_name"
|
||||
|
||||
def test_trailing_periods_and_spaces(self):
|
||||
"""Test that trailing periods and spaces are removed."""
|
||||
assert sanitize_filename("filename.") == "filename"
|
||||
assert sanitize_filename("filename...") == "filename"
|
||||
assert sanitize_filename("filename ") == "filename"
|
||||
assert sanitize_filename("filename . ") == "filename"
|
||||
|
||||
def test_leading_periods_and_spaces(self):
|
||||
"""Test that leading periods and spaces are removed."""
|
||||
assert sanitize_filename(".filename") == "filename"
|
||||
assert sanitize_filename("...filename") == "filename"
|
||||
assert sanitize_filename(" filename") == "filename"
|
||||
assert sanitize_filename(" . filename") == "filename"
|
||||
|
||||
def test_multiple_underscores_collapsed(self):
|
||||
"""Test that multiple consecutive underscores are collapsed to one."""
|
||||
assert sanitize_filename("file___name") == "file_name"
|
||||
# Multiple unsafe chars in a row
|
||||
assert sanitize_filename("file?*:name") == "file_name"
|
||||
|
||||
def test_multiple_spaces_collapsed(self):
|
||||
"""Test that multiple consecutive spaces are collapsed to one."""
|
||||
assert sanitize_filename("file name") == "file name"
|
||||
|
||||
def test_none_input(self):
|
||||
"""Test that None input returns None."""
|
||||
assert sanitize_filename(None) is None
|
||||
|
||||
def test_empty_string(self):
|
||||
"""Test that empty string returns empty string."""
|
||||
assert sanitize_filename("") == ""
|
||||
|
||||
def test_real_world_examples(self):
|
||||
"""Test real-world examples that have caused issues."""
|
||||
# The exact title from job d49efab1
|
||||
assert sanitize_filename("Mama Says (You Can't Back Down)") == "Mama Says (You Can't Back Down)"
|
||||
|
||||
# Broadway cast with smart quotes
|
||||
assert sanitize_filename("Footloose (Broadway Cast) \u2014 \u201cFinal Song\u201d") == "Footloose (Broadway Cast) - _Final Song_"
|
||||
|
||||
# Japanese artist with em dash
|
||||
assert sanitize_filename("宇多田ヒカル — First Love") == "宇多田ヒカル - First Love"
|
||||
|
||||
# Korean title (should pass through unchanged)
|
||||
assert sanitize_filename("아이유 - 좋은 날") == "아이유 - 좋은 날"
|
||||
|
||||
# Mixed content
|
||||
assert sanitize_filename("L'Arc~en~Ciel - Driver's High") == "L'Arc~en~Ciel - Driver's High"
|
||||
|
||||
def test_combination_of_issues(self):
|
||||
"""Test strings with multiple problematic characters."""
|
||||
result = sanitize_filename("It\u2019s \u201cMy\u201d Song \u2014 Volume\u20261")
|
||||
# Curly ' -> ', curly " -> _ (via filesystem check), em dash -> -, ellipsis -> ...
|
||||
assert result == "It's _My_ Song - Volume...1"
|
||||
|
||||
def test_unicode_replacements_dict_complete(self):
|
||||
"""Verify all expected Unicode characters are in the replacements dict."""
|
||||
# Curly quotes
|
||||
assert "\u2018" in UNICODE_REPLACEMENTS # LEFT SINGLE QUOTATION MARK
|
||||
assert "\u2019" in UNICODE_REPLACEMENTS # RIGHT SINGLE QUOTATION MARK
|
||||
assert "\u201A" in UNICODE_REPLACEMENTS # SINGLE LOW-9 QUOTATION MARK
|
||||
assert "\u201B" in UNICODE_REPLACEMENTS # SINGLE HIGH-REVERSED-9 QUOTATION MARK
|
||||
assert "\u201C" in UNICODE_REPLACEMENTS # LEFT DOUBLE QUOTATION MARK
|
||||
assert "\u201D" in UNICODE_REPLACEMENTS # RIGHT DOUBLE QUOTATION MARK
|
||||
assert "\u201E" in UNICODE_REPLACEMENTS # DOUBLE LOW-9 QUOTATION MARK
|
||||
assert "\u201F" in UNICODE_REPLACEMENTS # DOUBLE HIGH-REVERSED-9 QUOTATION MARK
|
||||
# Dashes
|
||||
assert "\u2013" in UNICODE_REPLACEMENTS # EN DASH
|
||||
assert "\u2014" in UNICODE_REPLACEMENTS # EM DASH
|
||||
# Other
|
||||
assert "\u2026" in UNICODE_REPLACEMENTS # HORIZONTAL ELLIPSIS
|
||||
assert "\u00A0" in UNICODE_REPLACEMENTS # NON-BREAKING SPACE
|
||||
|
||||
|
||||
class TestSanitizationInContext:
|
||||
"""Test that sanitization is applied correctly in various contexts.
|
||||
|
||||
These tests verify that the fixes we applied work in the actual
|
||||
code paths that use artist/title data.
|
||||
"""
|
||||
|
||||
def test_artist_title_format_for_audio_separation(self):
|
||||
"""Verify artist-title formatting is sanitized for Modal API."""
|
||||
# Simulate what audio_worker.py does
|
||||
artist = "Footloose (Broadway Cast)"
|
||||
title = "Mama Says (You Can\u2019t Back Down)" # Curly apostrophe U+2019
|
||||
|
||||
safe_artist = sanitize_filename(artist) if artist else "Unknown"
|
||||
safe_title = sanitize_filename(title) if title else "Unknown"
|
||||
artist_title = f"{safe_artist} - {safe_title}"
|
||||
|
||||
# The curly apostrophe should be converted to straight
|
||||
assert "'" in artist_title # Straight apostrophe
|
||||
assert "\u2019" not in artist_title # No curly apostrophe (U+2019)
|
||||
|
||||
def test_email_subject_safe_for_latin1(self):
|
||||
"""Verify email subjects can be encoded to latin-1 after sanitization."""
|
||||
artist = "Café del Mar" # Has accented e
|
||||
title = "It\u2019s a \u201cBeautiful\u201d Day \u2014 Remix"
|
||||
|
||||
safe_artist = sanitize_filename(artist) if artist else None
|
||||
safe_title = sanitize_filename(title) if title else None
|
||||
subject = f"{safe_artist} - {safe_title}"
|
||||
|
||||
# Accented characters should pass through (they're valid latin-1)
|
||||
assert "é" in subject
|
||||
# But curly quotes and em dash should be converted
|
||||
assert "'" in subject # Straight apostrophe
|
||||
assert "-" in subject # Regular hyphen
|
||||
# No curly apostrophe (U+2019)
|
||||
assert "\u2019" not in subject
|
||||
|
||||
def test_content_disposition_safe(self):
|
||||
"""Verify filenames are safe for HTTP Content-Disposition headers."""
|
||||
artist = "Artist\u2019s \u201cName\u201d"
|
||||
title = "Song\u2014Title"
|
||||
|
||||
safe_artist = sanitize_filename(artist) if artist else None
|
||||
safe_title = sanitize_filename(title) if title else None
|
||||
filename = f"{safe_artist} - {safe_title} (Final Karaoke).mp4"
|
||||
|
||||
# Should be able to encode to latin-1 for HTTP headers
|
||||
try:
|
||||
filename.encode('latin-1')
|
||||
can_encode = True
|
||||
except UnicodeEncodeError:
|
||||
can_encode = False
|
||||
|
||||
# Standard ASCII chars and latin-1 safe accented chars should work
|
||||
# Note: The test above with 'é' passes latin-1; smart quotes do not
|
||||
assert can_encode
|
||||
|
||||
def test_google_drive_query_safe(self):
|
||||
"""Verify filenames don't break Google Drive API queries."""
|
||||
base_name = "Artist\u2019s \u201cSong\u201d"
|
||||
|
||||
safe_base_name = sanitize_filename(base_name) if base_name else base_name
|
||||
filename = f"NOMAD-1234 - {safe_base_name}.mp4"
|
||||
|
||||
# Google Drive queries use single quotes - our sanitized string
|
||||
# should have straight single quotes, not curly
|
||||
# The query escaping handles straight quotes: '
|
||||
escaped = filename.replace("'", "\\'")
|
||||
query = f"name='{escaped}'"
|
||||
|
||||
# Should be a valid query string (no curly quotes to break syntax)
|
||||
assert "\u2019" not in query # No curly single quote (U+2019)
|
||||
assert "\u2018" not in query # No curly single quote (U+2018)
|
||||
|
||||
def test_dropbox_path_safe(self):
|
||||
"""Verify Dropbox paths don't have problematic characters."""
|
||||
artist = "Don\u2019t Stop"
|
||||
title = "Believin\u2019"
|
||||
|
||||
safe_artist = sanitize_filename(artist) if artist else "Unknown"
|
||||
safe_title = sanitize_filename(title) if title else "Unknown"
|
||||
folder_name = f"NOMAD-1234 - {safe_artist} - {safe_title}"
|
||||
remote_path = f"/Karaoke/{folder_name}"
|
||||
|
||||
# Path should not have curly quotes (U+2018 and U+2019)
|
||||
assert "\u2018" not in remote_path
|
||||
assert "\u2019" not in remote_path
|
||||
# But should have the converted straight apostrophe
|
||||
assert "'" in remote_path
|
||||
|
||||
|
||||
class TestInternationalCharacters:
|
||||
"""Test that international/non-ASCII characters are handled properly.
|
||||
|
||||
The goal is NOT to strip all non-ASCII, but to convert problematic
|
||||
Unicode to safe equivalents while preserving legitimate international text.
|
||||
"""
|
||||
|
||||
def test_japanese_preserved(self):
|
||||
"""Japanese characters should pass through unchanged."""
|
||||
assert sanitize_filename("宇多田ヒカル") == "宇多田ヒカル"
|
||||
assert sanitize_filename("君が代") == "君が代"
|
||||
|
||||
def test_korean_preserved(self):
|
||||
"""Korean characters should pass through unchanged."""
|
||||
assert sanitize_filename("방탄소년단") == "방탄소년단"
|
||||
assert sanitize_filename("좋은 날") == "좋은 날"
|
||||
|
||||
def test_chinese_preserved(self):
|
||||
"""Chinese characters should pass through unchanged."""
|
||||
assert sanitize_filename("周杰倫") == "周杰倫"
|
||||
assert sanitize_filename("青花瓷") == "青花瓷"
|
||||
|
||||
def test_cyrillic_preserved(self):
|
||||
"""Cyrillic characters should pass through unchanged."""
|
||||
assert sanitize_filename("Тату") == "Тату"
|
||||
assert sanitize_filename("Не верь, не бойся") == "Не верь, не бойся"
|
||||
|
||||
def test_arabic_preserved(self):
|
||||
"""Arabic characters should pass through unchanged."""
|
||||
assert sanitize_filename("فيروز") == "فيروز"
|
||||
|
||||
def test_accented_latin_preserved(self):
|
||||
"""Accented Latin characters should pass through unchanged."""
|
||||
assert sanitize_filename("Café") == "Café"
|
||||
assert sanitize_filename("Señorita") == "Señorita"
|
||||
assert sanitize_filename("Naïve") == "Naïve"
|
||||
assert sanitize_filename("Björk") == "Björk"
|
||||
|
||||
def test_mixed_script_preserved(self):
|
||||
"""Mixed script text should work correctly."""
|
||||
# Japanese artist, English title
|
||||
assert sanitize_filename("宇多田ヒカル - First Love") == "宇多田ヒカル - First Love"
|
||||
# K-pop with English
|
||||
assert sanitize_filename("BTS 방탄소년단 - Dynamite") == "BTS 방탄소년단 - Dynamite"
|
||||
|
||||
|
||||
class TestEdgeCasesAndRegression:
|
||||
"""Edge cases and regression tests for specific bugs."""
|
||||
|
||||
def test_job_d49efab1_exact_title(self):
|
||||
"""Exact reproduction of job d49efab1 failure case.
|
||||
|
||||
The job had:
|
||||
- artist: "Footloose (Broadway Cast)" (from display_artist override)
|
||||
- title: "Mama Says (You Can't Back Down)" (with curly apostrophe U+2019)
|
||||
|
||||
This caused Stage 2 audio separation to fail because the filename
|
||||
with the curly apostrophe couldn't be encoded in HTTP headers.
|
||||
"""
|
||||
artist = "Footloose (Broadway Cast)"
|
||||
title = "Mama Says (You Can\u2019t Back Down)" # Explicit U+2019
|
||||
|
||||
safe_artist = sanitize_filename(artist)
|
||||
safe_title = sanitize_filename(title)
|
||||
artist_title = f"{safe_artist} - {safe_title}"
|
||||
|
||||
# The result should use straight apostrophe
|
||||
assert "Can't" in artist_title
|
||||
assert "\u2019" not in artist_title # No curly apostrophe
|
||||
|
||||
# Should be HTTP-header safe
|
||||
try:
|
||||
artist_title.encode('latin-1')
|
||||
header_safe = True
|
||||
except UnicodeEncodeError:
|
||||
header_safe = False
|
||||
assert header_safe
|
||||
|
||||
def test_double_sanitization_idempotent(self):
|
||||
"""Sanitizing twice should give the same result as once."""
|
||||
original = "It\u2019s \u201cMy\u201d Song \u2014 Test\u2026"
|
||||
once = sanitize_filename(original)
|
||||
twice = sanitize_filename(once)
|
||||
assert once == twice
|
||||
|
||||
def test_only_problematic_chars_string(self):
|
||||
"""Test string made entirely of problematic characters."""
|
||||
result = sanitize_filename("\u2018\u2019\u201c\u201d\u2014\u2026")
|
||||
# Should become: ''""--... then quotes -> underscores, collapses
|
||||
# Actually: ' ' " " - ... -> underscores for filesystem chars
|
||||
assert result # Should not be empty
|
||||
|
||||
def test_very_long_filename(self):
|
||||
"""Test that very long filenames are handled."""
|
||||
long_name = "A" * 1000
|
||||
result = sanitize_filename(long_name)
|
||||
assert result == long_name # No truncation in sanitize_filename itself
|
||||
|
||||
def test_special_musical_characters(self):
|
||||
"""Test musical symbols and special characters."""
|
||||
# These should pass through as they're not in our replacement list
|
||||
assert "♪" in sanitize_filename("♪ Intro ♪")
|
||||
assert "♫" in sanitize_filename("♫ Music ♫")
|
||||
assert "♯" in sanitize_filename("C♯ Minor")
|
||||
assert "♭" in sanitize_filename("B♭ Major")
|
||||
|
||||
|
||||
class TestNormalizeText:
|
||||
"""Test the normalize_text function for data consistency normalization."""
|
||||
|
||||
def test_curly_single_quotes_normalized(self):
|
||||
"""Test that curly single quotes are converted to straight apostrophe."""
|
||||
assert normalize_text("Can\u2019t") == "Can't"
|
||||
assert normalize_text("It\u2018s") == "It's"
|
||||
assert normalize_text("\u201Aquote\u201B") == "'quote'"
|
||||
|
||||
def test_curly_double_quotes_normalized(self):
|
||||
"""Test that curly double quotes are converted to straight double quotes."""
|
||||
assert normalize_text("\u201CHello\u201D") == '"Hello"'
|
||||
assert normalize_text("\u201Equote\u201F") == '"quote"'
|
||||
|
||||
def test_backticks_normalized(self):
|
||||
"""Test that backticks and similar marks are converted to apostrophe."""
|
||||
assert normalize_text("code`here") == "code'here"
|
||||
assert normalize_text("acute\u00B4accent") == "acute'accent"
|
||||
assert normalize_text("prime\u2032mark") == "prime'mark"
|
||||
|
||||
def test_dashes_normalized(self):
|
||||
"""Test that various dashes are converted to hyphen-minus."""
|
||||
# EN DASH
|
||||
assert normalize_text("1990\u20132000") == "1990-2000"
|
||||
# EM DASH
|
||||
assert normalize_text("word\u2014word") == "word-word"
|
||||
# MINUS SIGN
|
||||
assert normalize_text("a\u2212b") == "a-b"
|
||||
# FIGURE DASH
|
||||
assert normalize_text("phone\u2012number") == "phone-number"
|
||||
|
||||
def test_whitespace_normalized(self):
|
||||
"""Test that various whitespace characters are normalized."""
|
||||
# NON-BREAKING SPACE
|
||||
assert normalize_text("hello\u00A0world") == "hello world"
|
||||
# EM SPACE
|
||||
assert normalize_text("hello\u2003world") == "hello world"
|
||||
# IDEOGRAPHIC SPACE (CJK full-width)
|
||||
assert normalize_text("hello\u3000world") == "hello world"
|
||||
# ZERO WIDTH SPACE (removed entirely)
|
||||
assert normalize_text("hello\u200Bworld") == "helloworld"
|
||||
|
||||
def test_ellipsis_normalized(self):
|
||||
"""Test that ellipsis character is converted to three dots."""
|
||||
assert normalize_text("Wait\u2026") == "Wait..."
|
||||
assert normalize_text("Loading\u2026please wait") == "Loading...please wait"
|
||||
|
||||
def test_multiple_spaces_collapsed(self):
|
||||
"""Test that multiple spaces are collapsed to one."""
|
||||
assert normalize_text("hello world") == "hello world"
|
||||
# After normalizing multiple whitespace chars
|
||||
assert normalize_text("hello\u00A0\u00A0\u00A0world") == "hello world"
|
||||
|
||||
def test_leading_trailing_whitespace_stripped(self):
|
||||
"""Test that leading/trailing whitespace is stripped."""
|
||||
assert normalize_text(" hello ") == "hello"
|
||||
assert normalize_text("\u00A0hello\u00A0") == "hello"
|
||||
|
||||
def test_none_input(self):
|
||||
"""Test that None input returns None."""
|
||||
assert normalize_text(None) is None
|
||||
|
||||
def test_non_string_input(self):
|
||||
"""Test that non-string input is returned unchanged."""
|
||||
assert normalize_text(123) == 123
|
||||
assert normalize_text(["list"]) == ["list"]
|
||||
|
||||
def test_international_characters_preserved(self):
|
||||
"""Test that international characters are NOT normalized away."""
|
||||
assert normalize_text("日本語") == "日本語"
|
||||
assert normalize_text("한국어") == "한국어"
|
||||
assert normalize_text("Café") == "Café"
|
||||
assert normalize_text("Björk") == "Björk"
|
||||
|
||||
def test_real_world_examples(self):
|
||||
"""Test real-world examples with mixed content."""
|
||||
# Job d49efab1's title
|
||||
assert normalize_text("Mama Says (You Can\u2019t Back Down)") == "Mama Says (You Can't Back Down)"
|
||||
# Broadway cast with smart quotes and em dash
|
||||
assert normalize_text("Footloose \u2014 \u201CFinal Song\u201D") == 'Footloose - "Final Song"'
|
||||
# Japanese with em dash
|
||||
assert normalize_text("宇多田ヒカル \u2014 First Love") == "宇多田ヒカル - First Love"
|
||||
|
||||
def test_idempotent(self):
|
||||
"""Test that normalizing twice gives the same result."""
|
||||
original = "It\u2019s \u201CMy\u201D Song \u2014 Test\u2026"
|
||||
once = normalize_text(original)
|
||||
twice = normalize_text(once)
|
||||
assert once == twice
|
||||
|
||||
def test_text_normalizations_dict_complete(self):
|
||||
"""Verify TEXT_NORMALIZATIONS includes all expected categories."""
|
||||
# Check apostrophe-like characters
|
||||
for char in APOSTROPHE_REPLACEMENTS:
|
||||
assert char in TEXT_NORMALIZATIONS
|
||||
|
||||
# Check double quote-like characters
|
||||
for char in DOUBLE_QUOTE_REPLACEMENTS:
|
||||
assert char in TEXT_NORMALIZATIONS
|
||||
|
||||
# Check dash-like characters
|
||||
for char in DASH_REPLACEMENTS:
|
||||
assert char in TEXT_NORMALIZATIONS
|
||||
|
||||
# Check whitespace characters
|
||||
for char in WHITESPACE_REPLACEMENTS:
|
||||
assert char in TEXT_NORMALIZATIONS
|
||||
|
||||
|
||||
class TestModelValidatorNormalization:
|
||||
"""Test that model validators correctly normalize input text."""
|
||||
|
||||
def test_job_create_normalizes_artist_title(self):
|
||||
"""Test that JobCreate model normalizes artist and title fields."""
|
||||
from backend.models.job import JobCreate
|
||||
|
||||
job = JobCreate(
|
||||
artist="Don\u2019t Stop",
|
||||
title="Believin\u2019 \u2014 Live",
|
||||
)
|
||||
assert job.artist == "Don't Stop"
|
||||
assert job.title == "Believin' - Live"
|
||||
|
||||
def test_job_create_preserves_international_chars(self):
|
||||
"""Test that JobCreate preserves international characters."""
|
||||
from backend.models.job import JobCreate
|
||||
|
||||
job = JobCreate(
|
||||
artist="宇多田ヒカル",
|
||||
title="First Love",
|
||||
)
|
||||
assert job.artist == "宇多田ヒカル"
|
||||
assert job.title == "First Love"
|
||||
|
||||
def test_job_create_handles_none(self):
|
||||
"""Test that JobCreate handles None values correctly."""
|
||||
from backend.models.job import JobCreate
|
||||
|
||||
job = JobCreate(
|
||||
artist=None,
|
||||
title="Some Title",
|
||||
)
|
||||
assert job.artist is None
|
||||
assert job.title == "Some Title"
|
||||
|
||||
def test_audio_search_normalizes_fields(self):
|
||||
"""Test that AudioSearchRequest normalizes text fields."""
|
||||
from backend.api.routes.audio_search import AudioSearchRequest
|
||||
|
||||
request = AudioSearchRequest(
|
||||
artist="Artist\u2019s Name",
|
||||
title="Song \u2014 Remix",
|
||||
display_artist="Display\u2019s Artist",
|
||||
display_title="Display\u2019s Title",
|
||||
)
|
||||
assert request.artist == "Artist's Name"
|
||||
assert request.title == "Song - Remix"
|
||||
assert request.display_artist == "Display's Artist"
|
||||
assert request.display_title == "Display's Title"
|
||||
|
||||
def test_audio_search_preserves_international_chars(self):
|
||||
"""Test that AudioSearchRequest preserves international characters."""
|
||||
from backend.api.routes.audio_search import AudioSearchRequest
|
||||
|
||||
request = AudioSearchRequest(
|
||||
artist="방탄소년단",
|
||||
title="Dynamite",
|
||||
)
|
||||
assert request.artist == "방탄소년단"
|
||||
assert request.title == "Dynamite"
|
||||
@@ -344,7 +344,12 @@ async def process_audio_separation(job_id: str) -> bool:
|
||||
job_log.info(f"Stored effective model names: clean={effective_model_names['clean_instrumental_model']}")
|
||||
|
||||
# Format artist-title for file naming (matches CLI behavior)
|
||||
artist_title = f"{job.artist} - {job.title}"
|
||||
# Sanitize to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
# that cause HTTP header encoding issues with the remote API
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
artist_title = f"{safe_artist} - {safe_title}"
|
||||
|
||||
# Run audio separation (calls Modal API internally)
|
||||
# This returns a dict with paths to all separated stems
|
||||
|
||||
@@ -43,6 +43,7 @@ from lyrics_transcriber.core.config import OutputConfig
|
||||
|
||||
# Import from the unified style loader
|
||||
from karaoke_gen.style_loader import load_styles_from_gcs
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -242,7 +243,10 @@ async def process_render_video(job_id: str) -> bool:
|
||||
output_generator = OutputGenerator(config, logger)
|
||||
|
||||
# 8. Generate outputs (video, LRC, ASS, etc.)
|
||||
output_prefix = f"{job.artist or 'Unknown'} - {job.title or 'Unknown'}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
output_prefix = f"{safe_artist} - {safe_title}"
|
||||
job_log.info(f"Generating outputs with prefix '{output_prefix}'")
|
||||
logger.info(f"Job {job_id}: Generating outputs with prefix '{output_prefix}'")
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ from backend.services.tracing import job_span, add_span_event, add_span_attribut
|
||||
|
||||
# Import from karaoke_gen package
|
||||
from karaoke_gen.video_generator import VideoGenerator
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -294,9 +295,12 @@ async def _generate_title_screen(
|
||||
"""
|
||||
try:
|
||||
logger.info(f"Job {job_id}: Generating title screen")
|
||||
|
||||
|
||||
# Set up output paths
|
||||
artist_title = f"{job.artist} - {job.title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
artist_title = f"{safe_artist} - {safe_title}"
|
||||
output_image_filepath_noext = os.path.join(temp_dir, f"{artist_title} (Title)")
|
||||
output_video_filepath = os.path.join(temp_dir, f"{artist_title} (Title).mov")
|
||||
|
||||
@@ -372,9 +376,12 @@ async def _generate_end_screen(
|
||||
"""
|
||||
try:
|
||||
logger.info(f"Job {job_id}: Generating end screen")
|
||||
|
||||
|
||||
# Set up output paths
|
||||
artist_title = f"{job.artist} - {job.title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
artist_title = f"{safe_artist} - {safe_title}"
|
||||
output_image_filepath_noext = os.path.join(temp_dir, f"{artist_title} (End)")
|
||||
output_video_filepath = os.path.join(temp_dir, f"{artist_title} (End).mov")
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ from backend.services.tracing import job_span, add_span_event, add_span_attribut
|
||||
|
||||
# Import from karaoke_gen package - reuse existing implementation
|
||||
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -261,7 +262,10 @@ async def generate_video_orchestrated(job_id: str) -> bool:
|
||||
)
|
||||
|
||||
# Download and set up files
|
||||
base_name = f"{job.artist} - {job.title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
base_name = f"{safe_artist} - {safe_title}"
|
||||
with job_span("download-files", job_id):
|
||||
job_log.info("Downloading files from GCS...")
|
||||
await _setup_working_directory(job_id, job, storage, temp_dir, base_name, job_log)
|
||||
@@ -335,16 +339,9 @@ async def generate_video_orchestrated(job_id: str) -> bool:
|
||||
'final_karaoke_txt_zip': result.final_karaoke_txt_zip,
|
||||
})
|
||||
|
||||
# Mark job as complete
|
||||
# Store result metadata in job BEFORE transitioning to COMPLETE
|
||||
# This ensures youtube_url is available when completion email is sent
|
||||
logger.info(f"[job:{job_id}] Video generation complete")
|
||||
job_manager.transition_to_state(
|
||||
job_id=job_id,
|
||||
new_status=JobStatus.COMPLETE,
|
||||
progress=100,
|
||||
message="Karaoke generation complete!"
|
||||
)
|
||||
|
||||
# Store result metadata in job
|
||||
job_manager.update_job(job_id, {
|
||||
'state_data': {
|
||||
**job.state_data,
|
||||
@@ -355,6 +352,14 @@ async def generate_video_orchestrated(job_id: str) -> bool:
|
||||
}
|
||||
})
|
||||
|
||||
# Mark job as complete (triggers completion email with youtube_url now available)
|
||||
job_manager.transition_to_state(
|
||||
job_id=job_id,
|
||||
new_status=JobStatus.COMPLETE,
|
||||
progress=100,
|
||||
message="Karaoke generation complete!"
|
||||
)
|
||||
|
||||
duration = time.time() - start_time
|
||||
root_span.set_attribute("duration_seconds", duration)
|
||||
root_span.set_attribute("brand_code", result.brand_code or '')
|
||||
@@ -492,7 +497,10 @@ async def generate_video_legacy(job_id: str) -> bool:
|
||||
)
|
||||
|
||||
# Download and set up files in the format KaraokeFinalise expects
|
||||
base_name = f"{job.artist} - {job.title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
base_name = f"{safe_artist} - {safe_title}"
|
||||
with job_span("download-files", job_id):
|
||||
job_log.info("Downloading files from GCS (this may take a few minutes for large files)...")
|
||||
await _setup_working_directory(job_id, job, storage, temp_dir, base_name, job_log)
|
||||
@@ -665,19 +673,12 @@ async def generate_video_legacy(job_id: str) -> bool:
|
||||
with job_span("upload-results", job_id):
|
||||
await _upload_results(job_id, job_manager, storage, temp_dir, result)
|
||||
|
||||
# Mark job as complete
|
||||
logger.info(f"[job:{job_id}] Video generation complete")
|
||||
job_manager.transition_to_state(
|
||||
job_id=job_id,
|
||||
new_status=JobStatus.COMPLETE,
|
||||
progress=100,
|
||||
message="Karaoke generation complete!"
|
||||
)
|
||||
|
||||
# Store result metadata in job
|
||||
# Store result metadata in job BEFORE transitioning to COMPLETE
|
||||
# This ensures youtube_url is available when completion email is sent
|
||||
# NOTE: Must include dropbox_link and gdrive_files from result, since
|
||||
# _handle_native_distribution already saved them but job.state_data
|
||||
# is stale (fetched before distribution ran)
|
||||
logger.info(f"[job:{job_id}] Video generation complete")
|
||||
job_manager.update_job(job_id, {
|
||||
'state_data': {
|
||||
**job.state_data,
|
||||
@@ -687,7 +688,15 @@ async def generate_video_legacy(job_id: str) -> bool:
|
||||
'gdrive_files': result.get('gdrive_files'),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
# Mark job as complete (triggers completion email with youtube_url now available)
|
||||
job_manager.transition_to_state(
|
||||
job_id=job_id,
|
||||
new_status=JobStatus.COMPLETE,
|
||||
progress=100,
|
||||
message="Karaoke generation complete!"
|
||||
)
|
||||
|
||||
duration = time.time() - start_time
|
||||
root_span.set_attribute("duration_seconds", duration)
|
||||
root_span.set_attribute("brand_code", result.get('brand_code', ''))
|
||||
@@ -753,8 +762,11 @@ async def _handle_native_distribution(
|
||||
storage: StorageService instance for downloading stems/lyrics
|
||||
"""
|
||||
brand_code = result.get('brand_code')
|
||||
base_name = f"{job.artist} - {job.title}"
|
||||
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
base_name = f"{safe_artist} - {safe_title}"
|
||||
|
||||
# Check if we should preserve existing brand code (Batch 6: --keep-brand-code)
|
||||
keep_brand_code = getattr(job, 'keep_brand_code', None)
|
||||
if keep_brand_code:
|
||||
|
||||
@@ -27,6 +27,7 @@ from backend.models.job import JobStatus
|
||||
from backend.services.job_manager import JobManager
|
||||
from backend.services.storage_service import StorageService
|
||||
from backend.services.tracing import job_span, add_span_event
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -538,7 +539,10 @@ class VideoWorkerOrchestrator:
|
||||
self.job_log.warning("Dropbox not configured, skipping upload")
|
||||
return
|
||||
|
||||
base_name = f"{self.config.artist} - {self.config.title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(self.config.artist) if self.config.artist else "Unknown"
|
||||
safe_title = sanitize_filename(self.config.title) if self.config.title else "Unknown"
|
||||
base_name = f"{safe_artist} - {safe_title}"
|
||||
folder_name = f"{self.result.brand_code or 'TRACK-0000'} - {base_name}"
|
||||
remote_folder = f"{self.config.dropbox_path}/{folder_name}"
|
||||
|
||||
@@ -637,7 +641,10 @@ def create_orchestrator_config_from_job(
|
||||
Returns:
|
||||
OrchestratorConfig for the orchestrator
|
||||
"""
|
||||
base_name = f"{job.artist} - {job.title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
safe_artist = sanitize_filename(job.artist) if job.artist else "Unknown"
|
||||
safe_title = sanitize_filename(job.title) if job.title else "Unknown"
|
||||
base_name = f"{safe_artist} - {safe_title}"
|
||||
|
||||
# Determine instrumental file path
|
||||
instrumental_selection = job.state_data.get('instrumental_selection', 'clean')
|
||||
|
||||
@@ -20,6 +20,30 @@ GET /health
|
||||
|
||||
No auth required. Returns service status.
|
||||
|
||||
#### Encoding Worker Health
|
||||
|
||||
```http
|
||||
GET /health/encoding-worker
|
||||
```
|
||||
|
||||
No auth required. Returns GCE encoding worker status for frontend display.
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"available": true,
|
||||
"status": "ok",
|
||||
"version": "0.95.1",
|
||||
"active_jobs": 0,
|
||||
"queue_length": 0
|
||||
}
|
||||
```
|
||||
|
||||
Status values:
|
||||
- `ok` - Worker is healthy and available
|
||||
- `offline` - Worker is unavailable (includes `error` field)
|
||||
- `not_configured` - Encoding worker not configured on backend
|
||||
|
||||
### Jobs
|
||||
|
||||
#### Create Job with Upload
|
||||
|
||||
@@ -0,0 +1,701 @@
|
||||
# Nomad Karaoke Brand Style Guide
|
||||
|
||||
> **Version**: 1.1
|
||||
> **Last Updated**: 2026-01-07
|
||||
> **Purpose**: Unified brand identity for all Nomad Karaoke products and communications
|
||||
|
||||
This style guide is designed for both human designers and LLM agents implementing the Nomad Karaoke brand across web applications, emails, marketing materials, and other touchpoints.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Brand Overview](#brand-overview)
|
||||
2. [Color Palette](#color-palette)
|
||||
3. [Typography](#typography)
|
||||
4. [Logo Usage](#logo-usage)
|
||||
5. [Iconography](#iconography)
|
||||
6. [UI Components](#ui-components)
|
||||
7. [Layout & Spacing](#layout--spacing)
|
||||
8. [Email Design](#email-design)
|
||||
9. [Tone & Voice](#tone--voice)
|
||||
10. [Light/Dark Theme Requirements](#lightdark-theme-requirements)
|
||||
11. [Implementation Reference](#implementation-reference)
|
||||
|
||||
---
|
||||
|
||||
## Brand Overview
|
||||
|
||||
### Brand Personality
|
||||
Nomad Karaoke is **approachable**, **professional**, and **modern**. We make sophisticated technology feel accessible and fun. Our brand bridges the gap between serious audio engineering and the joy of karaoke.
|
||||
|
||||
### Core Values
|
||||
- **Approachable**: Technology that anyone can use
|
||||
- **Professional**: Studio-quality output
|
||||
- **Playful**: Karaoke should be fun
|
||||
- **Trustworthy**: Reliable service and results
|
||||
|
||||
### Brand Keywords
|
||||
`modern` `vibrant` `accessible` `professional` `musical` `AI-powered` `creative`
|
||||
|
||||
---
|
||||
|
||||
## Color Palette
|
||||
|
||||
### Primary Colors
|
||||
|
||||
| Name | Hex | RGB | Usage |
|
||||
|------|-----|-----|-------|
|
||||
| **Hot Pink** | `#ff7acc` | rgb(255, 122, 204) | Primary brand color, logo, primary buttons, key accents |
|
||||
| **Gold** | `#ffdf6b` | rgb(255, 223, 107) | Secondary accent, highlights, success states, premium feel |
|
||||
|
||||
### Supporting Colors
|
||||
|
||||
| Name | Hex | RGB | Usage |
|
||||
|------|-----|-----|-------|
|
||||
| **Deep Purple** | `#8b5cf6` | rgb(139, 92, 246) | Gradients, special features, beta badges |
|
||||
| **Electric Blue** | `#3b82f6` | rgb(59, 130, 246) | Links, interactive elements, info states |
|
||||
| **Soft Pink** | `#ec4899` | rgb(236, 72, 153) | Gradient end points, hover states |
|
||||
|
||||
### Semantic Colors
|
||||
|
||||
| Name | Hex | Usage |
|
||||
|------|-----|-------|
|
||||
| **Success** | `#22c55e` | Completed states, positive feedback |
|
||||
| **Warning** | `#f59e0b` | Attention needed, caution states |
|
||||
| **Error** | `#ef4444` | Errors, destructive actions |
|
||||
| **Info** | `#3b82f6` | Informational messages |
|
||||
|
||||
### Dark Theme (Default)
|
||||
|
||||
| Name | Hex | Usage |
|
||||
|------|-----|-------|
|
||||
| **Background** | `#0f0f0f` | Page background |
|
||||
| **Card Background** | `#1a1a1a` | Card surfaces |
|
||||
| **Card Border** | `#2a2a2a` | Subtle borders |
|
||||
| **Text Primary** | `#e5e5e5` | Main content text |
|
||||
| **Text Muted** | `#888888` | Secondary text, labels |
|
||||
| **Text Subtle** | `#666666` | Tertiary text, hints |
|
||||
|
||||
### Light Theme
|
||||
|
||||
| Name | Hex | Usage |
|
||||
|------|-----|-------|
|
||||
| **Background** | `#f8fafc` | Page background |
|
||||
| **Card Background** | `#ffffff` | Card surfaces |
|
||||
| **Card Border** | `#e2e8f0` | Subtle borders |
|
||||
| **Text Primary** | `#1e293b` | Main content text |
|
||||
| **Text Muted** | `#64748b` | Secondary text, labels |
|
||||
|
||||
### Gradients
|
||||
|
||||
#### Primary Gradient (Brand Gradient)
|
||||
```css
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ff7acc 100%);
|
||||
```
|
||||
Use for: Hero text, feature highlights, premium elements. The gradient flows from blue through purple to the brand pink.
|
||||
|
||||
#### Radial Background Gradient (Landing Pages)
|
||||
```css
|
||||
/* Layered radial gradients using brand colors */
|
||||
body::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
background:
|
||||
radial-gradient(ellipse at 20% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 50%), /* Purple glow top-left */
|
||||
radial-gradient(ellipse at 80% 100%, rgba(255, 122, 204, 0.10) 0%, transparent 50%), /* Pink glow bottom-right */
|
||||
radial-gradient(ellipse at 50% 50%, rgba(255, 223, 107, 0.03) 0%, transparent 70%); /* Gold subtle center */
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Optional: Add subtle pulsing animation for ambient glow effect */
|
||||
@keyframes ambient-glow {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.7; }
|
||||
}
|
||||
body::after {
|
||||
animation: ambient-glow 8s ease-in-out infinite;
|
||||
}
|
||||
```
|
||||
Use for: Landing page backgrounds, hero sections. Creates depth with brand colors without being distracting.
|
||||
|
||||
**Light theme variant**: Reduce opacity values (0.08, 0.06, 0.02) for subtler effect on light backgrounds.
|
||||
|
||||
#### Beta/Special Gradient
|
||||
```css
|
||||
background: linear-gradient(135deg, #8b5cf6, #ec4899);
|
||||
```
|
||||
Use for: Beta badges, special promotions, exclusive features.
|
||||
|
||||
---
|
||||
|
||||
## Typography
|
||||
|
||||
### Font Stack
|
||||
|
||||
#### Primary (Sans-serif)
|
||||
```css
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
```
|
||||
Use system fonts for optimal performance and native feel.
|
||||
|
||||
#### Monospace (Code/Technical)
|
||||
```css
|
||||
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
|
||||
```
|
||||
Use for: Code snippets, technical information, job IDs.
|
||||
|
||||
### Type Scale
|
||||
|
||||
| Name | Size | Weight | Line Height | Usage |
|
||||
|------|------|--------|-------------|-------|
|
||||
| **Display** | 48-60px | 800 (extrabold) | 1.1 | Hero headlines |
|
||||
| **H1** | 36-48px | 700 (bold) | 1.2 | Page titles |
|
||||
| **H2** | 28-32px | 700 (bold) | 1.3 | Section headers |
|
||||
| **H3** | 20-24px | 600 (semibold) | 1.4 | Card titles |
|
||||
| **Body** | 16px | 400 (regular) | 1.6 | Main content |
|
||||
| **Body Small** | 14px | 400 (regular) | 1.5 | Secondary content |
|
||||
| **Caption** | 12px | 400 (regular) | 1.4 | Labels, hints |
|
||||
|
||||
### Text Styling
|
||||
|
||||
- **Gradient Text**: Apply brand gradient to hero headlines
|
||||
- **Antialiasing**: Always use `-webkit-font-smoothing: antialiased`
|
||||
- **Letter Spacing**: Default, slightly increased for ALL CAPS text
|
||||
|
||||
---
|
||||
|
||||
## Logo Usage
|
||||
|
||||
**Important**: Always use the Nomad Karaoke logo rather than generic emojis (like 🎤) in headers, navigation, and brand touchpoints.
|
||||
|
||||
### Primary Logo
|
||||
The Nomad Karaoke logo consists of:
|
||||
1. **Wordmark**: "NOMAD" stylized letters (pink #ff7acc)
|
||||
2. **Tagline**: "KARAOKE" below (pink #ff7acc)
|
||||
3. **Subline**: "WHERE EVERY SONG'S YOURS, SINGING!" (gold #ffdf6b)
|
||||
|
||||
### Logo Format Priority
|
||||
|
||||
1. **SVG (Preferred)**: Use `nomad-karaoke-logo.svg` for all web applications
|
||||
- Vector format scales perfectly at any size
|
||||
- Smaller file size
|
||||
- Supports both light and dark themes
|
||||
- Located in: `frontend/public/` directory
|
||||
|
||||
2. **PNG**: Use for contexts that don't support SVG
|
||||
- `nomad-logo.png` - Standard PNG fallback
|
||||
|
||||
3. **GIF (Email Only)**: Use the hosted GIF **only** for email templates
|
||||
- URL: `https://beveradb.github.io/public-images/Nomad-Karaoke-Logo-small-indexed-websafe-rectangle.gif`
|
||||
- This hosted URL exists because emails cannot embed local assets
|
||||
- Do NOT use this URL in web applications - use the local SVG instead
|
||||
|
||||
### Logo Files
|
||||
- `nomad-karaoke-logo.svg` - Full vector logo (**primary choice**)
|
||||
- `nomad-logo.png` - PNG fallback
|
||||
- `favicon.ico`, `favicon-16x16.png`, `favicon-32x32.png` - Favicons
|
||||
- `apple-touch-icon.png` - iOS home screen icon
|
||||
|
||||
### Logo Placement
|
||||
- **Navigation**: Left-aligned, 32-40px height, use SVG
|
||||
- **Footer**: Smaller, 24-32px height, use SVG
|
||||
- **Email Header**: Centered, 130-180px width, use hosted GIF URL
|
||||
|
||||
### Logo Clear Space
|
||||
Maintain clear space equal to the "N" letter height around all sides of the logo.
|
||||
|
||||
### Logo Don'ts
|
||||
- Don't use emojis (🎤, 🎵) instead of the logo
|
||||
- Don't change the logo colors
|
||||
- Don't stretch or distort the logo
|
||||
- Don't add effects (shadows, gradients, etc.)
|
||||
- Don't place on busy backgrounds without contrast
|
||||
- Don't use the logo smaller than 24px height
|
||||
- Don't use the hosted GIF URL in web applications (use SVG)
|
||||
|
||||
---
|
||||
|
||||
## Iconography
|
||||
|
||||
### Icon Library
|
||||
Use [Lucide Icons](https://lucide.dev/) for UI icons. They are:
|
||||
- Open source
|
||||
- Consistent stroke width
|
||||
- Good visual balance
|
||||
|
||||
### Common Icons
|
||||
|
||||
| Icon | Name | Usage |
|
||||
|------|------|-------|
|
||||
| `MicVocal` | Microphone | Brand representation in nav (when logo not used) |
|
||||
| `Music` | Music note | Audio/song related |
|
||||
| `Music2` | Double notes | Empty states for songs |
|
||||
| `Sparkles` | Stars | AI/magic features |
|
||||
| `Video` | Video | Video output |
|
||||
| `Youtube` | YouTube logo | YouTube integration |
|
||||
| `Gift` | Gift box | Free credits, promotions |
|
||||
| `Check` | Checkmark | Success, confirmation |
|
||||
| `Loader2` | Spinner | Loading states |
|
||||
|
||||
### Icon Sizing
|
||||
- **Small**: 16px (inline with text)
|
||||
- **Medium**: 20-24px (buttons, lists)
|
||||
- **Large**: 32-48px (feature highlights)
|
||||
- **XL**: 64px+ (empty states, hero)
|
||||
|
||||
### Icon Colors
|
||||
- Match text color in context
|
||||
- Use brand pink (#ff7acc) for emphasis
|
||||
- Use muted color for decorative icons
|
||||
|
||||
---
|
||||
|
||||
## UI Components
|
||||
|
||||
### Buttons
|
||||
|
||||
#### Primary Button (CTA)
|
||||
```css
|
||||
background-color: #ff7acc;
|
||||
color: #ffffff;
|
||||
padding: 14px 28px;
|
||||
border-radius: 12px;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 0 20px rgba(255, 122, 204, 0.4);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
/* Hover */
|
||||
background-color: #ff5bb8;
|
||||
box-shadow: 0 0 30px rgba(255, 122, 204, 0.6);
|
||||
```
|
||||
|
||||
#### Secondary Button
|
||||
```css
|
||||
background-color: #252525;
|
||||
color: #e5e5e5;
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #2a2a2a;
|
||||
|
||||
/* Hover */
|
||||
background-color: #333333;
|
||||
```
|
||||
|
||||
#### Ghost Button
|
||||
```css
|
||||
background-color: transparent;
|
||||
color: #888888;
|
||||
padding: 8px 16px;
|
||||
|
||||
/* Hover */
|
||||
color: #e5e5e5;
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
```
|
||||
|
||||
### Cards
|
||||
|
||||
```css
|
||||
background-color: var(--card); /* #1a1a1a dark / #ffffff light */
|
||||
border: 1px solid var(--card-border); /* #2a2a2a dark / #e2e8f0 light */
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
|
||||
/* Hover effect (optional) */
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
|
||||
```
|
||||
|
||||
### Form Inputs
|
||||
|
||||
```css
|
||||
background-color: #0f0f0f; /* Darker than card */
|
||||
border: 1px solid #2a2a2a;
|
||||
border-radius: 8px;
|
||||
padding: 12px 16px;
|
||||
color: #e5e5e5;
|
||||
|
||||
/* Focus */
|
||||
border-color: #ff7acc;
|
||||
box-shadow: 0 0 0 2px rgba(255, 122, 204, 0.2);
|
||||
outline: none;
|
||||
|
||||
/* Placeholder */
|
||||
color: #666666;
|
||||
```
|
||||
|
||||
### Badges
|
||||
|
||||
#### Beta Badge
|
||||
```css
|
||||
background: linear-gradient(135deg, #8b5cf6, #ec4899);
|
||||
color: #ffffff;
|
||||
padding: 4px 12px;
|
||||
border-radius: 20px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
```
|
||||
|
||||
#### Status Badges
|
||||
Use semantic colors with 20% opacity backgrounds:
|
||||
- Success: `background: rgba(34, 197, 94, 0.2); color: #22c55e;`
|
||||
- Warning: `background: rgba(245, 158, 11, 0.2); color: #f59e0b;`
|
||||
- Error: `background: rgba(239, 68, 68, 0.2); color: #ef4444;`
|
||||
|
||||
---
|
||||
|
||||
## Layout & Spacing
|
||||
|
||||
### Spacing Scale
|
||||
Use a consistent 4px base unit:
|
||||
|
||||
| Name | Value | Usage |
|
||||
|------|-------|-------|
|
||||
| `xs` | 4px | Tight spacing |
|
||||
| `sm` | 8px | Small gaps |
|
||||
| `md` | 16px | Default gaps |
|
||||
| `lg` | 24px | Section padding |
|
||||
| `xl` | 32px | Large sections |
|
||||
| `2xl` | 48px | Major sections |
|
||||
| `3xl` | 64px | Page sections |
|
||||
|
||||
### Container Widths
|
||||
- **Max content width**: 1200px (6xl)
|
||||
- **Text content**: 672px (2xl) for readability
|
||||
- **Form width**: 448px (md) for focused input
|
||||
|
||||
### Grid
|
||||
Use CSS Grid or Flexbox with responsive breakpoints:
|
||||
- Mobile: 1 column
|
||||
- Tablet (md: 768px): 2 columns
|
||||
- Desktop (lg: 1024px): 2-4 columns
|
||||
|
||||
### Border Radius
|
||||
- **Small** (inputs, small buttons): 8px
|
||||
- **Medium** (cards, buttons): 12px
|
||||
- **Large** (feature cards, modals): 16px
|
||||
- **Pill** (badges, tags): 20px or 9999px
|
||||
|
||||
---
|
||||
|
||||
## Email Design
|
||||
|
||||
### Email Structure
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333333;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Header with logo -->
|
||||
<div style="text-align: center; padding: 20px 0;">
|
||||
<img src="logo-url" alt="Nomad Karaoke" width="150" />
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div>...</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div style="margin-top: 30px; padding-top: 20px; border-top: 1px solid #ff7acc; font-size: 12px; color: #666;">
|
||||
...
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### Email Colors
|
||||
- **Background**: `#ffffff` (white for email client compatibility)
|
||||
- **Text**: `#333333`
|
||||
- **Primary Button**: `#ff7acc` with white text
|
||||
- **Links**: `#3b82f6`
|
||||
- **Dividers**: `#ff7acc` (brand pink) or `#eeeeee`
|
||||
- **Footer text**: `#666666`
|
||||
|
||||
### Email Button
|
||||
```html
|
||||
<a href="URL" style="display: inline-block; background-color: #ff7acc; color: #ffffff; padding: 14px 28px; text-decoration: none; border-radius: 8px; font-weight: 600;">
|
||||
Button Text
|
||||
</a>
|
||||
```
|
||||
|
||||
### Email Header
|
||||
Always use the Nomad Karaoke logo image in email headers, not an emoji.
|
||||
|
||||
```html
|
||||
<div style="text-align: center; padding: 20px 0;">
|
||||
<a href="https://nomadkaraoke.com">
|
||||
<img src="https://beveradb.github.io/public-images/Nomad-Karaoke-Logo-small-indexed-websafe-rectangle.gif"
|
||||
alt="Nomad Karaoke"
|
||||
style="max-width: 180px; height: auto; border-radius: 10px;" />
|
||||
</a>
|
||||
</div>
|
||||
```
|
||||
|
||||
### Email Signature
|
||||
Include consistent signature with:
|
||||
- Profile image
|
||||
- Name and title
|
||||
- Social media icons
|
||||
- Contact information
|
||||
- Pink (#ff7acc) accent lines
|
||||
|
||||
---
|
||||
|
||||
## Tone & Voice
|
||||
|
||||
### Writing Style
|
||||
- **Friendly but professional**: "Hi there!" not "Dear Customer"
|
||||
- **Clear and concise**: Get to the point
|
||||
- **Encouraging**: Celebrate user accomplishments
|
||||
- **Helpful**: Guide users through actions
|
||||
|
||||
### Example Phrases
|
||||
|
||||
| Instead of... | Use... |
|
||||
|---------------|--------|
|
||||
| "Your order has been processed" | "Your karaoke video is ready!" |
|
||||
| "Error occurred" | "Something went wrong - we're on it!" |
|
||||
| "Please wait" | "Just a moment..." |
|
||||
| "Submit" | "Create Karaoke" or "Get Started" |
|
||||
|
||||
### Emoji Usage
|
||||
- Use sparingly for warmth
|
||||
- Common: 🎤 (brand), 🎵 (music), ✨ (magic), 🎉 (celebration)
|
||||
- Avoid in error messages
|
||||
- Email subject lines: One emoji max
|
||||
|
||||
---
|
||||
|
||||
## Light/Dark Theme Requirements
|
||||
|
||||
### Overview
|
||||
All Nomad Karaoke web application screens must support both light and dark themes. Dark theme is the default, but users should have easy access to toggle between themes.
|
||||
|
||||
### Implementation Requirements
|
||||
|
||||
1. **Theme Toggle**: Every screen/page must include a visible theme toggle
|
||||
- Location: Typically in the header or settings area
|
||||
- Use `next-themes` library for Next.js applications
|
||||
- Toggle should be easily discoverable
|
||||
|
||||
2. **Default Theme**: Dark mode
|
||||
- Respects system preference on first visit
|
||||
- User preference is persisted
|
||||
|
||||
3. **Color Consistency**: All brand colors must work in both themes
|
||||
- Brand pink (#ff7acc) remains consistent
|
||||
- Background, card, and text colors adapt per theme tables above
|
||||
- Ensure sufficient contrast in both modes
|
||||
|
||||
### next-themes Setup (Next.js)
|
||||
|
||||
```tsx
|
||||
// app/layout.tsx or _app.tsx
|
||||
import { ThemeProvider } from 'next-themes'
|
||||
|
||||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html suppressHydrationWarning>
|
||||
<body>
|
||||
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
||||
// Theme toggle component
|
||||
import { useTheme } from 'next-themes'
|
||||
import { Sun, Moon } from 'lucide-react'
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { theme, setTheme } = useTheme()
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
|
||||
className="p-2 rounded-lg hover:bg-white/10"
|
||||
aria-label="Toggle theme"
|
||||
>
|
||||
{theme === 'dark' ? <Sun size={20} /> : <Moon size={20} />}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### CSS Variables for Theming
|
||||
|
||||
```css
|
||||
/* Dark theme (default) */
|
||||
:root {
|
||||
--background: #0f0f0f;
|
||||
--card: #1a1a1a;
|
||||
--card-border: #2a2a2a;
|
||||
--text: #e5e5e5;
|
||||
--text-muted: #888888;
|
||||
}
|
||||
|
||||
/* Light theme */
|
||||
.light {
|
||||
--background: #f8fafc;
|
||||
--card: #ffffff;
|
||||
--card-border: #e2e8f0;
|
||||
--text: #1e293b;
|
||||
--text-muted: #64748b;
|
||||
}
|
||||
|
||||
/* Brand colors stay consistent */
|
||||
:root {
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
}
|
||||
```
|
||||
|
||||
### Testing Checklist
|
||||
- [ ] Theme toggle is visible on all pages
|
||||
- [ ] Toggle persists preference across sessions
|
||||
- [ ] All text is readable in both themes
|
||||
- [ ] Brand colors render correctly in both themes
|
||||
- [ ] Interactive elements have proper hover/focus states in both themes
|
||||
- [ ] Radial background gradient adjusts opacity for light theme
|
||||
|
||||
---
|
||||
|
||||
## Implementation Reference
|
||||
|
||||
### CSS Variables (Recommended)
|
||||
|
||||
```css
|
||||
:root {
|
||||
/* Brand Colors */
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-pink-hover: #ff5bb8;
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
--brand-blue: #3b82f6;
|
||||
|
||||
/* Semantic Colors */
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
|
||||
/* Dark Theme */
|
||||
--bg: #0f0f0f;
|
||||
--card: #1a1a1a;
|
||||
--card-border: #2a2a2a;
|
||||
--text: #e5e5e5;
|
||||
--text-muted: #888888;
|
||||
|
||||
/* Spacing */
|
||||
--space-xs: 4px;
|
||||
--space-sm: 8px;
|
||||
--space-md: 16px;
|
||||
--space-lg: 24px;
|
||||
--space-xl: 32px;
|
||||
|
||||
/* Border Radius */
|
||||
--radius-sm: 8px;
|
||||
--radius-md: 12px;
|
||||
--radius-lg: 16px;
|
||||
--radius-pill: 9999px;
|
||||
}
|
||||
```
|
||||
|
||||
### Tailwind Configuration
|
||||
|
||||
```javascript
|
||||
// tailwind.config.js
|
||||
module.exports = {
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
brand: {
|
||||
pink: '#ff7acc',
|
||||
'pink-hover': '#ff5bb8',
|
||||
gold: '#ffdf6b',
|
||||
purple: '#8b5cf6',
|
||||
blue: '#3b82f6',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### React Component Example
|
||||
|
||||
```tsx
|
||||
// Primary Button Component
|
||||
export function PrimaryButton({ children, ...props }) {
|
||||
return (
|
||||
<button
|
||||
className="bg-brand-pink hover:bg-brand-pink-hover text-white font-semibold px-7 py-3.5 rounded-xl transition-all shadow-[0_0_20px_rgba(255,122,204,0.4)] hover:shadow-[0_0_30px_rgba(255,122,204,0.6)]"
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Checklist for Brand Compliance
|
||||
|
||||
### Landing Pages
|
||||
- [ ] Uses brand pink (#ff7acc) for primary CTAs
|
||||
- [ ] Logo displayed correctly
|
||||
- [ ] Dark theme as default
|
||||
- [ ] Gradient text on hero headlines
|
||||
- [ ] Consistent typography scale
|
||||
- [ ] Proper spacing (multiples of 4px)
|
||||
|
||||
### Application UI
|
||||
- [ ] Logo in header (32-40px height)
|
||||
- [ ] Brand pink for primary actions
|
||||
- [ ] Consistent card styling
|
||||
- [ ] Proper focus states with brand pink
|
||||
- [ ] Dark/light theme toggle working
|
||||
|
||||
### Emails
|
||||
- [ ] Header with logo image (not emoji)
|
||||
- [ ] Brand pink buttons
|
||||
- [ ] Pink divider lines
|
||||
- [ ] Consistent footer with signature
|
||||
- [ ] White background for compatibility
|
||||
|
||||
### Marketing Materials
|
||||
- [ ] Logo with proper clear space
|
||||
- [ ] Brand colors only
|
||||
- [ ] Consistent typography
|
||||
- [ ] No logo modifications
|
||||
|
||||
---
|
||||
|
||||
## Version History
|
||||
|
||||
| Version | Date | Changes |
|
||||
|---------|------|---------|
|
||||
| 1.1 | 2026-01-07 | Updated radial background gradient (now uses layered radial gradients with optional animation); Updated logo usage (SVG preferred, hosted GIF URL for emails only); Updated email header (use logo image, not emoji); Added Light/Dark Theme Requirements section; Fixed success color consistency (#22c55e) |
|
||||
| 1.0 | 2026-01-07 | Initial brand guide created |
|
||||
|
||||
---
|
||||
|
||||
*This guide is the source of truth for Nomad Karaoke brand identity. For questions or clarifications, contact the design team.*
|
||||
@@ -78,6 +78,62 @@ Audio separation and lyrics transcription run in parallel:
|
||||
|
||||
## Common Gotchas
|
||||
|
||||
### Verify Active Worktree Before Making Changes
|
||||
|
||||
**Problem**: When multiple git worktrees exist (e.g., `karaoke-gen` for main, `karaoke-gen-brand-consistency` for a feature branch), it's easy to make changes in the wrong worktree, especially if not paying attention to which directory the user's dev server is running from.
|
||||
|
||||
**Symptoms**:
|
||||
- Changes made successfully but don't appear in the user's browser
|
||||
- User says "I'm running the dev server from X" and X is a different directory
|
||||
- Build passes but UI doesn't reflect changes
|
||||
|
||||
**Solution**: Before making any file changes in a multi-worktree setup:
|
||||
1. Ask or confirm which worktree/directory the user is actively working in
|
||||
2. Verify by checking where their dev server is running
|
||||
3. Make changes in the correct worktree path
|
||||
|
||||
**Lesson**: The working directory in your terminal may not match where the user is running their dev server. Always verify the active worktree before editing files.
|
||||
|
||||
### Frontend Theme-Aware Styling: Search All Files Proactively
|
||||
|
||||
**Problem**: When making frontend styling changes for theme support (light/dark mode), fixing issues one-by-one as they're reported is inefficient. Hardcoded colors are scattered across many files.
|
||||
|
||||
**Wrong approach**:
|
||||
1. User reports: "email placeholder is invisible in light mode"
|
||||
2. Fix that one file
|
||||
3. User reports: "sign-in dialog is dark"
|
||||
4. Fix that file
|
||||
5. Repeat for every component...
|
||||
|
||||
**Right approach**: Proactively search for ALL non-theme-aware color patterns and fix them in one pass:
|
||||
|
||||
```bash
|
||||
# Find all hardcoded slate/gray colors that should be theme-aware
|
||||
grep -r --include="*.tsx" --include="*.ts" -E \
|
||||
"(text-slate-|bg-slate-|border-slate-|text-gray-|bg-gray-|border-gray-)" \
|
||||
app/ components/ lib/
|
||||
```
|
||||
|
||||
**Theme-aware replacements**:
|
||||
| Hardcoded | Theme-aware |
|
||||
|-----------|-------------|
|
||||
| `text-slate-400`, `text-gray-400` | `text-muted-foreground` |
|
||||
| `text-slate-100`, `text-white` | `text-foreground` |
|
||||
| `bg-slate-800`, `bg-gray-800` | `bg-card` or `bg-secondary` |
|
||||
| `bg-slate-900`, `bg-gray-900` | `bg-background` |
|
||||
| `border-slate-700`, `border-gray-700` | `border-border` |
|
||||
|
||||
**CSS variables** (defined in `globals.css`):
|
||||
- `--background`, `--foreground` - Main page colors
|
||||
- `--card`, `--card-foreground` - Card/dialog colors
|
||||
- `--muted`, `--muted-foreground` - Subdued text
|
||||
- `--border` - Border colors
|
||||
- `--primary`, `--secondary`, `--destructive`, etc. - Semantic colors
|
||||
|
||||
**Also check tests**: After bulk-replacing colors in source files, update test expectations that assert on color classes.
|
||||
|
||||
**Lesson**: When adding theme support, treat it as a codebase-wide refactor. Search for all hardcoded color patterns upfront rather than playing whack-a-mole with user-reported issues.
|
||||
|
||||
### Cross-Domain localStorage Isolation
|
||||
|
||||
**Problem**: Auth tokens stored in localStorage on one subdomain are invisible to other subdomains.
|
||||
@@ -753,6 +809,53 @@ Choose based on your threat model. For most projects, trusting Pulumi state is a
|
||||
- Pre-job checks provide fail-fast behavior with clear error messages
|
||||
- `docker builder prune -af` catches buildkit cache that `system prune` misses
|
||||
|
||||
### Unicode Characters in Artist/Title Break HTTP Headers
|
||||
|
||||
**Problem**: Non-ASCII "smart" characters (curly quotes, em dashes) in artist/title fields caused HTTP header encoding failures. Job d49efab1 failed because the title "Mama Says (You Can't Back Down)" contained a curly apostrophe (U+2019 `'`) instead of a straight apostrophe (U+0027 `'`).
|
||||
|
||||
**Symptoms**:
|
||||
- Audio separation fails with "no files were downloaded"
|
||||
- Modal API returns encoding errors
|
||||
- Email subjects cause UnicodeEncodeError
|
||||
- Google Drive API queries fail with "Invalid Value"
|
||||
- Content-Disposition headers fail
|
||||
|
||||
**Root cause**: HTTP headers must be latin-1 encodable. Many Unicode characters (curly quotes U+2018/U+2019, em dash U+2014, ellipsis U+2026, etc.) are NOT latin-1 compatible, but look identical to ASCII equivalents.
|
||||
|
||||
**Solution**: Two-tier sanitization approach:
|
||||
|
||||
1. **Input-time normalization** (`normalize_text()`): Standardize visually-similar Unicode characters to ASCII equivalents when data enters the system. Applied via Pydantic validators on `JobCreate` and `AudioSearchRequest` models.
|
||||
|
||||
2. **Output-time sanitization** (`sanitize_filename()`): Additional safety for filenames and HTTP headers. Removes filesystem-unsafe characters, strips periods/spaces, collapses underscores.
|
||||
|
||||
```python
|
||||
# Character categories normalized:
|
||||
APOSTROPHE_REPLACEMENTS = {
|
||||
"\u2018": "'", # LEFT SINGLE QUOTATION MARK
|
||||
"\u2019": "'", # RIGHT SINGLE QUOTATION MARK (caused the bug!)
|
||||
"\u0060": "'", # GRAVE ACCENT (backtick)
|
||||
# ... more
|
||||
}
|
||||
DASH_REPLACEMENTS = {
|
||||
"\u2013": "-", # EN DASH
|
||||
"\u2014": "-", # EM DASH
|
||||
# ... more
|
||||
}
|
||||
WHITESPACE_REPLACEMENTS = {
|
||||
"\u00A0": " ", # NON-BREAKING SPACE
|
||||
"\u3000": " ", # IDEOGRAPHIC SPACE (CJK full-width)
|
||||
# ... more
|
||||
}
|
||||
```
|
||||
|
||||
**Key insight**: These characters are often invisible problems - they look correct in logs and UIs but fail at encoding time. Users copy/paste from Word, macOS, or websites that use "smart" typography.
|
||||
|
||||
**Where to sanitize**:
|
||||
- `sanitize_filename()` call anywhere artist/title is used in: HTTP headers, filenames, API queries, email subjects
|
||||
- `normalize_text()` applied automatically via model validators at job creation and audio search
|
||||
|
||||
**Lesson**: Always normalize user-provided text at input time. Don't trust that "obviously ASCII" text is actually ASCII - smart quotes from copy/paste are invisible bugs waiting to happen.
|
||||
|
||||
### Fonts in Docker for Video Rendering
|
||||
|
||||
**Problem**: Video rendering showed replacement characters (squares with question marks) for special Unicode symbols like `♪` in intro/instrumental screens.
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
# Product Communication Guide
|
||||
|
||||
Guidelines for how to communicate about Nomad Karaoke to users, in marketing materials, UI copy, and support interactions.
|
||||
|
||||
## Core Principles
|
||||
|
||||
1. **Transparency over hype** - Set realistic expectations so users aren't surprised
|
||||
2. **Avoid AI terminology** - "AI" has become a loaded term; say "our system" or "the tool" instead
|
||||
3. **Acknowledge user effort** - The human review step is required, not optional
|
||||
4. **Highlight real differentiators** - Real instrumentals (not covers), precise sync, multiple formats
|
||||
|
||||
---
|
||||
|
||||
## Key Facts to Communicate Accurately
|
||||
|
||||
### Timing
|
||||
- **Accurate:** "Create a karaoke video in under 30 minutes"
|
||||
- **Avoid:** "in minutes" (implies much faster than reality)
|
||||
- Typical flow: ~20-30 minutes including human review
|
||||
|
||||
### Song Availability
|
||||
- **Accurate:** "Any song" - this IS true
|
||||
- Users can: search by artist/title, paste YouTube URL, or upload their own audio
|
||||
- If users can get the audio from somewhere, we can make karaoke from it
|
||||
|
||||
### Lyrics Sync Quality
|
||||
- **Accurate:** "Precise lyrics sync" - the timing/sync IS very accurate
|
||||
- The sync (when words appear) is reliable and handled automatically
|
||||
- The challenge is lyrics ACCURACY (correct words), not timing
|
||||
|
||||
### Human Review Requirement
|
||||
- **Be clear:** Users ALWAYS need to review the transcribed lyrics
|
||||
- For songs with clear vocals (country, ballads): few or no corrections needed
|
||||
- For complex songs: expect 5-10 minutes of corrections
|
||||
- Frame as "Review & Correct" not "Preview and fine-tune" (the latter sounds optional)
|
||||
|
||||
### Audio Separation
|
||||
- **Accurate:** "Real instrumentals from the original song"
|
||||
- **Avoid:** "Studio-quality separation" (oversells it)
|
||||
- Key differentiator: NOT a cover band or MIDI recreation - it's the actual song
|
||||
- Separation quality is very good but not perfect for all songs
|
||||
|
||||
### Backing Vocals Option
|
||||
- Users can choose between:
|
||||
- Clean instrumental (all vocals removed)
|
||||
- Instrumental with backing vocals preserved
|
||||
- This matters for songs with backing vocals; irrelevant for songs without
|
||||
|
||||
### Output Formats
|
||||
- 4K MP4 karaoke video (main output)
|
||||
- "With Vocals" version for sing-along practice
|
||||
- CDG+MP3 ZIP for older/commercial karaoke systems
|
||||
- All videos published to Nomad Karaoke YouTube channel (not user's channel)
|
||||
|
||||
### YouTube Integration
|
||||
- **Accurate:** Videos are published to the Nomad Karaoke YouTube channel
|
||||
- **Wrong:** "Upload to your YouTube channel" - we don't do this
|
||||
- This is for easy sharing, not user channel integration
|
||||
|
||||
---
|
||||
|
||||
## Beta Tester Program
|
||||
|
||||
- Beta testers get up to 5 free karaoke video generations
|
||||
- Mandatory feedback required after each video
|
||||
- Must acknowledge they'll review/correct lyrics transcription
|
||||
- Helps improve the system through real-world testing
|
||||
|
||||
---
|
||||
|
||||
## Terminology Preferences
|
||||
|
||||
| Avoid | Use Instead |
|
||||
|-------|-------------|
|
||||
| AI, AI-powered, AI-generated | "our system", "the tool", "automated" |
|
||||
| Perfect lyrics | "precise sync", "accurate timing" |
|
||||
| Studio-quality | "real instrumentals", "actual song" |
|
||||
| In minutes | "in under 30 minutes" |
|
||||
| Fine-tune (sounds optional) | "review and correct" (sounds required) |
|
||||
| Upload to YouTube | "published to our YouTube channel" |
|
||||
|
||||
---
|
||||
|
||||
## FAQ Guidance
|
||||
|
||||
When answering user questions:
|
||||
|
||||
**Q: Is it fully automatic?**
|
||||
A: The transcription and sync are automatic, but you'll need to review and correct any misheard words before the final video is generated. For clear songs, this might take just a minute. For complex songs, expect 5-10 minutes.
|
||||
|
||||
**Q: What songs work?**
|
||||
A: Any song you can get audio for. Search our database, paste a YouTube link, or upload your own audio file.
|
||||
|
||||
**Q: What do I get?**
|
||||
A: Multiple files - 4K karaoke video, a sing-along version with vocals, and CDG+MP3 for older systems. Videos are also published to our YouTube channel.
|
||||
|
||||
**Q: How long does it take?**
|
||||
A: About 20-30 minutes total, including your review time.
|
||||
|
||||
---
|
||||
|
||||
## Version History
|
||||
|
||||
| Version | Date | Changes |
|
||||
|---------|------|---------|
|
||||
| 1.0 | 2026-01-07 | Initial guide created based on founder feedback |
|
||||
@@ -36,6 +36,8 @@
|
||||
|
||||
## Recent Changes
|
||||
|
||||
- **Brand Consistency & Style Guide** (2026-01-07): Implemented unified brand theming across all Nomad Karaoke frontends. Primary color changed from blue to brand pink (#ff7acc). Added comprehensive [BRAND-STYLE-GUIDE.md](BRAND-STYLE-GUIDE.md) for human and LLM reference. Includes: CSS variables for light/dark mode, MUI theme updates for lyrics transcriber, email template branding, and Playwright visual tests. See [BRAND-STYLE-GUIDE.md](BRAND-STYLE-GUIDE.md).
|
||||
|
||||
- **Audio Search Display Override** (2026-01-06): Added optional "Display As" fields to audio search, allowing users to search for audio by one artist/title (e.g., "Jeremy Kushnier") but display a different artist/title on title screens and filenames (e.g., "Footloose (Broadway Cast)"). Useful for Broadway casts, covers, remixes where tracker metadata differs from desired display. See [API.md](API.md#audio-search).
|
||||
|
||||
- **Infrastructure Modularization** (2026-01-06): Refactored `infrastructure/__main__.py` from 2,602 lines to 339 lines (87% reduction). Split into organized modules: `modules/` for core GCP resources, `compute/` for VMs and startup scripts, `config.py` for shared constants. Extracted embedded encoding worker Python app to `backend/services/gce_encoding/`. See `infrastructure/README.md` for new structure and `infrastructure/docs/PHASE5-PACKER-IMAGE-PLAN.md` for planned Packer image optimization.
|
||||
@@ -97,6 +99,7 @@
|
||||
| [ARCHITECTURE.md](ARCHITECTURE.md) | System design, data flow, integrations |
|
||||
| [DEVELOPMENT.md](DEVELOPMENT.md) | Local setup, testing, deployment |
|
||||
| [API.md](API.md) | Backend endpoint reference |
|
||||
| [BRAND-STYLE-GUIDE.md](BRAND-STYLE-GUIDE.md) | Brand colors, typography, UI patterns |
|
||||
| [LESSONS-LEARNED.md](LESSONS-LEARNED.md) | Key insights for future agents |
|
||||
| [STRIPE-SETUP.md](STRIPE-SETUP.md) | Payment integration setup |
|
||||
| [MOBILE-UX-BEST-PRACTICES.md](MOBILE-UX-BEST-PRACTICES.md) | Mobile/responsive design guidelines |
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Brand Consistency Implementation - 2026-01-07
|
||||
|
||||
## Summary
|
||||
|
||||
Implemented unified brand theming across all Nomad Karaoke frontends and created a comprehensive brand style guide for human and LLM reference.
|
||||
|
||||
## Key Changes
|
||||
|
||||
### Frontend (Next.js)
|
||||
- Added `ThemeToggle` component using `next-themes`
|
||||
- Made all components theme-aware (light/dark mode support)
|
||||
- Changed primary color from blue to brand pink (#ff7acc)
|
||||
- Updated CSS variables for consistent theming
|
||||
- Added brand screenshots for visual verification
|
||||
|
||||
### Lyrics Transcriber Frontend (MUI)
|
||||
- Updated MUI theme with brand colors
|
||||
- Made timeline, modals, and controls theme-aware
|
||||
- Fixed mobile responsiveness issues
|
||||
- Added mobile TAP button for manual sync
|
||||
- Improved WordDivider for mobile/desktop parity
|
||||
|
||||
### Email Templates
|
||||
- Refactored to use reusable helper methods (`_build_email_html`, `_get_email_header`, `_get_email_footer`)
|
||||
- Fixed success color to match brand guide (#22c55e)
|
||||
- Updated preview script to use actual email service instead of duplicated content
|
||||
- Changed email header from emoji to logo image
|
||||
|
||||
### Brand Style Guide (docs/BRAND-STYLE-GUIDE.md)
|
||||
- Created comprehensive v1.1 guide covering:
|
||||
- Color palette (primary, supporting, semantic colors)
|
||||
- Typography (font stack, type scale)
|
||||
- Logo usage (SVG preferred, hosted GIF for emails)
|
||||
- UI components (buttons, cards, badges)
|
||||
- Email design standards
|
||||
- Light/dark theme requirements with `next-themes` examples
|
||||
- Implementation reference (CSS variables, Tailwind config)
|
||||
|
||||
## Decisions Made
|
||||
|
||||
1. **Dark theme as default** - More common in modern applications, easier on the eyes for karaoke use
|
||||
2. **SVG logo preferred** - Scalable, smaller file size; GIF only for emails where SVG not supported
|
||||
3. **No emojis in headers** - Always use the Nomad Karaoke logo for brand consistency
|
||||
4. **Hosted logo URL for emails only** - Local SVG for webapp, hosted GIF only when necessary
|
||||
|
||||
## Files Changed
|
||||
|
||||
### Core Brand Files
|
||||
- `docs/BRAND-STYLE-GUIDE.md` - New comprehensive guide
|
||||
- `frontend/components/ThemeToggle.tsx` - New theme toggle
|
||||
- `frontend/app/globals.css` - Updated CSS variables
|
||||
|
||||
### Email System
|
||||
- `backend/services/email_service.py` - Refactored with reusable helpers
|
||||
- `scripts/preview-emails.py` - Now uses real email service
|
||||
|
||||
### Lyrics Transcriber (submodule)
|
||||
- Multiple component files updated for theme awareness
|
||||
- `src/theme.ts` - Updated MUI theme with brand colors
|
||||
|
||||
## Future Considerations
|
||||
|
||||
- Consider adding ambient glow animation to landing page background
|
||||
- Monitor theme toggle usage to ensure discoverability
|
||||
- Keep brand guide updated as new components are added
|
||||
@@ -26,7 +26,7 @@ describe('getJobStep', () => {
|
||||
expect(result.total).toBe(10);
|
||||
expect(result.label).toBe('Setting up');
|
||||
expect(result.isBlocking).toBe(false);
|
||||
expect(result.color).toBe('text-slate-400');
|
||||
expect(result.color).toBe('text-muted-foreground');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -328,7 +328,7 @@ describe('getJobStep', () => {
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(0);
|
||||
expect(result.label).toBe('Cancelled');
|
||||
expect(result.color).toBe('text-slate-500');
|
||||
expect(result.color).toBe('text-muted-foreground');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -339,7 +339,7 @@ describe('getJobStep', () => {
|
||||
expect(result.step).toBe(0);
|
||||
expect(result.label).toBe('some unknown status');
|
||||
expect(result.isBlocking).toBe(false);
|
||||
expect(result.color).toBe('text-slate-400');
|
||||
expect(result.color).toBe('text-muted-foreground');
|
||||
});
|
||||
|
||||
it('handles null status gracefully', () => {
|
||||
|
||||
@@ -125,7 +125,7 @@ export default function AdminJobDetailPage() {
|
||||
case "INFO":
|
||||
return "text-blue-500"
|
||||
case "DEBUG":
|
||||
return "text-gray-500"
|
||||
return "text-muted-foreground"
|
||||
default:
|
||||
return "text-foreground"
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ export default function AdminDashboardPage() {
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<XCircle className="w-4 h-4 text-gray-500" />
|
||||
<XCircle className="w-4 h-4 text-muted-foreground" />
|
||||
<span className="text-sm">Cancelled</span>
|
||||
</div>
|
||||
<Badge variant="outline">{stats?.jobs_by_status?.cancelled ?? 0}</Badge>
|
||||
|
||||
@@ -190,7 +190,7 @@ export default function AdminSearchesPage() {
|
||||
case "ops":
|
||||
return "bg-blue-500/20 text-blue-400 border-blue-500/30"
|
||||
default:
|
||||
return "bg-slate-500/20 text-slate-400 border-slate-500/30"
|
||||
return "bg-muted text-muted-foreground border-border"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +51,14 @@ function VerifyMagicLinkContent() {
|
||||
}, [searchParams, verifyMagicLink, router])
|
||||
|
||||
return (
|
||||
<div className="max-w-md w-full bg-slate-900 border border-slate-700 rounded-xl p-8 text-center">
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
{state === "loading" && (
|
||||
<>
|
||||
<Loader2 className="w-12 h-12 text-blue-400 animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-white mb-2">
|
||||
<Loader2 className="w-12 h-12 text-primary animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
Verifying your sign-in link...
|
||||
</h1>
|
||||
<p className="text-slate-400">
|
||||
<p className="text-muted-foreground">
|
||||
Please wait while we sign you in.
|
||||
</p>
|
||||
</>
|
||||
@@ -66,14 +66,14 @@ function VerifyMagicLinkContent() {
|
||||
|
||||
{state === "success" && (
|
||||
<>
|
||||
<CheckCircle className="w-12 h-12 text-green-400 mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-white mb-2">
|
||||
<CheckCircle className="w-12 h-12 text-success mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
Successfully signed in!
|
||||
</h1>
|
||||
<p className="text-slate-400 mb-4">
|
||||
<p className="text-muted-foreground mb-4">
|
||||
Welcome back{user?.email ? `, ${user.email}` : ""}!
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Redirecting you to the app...
|
||||
</p>
|
||||
</>
|
||||
@@ -81,21 +81,21 @@ function VerifyMagicLinkContent() {
|
||||
|
||||
{state === "error" && (
|
||||
<>
|
||||
<XCircle className="w-12 h-12 text-red-400 mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-white mb-2">
|
||||
<XCircle className="w-12 h-12 text-destructive mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
Sign-in failed
|
||||
</h1>
|
||||
<p className="text-slate-400 mb-6">
|
||||
<p className="text-muted-foreground mb-6">
|
||||
{errorMessage || "The link may have expired or already been used."}
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
<Button
|
||||
onClick={() => router.push("/app")}
|
||||
className="w-full bg-blue-600 hover:bg-blue-500"
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
Go to App
|
||||
</Button>
|
||||
<p className="text-xs text-slate-500">
|
||||
<p className="text-xs text-muted-foreground">
|
||||
You can request a new sign-in link from the app.
|
||||
</p>
|
||||
</div>
|
||||
@@ -107,12 +107,12 @@ function VerifyMagicLinkContent() {
|
||||
|
||||
function VerifyLoadingFallback() {
|
||||
return (
|
||||
<div className="max-w-md w-full bg-slate-900 border border-slate-700 rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-12 h-12 text-blue-400 animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-white mb-2">
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-12 h-12 text-primary animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
Loading...
|
||||
</h1>
|
||||
<p className="text-slate-400">
|
||||
<p className="text-muted-foreground">
|
||||
Please wait.
|
||||
</p>
|
||||
</div>
|
||||
@@ -121,7 +121,7 @@ function VerifyLoadingFallback() {
|
||||
|
||||
export default function VerifyMagicLinkPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-950 flex items-center justify-center p-4">
|
||||
<div className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<Suspense fallback={<VerifyLoadingFallback />}>
|
||||
<VerifyMagicLinkContent />
|
||||
</Suspense>
|
||||
|
||||
@@ -4,22 +4,40 @@
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
:root {
|
||||
/* Dark theme (default) - Matching instrumental review UI color scheme */
|
||||
/* ===========================================
|
||||
Nomad Karaoke Brand Colors
|
||||
See docs/BRAND-STYLE-GUIDE.md for details
|
||||
=========================================== */
|
||||
|
||||
/* Brand Primary Colors */
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-pink-hover: #ff5bb8;
|
||||
--brand-pink-glow: rgba(255, 122, 204, 0.4);
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
--brand-blue: #3b82f6;
|
||||
--brand-soft-pink: #ec4899;
|
||||
|
||||
/* Dark theme (default) */
|
||||
--bg: #0f0f0f;
|
||||
--card: #1a1a1a;
|
||||
--card-border: #2a2a2a;
|
||||
--waveform-bg: #0d1117;
|
||||
--text: #e5e5e5;
|
||||
--text-muted: #888;
|
||||
--primary: #3b82f6;
|
||||
--primary-hover: #2563eb;
|
||||
--text-muted: #888888;
|
||||
--text-subtle: #666666;
|
||||
|
||||
/* Primary now uses brand pink */
|
||||
--primary: var(--brand-pink);
|
||||
--primary-hover: var(--brand-pink-hover);
|
||||
|
||||
--secondary: #252525;
|
||||
--secondary-hover: #333;
|
||||
--secondary-hover: #333333;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--pink: #ec4899;
|
||||
--blue: #60a5fa;
|
||||
--pink: var(--brand-pink);
|
||||
--blue: var(--brand-blue);
|
||||
|
||||
/* Tailwind compatibility mappings */
|
||||
--background: var(--bg);
|
||||
@@ -38,26 +56,38 @@
|
||||
--border: var(--card-border);
|
||||
--input: var(--secondary);
|
||||
--ring: var(--primary);
|
||||
--radius: 0.5rem;
|
||||
--radius: 0.75rem;
|
||||
}
|
||||
|
||||
:root.light {
|
||||
/* Light theme */
|
||||
.light {
|
||||
/* Light theme - applied via next-themes class on html element */
|
||||
--bg: #f8fafc;
|
||||
--card: #ffffff;
|
||||
--card-border: #e2e8f0;
|
||||
--waveform-bg: #f1f5f9;
|
||||
--text: #1e293b;
|
||||
--text-muted: #64748b;
|
||||
--primary: #3b82f6;
|
||||
--primary-hover: #2563eb;
|
||||
--text-subtle: #94a3b8;
|
||||
--primary: var(--brand-pink);
|
||||
--primary-hover: var(--brand-pink-hover);
|
||||
--secondary: #f1f5f9;
|
||||
--secondary-hover: #e2e8f0;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--pink: #ec4899;
|
||||
--blue: #60a5fa;
|
||||
--pink: var(--brand-pink);
|
||||
--blue: var(--brand-blue);
|
||||
|
||||
/* Tailwind compatibility - light mode adjustments */
|
||||
--background: var(--bg);
|
||||
--foreground: var(--text);
|
||||
--card-foreground: var(--text);
|
||||
--popover: var(--card);
|
||||
--popover-foreground: var(--text);
|
||||
--muted: var(--secondary);
|
||||
--muted-foreground: var(--text-muted);
|
||||
--border: var(--card-border);
|
||||
--input: var(--secondary);
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
@@ -95,21 +125,45 @@
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
|
||||
/* Radial gradient background overlay (like decide.nomadkaraoke.com) */
|
||||
body::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background:
|
||||
radial-gradient(ellipse at 20% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
|
||||
radial-gradient(ellipse at 80% 100%, rgba(255, 122, 204, 0.1) 0%, transparent 50%),
|
||||
radial-gradient(ellipse at 50% 50%, rgba(255, 223, 107, 0.03) 0%, transparent 70%);
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Light mode uses subtle pink tints */
|
||||
.light body::after {
|
||||
background:
|
||||
radial-gradient(ellipse at 20% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
|
||||
radial-gradient(ellipse at 80% 100%, rgba(255, 122, 204, 0.06) 0%, transparent 50%),
|
||||
radial-gradient(ellipse at 50% 50%, rgba(255, 223, 107, 0.02) 0%, transparent 70%);
|
||||
}
|
||||
}
|
||||
|
||||
/* Landing page utilities */
|
||||
@layer utilities {
|
||||
/* Glow effect for primary buttons */
|
||||
/* Glow effect for primary buttons - uses brand pink */
|
||||
.btn-glow {
|
||||
box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
|
||||
box-shadow: 0 0 20px var(--brand-pink-glow);
|
||||
}
|
||||
.btn-glow:hover {
|
||||
box-shadow: 0 0 30px rgba(59, 130, 246, 0.7);
|
||||
box-shadow: 0 0 30px rgba(255, 122, 204, 0.6);
|
||||
}
|
||||
|
||||
/* Gradient text */
|
||||
/* Gradient text - flows to brand pink */
|
||||
.gradient-text {
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ff7acc 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
@@ -124,31 +178,35 @@
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
/* Animated background gradient */
|
||||
@keyframes gradient-shift {
|
||||
0% { background-position: 0% 50%; }
|
||||
50% { background-position: 100% 50%; }
|
||||
100% { background-position: 0% 50%; }
|
||||
}
|
||||
/* Animated background gradient - subtle brand integration */
|
||||
/* animated-gradient class - now just ensures min-height, gradient provided by body::after */
|
||||
.animated-gradient {
|
||||
background: linear-gradient(-45deg, #0f172a, #1e293b, #1e3a8a, #312e81);
|
||||
background-size: 400% 400%;
|
||||
animation: gradient-shift 15s ease infinite;
|
||||
/* Background is now provided by body::after radial gradient */
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Dark theme color utilities for landing page */
|
||||
.text-dark-300 { color: #d1d5db; }
|
||||
.text-dark-400 { color: #9ca3af; }
|
||||
.text-dark-500 { color: #6b7280; }
|
||||
.bg-dark-700 { background-color: #374151; }
|
||||
.bg-dark-800 { background-color: #1f2937; }
|
||||
.bg-dark-900 { background-color: #111827; }
|
||||
.border-dark-600 { border-color: #4b5563; }
|
||||
.border-dark-700 { border-color: #374151; }
|
||||
.text-primary-400 { color: #60a5fa; }
|
||||
.text-primary-500 { color: #3b82f6; }
|
||||
.bg-primary-500 { background-color: #3b82f6; }
|
||||
.hover\:bg-primary-600:hover { background-color: #2563eb; }
|
||||
/* Theme-aware color utilities - use CSS variables for theme switching */
|
||||
.text-dark-300 { color: var(--text); }
|
||||
.text-dark-400 { color: var(--text-muted); }
|
||||
.text-dark-500 { color: var(--text-subtle); }
|
||||
.bg-dark-700 { background-color: var(--secondary); }
|
||||
.bg-dark-800 { background-color: var(--card); }
|
||||
.bg-dark-900 { background-color: var(--bg); }
|
||||
.border-dark-600 { border-color: var(--card-border); }
|
||||
.border-dark-700 { border-color: var(--card-border); }
|
||||
|
||||
/* Primary color utilities - now brand pink */
|
||||
.text-primary-400 { color: #ff8fd4; } /* Lighter pink */
|
||||
.text-primary-500 { color: var(--brand-pink); }
|
||||
.bg-primary-500 { background-color: var(--brand-pink); }
|
||||
.hover\:bg-primary-600:hover { background-color: var(--brand-pink-hover); }
|
||||
|
||||
/* Brand accent utilities */
|
||||
.text-brand-pink { color: var(--brand-pink); }
|
||||
.text-brand-gold { color: var(--brand-gold); }
|
||||
.bg-brand-pink { background-color: var(--brand-pink); }
|
||||
.bg-brand-gold { background-color: var(--brand-gold); }
|
||||
.border-brand-pink { border-color: var(--brand-pink); }
|
||||
|
||||
/* Fade in animation for cold start messages */
|
||||
@keyframes fade-in {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type React from "react"
|
||||
import type { Metadata } from "next"
|
||||
import { ThemeProvider } from "@/components/theme-provider"
|
||||
import "./globals.css"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -21,9 +22,16 @@ export default function RootLayout({
|
||||
children: React.ReactNode
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en" className="dark">
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
<body className="font-sans antialiased" style={{ background: 'var(--bg)', color: 'var(--text)' }}>
|
||||
{children}
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
defaultTheme="dark"
|
||||
enableSystem
|
||||
disableTransitionOnChange
|
||||
>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import Image from 'next/image';
|
||||
import {
|
||||
MicVocal,
|
||||
Music,
|
||||
Sparkles,
|
||||
Video,
|
||||
@@ -18,28 +18,29 @@ import {
|
||||
import { api, setAccessToken, getAccessToken, CreditPackage, BetaEnrollResponse } from '@/lib/api';
|
||||
import { AuthDialog } from '@/components/auth/AuthDialog';
|
||||
import { WarmingUpLoader } from '@/components/WarmingUpLoader';
|
||||
import { ThemeToggle } from '@/components/ThemeToggle';
|
||||
|
||||
// FAQ data
|
||||
const faqs = [
|
||||
{
|
||||
question: 'How does it work?',
|
||||
answer:
|
||||
'Enter the artist and song title, and our AI finds the audio, removes the vocals, transcribes and syncs the lyrics, then generates a professional karaoke video. You can review and edit the lyrics before final export.',
|
||||
'Enter an artist and song title (or paste a YouTube link, or upload your own audio file). Our system finds the audio, separates the vocals from the instrumental, transcribes the lyrics, and syncs them to the music. You then review and correct any transcription errors before we generate your final karaoke video.',
|
||||
},
|
||||
{
|
||||
question: 'What songs can I use?',
|
||||
answer:
|
||||
'Any song! Our system searches multiple audio sources to find high-quality versions. If a song exists online, we can likely create a karaoke video for it.',
|
||||
'Any song! Search by artist and title, paste a YouTube URL, or upload your own audio file. If you can get the audio, we can make it into karaoke.',
|
||||
},
|
||||
{
|
||||
question: 'What format is the output?',
|
||||
answer:
|
||||
'You get a 4K MP4 video file with perfectly synced lyrics. We also offer direct YouTube upload and cloud storage integration.',
|
||||
'You get multiple files: a 4K MP4 karaoke video, a "With Vocals" version for sing-along practice, and a CDG+MP3 ZIP for older karaoke systems. All videos are also published to our YouTube channel for easy sharing.',
|
||||
},
|
||||
{
|
||||
question: 'What if something goes wrong?',
|
||||
question: 'Do I need to do anything, or is it fully automatic?',
|
||||
answer:
|
||||
"If the AI makes mistakes, you can edit the lyrics and timing before generating the final video. If there's a technical issue, contact us and we'll make it right.",
|
||||
"The lyrics transcription is very accurate, but you'll need to review it and correct any misheard words before the final video is generated. For songs with clear vocals, there may be few or no corrections needed. For complex songs, expect to spend 5-10 minutes fixing errors. The word timing/sync is handled automatically and is very precise.",
|
||||
},
|
||||
{
|
||||
question: 'Do credits expire?',
|
||||
@@ -69,8 +70,6 @@ export default function LandingPage() {
|
||||
const [betaSuccess, setBetaSuccess] = useState(false);
|
||||
const [betaWillRedirect, setBetaWillRedirect] = useState(false);
|
||||
|
||||
// FAQ expansion state
|
||||
const [expandedFaq, setExpandedFaq] = useState<number | null>(null);
|
||||
|
||||
// Auth dialog state
|
||||
const [showAuthDialog, setShowAuthDialog] = useState(false);
|
||||
@@ -212,16 +211,18 @@ export default function LandingPage() {
|
||||
{/* Navigation */}
|
||||
<nav className="fixed top-0 left-0 right-0 z-50 bg-dark-900/80 backdrop-blur-md border-b border-dark-700">
|
||||
<div className="max-w-6xl mx-auto px-4 py-4 flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<MicVocal className="w-8 h-8 text-primary-500" />
|
||||
<span className="text-xl font-bold">Nomad Karaoke</span>
|
||||
<div className="flex items-center gap-3">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-10" />
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<ThemeToggle />
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="text-sm text-dark-300 hover:text-white transition-colors"
|
||||
>
|
||||
Already have credits? Sign in
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="text-sm text-dark-300 hover:text-white transition-colors"
|
||||
>
|
||||
Already have credits? Sign in
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -229,33 +230,51 @@ export default function LandingPage() {
|
||||
<section className="pt-32 pb-16 px-4">
|
||||
<div className="max-w-4xl mx-auto text-center">
|
||||
<h1 className="text-4xl sm:text-5xl md:text-6xl font-extrabold mb-6 leading-tight">
|
||||
Turn Any Song Into a{' '}
|
||||
<span className="gradient-text">Karaoke Video</span>
|
||||
Create a <span className="gradient-text">Karaoke Video</span> for Any Song
|
||||
</h1>
|
||||
<p className="text-xl text-dark-300 mb-8 max-w-2xl mx-auto">
|
||||
Professional karaoke videos in minutes. AI-powered vocal removal,
|
||||
perfect lyrics sync, and stunning video output.
|
||||
Create professional karaoke videos in under 30 minutes. Real instrumentals
|
||||
from the original song, precise lyrics sync, and 4K video output.
|
||||
</p>
|
||||
<a
|
||||
href="#pricing"
|
||||
href="#beta"
|
||||
className="inline-flex items-center gap-2 bg-primary-500 hover:bg-primary-600 text-white font-semibold px-8 py-4 rounded-xl transition-all btn-glow"
|
||||
>
|
||||
Get Started
|
||||
Try It For Free
|
||||
<ChevronDown className="w-5 h-5" />
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Demo Video Section */}
|
||||
<section className="py-8 px-4">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-2 overflow-hidden">
|
||||
<div className="aspect-video">
|
||||
<iframe
|
||||
className="w-full h-full rounded-xl"
|
||||
src="https://www.youtube.com/embed/wHiMti3xLJE?si=dij5wsaHnedaZdFg"
|
||||
title="Nomad Karaoke Demo"
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
referrerPolicy="strict-origin-when-cross-origin"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* How It Works */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">How It Works</h2>
|
||||
<div className="grid md:grid-cols-4 gap-8">
|
||||
{[
|
||||
{ icon: Music, title: 'Search', desc: 'Enter artist & song title' },
|
||||
{ icon: Sparkles, title: 'AI Magic', desc: 'We remove vocals & sync lyrics' },
|
||||
{ icon: Video, title: 'Review', desc: 'Preview and fine-tune' },
|
||||
{ icon: Youtube, title: 'Export', desc: 'Download or upload to YouTube' },
|
||||
{ icon: Music, title: 'Choose a Song', desc: 'Search, paste a YouTube link, or upload audio' },
|
||||
{ icon: Sparkles, title: 'We Do the Heavy Lifting', desc: 'Vocals removed, lyrics transcribed & synced' },
|
||||
{ icon: Video, title: 'Review & Correct', desc: 'Fix any transcription errors (usually 5-10 min)' },
|
||||
{ icon: Youtube, title: 'Get Your Video', desc: 'Download files or watch on our YouTube' },
|
||||
].map((step, i) => (
|
||||
<div key={i} className="text-center">
|
||||
<div className="w-16 h-16 bg-primary-500/20 rounded-2xl flex items-center justify-center mx-auto mb-4">
|
||||
@@ -275,12 +294,12 @@ export default function LandingPage() {
|
||||
<h2 className="text-3xl font-bold text-center mb-12">What You Get</h2>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{[
|
||||
{ title: 'Studio-Quality Separation', desc: 'State-of-the-art AI removes vocals cleanly, keeping the instrumental crisp.' },
|
||||
{ title: 'Perfect Lyrics Sync', desc: 'Word-by-word timing that highlights exactly when to sing.' },
|
||||
{ title: 'Multiple Instrumental Options', desc: 'Choose from different vocal removal levels to get the sound you want.' },
|
||||
{ title: '4K Video Output', desc: 'Stunning video quality that looks great on any screen.' },
|
||||
{ title: 'YouTube Integration', desc: 'Upload directly to your YouTube channel with one click.' },
|
||||
{ title: 'Edit Before Export', desc: 'Fix any lyrics issues before generating your final video.' },
|
||||
{ title: 'Real Instrumentals', desc: "Uses the actual instrumental from your song—not a cover band or MIDI recreation." },
|
||||
{ title: 'Precise Lyrics Sync', desc: 'Word-by-word timing that highlights exactly when to sing. You review the lyrics for accuracy.' },
|
||||
{ title: 'Keep or Remove Backing Vocals', desc: 'Choose a clean instrumental or one that preserves backing vocals for a fuller sound.' },
|
||||
{ title: '4K Video + Multiple Formats', desc: 'Get a 4K karaoke video, a sing-along version with vocals, and CDG+MP3 for older systems.' },
|
||||
{ title: 'Published to YouTube', desc: 'Every video is automatically published to our YouTube channel for easy sharing.' },
|
||||
{ title: 'Full Control Before Export', desc: 'Review and correct any transcription errors before the final video is generated.' },
|
||||
].map((feature, i) => (
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl p-6 card-hover">
|
||||
<h3 className="font-semibold text-lg mb-2">{feature.title}</h3>
|
||||
@@ -291,25 +310,104 @@ export default function LandingPage() {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Screenshots Section */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-4">See It In Action</h2>
|
||||
<p className="text-dark-400 text-center mb-12 max-w-xl mx-auto">
|
||||
Here's what the process looks like at each step
|
||||
</p>
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
{/* Job Dashboard Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/job-dashboard.avif"
|
||||
alt="Job Dashboard showing karaoke video projects with status indicators"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Job Dashboard</h3>
|
||||
<p className="text-dark-400 text-sm">Track progress of all your karaoke video projects</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Lyrics Review Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/lyrics-review.avif"
|
||||
alt="Lyrics Review UI with word-by-word editing and timing controls"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Lyrics Review</h3>
|
||||
<p className="text-dark-400 text-sm">Correct any transcription errors before generating your video</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Instrumental Selection Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/instrumental-review.avif"
|
||||
alt="Instrumental Selection UI with audio player and backing vocals options"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Instrumental Selection</h3>
|
||||
<p className="text-dark-400 text-sm">Pick the sound that works best for your karaoke</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Example Output Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/example-output.avif"
|
||||
alt="Example karaoke video output with synchronized lyrics"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Final Video</h3>
|
||||
<p className="text-dark-400 text-sm">4K karaoke video ready for your next singing session</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Beta Tester Program */}
|
||||
<section className="py-12 px-4">
|
||||
<section id="beta" className="py-12 px-4">
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="bg-gradient-to-r from-purple-900/40 to-pink-900/40 border border-purple-500/30 rounded-2xl p-8 text-center">
|
||||
<div className="inline-flex items-center gap-2 bg-purple-500/20 text-purple-300 px-4 py-2 rounded-full text-sm font-medium mb-4">
|
||||
<div className="bg-gradient-to-r from-pink-500/10 to-purple-500/10 border border-primary/30 rounded-2xl p-8 text-center">
|
||||
<div className="inline-flex items-center gap-2 bg-primary-500/20 text-primary-400 px-4 py-2 rounded-full text-sm font-medium mb-4">
|
||||
<Gift className="w-4 h-4" />
|
||||
Beta Tester Program
|
||||
</div>
|
||||
<h3 className="text-2xl font-bold mb-3">Try It Free!</h3>
|
||||
<p className="text-dark-300 mb-6">
|
||||
Help us improve by testing the tool and sharing your feedback. Get a{' '}
|
||||
<span className="text-green-400 font-semibold">free credit</span> to
|
||||
create your first karaoke video!
|
||||
Help us improve by testing the tool and sharing your feedback. Beta testers get{' '}
|
||||
<span className="text-green-400 font-semibold">up to 5 free karaoke videos</span>{' '}
|
||||
in exchange for providing feedback on each one.
|
||||
</p>
|
||||
|
||||
{!showBetaForm && !betaSuccess && (
|
||||
<button
|
||||
onClick={() => setShowBetaForm(true)}
|
||||
className="inline-flex items-center gap-2 bg-purple-500 hover:bg-purple-600 text-white font-semibold px-6 py-3 rounded-xl transition-all"
|
||||
className="inline-flex items-center gap-2 bg-primary-500 hover:bg-primary-600 text-white font-semibold px-6 py-3 rounded-xl transition-all btn-glow"
|
||||
>
|
||||
Join Beta Program
|
||||
<MessageSquare className="w-5 h-5" />
|
||||
@@ -328,7 +426,7 @@ export default function LandingPage() {
|
||||
value={betaEmail}
|
||||
onChange={(e) => setBetaEmail(e.target.value)}
|
||||
placeholder="you@example.com"
|
||||
className="w-full px-4 py-3 bg-dark-900 border border-dark-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-white placeholder-dark-500"
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary text-foreground placeholder:text-muted-foreground"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
@@ -343,7 +441,7 @@ export default function LandingPage() {
|
||||
onChange={(e) => setBetaPromise(e.target.value)}
|
||||
placeholder="Tell us about a song you'd love to sing..."
|
||||
rows={3}
|
||||
className="w-full px-4 py-3 bg-dark-900 border border-dark-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 text-white placeholder-dark-500 resize-none"
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary text-foreground placeholder:text-muted-foreground resize-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -353,10 +451,10 @@ export default function LandingPage() {
|
||||
id="beta-accept"
|
||||
checked={betaAccept}
|
||||
onChange={(e) => setBetaAccept(e.target.checked)}
|
||||
className="mt-1 w-4 h-4 rounded border-dark-600 bg-dark-900 text-purple-500 focus:ring-purple-500"
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary text-primary focus:ring-primary"
|
||||
/>
|
||||
<label htmlFor="beta-accept" className="text-sm text-dark-300">
|
||||
I understand that beta testers help improve lyrics accuracy by reviewing and correcting AI-generated lyrics
|
||||
<label htmlFor="beta-accept" className="text-sm text-muted-foreground">
|
||||
I understand that I'll need to review and correct any lyrics transcription errors, and provide feedback after each video
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -367,7 +465,7 @@ export default function LandingPage() {
|
||||
<button
|
||||
type="submit"
|
||||
disabled={betaLoading}
|
||||
className="w-full bg-purple-500 hover:bg-purple-600 disabled:bg-purple-500/50 text-white font-semibold py-3 rounded-xl transition-all flex items-center justify-center gap-2"
|
||||
className="w-full bg-primary-500 hover:bg-primary-600 disabled:bg-primary-500/50 text-white font-semibold py-3 rounded-xl transition-all btn-glow flex items-center justify-center gap-2"
|
||||
>
|
||||
{betaLoading ? 'Enrolling...' : 'Get My Free Credit'}
|
||||
{!betaLoading && <Gift className="w-5 h-5" />}
|
||||
@@ -461,14 +559,14 @@ export default function LandingPage() {
|
||||
Email address
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Mail className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-dark-500" />
|
||||
<Mail className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground" />
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
placeholder="you@example.com"
|
||||
className="w-full pl-10 pr-4 py-3 bg-dark-900 border border-dark-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent text-white placeholder-dark-500"
|
||||
className="w-full pl-10 pr-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
@@ -503,22 +601,9 @@ export default function LandingPage() {
|
||||
<h2 className="text-3xl font-bold text-center mb-12">Questions?</h2>
|
||||
<div className="space-y-4">
|
||||
{faqs.map((faq, i) => (
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<button
|
||||
onClick={() => setExpandedFaq(expandedFaq === i ? null : i)}
|
||||
aria-expanded={expandedFaq === i}
|
||||
className="w-full px-6 py-4 text-left flex items-center justify-between hover:bg-dark-700/50 transition-colors"
|
||||
>
|
||||
<span className="font-medium">{faq.question}</span>
|
||||
<ChevronDown
|
||||
className={`w-5 h-5 text-dark-400 transition-transform ${
|
||||
expandedFaq === i ? 'rotate-180' : ''
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
{expandedFaq === i && (
|
||||
<div className="px-6 pb-4 text-dark-300 text-sm">{faq.answer}</div>
|
||||
)}
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl p-6">
|
||||
<h3 className="font-medium mb-2">{faq.question}</h3>
|
||||
<p className="text-dark-400 text-sm">{faq.answer}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -526,20 +611,19 @@ export default function LandingPage() {
|
||||
</section>
|
||||
|
||||
{/* Footer */}
|
||||
<footer className="py-12 px-4 border-t border-dark-700">
|
||||
<footer className="py-12 px-4 border-t border-primary-500/30">
|
||||
<div className="max-w-6xl mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<MicVocal className="w-6 h-6 text-primary-500" />
|
||||
<span className="font-semibold">Nomad Karaoke</span>
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-8" />
|
||||
</div>
|
||||
<div className="text-sm text-dark-500">
|
||||
© {new Date().getFullYear()} Nomad Karaoke. All rights reserved.
|
||||
</div>
|
||||
<div className="flex gap-6 text-sm text-dark-400">
|
||||
<a href="mailto:support@nomadkaraoke.com" className="hover:text-white transition-colors">
|
||||
<a href="mailto:support@nomadkaraoke.com" className="hover:text-primary-400 transition-colors">
|
||||
Support
|
||||
</a>
|
||||
<a href="https://nomadkaraoke.com" className="hover:text-white transition-colors">
|
||||
<a href="https://nomadkaraoke.com" className="hover:text-primary-400 transition-colors">
|
||||
About
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -25,28 +25,28 @@ function PaymentSuccessContent() {
|
||||
const sessionId = searchParams.get("session_id")
|
||||
|
||||
return (
|
||||
<div className="max-w-md w-full bg-slate-900 border border-slate-700 rounded-xl p-8 text-center">
|
||||
<CheckCircle className="w-16 h-16 text-green-400 mx-auto mb-4" />
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<CheckCircle className="w-16 h-16 text-success mx-auto mb-4" />
|
||||
|
||||
<h1 className="text-2xl font-bold text-white mb-2">
|
||||
<h1 className="text-2xl font-bold text-foreground mb-2">
|
||||
Payment Successful!
|
||||
</h1>
|
||||
|
||||
<p className="text-slate-400 mb-6">
|
||||
<p className="text-muted-foreground mb-6">
|
||||
Thank you for your purchase. Your credits have been added to your account.
|
||||
</p>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="flex items-center justify-center gap-2 text-slate-400 mb-6">
|
||||
<div className="flex items-center justify-center gap-2 text-muted-foreground mb-6">
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
Loading your balance...
|
||||
</div>
|
||||
) : user ? (
|
||||
<div className="bg-slate-800 rounded-lg p-4 mb-6">
|
||||
<div className="flex items-center justify-center gap-2 text-amber-400">
|
||||
<div className="bg-secondary rounded-lg p-4 mb-6">
|
||||
<div className="flex items-center justify-center gap-2 text-warning">
|
||||
<Coins className="w-5 h-5" />
|
||||
<span className="text-2xl font-bold">{user.credits}</span>
|
||||
<span className="text-slate-400">credits available</span>
|
||||
<span className="text-muted-foreground">credits available</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
@@ -54,12 +54,12 @@ function PaymentSuccessContent() {
|
||||
<div className="space-y-3">
|
||||
<Button
|
||||
onClick={() => router.push("/app")}
|
||||
className="w-full bg-blue-600 hover:bg-blue-500"
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
Start Creating Karaoke
|
||||
</Button>
|
||||
|
||||
<p className="text-xs text-slate-500">
|
||||
<p className="text-xs text-muted-foreground">
|
||||
A confirmation email has been sent to your email address.
|
||||
</p>
|
||||
</div>
|
||||
@@ -69,12 +69,12 @@ function PaymentSuccessContent() {
|
||||
|
||||
export default function PaymentSuccessPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-slate-950 flex items-center justify-center p-4">
|
||||
<div className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="max-w-md w-full bg-slate-900 border border-slate-700 rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-16 h-16 text-blue-400 mx-auto mb-4 animate-spin" />
|
||||
<p className="text-slate-400">Loading...</p>
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-16 h-16 text-primary mx-auto mb-4 animate-spin" />
|
||||
<p className="text-muted-foreground">Loading...</p>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
|
||||
|
After Width: | Height: | Size: 920 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 733 KiB |
|
After Width: | Height: | Size: 222 KiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 137 KiB |
@@ -0,0 +1,35 @@
|
||||
"use client"
|
||||
|
||||
import { Moon, Sun } from "lucide-react"
|
||||
import { useTheme } from "@/lib/theme"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
export function ThemeToggle() {
|
||||
const { theme, toggleTheme, mounted } = useTheme()
|
||||
|
||||
// Avoid hydration mismatch by not rendering until mounted
|
||||
if (!mounted) {
|
||||
return (
|
||||
<Button variant="ghost" size="icon" className="w-9 h-9">
|
||||
<span className="sr-only">Toggle theme</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={toggleTheme}
|
||||
className="w-9 h-9"
|
||||
title={`Switch to ${theme === 'dark' ? 'light' : 'dark'} mode`}
|
||||
>
|
||||
{theme === "dark" ? (
|
||||
<Sun className="h-5 w-5 text-muted-foreground hover:text-foreground transition-colors" />
|
||||
) : (
|
||||
<Moon className="h-5 w-5 text-muted-foreground hover:text-foreground transition-colors" />
|
||||
)}
|
||||
<span className="sr-only">Toggle theme</span>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -52,7 +52,7 @@ const CATEGORY_CONFIG: Record<string, CategoryConfig> = {
|
||||
'COMPILATIONS': { name: 'COMPILATIONS', maxDisplay: 2, color: 'text-teal-400', borderColor: 'border-teal-500/30' },
|
||||
'VINYL RIPS': { name: 'VINYL RIPS', maxDisplay: 2, color: 'text-orange-400', borderColor: 'border-orange-500/30' },
|
||||
'YOUTUBE/LOSSY': { name: 'YOUTUBE/LOSSY', maxDisplay: 3, color: 'text-red-400', borderColor: 'border-red-500/30' },
|
||||
'OTHER': { name: 'OTHER', maxDisplay: 3, color: 'text-slate-400', borderColor: 'border-slate-500/30' },
|
||||
'OTHER': { name: 'OTHER', maxDisplay: 3, color: 'text-muted-foreground', borderColor: 'border-border' },
|
||||
}
|
||||
|
||||
const CATEGORY_ORDER = [
|
||||
@@ -261,30 +261,30 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(open) => !open && onClose()}>
|
||||
<DialogContent className="max-w-7xl w-[95vw] max-h-[90vh] flex flex-col bg-slate-900 border-slate-700 !p-0 gap-0 overflow-hidden">
|
||||
<div className="px-4 py-2.5 border-b border-slate-700 shrink-0 bg-slate-900 flex items-center justify-between">
|
||||
<DialogTitle className="text-white text-sm font-semibold flex items-center gap-2">
|
||||
<DialogContent className="max-w-7xl w-[95vw] max-h-[90vh] flex flex-col bg-card border-border !p-0 gap-0 overflow-hidden">
|
||||
<div className="px-4 py-2.5 border-b border-border shrink-0 bg-card flex items-center justify-between">
|
||||
<DialogTitle className="text-foreground text-sm font-semibold flex items-center gap-2">
|
||||
Select Audio Source
|
||||
<span className="text-[10px] px-1.5 py-0.5 rounded bg-slate-700 text-slate-400 font-mono">v{APP_VERSION}</span>
|
||||
<span className="text-slate-400 font-normal text-xs">
|
||||
<span className="text-[10px] px-1.5 py-0.5 rounded bg-secondary text-muted-foreground font-mono">v{APP_VERSION}</span>
|
||||
<span className="text-muted-foreground font-normal text-xs">
|
||||
({results.length} results across {totalCategories} categories)
|
||||
</span>
|
||||
</DialogTitle>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="px-4 py-2 text-xs text-red-400 bg-red-500/10 border-b border-slate-800">
|
||||
<div className="px-4 py-2 text-xs text-red-400 bg-red-500/10 border-b border-border">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isLoading ? (
|
||||
<div className="flex-1 flex items-center justify-center py-12">
|
||||
<Loader2 className="w-5 h-5 animate-spin text-slate-400" />
|
||||
<span className="ml-2 text-sm text-slate-400">Loading...</span>
|
||||
<Loader2 className="w-5 h-5 animate-spin text-muted-foreground" />
|
||||
<span className="ml-2 text-sm text-muted-foreground">Loading...</span>
|
||||
</div>
|
||||
) : results.length === 0 ? (
|
||||
<div className="flex-1 flex flex-col items-center justify-center py-12 text-slate-500">
|
||||
<div className="flex-1 flex flex-col items-center justify-center py-12 text-muted-foreground">
|
||||
<Music2 className="w-8 h-8 mb-2 opacity-50" />
|
||||
<p className="text-sm">No audio sources found</p>
|
||||
</div>
|
||||
@@ -299,17 +299,17 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
const hasMore = hiddenCount > 0
|
||||
|
||||
return (
|
||||
<div key={category} className="border border-slate-700 rounded-lg overflow-hidden bg-slate-800/20">
|
||||
<div key={category} className="border border-border rounded-lg overflow-hidden bg-secondary/20">
|
||||
{/* Category Header */}
|
||||
<div className={`px-3 py-2 bg-slate-800/70 flex items-center justify-between ${config.color}`}>
|
||||
<div className={`px-3 py-2 bg-secondary flex items-center justify-between ${config.color}`}>
|
||||
<div className="flex items-center gap-2 text-xs font-semibold">
|
||||
<span>{category}</span>
|
||||
<span className="text-slate-500 font-normal">({catResults.length})</span>
|
||||
<span className="text-muted-foreground font-normal">({catResults.length})</span>
|
||||
</div>
|
||||
{hasMore && (
|
||||
<button
|
||||
onClick={() => toggleCategory(category)}
|
||||
className="text-[10px] text-slate-400 hover:text-white flex items-center gap-1"
|
||||
className="text-[10px] text-muted-foreground hover:text-foreground flex items-center gap-1"
|
||||
>
|
||||
{isExpanded ? (
|
||||
<>Show less <ChevronUp className="w-3 h-3" /></>
|
||||
@@ -325,10 +325,10 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
{displayResults.map((result) => (
|
||||
<div
|
||||
key={result.index}
|
||||
className="px-3 py-1.5 hover:bg-slate-800/50 flex items-center gap-2 text-xs"
|
||||
className="px-3 py-1.5 hover:bg-secondary/50 flex items-center gap-2 text-xs"
|
||||
>
|
||||
{/* Index */}
|
||||
<span className="w-5 text-slate-500 font-mono shrink-0 text-[10px]">
|
||||
<span className="w-5 text-muted-foreground font-mono shrink-0 text-[10px]">
|
||||
{result.index + 1}.
|
||||
</span>
|
||||
|
||||
@@ -345,17 +345,17 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
result.provider === "YouTube" ? "bg-red-600/20 text-red-400" :
|
||||
result.provider === "RED" ? "bg-red-600/30 text-red-300" :
|
||||
result.provider === "OPS" ? "bg-blue-600/20 text-blue-400" :
|
||||
"bg-slate-600/20 text-slate-400"
|
||||
"bg-muted text-muted-foreground"
|
||||
}`}>
|
||||
{result.provider}
|
||||
</span>
|
||||
<span className="text-green-400 font-medium">{getDisplayName(result)}</span>
|
||||
<span className="text-slate-500">-</span>
|
||||
<span className="text-white">{result.title}</span>
|
||||
<span className={`text-[10px] ${result.is_lossless ? "text-green-400" : "text-slate-400"}`}>
|
||||
<span className="text-muted-foreground">-</span>
|
||||
<span className="text-foreground">{result.title}</span>
|
||||
<span className={`text-[10px] ${result.is_lossless ? "text-green-400" : "text-muted-foreground"}`}>
|
||||
({formatQuality(result)})
|
||||
</span>
|
||||
<span className="text-[10px] text-slate-400">{result.formatted_size || '-'}</span>
|
||||
<span className="text-[10px] text-muted-foreground">{result.formatted_size || '-'}</span>
|
||||
{result.seeders !== undefined && result.seeders !== null ? (
|
||||
<span className={`text-[10px] ${
|
||||
result.seeders >= 50 ? 'text-green-400' :
|
||||
@@ -368,7 +368,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
<span className={`text-[10px] ${
|
||||
result.view_count >= 1000000 ? 'text-green-400' :
|
||||
result.view_count >= 10000 ? 'text-yellow-400' :
|
||||
'text-slate-400'
|
||||
'text-muted-foreground'
|
||||
}`}>
|
||||
{formatCount(result.view_count)} views
|
||||
</span>
|
||||
@@ -377,7 +377,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
|
||||
{/* Line 2: metadata + filename */}
|
||||
{(formatMetadata(result) || result.target_file) && (
|
||||
<div className="flex items-center gap-1.5 text-[10px] text-slate-500">
|
||||
<div className="flex items-center gap-1.5 text-[10px] text-muted-foreground">
|
||||
{formatMetadata(result) && (
|
||||
<span className="truncate">{formatMetadata(result)}</span>
|
||||
)}
|
||||
@@ -393,7 +393,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
size="sm"
|
||||
onClick={() => handleSelect(result.index)}
|
||||
disabled={isSelecting !== null}
|
||||
className="w-14 h-6 text-[9px] bg-amber-600 hover:bg-amber-500 text-white px-2 shrink-0"
|
||||
className="w-14 h-6 text-[9px] bg-amber-600 hover:bg-amber-500 text-foreground px-2 shrink-0"
|
||||
>
|
||||
{isSelecting === result.index ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
|
||||
@@ -79,15 +79,15 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(open) => !open && handleClose()}>
|
||||
<DialogContent className="sm:max-w-md bg-slate-900 border-slate-700">
|
||||
<DialogContent className="sm:max-w-md bg-card border-border">
|
||||
{step === "email" && (
|
||||
<>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-white flex items-center gap-2">
|
||||
<Mail className="w-5 h-5 text-blue-400" />
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<Mail className="w-5 h-5 text-primary" />
|
||||
Sign In
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-slate-400">
|
||||
<DialogDescription className="text-muted-foreground">
|
||||
Enter your email to receive a sign-in link
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
@@ -102,19 +102,19 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
setLocalError("")
|
||||
clearError()
|
||||
}}
|
||||
className="bg-slate-800 border-slate-600 text-white"
|
||||
className="bg-secondary border-border text-foreground"
|
||||
autoFocus
|
||||
disabled={isLoading}
|
||||
/>
|
||||
{displayError && (
|
||||
<p className="text-xs text-red-400 mt-1">{displayError}</p>
|
||||
<p className="text-xs text-destructive mt-1">{displayError}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={!email.trim() || isLoading}
|
||||
className="w-full bg-blue-600 hover:bg-blue-500"
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
{isLoading ? (
|
||||
<>
|
||||
@@ -129,13 +129,13 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
type="button"
|
||||
variant="ghost"
|
||||
onClick={() => setStep("token")}
|
||||
className="text-slate-400 hover:text-white"
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<KeyRound className="w-4 h-4 mr-2" />
|
||||
Use Access Token Instead
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-slate-500 text-center">
|
||||
<p className="text-xs text-muted-foreground text-center">
|
||||
No account? Just enter your email to get started.
|
||||
</p>
|
||||
</form>
|
||||
@@ -145,26 +145,26 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
{step === "sent" && (
|
||||
<>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-white flex items-center gap-2">
|
||||
<CheckCircle className="w-5 h-5 text-green-400" />
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<CheckCircle className="w-5 h-5 text-success" />
|
||||
Check Your Email
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4 py-4">
|
||||
<p className="text-slate-300">
|
||||
<p className="text-foreground">
|
||||
We sent a sign-in link to:
|
||||
</p>
|
||||
<p className="text-white font-medium bg-slate-800 px-4 py-2 rounded-md">
|
||||
<p className="text-foreground font-medium bg-secondary px-4 py-2 rounded-md">
|
||||
{email}
|
||||
</p>
|
||||
<p className="text-sm text-slate-400">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Click the link in the email to sign in. The link expires in 15 minutes.
|
||||
</p>
|
||||
<div className="pt-4 border-t border-slate-700 space-y-2">
|
||||
<div className="pt-4 border-t border-border space-y-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setStep("email")}
|
||||
className="w-full border-slate-600 text-slate-300 hover:text-white"
|
||||
className="w-full border-border text-foreground hover:text-foreground"
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Try a Different Email
|
||||
@@ -172,7 +172,7 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={handleClose}
|
||||
className="w-full text-slate-400"
|
||||
className="w-full text-muted-foreground"
|
||||
>
|
||||
Close
|
||||
</Button>
|
||||
@@ -184,11 +184,11 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
{step === "token" && (
|
||||
<>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-white flex items-center gap-2">
|
||||
<KeyRound className="w-5 h-5 text-amber-400" />
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<KeyRound className="w-5 h-5 text-warning" />
|
||||
Access Token
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-slate-400">
|
||||
<DialogDescription className="text-muted-foreground">
|
||||
Enter your access token to authenticate
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
@@ -203,19 +203,19 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
setLocalError("")
|
||||
clearError()
|
||||
}}
|
||||
className="bg-slate-800 border-slate-600 text-white"
|
||||
className="bg-secondary border-border text-foreground"
|
||||
autoFocus
|
||||
disabled={isLoading}
|
||||
/>
|
||||
{displayError && (
|
||||
<p className="text-xs text-red-400 mt-1">{displayError}</p>
|
||||
<p className="text-xs text-destructive mt-1">{displayError}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={!token.trim() || isLoading}
|
||||
className="w-full bg-amber-600 hover:bg-amber-500"
|
||||
className="w-full bg-warning hover:bg-warning/90 text-warning-foreground"
|
||||
>
|
||||
{isLoading ? (
|
||||
<>
|
||||
@@ -230,13 +230,13 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
type="button"
|
||||
variant="ghost"
|
||||
onClick={() => setStep("email")}
|
||||
className="text-slate-400 hover:text-white"
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to Email Sign-In
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-slate-500 text-center">
|
||||
<p className="text-xs text-muted-foreground text-center">
|
||||
Contact an admin to get an access token
|
||||
</p>
|
||||
</form>
|
||||
|
||||
@@ -62,46 +62,46 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="text-slate-300 hover:text-white flex items-center gap-2 min-h-[40px] px-2 sm:px-3"
|
||||
className="text-muted-foreground hover:text-foreground flex items-center gap-2 min-h-[40px] px-2 sm:px-3"
|
||||
>
|
||||
<User className="w-4 h-4" />
|
||||
<span className="hidden sm:inline max-w-[150px] truncate">
|
||||
{user.display_name || user.email}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 text-amber-400 font-medium">
|
||||
<span className="flex items-center gap-1 text-warning font-medium">
|
||||
<Coins className="w-3 h-3" />
|
||||
{user.credits} {user.credits === 1 ? 'credit' : 'credits'}
|
||||
</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-56 bg-slate-900 border-slate-700">
|
||||
<DropdownMenuLabel className="text-slate-400 font-normal">
|
||||
<DropdownMenuContent align="end" className="w-56 bg-card border-border">
|
||||
<DropdownMenuLabel className="text-muted-foreground font-normal">
|
||||
<div className="flex flex-col space-y-1">
|
||||
<p className="text-sm font-medium text-white">
|
||||
<p className="text-sm font-medium text-foreground">
|
||||
{user.display_name || "Karaoke Fan"}
|
||||
</p>
|
||||
<p className="text-xs text-slate-500 truncate">{user.email}</p>
|
||||
<p className="text-xs text-muted-foreground truncate">{user.email}</p>
|
||||
</div>
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator className="bg-slate-700" />
|
||||
<DropdownMenuSeparator className="bg-border" />
|
||||
<DropdownMenuItem
|
||||
className="text-slate-300 focus:text-white focus:bg-slate-800 cursor-default"
|
||||
className="text-muted-foreground focus:text-foreground focus:bg-secondary cursor-default"
|
||||
disabled
|
||||
>
|
||||
<Coins className="w-4 h-4 mr-2 text-amber-400" />
|
||||
<Coins className="w-4 h-4 mr-2 text-warning" />
|
||||
<span>{user.credits} credits available</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={handleBuyCredits}
|
||||
className="text-slate-300 focus:text-white focus:bg-slate-800"
|
||||
className="text-muted-foreground focus:text-foreground focus:bg-secondary"
|
||||
>
|
||||
<CreditCard className="w-4 h-4 mr-2" />
|
||||
<span>Buy More Credits</span>
|
||||
</DropdownMenuItem>
|
||||
{(user.role === "admin" || user.email?.endsWith("@nomadkaraoke.com")) && (
|
||||
<>
|
||||
<DropdownMenuSeparator className="bg-slate-700" />
|
||||
<DropdownMenuItem asChild className="text-slate-300 focus:text-white focus:bg-slate-800">
|
||||
<DropdownMenuSeparator className="bg-border" />
|
||||
<DropdownMenuItem asChild className="text-muted-foreground focus:text-foreground focus:bg-secondary">
|
||||
<Link href="/admin">
|
||||
<Shield className="w-4 h-4 mr-2" />
|
||||
<span>Admin Dashboard</span>
|
||||
@@ -109,10 +109,10 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
<DropdownMenuSeparator className="bg-slate-700" />
|
||||
<DropdownMenuSeparator className="bg-border" />
|
||||
<DropdownMenuItem
|
||||
onClick={handleLogout}
|
||||
className="text-red-400 focus:text-red-300 focus:bg-slate-800"
|
||||
className="text-destructive focus:text-destructive focus:bg-secondary"
|
||||
>
|
||||
<LogOut className="w-4 h-4 mr-2" />
|
||||
<span>Sign Out</span>
|
||||
@@ -128,7 +128,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="text-amber-400 hover:text-amber-300 min-h-[40px] px-2 sm:px-3"
|
||||
className="text-warning hover:text-warning/80 min-h-[40px] px-2 sm:px-3"
|
||||
>
|
||||
<KeyRound className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Login</span>
|
||||
|
||||
@@ -45,7 +45,7 @@ function ProgressBar({ job }: { job: Job }) {
|
||||
|
||||
// Map color class to background color for the bar
|
||||
const barColorMap: Record<string, string> = {
|
||||
"text-slate-400": "bg-slate-400",
|
||||
"text-muted-foreground": "bg-muted-foreground",
|
||||
"text-blue-400": "bg-blue-400",
|
||||
"text-purple-400": "bg-purple-400",
|
||||
"text-teal-400": "bg-teal-400",
|
||||
@@ -56,7 +56,7 @@ function ProgressBar({ job }: { job: Job }) {
|
||||
"text-violet-400": "bg-violet-400",
|
||||
"text-green-400": "bg-green-400",
|
||||
}
|
||||
const barColor = barColorMap[color] || "bg-blue-400"
|
||||
const barColor = barColorMap[color] || "bg-primary-500"
|
||||
|
||||
return (
|
||||
<div className="w-full h-1 rounded-full mt-2 overflow-hidden" style={{ backgroundColor: 'var(--secondary)' }}>
|
||||
@@ -133,7 +133,7 @@ export function JobCard({ job, onRefresh }: JobCardProps) {
|
||||
href={getReviewUrl()}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-500 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-primary-500 hover:bg-primary-600 text-white"
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
Review Lyrics
|
||||
@@ -146,7 +146,7 @@ export function JobCard({ job, onRefresh }: JobCardProps) {
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => setShowAudioSearch(true)}
|
||||
className="text-xs h-7 px-3 bg-blue-600 hover:bg-blue-500"
|
||||
className="text-xs h-7 px-3 bg-primary-500 hover:bg-primary-600"
|
||||
>
|
||||
Select Audio
|
||||
</Button>
|
||||
@@ -159,7 +159,7 @@ export function JobCard({ job, onRefresh }: JobCardProps) {
|
||||
href={getInstrumentalUrl()}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-500 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-primary-500 hover:bg-primary-600 text-white"
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
Select Instrumental
|
||||
|
||||
@@ -273,7 +273,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
className="mt-1 w-4 h-4 rounded border-gray-600 bg-gray-700 text-amber-500 focus:ring-amber-500 focus:ring-offset-gray-800"
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary text-amber-500 focus:ring-amber-500 focus:ring-offset-background"
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="non-interactive-upload" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
@@ -378,7 +378,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
className="mt-1 w-4 h-4 rounded border-gray-600 bg-gray-700 text-amber-500 focus:ring-amber-500 focus:ring-offset-gray-800"
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary text-amber-500 focus:ring-amber-500 focus:ring-offset-background"
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="non-interactive-url" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
@@ -502,7 +502,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
className="mt-1 w-4 h-4 rounded border-gray-600 bg-gray-700 text-amber-500 focus:ring-amber-500 focus:ring-offset-gray-800"
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary text-amber-500 focus:ring-amber-500 focus:ring-offset-background"
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="non-interactive-search" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
|
||||
@@ -206,7 +206,7 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
href={dropboxUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-blue-600 hover:bg-blue-500 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-primary-500 hover:bg-primary-600 text-white"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<FolderOpen className="w-3 h-3" />
|
||||
@@ -215,7 +215,7 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyToClipboard(dropboxUrl) }}
|
||||
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-blue-700 hover:bg-blue-600 text-white"
|
||||
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-[#cc5fa3] hover:bg-primary-600 text-white"
|
||||
title="Copy Dropbox URL"
|
||||
aria-label={copiedUrl === dropboxUrl ? "Dropbox URL copied" : "Copy Dropbox URL"}
|
||||
>
|
||||
@@ -257,7 +257,7 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
{downloadUrls?.packages?.cdg_zip && (
|
||||
<a
|
||||
href={api.getDownloadUrl(jobId, "packages", "cdg_zip")}
|
||||
className="inline-flex items-center gap-1 text-xs px-2 py-1.5 rounded bg-gray-700 hover:bg-gray-600 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-2 py-1.5 rounded bg-secondary hover:bg-muted text-white"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
@@ -267,7 +267,7 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
{downloadUrls?.packages?.txt_zip && (
|
||||
<a
|
||||
href={api.getDownloadUrl(jobId, "packages", "txt_zip")}
|
||||
className="inline-flex items-center gap-1 text-xs px-2 py-1.5 rounded bg-gray-700 hover:bg-gray-600 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-2 py-1.5 rounded bg-secondary hover:bg-muted text-white"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
@@ -278,7 +278,7 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
|
||||
{/* Admin-only buttons */}
|
||||
{isAdmin && (
|
||||
<div className="flex flex-wrap gap-2 pt-1 border-t border-gray-700/50 mt-2">
|
||||
<div className="flex flex-wrap gap-2 pt-1 border-t border-border/50 mt-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyCompletionMessage() }}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { api } from "@/lib/api";
|
||||
import { api, EncodingWorkerHealth } from "@/lib/api";
|
||||
|
||||
export function VersionFooter() {
|
||||
const [backendVersion, setBackendVersion] = useState<string | null>(null);
|
||||
const [encodingWorker, setEncodingWorker] = useState<EncodingWorkerHealth | null>(null);
|
||||
// Frontend version is injected at build time from pyproject.toml
|
||||
const frontendVersion = process.env.NEXT_PUBLIC_APP_VERSION || "dev";
|
||||
|
||||
@@ -19,9 +20,56 @@ export function VersionFooter() {
|
||||
}
|
||||
};
|
||||
|
||||
const fetchEncodingWorkerHealth = async () => {
|
||||
try {
|
||||
const health = await api.getEncodingWorkerHealth();
|
||||
setEncodingWorker(health);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch encoding worker health:", error);
|
||||
setEncodingWorker(null);
|
||||
}
|
||||
};
|
||||
|
||||
fetchBackendVersion();
|
||||
fetchEncodingWorkerHealth();
|
||||
}, []);
|
||||
|
||||
// Render encoding worker status indicator
|
||||
const renderEncodingWorkerStatus = () => {
|
||||
if (!encodingWorker) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (encodingWorker.status === "not_configured") {
|
||||
return null; // Don't show if not configured
|
||||
}
|
||||
|
||||
const isHealthy = encodingWorker.available && encodingWorker.status === "ok";
|
||||
const statusColor = isHealthy ? "text-green-500" : "text-red-500";
|
||||
const statusDot = isHealthy ? "●" : "○";
|
||||
|
||||
// Build status text
|
||||
let statusText = isHealthy ? "Encoder" : "Encoder offline";
|
||||
if (isHealthy && encodingWorker.version) {
|
||||
statusText = `Encoder: v${encodingWorker.version}`;
|
||||
}
|
||||
|
||||
// Add active jobs indicator if there are any
|
||||
if (isHealthy && encodingWorker.active_jobs && encodingWorker.active_jobs > 0) {
|
||||
statusText += ` (${encodingWorker.active_jobs} active)`;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{" | "}
|
||||
<span className={statusColor} title={isHealthy ? "Encoding worker healthy" : encodingWorker.error || "Encoding worker offline"}>
|
||||
{statusDot}
|
||||
</span>{" "}
|
||||
{statusText}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<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)' }}>
|
||||
@@ -39,6 +87,7 @@ export function VersionFooter() {
|
||||
Backend: v{backendVersion}
|
||||
</>
|
||||
)}
|
||||
{renderEncodingWorkerStatus()}
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test('lyrics review UI loads test data correctly', async ({ page }) => {
|
||||
// Navigate to the UI with the API URL parameter
|
||||
const url = 'http://localhost:8767?baseApiUrl=http%3A%2F%2Flocalhost%3A8767%2Fapi';
|
||||
|
||||
await page.goto(url);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Wait for content to render
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Check NOT in read-only mode
|
||||
const pageContent = await page.content();
|
||||
expect(pageContent.toLowerCase()).not.toContain('read-only mode');
|
||||
|
||||
// Check for lyrics content - look for actual words from test data
|
||||
await expect(page.locator('body')).toContainText('Hello', { timeout: 5000 });
|
||||
|
||||
// Take screenshot for verification
|
||||
await page.screenshot({ path: '/tmp/lyrics-review-test.png', fullPage: true });
|
||||
});
|
||||
@@ -0,0 +1,119 @@
|
||||
import { test, expect, Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Mobile Responsiveness Tests for Lyrics Review UI
|
||||
*
|
||||
* Tests the lyrics review frontend at localhost:8767 for mobile compatibility.
|
||||
*/
|
||||
|
||||
// Common mobile viewport sizes
|
||||
const MOBILE_VIEWPORTS = {
|
||||
'iPhone SE': { width: 375, height: 667 },
|
||||
'iPhone 14': { width: 390, height: 844 },
|
||||
'Pixel 7': { width: 412, height: 915 },
|
||||
} as const;
|
||||
|
||||
// Helper to check no horizontal overflow
|
||||
async function hasNoHorizontalOverflow(page: Page): Promise<boolean> {
|
||||
return await page.evaluate(() => {
|
||||
const docWidth = document.documentElement.scrollWidth;
|
||||
const viewportWidth = window.innerWidth;
|
||||
return docWidth <= viewportWidth + 2; // Allow 2px tolerance
|
||||
});
|
||||
}
|
||||
|
||||
// Use dev server with API pointing to test server
|
||||
const BASE_URL = 'http://localhost:5173?baseApiUrl=http%3A%2F%2Flocalhost%3A8767%2Fapi';
|
||||
|
||||
test.describe('Lyrics Review UI - Mobile Responsiveness', () => {
|
||||
for (const [deviceName, viewport] of Object.entries(MOBILE_VIEWPORTS)) {
|
||||
test(`${deviceName}: No horizontal overflow`, async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto(BASE_URL);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Wait for content to render
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
const noOverflow = await hasNoHorizontalOverflow(page);
|
||||
expect(noOverflow).toBe(true);
|
||||
});
|
||||
|
||||
test(`${deviceName}: Header content is visible`, async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto(BASE_URL);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Wait for content
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Header title should be visible
|
||||
await expect(page.locator('text=Nomad Karaoke')).toBeVisible({ timeout: 5000 });
|
||||
});
|
||||
|
||||
test(`${deviceName}: Lyrics segments are visible`, async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto(BASE_URL);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Wait for content
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Should show lyrics text
|
||||
await expect(page.locator('body')).toContainText('Hello', { timeout: 5000 });
|
||||
});
|
||||
|
||||
test(`${deviceName}: Action buttons fit viewport`, async ({ page }) => {
|
||||
await page.setViewportSize(viewport);
|
||||
await page.goto(BASE_URL);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Wait for content
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Look for action buttons (Find/Replace, Edit All, etc.)
|
||||
const findReplaceBtn = page.getByRole('button', { name: /find.*replace/i });
|
||||
|
||||
if (await findReplaceBtn.isVisible({ timeout: 3000 }).catch(() => false)) {
|
||||
const box = await findReplaceBtn.boundingBox();
|
||||
if (box) {
|
||||
// Button should be within viewport
|
||||
expect(box.x).toBeGreaterThanOrEqual(0);
|
||||
expect(box.x + box.width).toBeLessThanOrEqual(viewport.width + 10);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test('Screenshot comparison - iPhone SE', async ({ page }) => {
|
||||
await page.setViewportSize(MOBILE_VIEWPORTS['iPhone SE']);
|
||||
await page.goto(BASE_URL);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Take screenshot for visual verification
|
||||
await page.screenshot({
|
||||
path: '/tmp/lyrics-review-mobile-iphone-se.png',
|
||||
fullPage: true
|
||||
});
|
||||
|
||||
// Just verify content loaded
|
||||
await expect(page.locator('body')).toContainText('Hello');
|
||||
});
|
||||
|
||||
test('Screenshot comparison - Desktop', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await page.goto(BASE_URL);
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// Take screenshot for visual verification
|
||||
await page.screenshot({
|
||||
path: '/tmp/lyrics-review-desktop.png',
|
||||
fullPage: true
|
||||
});
|
||||
|
||||
// Just verify content loaded
|
||||
await expect(page.locator('body')).toContainText('Hello');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Screenshot capture script for PR documentation.
|
||||
* Run with: npm run test:e2e -- tests/take-screenshots.spec.ts
|
||||
*/
|
||||
|
||||
import { test, expect } from '@playwright/test';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const SCREENSHOT_DIR = path.join(__dirname, '..', '..', 'public', 'screenshots');
|
||||
|
||||
test.describe('PR Screenshots', () => {
|
||||
test.beforeAll(async () => {
|
||||
// Ensure screenshot directory exists
|
||||
if (!fs.existsSync(SCREENSHOT_DIR)) {
|
||||
fs.mkdirSync(SCREENSHOT_DIR, { recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('capture homepage', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
|
||||
// Use local dev server for latest code
|
||||
await page.goto('http://localhost:3000', { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Hero section
|
||||
await page.screenshot({
|
||||
path: path.join(SCREENSHOT_DIR, 'homepage-hero.png'),
|
||||
});
|
||||
|
||||
// Full page
|
||||
await page.screenshot({
|
||||
path: path.join(SCREENSHOT_DIR, 'homepage-full.png'),
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
|
||||
test('capture lyrics review UI', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
|
||||
const lyricsUrl = 'http://localhost:8766?baseApiUrl=http%3A%2F%2Flocalhost%3A8766%2Fapi';
|
||||
|
||||
try {
|
||||
await page.goto(lyricsUrl, { waitUntil: 'networkidle', timeout: 10000 });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page.screenshot({
|
||||
path: path.join(SCREENSHOT_DIR, 'lyrics-review.png'),
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Warning: Could not capture lyrics review UI. Make sure test-lyrics-review.py is running.');
|
||||
}
|
||||
});
|
||||
|
||||
test('capture instrumental review UI', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1280, height: 800 });
|
||||
|
||||
const instrumentalUrl = 'http://localhost:8765';
|
||||
|
||||
try {
|
||||
await page.goto(instrumentalUrl, { waitUntil: 'networkidle', timeout: 10000 });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await page.screenshot({
|
||||
path: path.join(SCREENSHOT_DIR, 'instrumental-review.png'),
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Warning: Could not capture instrumental review UI. Make sure test-instrumental-review.py is running.');
|
||||
}
|
||||
});
|
||||
|
||||
test('capture email templates', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 700, height: 900 });
|
||||
|
||||
const emailDir = '/tmp/email-previews';
|
||||
const emails = ['job_completion', 'action_reminder', 'beta_welcome'];
|
||||
|
||||
for (const emailName of emails) {
|
||||
const emailPath = path.join(emailDir, `${emailName}.html`);
|
||||
if (fs.existsSync(emailPath)) {
|
||||
await page.goto(`file://${emailPath}`, { waitUntil: 'load' });
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
await page.screenshot({
|
||||
path: path.join(SCREENSHOT_DIR, `email-${emailName}.png`),
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -138,6 +138,15 @@ export interface JobLog {
|
||||
details?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface EncodingWorkerHealth {
|
||||
available: boolean;
|
||||
status: string; // 'ok' | 'offline' | 'not_configured'
|
||||
version?: string | null;
|
||||
active_jobs?: number;
|
||||
queue_length?: number;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
class ApiError extends Error {
|
||||
status: number;
|
||||
data?: any;
|
||||
@@ -589,7 +598,7 @@ export const api = {
|
||||
},
|
||||
|
||||
// ==========================================================================
|
||||
// Version API endpoint
|
||||
// Version & Health API endpoints
|
||||
// ==========================================================================
|
||||
|
||||
/**
|
||||
@@ -602,6 +611,14 @@ export const api = {
|
||||
return handleResponse(response);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get encoding worker health status
|
||||
*/
|
||||
async getEncodingWorkerHealth(): Promise<EncodingWorkerHealth> {
|
||||
const response = await fetch(`${API_BASE_URL}/health/encoding-worker`);
|
||||
return handleResponse(response);
|
||||
},
|
||||
|
||||
// ==========================================================================
|
||||
// Credits/Payment API endpoints
|
||||
// ==========================================================================
|
||||
|
||||
@@ -35,7 +35,7 @@ const STATUS_CONFIG: Record<
|
||||
{ step: number; label: string; isBlocking: boolean; color: string }
|
||||
> = {
|
||||
// Step 1: Setup
|
||||
pending: { step: 1, label: "Setting up", isBlocking: false, color: "text-slate-400" },
|
||||
pending: { step: 1, label: "Setting up", isBlocking: false, color: "text-muted-foreground" },
|
||||
|
||||
// Step 2: Audio Search (optional path)
|
||||
searching_audio: { step: 2, label: "Searching for audio", isBlocking: false, color: "text-blue-400" },
|
||||
@@ -82,7 +82,7 @@ const STATUS_CONFIG: Record<
|
||||
|
||||
// Terminal states (no step progression)
|
||||
failed: { step: 0, label: "Failed", isBlocking: false, color: "text-red-400" },
|
||||
cancelled: { step: 0, label: "Cancelled", isBlocking: false, color: "text-slate-500" },
|
||||
cancelled: { step: 0, label: "Cancelled", isBlocking: false, color: "text-muted-foreground" },
|
||||
};
|
||||
|
||||
const TOTAL_STEPS = 10;
|
||||
@@ -118,7 +118,7 @@ export function getJobStep(job: Job): JobStep {
|
||||
total: TOTAL_STEPS,
|
||||
label: status.replace(/_/g, " "),
|
||||
isBlocking: false,
|
||||
color: "text-slate-400",
|
||||
color: "text-muted-foreground",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.80.0",
|
||||
"version": "0.81.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.80.0",
|
||||
"version": "0.81.0",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
"@radix-ui/react-accordion": "1.2.2",
|
||||
@@ -75,6 +75,7 @@
|
||||
"concurrently": "^9.2.1",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"playwright": "^1.57.0",
|
||||
"postcss": "^8.5",
|
||||
"tailwindcss": "^4.1.9",
|
||||
"ts-node": "^10.9.2",
|
||||
@@ -3302,6 +3303,66 @@
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
|
||||
"version": "1.6.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.1.0",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
|
||||
"version": "1.6.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.1.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "1.0.7",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/core": "^1.5.0",
|
||||
"@emnapi/runtime": "^1.5.0",
|
||||
"@tybys/wasm-util": "^0.10.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
|
||||
"version": "0.10.1",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
||||
"version": "4.1.17",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.17.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.80.0",
|
||||
"version": "0.81.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "next build",
|
||||
@@ -82,6 +82,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.57.0",
|
||||
"playwright": "^1.57.0",
|
||||
"@tailwindcss/postcss": "^4.1.9",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.1",
|
||||
|
||||
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 602 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,156 @@
|
||||
/**
|
||||
* Brand consistency visual testing script
|
||||
* Takes screenshots of key pages in both light and dark modes
|
||||
* for visual verification of brand colors.
|
||||
*/
|
||||
import { chromium } from 'playwright';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname, join } from 'path';
|
||||
import { mkdir } from 'fs/promises';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const screenshotsDir = join(__dirname, 'brand-screenshots');
|
||||
|
||||
async function takeScreenshots() {
|
||||
// Create screenshots directory
|
||||
await mkdir(screenshotsDir, { recursive: true });
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const context = await browser.newContext({
|
||||
viewport: { width: 1280, height: 800 }
|
||||
});
|
||||
const page = await context.newPage();
|
||||
|
||||
const baseUrl = 'http://localhost:3000';
|
||||
|
||||
console.log('Taking screenshots...\n');
|
||||
console.log('=== DARK MODE ===\n');
|
||||
|
||||
// Landing page - dark mode (default)
|
||||
console.log('1. Landing page (dark mode)...');
|
||||
await page.goto(baseUrl, { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(1000); // Wait for animations
|
||||
await page.screenshot({
|
||||
path: join(screenshotsDir, '01-landing-dark.png'),
|
||||
fullPage: true
|
||||
});
|
||||
console.log(' ✓ Saved: 01-landing-dark.png');
|
||||
|
||||
// Scroll to beta section
|
||||
console.log('2. Beta section (dark mode)...');
|
||||
await page.evaluate(() => {
|
||||
const betaSection = document.querySelector('[class*="beta"]') ||
|
||||
document.evaluate("//h3[contains(text(),'Try It Free')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue?.closest('section');
|
||||
if (betaSection) betaSection.scrollIntoView({ behavior: 'instant' });
|
||||
});
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({
|
||||
path: join(screenshotsDir, '02-beta-section-dark.png'),
|
||||
fullPage: false
|
||||
});
|
||||
console.log(' ✓ Saved: 02-beta-section-dark.png');
|
||||
|
||||
// Scroll to pricing section
|
||||
console.log('3. Pricing section (dark mode)...');
|
||||
await page.goto(`${baseUrl}#pricing`, { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({
|
||||
path: join(screenshotsDir, '03-pricing-dark.png'),
|
||||
fullPage: false
|
||||
});
|
||||
console.log(' ✓ Saved: 03-pricing-dark.png');
|
||||
|
||||
// Footer
|
||||
console.log('4. Footer (dark mode)...');
|
||||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
|
||||
await page.waitForTimeout(500);
|
||||
await page.screenshot({
|
||||
path: join(screenshotsDir, '04-footer-dark.png'),
|
||||
fullPage: false
|
||||
});
|
||||
console.log(' ✓ Saved: 04-footer-dark.png');
|
||||
|
||||
// === LIGHT MODE ===
|
||||
console.log('\n=== LIGHT MODE ===\n');
|
||||
|
||||
// Create a new context with localStorage preset for light mode
|
||||
console.log('Switching to light mode...');
|
||||
const lightContext = await browser.newContext({
|
||||
viewport: { width: 1280, height: 800 },
|
||||
storageState: {
|
||||
cookies: [],
|
||||
origins: [{
|
||||
origin: baseUrl,
|
||||
localStorage: [
|
||||
{ name: 'theme', value: 'light' },
|
||||
{ name: 'nomad-karaoke-theme', value: 'light' }
|
||||
]
|
||||
}]
|
||||
}
|
||||
});
|
||||
const lightPage = await lightContext.newPage();
|
||||
|
||||
// Landing page - light mode
|
||||
console.log('5. Landing page (light mode)...');
|
||||
await lightPage.goto(baseUrl, { waitUntil: 'networkidle' });
|
||||
await lightPage.waitForTimeout(1000);
|
||||
await lightPage.screenshot({
|
||||
path: join(screenshotsDir, '05-landing-light.png'),
|
||||
fullPage: true
|
||||
});
|
||||
console.log(' ✓ Saved: 05-landing-light.png');
|
||||
|
||||
// Scroll to beta section
|
||||
console.log('6. Beta section (light mode)...');
|
||||
await lightPage.evaluate(() => {
|
||||
const betaSection = document.querySelector('[class*="beta"]') ||
|
||||
document.evaluate("//h3[contains(text(),'Try It Free')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue?.closest('section');
|
||||
if (betaSection) betaSection.scrollIntoView({ behavior: 'instant' });
|
||||
});
|
||||
await lightPage.waitForTimeout(500);
|
||||
await lightPage.screenshot({
|
||||
path: join(screenshotsDir, '06-beta-section-light.png'),
|
||||
fullPage: false
|
||||
});
|
||||
console.log(' ✓ Saved: 06-beta-section-light.png');
|
||||
|
||||
// Scroll to pricing section
|
||||
console.log('7. Pricing section (light mode)...');
|
||||
await lightPage.goto(`${baseUrl}#pricing`, { waitUntil: 'networkidle' });
|
||||
await lightPage.waitForTimeout(500);
|
||||
await lightPage.screenshot({
|
||||
path: join(screenshotsDir, '07-pricing-light.png'),
|
||||
fullPage: false
|
||||
});
|
||||
console.log(' ✓ Saved: 07-pricing-light.png');
|
||||
|
||||
// Footer
|
||||
console.log('8. Footer (light mode)...');
|
||||
await lightPage.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
|
||||
await lightPage.waitForTimeout(500);
|
||||
await lightPage.screenshot({
|
||||
path: join(screenshotsDir, '08-footer-light.png'),
|
||||
fullPage: false
|
||||
});
|
||||
console.log(' ✓ Saved: 08-footer-light.png');
|
||||
|
||||
await lightContext.close();
|
||||
|
||||
// Note: App page requires authentication, so we can't test it directly
|
||||
// The instrumental and lyrics review pages require specific job data
|
||||
|
||||
await browser.close();
|
||||
|
||||
console.log('\n✅ Screenshots saved to:', screenshotsDir);
|
||||
console.log('\nReview checklist:');
|
||||
console.log('1. Primary buttons should be brand pink (#ff7acc) in both modes');
|
||||
console.log('2. Gradients should flow to pink in both modes');
|
||||
console.log('3. Beta section badge and button should be brand pink');
|
||||
console.log('4. Light mode backgrounds should be light, text should be dark');
|
||||
console.log('5. Dark mode backgrounds should be dark, text should be light');
|
||||
}
|
||||
|
||||
takeScreenshots().catch(err => {
|
||||
console.error('Error:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -6,21 +6,24 @@
|
||||
<title>Instrumental Review</title>
|
||||
<style>
|
||||
:root {
|
||||
/* Nomad Karaoke brand colors - see docs/BRAND-STYLE-GUIDE.md */
|
||||
--bg: #0f0f0f;
|
||||
--card: #1a1a1a;
|
||||
--card-border: #2a2a2a;
|
||||
--waveform-bg: #0d1117;
|
||||
--text: #e5e5e5;
|
||||
--text-muted: #888;
|
||||
--primary: #3b82f6;
|
||||
--primary-hover: #2563eb;
|
||||
--primary: #ff7acc;
|
||||
--primary-hover: #ff5bb8;
|
||||
--secondary: #252525;
|
||||
--secondary-hover: #333;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--danger: #ef4444;
|
||||
--pink: #ec4899;
|
||||
--blue: #60a5fa;
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
--blue: #3b82f6;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
@@ -20,6 +20,7 @@ from google.oauth2.credentials import Credentials
|
||||
import base64
|
||||
from email.mime.text import MIMEText
|
||||
from lyrics_transcriber.output.cdg import CDGGenerator
|
||||
from ..utils import sanitize_filename
|
||||
|
||||
|
||||
class KaraokeFinalise:
|
||||
@@ -1514,7 +1515,11 @@ class KaraokeFinalise:
|
||||
|
||||
email_body = template.format(youtube_url=youtube_url, dropbox_url=dropbox_url)
|
||||
|
||||
subject = f"{self.brand_code}: {artist} - {title}"
|
||||
# Sanitize artist/title to handle Unicode characters (curly quotes, em dashes, etc.)
|
||||
# that cause email header encoding issues (MIME headers use latin-1)
|
||||
safe_artist = sanitize_filename(artist) if artist else "Unknown"
|
||||
safe_title = sanitize_filename(title) if title else "Unknown"
|
||||
subject = f"{self.brand_code}: {safe_artist} - {safe_title}"
|
||||
|
||||
if self.dry_run:
|
||||
self.logger.info(f"DRY RUN: Would create email draft with subject: {subject}")
|
||||
|
||||
@@ -1,7 +1,85 @@
|
||||
import re
|
||||
|
||||
# Unicode character replacements for ASCII-safe filenames
|
||||
# These characters cause issues with HTTP headers (latin-1 encoding) and some filesystems
|
||||
# =============================================================================
|
||||
# Text Normalization
|
||||
# =============================================================================
|
||||
# These mappings normalize visually-similar Unicode characters to their standard
|
||||
# ASCII equivalents. This ensures consistency in stored data and reliable search.
|
||||
|
||||
# Apostrophe-like characters -> standard apostrophe (U+0027)
|
||||
APOSTROPHE_REPLACEMENTS = {
|
||||
"\u2018": "'", # LEFT SINGLE QUOTATION MARK (')
|
||||
"\u2019": "'", # RIGHT SINGLE QUOTATION MARK (') - common from Word/macOS
|
||||
"\u201A": "'", # SINGLE LOW-9 QUOTATION MARK (‚)
|
||||
"\u201B": "'", # SINGLE HIGH-REVERSED-9 QUOTATION MARK (‛)
|
||||
"\u0060": "'", # GRAVE ACCENT (`) - backtick
|
||||
"\u00B4": "'", # ACUTE ACCENT (´)
|
||||
"\u2032": "'", # PRIME (′)
|
||||
"\u02B9": "'", # MODIFIER LETTER PRIME (ʹ)
|
||||
"\u02BC": "'", # MODIFIER LETTER APOSTROPHE (ʼ)
|
||||
"\u02C8": "'", # MODIFIER LETTER VERTICAL LINE (ˈ)
|
||||
"\u0301": "'", # COMBINING ACUTE ACCENT (standalone, rare)
|
||||
}
|
||||
|
||||
# Double quote-like characters -> standard double quote (U+0022)
|
||||
DOUBLE_QUOTE_REPLACEMENTS = {
|
||||
"\u201C": '"', # LEFT DOUBLE QUOTATION MARK (")
|
||||
"\u201D": '"', # RIGHT DOUBLE QUOTATION MARK (")
|
||||
"\u201E": '"', # DOUBLE LOW-9 QUOTATION MARK („)
|
||||
"\u201F": '"', # DOUBLE HIGH-REVERSED-9 QUOTATION MARK (‟)
|
||||
"\u2033": '"', # DOUBLE PRIME (″)
|
||||
"\u02DD": '"', # DOUBLE ACUTE ACCENT (˝)
|
||||
"\u3003": '"', # DITTO MARK (〃) - CJK
|
||||
}
|
||||
|
||||
# Dash-like characters -> standard hyphen-minus (U+002D)
|
||||
DASH_REPLACEMENTS = {
|
||||
"\u2013": "-", # EN DASH (–)
|
||||
"\u2014": "-", # EM DASH (—)
|
||||
"\u2015": "-", # HORIZONTAL BAR (―)
|
||||
"\u2212": "-", # MINUS SIGN (−)
|
||||
"\u2010": "-", # HYPHEN (‐)
|
||||
"\u2011": "-", # NON-BREAKING HYPHEN (‑)
|
||||
"\u2012": "-", # FIGURE DASH (‒)
|
||||
"\u00AD": "-", # SOFT HYPHEN (invisible, but normalize anyway)
|
||||
}
|
||||
|
||||
# Whitespace characters -> standard space (U+0020)
|
||||
WHITESPACE_REPLACEMENTS = {
|
||||
"\u00A0": " ", # NO-BREAK SPACE
|
||||
"\u2002": " ", # EN SPACE
|
||||
"\u2003": " ", # EM SPACE
|
||||
"\u2004": " ", # THREE-PER-EM SPACE
|
||||
"\u2005": " ", # FOUR-PER-EM SPACE
|
||||
"\u2006": " ", # SIX-PER-EM SPACE
|
||||
"\u2007": " ", # FIGURE SPACE
|
||||
"\u2008": " ", # PUNCTUATION SPACE
|
||||
"\u2009": " ", # THIN SPACE
|
||||
"\u200A": " ", # HAIR SPACE
|
||||
"\u200B": "", # ZERO WIDTH SPACE (remove entirely)
|
||||
"\u202F": " ", # NARROW NO-BREAK SPACE
|
||||
"\u205F": " ", # MEDIUM MATHEMATICAL SPACE
|
||||
"\u3000": " ", # IDEOGRAPHIC SPACE (CJK full-width space)
|
||||
"\uFEFF": "", # ZERO WIDTH NO-BREAK SPACE / BOM (remove entirely)
|
||||
}
|
||||
|
||||
# Other replacements
|
||||
OTHER_REPLACEMENTS = {
|
||||
"\u2026": "...", # HORIZONTAL ELLIPSIS (…)
|
||||
"\u22EF": "...", # MIDLINE HORIZONTAL ELLIPSIS (⋯)
|
||||
}
|
||||
|
||||
# Combined replacement dict for normalize_text()
|
||||
TEXT_NORMALIZATIONS = {
|
||||
**APOSTROPHE_REPLACEMENTS,
|
||||
**DOUBLE_QUOTE_REPLACEMENTS,
|
||||
**DASH_REPLACEMENTS,
|
||||
**WHITESPACE_REPLACEMENTS,
|
||||
**OTHER_REPLACEMENTS,
|
||||
}
|
||||
|
||||
# Legacy dict for backwards compatibility (used by sanitize_filename)
|
||||
# This is a subset focused on HTTP header safety
|
||||
UNICODE_REPLACEMENTS = {
|
||||
# Curly/smart quotes -> straight quotes
|
||||
"\u2018": "'", # LEFT SINGLE QUOTATION MARK
|
||||
@@ -20,25 +98,102 @@ UNICODE_REPLACEMENTS = {
|
||||
}
|
||||
|
||||
|
||||
def normalize_text(text: str) -> str:
|
||||
"""
|
||||
Normalize visually-similar Unicode characters to standard ASCII equivalents.
|
||||
|
||||
This function standardizes text for consistency in stored data and reliable
|
||||
search/matching. It converts:
|
||||
- Curly quotes and backticks -> straight quotes
|
||||
- Various dashes (en dash, em dash, minus) -> hyphen
|
||||
- Various whitespace characters -> regular space
|
||||
- Ellipsis character -> three dots
|
||||
|
||||
This function also:
|
||||
- Collapses multiple spaces to a single space
|
||||
- Strips leading/trailing whitespace
|
||||
|
||||
Unlike sanitize_filename(), this does NOT:
|
||||
- Remove filesystem-unsafe characters (/, \, :, *, ?, ", <, >, |)
|
||||
- Collapse multiple underscores
|
||||
- Strip leading/trailing periods
|
||||
|
||||
This should be applied to user-facing text like artist names and song titles
|
||||
at input time to ensure data consistency.
|
||||
|
||||
Args:
|
||||
text: The text to normalize
|
||||
|
||||
Returns:
|
||||
Normalized text with standard ASCII equivalents, or None if input is None
|
||||
|
||||
Examples:
|
||||
>>> normalize_text("Don't Stop") # curly apostrophe
|
||||
"Don't Stop"
|
||||
>>> normalize_text("Song — Title") # em dash
|
||||
"Song - Title"
|
||||
>>> normalize_text("Hello\u00A0World") # non-breaking space
|
||||
"Hello World"
|
||||
"""
|
||||
if text is None:
|
||||
return None
|
||||
|
||||
if not isinstance(text, str):
|
||||
return text
|
||||
|
||||
# Apply all normalizations
|
||||
for unicode_char, replacement in TEXT_NORMALIZATIONS.items():
|
||||
text = text.replace(unicode_char, replacement)
|
||||
|
||||
# Collapse multiple spaces (but preserve intentional spacing structure)
|
||||
text = re.sub(r' {2,}', ' ', text)
|
||||
|
||||
# Strip leading/trailing whitespace
|
||||
text = text.strip()
|
||||
|
||||
return text
|
||||
|
||||
|
||||
def sanitize_filename(filename):
|
||||
"""Replace or remove characters that are unsafe for filenames."""
|
||||
"""
|
||||
Replace or remove characters that are unsafe for filenames.
|
||||
|
||||
This function makes text safe for use in:
|
||||
- Filesystem paths
|
||||
- HTTP headers (Content-Disposition)
|
||||
- API requests (Modal, Google Drive, Dropbox)
|
||||
|
||||
It applies normalize_text() first, then additionally:
|
||||
- Replaces filesystem-unsafe characters with underscores
|
||||
- Strips leading/trailing periods and spaces
|
||||
- Collapses multiple underscores/spaces
|
||||
|
||||
Args:
|
||||
filename: The filename to sanitize
|
||||
|
||||
Returns:
|
||||
Sanitized filename safe for filesystems and HTTP headers
|
||||
"""
|
||||
if filename is None:
|
||||
return None
|
||||
|
||||
# First, normalize Unicode characters that cause HTTP header encoding issues
|
||||
# (e.g., curly quotes from macOS/Word that can't be encoded in latin-1)
|
||||
for unicode_char, ascii_replacement in UNICODE_REPLACEMENTS.items():
|
||||
filename = filename.replace(unicode_char, ascii_replacement)
|
||||
# First, normalize Unicode characters
|
||||
filename = normalize_text(filename)
|
||||
|
||||
if filename is None:
|
||||
return None
|
||||
|
||||
# Replace problematic characters with underscores
|
||||
for char in ["\\", "/", ":", "*", "?", '"', "<", ">", "|"]:
|
||||
filename = filename.replace(char, "_")
|
||||
|
||||
# Remove any trailing periods or spaces
|
||||
filename = filename.rstrip(". ") # Added period here as well
|
||||
filename = filename.rstrip(". ")
|
||||
# Remove any leading periods or spaces
|
||||
filename = filename.lstrip(". ")
|
||||
# Replace multiple underscores with a single one
|
||||
filename = re.sub(r'_+', '_', filename)
|
||||
# Replace multiple spaces with a single one
|
||||
filename = re.sub(r' +', ' ', filename)
|
||||
|
||||
return filename
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "lyrics-transcriber-frontend",
|
||||
"version": "0.83.0",
|
||||
"version": "0.84.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "lyrics-transcriber-frontend",
|
||||
"version": "0.83.0",
|
||||
"version": "0.84.0",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.0",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "lyrics-transcriber-frontend",
|
||||
"private": true,
|
||||
"homepage": "https://nomadkaraoke.github.io/lyrics-transcriber-frontend",
|
||||
"version": "0.84.0",
|
||||
"version": "0.86.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -98,7 +98,7 @@ export const AIFeedbackModal: React.FC<Props> = ({ isOpen, onClose, onSubmit, su
|
||||
onClick={() =>
|
||||
onSubmit({ reviewerAction, finalText: finalText || undefined, reasonCategory, reasonDetail: reasonDetail || undefined })
|
||||
}
|
||||
style={{ background: '#f97316', color: '#fff', border: 'none', borderRadius: 4, padding: '6px 12px', cursor: 'pointer' }}
|
||||
style={{ background: '#ff7acc', color: '#fff', border: 'none', borderRadius: 4, padding: '6px 12px', cursor: 'pointer' }}
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
|
||||
@@ -43,21 +43,21 @@ const WordContainer = styled(Box, {
|
||||
'50%': { opacity: 0.5 }
|
||||
},
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(34, 197, 94, 0.35)' // green tint hover for dark mode
|
||||
backgroundColor: 'rgba(34, 197, 94, 0.35)' // green tint hover - works for both modes
|
||||
}
|
||||
}))
|
||||
|
||||
const OriginalWordLabel = styled(Box)({
|
||||
const OriginalWordLabel = styled(Box)(({ theme }) => ({
|
||||
position: 'absolute',
|
||||
top: '-14px',
|
||||
left: '0',
|
||||
fontSize: '0.6rem',
|
||||
color: '#888888', // slate-400 for dark mode
|
||||
color: theme.palette.text.secondary, // Theme-aware text color
|
||||
textDecoration: 'line-through',
|
||||
opacity: 0.7,
|
||||
whiteSpace: 'nowrap',
|
||||
pointerEvents: 'none'
|
||||
})
|
||||
}))
|
||||
|
||||
const ActionsContainer = styled(Box)({
|
||||
display: 'inline-flex',
|
||||
@@ -72,10 +72,14 @@ const ActionButton = styled(IconButton)(({ theme }) => ({
|
||||
minHeight: '20px',
|
||||
width: '20px',
|
||||
height: '20px',
|
||||
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
|
||||
backgroundColor: theme.palette.mode === 'dark'
|
||||
? 'rgba(30, 41, 59, 0.9)' // slate-800 with opacity for dark mode
|
||||
: 'rgba(241, 245, 249, 0.9)', // slate-100 for light mode
|
||||
border: `1px solid ${theme.palette.divider}`,
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(51, 65, 85, 1)', // slate-700 for dark mode
|
||||
backgroundColor: theme.palette.mode === 'dark'
|
||||
? 'rgba(51, 65, 85, 1)' // slate-700 for dark mode
|
||||
: 'rgba(226, 232, 240, 1)', // slate-200 for light mode
|
||||
transform: 'scale(1.1)'
|
||||
},
|
||||
'& .MuiSvgIcon-root': {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Box, Button } from '@mui/material'
|
||||
import { Box, Button, useMediaQuery, useTheme } from '@mui/material'
|
||||
import DeleteIcon from '@mui/icons-material/Delete'
|
||||
import RestoreIcon from '@mui/icons-material/RestoreFromTrash'
|
||||
import HistoryIcon from '@mui/icons-material/History'
|
||||
@@ -25,13 +25,29 @@ export default function EditActionBar({
|
||||
originalTranscribedSegment,
|
||||
isGlobal = false
|
||||
}: EditActionBarProps) {
|
||||
const theme = useTheme()
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1, width: '100%' }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
alignItems: isMobile ? 'stretch' : 'center',
|
||||
gap: 1,
|
||||
width: '100%'
|
||||
}}>
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 1,
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: isMobile ? 'center' : 'flex-start'
|
||||
}}>
|
||||
<Button
|
||||
startIcon={<RestoreIcon />}
|
||||
onClick={onReset}
|
||||
color="warning"
|
||||
size={isMobile ? 'small' : 'medium'}
|
||||
>
|
||||
Reset
|
||||
</Button>
|
||||
@@ -39,6 +55,7 @@ export default function EditActionBar({
|
||||
<Button
|
||||
onClick={onRevertToOriginal}
|
||||
startIcon={<HistoryIcon />}
|
||||
size={isMobile ? 'small' : 'medium'}
|
||||
>
|
||||
Un-Correct
|
||||
</Button>
|
||||
@@ -48,17 +65,26 @@ export default function EditActionBar({
|
||||
startIcon={<DeleteIcon />}
|
||||
onClick={onDelete}
|
||||
color="error"
|
||||
size={isMobile ? 'small' : 'medium'}
|
||||
>
|
||||
Delete Segment
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
<Box sx={{ ml: 'auto', display: 'flex', gap: 1 }}>
|
||||
<Button onClick={onClose}>Cancel</Button>
|
||||
<Box sx={{
|
||||
ml: isMobile ? 0 : 'auto',
|
||||
display: 'flex',
|
||||
gap: 1,
|
||||
justifyContent: isMobile ? 'center' : 'flex-end'
|
||||
}}>
|
||||
<Button onClick={onClose} size={isMobile ? 'small' : 'medium'}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={onSave}
|
||||
variant="contained"
|
||||
disabled={!editedSegment || editedSegment.words.length === 0}
|
||||
size={isMobile ? 'small' : 'medium'}
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
|
||||
@@ -6,7 +6,9 @@ import {
|
||||
IconButton,
|
||||
Box,
|
||||
CircularProgress,
|
||||
Typography
|
||||
Typography,
|
||||
useMediaQuery,
|
||||
useTheme
|
||||
} from '@mui/material'
|
||||
import CloseIcon from '@mui/icons-material/Close'
|
||||
import PlayCircleOutlineIcon from '@mui/icons-material/PlayCircleOutline'
|
||||
@@ -33,6 +35,8 @@ interface TimelineSectionProps {
|
||||
onPlaySegment?: (startTime: number) => void
|
||||
startManualSync: () => void
|
||||
isGlobal: boolean
|
||||
onTapStart?: () => void
|
||||
onTapEnd?: () => void
|
||||
}
|
||||
|
||||
const MemoizedTimelineSection = memo(function TimelineSection({
|
||||
@@ -47,7 +51,9 @@ const MemoizedTimelineSection = memo(function TimelineSection({
|
||||
onWordUpdate,
|
||||
onPlaySegment,
|
||||
startManualSync,
|
||||
isGlobal
|
||||
isGlobal,
|
||||
onTapStart,
|
||||
onTapEnd
|
||||
}: TimelineSectionProps) {
|
||||
return (
|
||||
<EditTimelineSection
|
||||
@@ -66,6 +72,8 @@ const MemoizedTimelineSection = memo(function TimelineSection({
|
||||
onPlaySegment={onPlaySegment}
|
||||
startManualSync={startManualSync}
|
||||
isGlobal={isGlobal}
|
||||
onTapStart={onTapStart}
|
||||
onTapEnd={onTapEnd}
|
||||
/>
|
||||
)
|
||||
})
|
||||
@@ -195,6 +203,9 @@ export default function EditModal({
|
||||
// hasOriginalTranscribedSegment: !!originalTranscribedSegment
|
||||
// });
|
||||
|
||||
const theme = useTheme()
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
|
||||
|
||||
const [editedSegment, setEditedSegment] = useState<LyricsSegment | null>(segment)
|
||||
const [isPlaying, setIsPlaying] = useState(false)
|
||||
|
||||
@@ -224,7 +235,9 @@ export default function EditModal({
|
||||
startManualSync,
|
||||
cleanupManualSync,
|
||||
handleSpacebar,
|
||||
isSpacebarPressed
|
||||
isSpacebarPressed,
|
||||
handleTapStart,
|
||||
handleTapEnd
|
||||
} = useManualSync({
|
||||
editedSegment,
|
||||
currentTime,
|
||||
@@ -588,6 +601,7 @@ export default function EditModal({
|
||||
onClose={handleClose}
|
||||
maxWidth="md"
|
||||
fullWidth
|
||||
fullScreen={isMobile}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey && !isLoading) {
|
||||
e.preventDefault()
|
||||
@@ -596,8 +610,8 @@ export default function EditModal({
|
||||
}}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
height: '90vh',
|
||||
margin: '5vh 0'
|
||||
height: isMobile ? '100%' : '90vh',
|
||||
margin: isMobile ? 0 : '5vh 0'
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -614,17 +628,19 @@ export default function EditModal({
|
||||
}}
|
||||
>
|
||||
{isLoading && (
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
backgroundColor: 'rgba(30, 41, 59, 0.95)', // slate-800 with opacity for dark mode
|
||||
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
||||
? 'rgba(30, 41, 59, 0.95)' // slate-800 with opacity for dark mode
|
||||
: 'rgba(248, 250, 252, 0.95)', // light background for light mode
|
||||
zIndex: 10
|
||||
}}>
|
||||
<CircularProgress size={60} thickness={4} />
|
||||
@@ -652,6 +668,8 @@ export default function EditModal({
|
||||
onPlaySegment={onPlaySegment}
|
||||
startManualSync={startManualSync}
|
||||
isGlobal={isGlobal}
|
||||
onTapStart={handleTapStart}
|
||||
onTapEnd={handleTapEnd}
|
||||
/>
|
||||
|
||||
<MemoizedWordList
|
||||
|
||||
@@ -4,7 +4,9 @@ import {
|
||||
Typography,
|
||||
IconButton,
|
||||
Tooltip,
|
||||
Stack
|
||||
Stack,
|
||||
useMediaQuery,
|
||||
useTheme
|
||||
} from '@mui/material'
|
||||
import PlayCircleOutlineIcon from '@mui/icons-material/PlayCircleOutline'
|
||||
import CancelIcon from '@mui/icons-material/Cancel'
|
||||
@@ -17,10 +19,68 @@ import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline'
|
||||
import PlayArrowIcon from '@mui/icons-material/PlayArrow'
|
||||
import StopIcon from '@mui/icons-material/Stop'
|
||||
import CenterFocusStrongIcon from '@mui/icons-material/CenterFocusStrong'
|
||||
import TouchAppIcon from '@mui/icons-material/TouchApp'
|
||||
import TimelineEditor from './TimelineEditor'
|
||||
import { Word } from '../types'
|
||||
import { useState, useEffect, useCallback, useRef, useMemo, memo } from 'react'
|
||||
|
||||
// Separate TapButton component to properly track local press state
|
||||
// This prevents issues where onMouseLeave fires before parent state updates
|
||||
const TapButton = memo(function TapButton({
|
||||
isSpacebarPressed,
|
||||
onTapStart,
|
||||
onTapEnd
|
||||
}: {
|
||||
isSpacebarPressed: boolean
|
||||
onTapStart: () => void
|
||||
onTapEnd: () => void
|
||||
}) {
|
||||
const isPressedRef = useRef(false)
|
||||
|
||||
const handleTapStart = useCallback(() => {
|
||||
isPressedRef.current = true
|
||||
onTapStart()
|
||||
}, [onTapStart])
|
||||
|
||||
const handleTapEnd = useCallback(() => {
|
||||
if (isPressedRef.current) {
|
||||
isPressedRef.current = false
|
||||
onTapEnd()
|
||||
}
|
||||
}, [onTapEnd])
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="contained"
|
||||
color={isSpacebarPressed ? "secondary" : "primary"}
|
||||
onTouchStart={(e) => {
|
||||
e.preventDefault()
|
||||
handleTapStart()
|
||||
}}
|
||||
onTouchEnd={(e) => {
|
||||
e.preventDefault()
|
||||
handleTapEnd()
|
||||
}}
|
||||
onMouseDown={handleTapStart}
|
||||
onMouseUp={handleTapEnd}
|
||||
onMouseLeave={handleTapEnd}
|
||||
startIcon={<TouchAppIcon />}
|
||||
sx={{
|
||||
py: 2,
|
||||
fontSize: '1.1rem',
|
||||
fontWeight: 'bold',
|
||||
width: '100%',
|
||||
minHeight: '56px',
|
||||
userSelect: 'none',
|
||||
WebkitUserSelect: 'none',
|
||||
touchAction: 'manipulation'
|
||||
}}
|
||||
>
|
||||
{isSpacebarPressed ? "HOLD..." : "TAP"}
|
||||
</Button>
|
||||
)
|
||||
})
|
||||
|
||||
interface EditTimelineSectionProps {
|
||||
words: Word[]
|
||||
startTime: number
|
||||
@@ -44,6 +104,8 @@ interface EditTimelineSectionProps {
|
||||
isGlobal?: boolean
|
||||
defaultZoomLevel?: number
|
||||
isReplaceAllMode?: boolean
|
||||
onTapStart?: () => void
|
||||
onTapEnd?: () => void
|
||||
}
|
||||
|
||||
// Memoized control buttons to prevent unnecessary re-renders
|
||||
@@ -91,16 +153,21 @@ const TimelineControls = memo(({
|
||||
onStopAudio?: () => void
|
||||
}) => {
|
||||
return (
|
||||
<Stack direction="row" spacing={1} alignItems="center">
|
||||
<Stack
|
||||
direction="row"
|
||||
spacing={0.5}
|
||||
alignItems="center"
|
||||
sx={{ flexWrap: 'wrap', justifyContent: 'center', gap: 0.5 }}
|
||||
>
|
||||
{isGlobal && (
|
||||
<>
|
||||
<>
|
||||
<Tooltip title="Scroll Left">
|
||||
<IconButton
|
||||
onClick={onScrollLeft}
|
||||
disabled={visibleStartTime <= startTime}
|
||||
size="small"
|
||||
>
|
||||
<ArrowBackIcon />
|
||||
<ArrowBackIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Zoom Out (Show More Time)">
|
||||
@@ -109,7 +176,7 @@ const TimelineControls = memo(({
|
||||
disabled={zoomLevel >= (endTime - startTime) || (isReplaceAllMode && isManualSyncing && !isPaused)}
|
||||
size="small"
|
||||
>
|
||||
<ZoomOutIcon />
|
||||
<ZoomOutIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Zoom In (Show Less Time)">
|
||||
@@ -118,7 +185,7 @@ const TimelineControls = memo(({
|
||||
disabled={zoomLevel <= 2 || (isReplaceAllMode && isManualSyncing && !isPaused)}
|
||||
size="small"
|
||||
>
|
||||
<ZoomInIcon />
|
||||
<ZoomInIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Scroll Right">
|
||||
@@ -127,7 +194,7 @@ const TimelineControls = memo(({
|
||||
disabled={visibleEndTime >= endTime}
|
||||
size="small"
|
||||
>
|
||||
<ArrowForwardIcon />
|
||||
<ArrowForwardIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
@@ -140,7 +207,7 @@ const TimelineControls = memo(({
|
||||
color={autoScrollEnabled ? "primary" : "default"}
|
||||
size="small"
|
||||
>
|
||||
{autoScrollEnabled ? <AutorenewIcon /> : <PauseCircleOutlineIcon />}
|
||||
{autoScrollEnabled ? <AutorenewIcon fontSize="small" /> : <PauseCircleOutlineIcon fontSize="small" />}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title="Jump to Current Playback Position">
|
||||
@@ -149,7 +216,7 @@ const TimelineControls = memo(({
|
||||
disabled={!currentTime}
|
||||
size="small"
|
||||
>
|
||||
<CenterFocusStrongIcon />
|
||||
<CenterFocusStrongIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
@@ -158,26 +225,27 @@ const TimelineControls = memo(({
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={onStopAudio}
|
||||
startIcon={<StopIcon />}
|
||||
startIcon={<StopIcon fontSize="small" />}
|
||||
color="error"
|
||||
size="small"
|
||||
>
|
||||
Stop Audio
|
||||
Stop
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant={isManualSyncing ? "outlined" : "contained"}
|
||||
onClick={onStartManualSync}
|
||||
startIcon={isManualSyncing ? <CancelIcon /> : <PlayCircleOutlineIcon />}
|
||||
startIcon={isManualSyncing ? <CancelIcon fontSize="small" /> : <PlayCircleOutlineIcon fontSize="small" />}
|
||||
color={isManualSyncing ? "error" : "primary"}
|
||||
size="small"
|
||||
>
|
||||
{isManualSyncing ? "Cancel Sync" : "Manual Sync"}
|
||||
{isManualSyncing ? "Cancel" : "Tap To Sync"}
|
||||
</Button>
|
||||
{isManualSyncing && isReplaceAllMode && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={onPauseResume}
|
||||
startIcon={isPaused ? <PlayArrowIcon /> : <PauseCircleOutlineIcon />}
|
||||
startIcon={isPaused ? <PlayArrowIcon fontSize="small" /> : <PauseCircleOutlineIcon fontSize="small" />}
|
||||
color={isPaused ? "success" : "warning"}
|
||||
size="small"
|
||||
>
|
||||
@@ -210,8 +278,12 @@ export default function EditTimelineSection({
|
||||
isPaused = false,
|
||||
isGlobal = false,
|
||||
defaultZoomLevel = 10,
|
||||
isReplaceAllMode = false
|
||||
isReplaceAllMode = false,
|
||||
onTapStart,
|
||||
onTapEnd
|
||||
}: EditTimelineSectionProps) {
|
||||
const theme = useTheme()
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
|
||||
// Add state for zoom level - use larger default for Replace All mode
|
||||
const [zoomLevel, setZoomLevel] = useState(defaultZoomLevel)
|
||||
const [visibleStartTime, setVisibleStartTime] = useState(startTime)
|
||||
@@ -432,7 +504,7 @@ export default function EditTimelineSection({
|
||||
return (
|
||||
<>
|
||||
<Box
|
||||
sx={{ height: '120px', mb: 2 }}
|
||||
sx={{ height: isMobile ? '80px' : '120px', mb: 0 }}
|
||||
ref={timelineRef}
|
||||
onWheel={handleScroll}
|
||||
>
|
||||
@@ -447,14 +519,30 @@ export default function EditTimelineSection({
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Original Time Range: {originalStartTime?.toFixed(2) ?? 'N/A'} - {originalEndTime?.toFixed(2) ?? 'N/A'}
|
||||
<br />
|
||||
Current Time Range: {currentStartTime?.toFixed(2) ?? 'N/A'} - {currentEndTime?.toFixed(2) ?? 'N/A'}
|
||||
</Typography>
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
alignItems: isMobile ? 'stretch' : 'center',
|
||||
justifyContent: 'space-between',
|
||||
gap: isMobile ? 1 : 0,
|
||||
mt: isMobile ? 1.5 : 0,
|
||||
mb: isMobile ? 2 : 0
|
||||
}}>
|
||||
{/* Time range info - hidden on mobile to save space */}
|
||||
{!isMobile && (
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Original Time Range: {originalStartTime?.toFixed(2) ?? 'N/A'} - {originalEndTime?.toFixed(2) ?? 'N/A'}
|
||||
<br />
|
||||
Current Time Range: {currentStartTime?.toFixed(2) ?? 'N/A'} - {currentEndTime?.toFixed(2) ?? 'N/A'}
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
alignItems: isMobile ? 'stretch' : 'center',
|
||||
gap: isMobile ? 1 : 2
|
||||
}}>
|
||||
<TimelineControls
|
||||
isGlobal={isGlobal}
|
||||
visibleStartTime={visibleStartTime}
|
||||
@@ -478,17 +566,25 @@ export default function EditTimelineSection({
|
||||
onStopAudio={onStopAudio}
|
||||
/>
|
||||
{currentWordInfo && (
|
||||
<Box>
|
||||
<Box sx={{ textAlign: isMobile ? 'center' : 'left' }}>
|
||||
<Typography variant="body2">
|
||||
Word {currentWordInfo.index} of {currentWordInfo.total}: <strong>{currentWordInfo.text}</strong>
|
||||
</Typography>
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
{isSpacebarPressed ?
|
||||
"Holding spacebar... Release when word ends" :
|
||||
"Press spacebar when word starts (tap for short words, hold for long words)"}
|
||||
"Holding... Release when word ends" :
|
||||
(isMobile ? "Tap the button when word starts" : "Press spacebar when word starts (tap for short words, hold for long words)")}
|
||||
</Typography>
|
||||
</Box>
|
||||
)}
|
||||
{/* Mobile TAP button for manual sync */}
|
||||
{isMobile && isManualSyncing && onTapStart && onTapEnd && (
|
||||
<TapButton
|
||||
isSpacebarPressed={isSpacebarPressed}
|
||||
onTapStart={onTapStart}
|
||||
onTapEnd={onTapEnd}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
</>
|
||||
|
||||
@@ -4,7 +4,9 @@ import {
|
||||
IconButton,
|
||||
Button,
|
||||
Pagination,
|
||||
Typography
|
||||
Typography,
|
||||
useMediaQuery,
|
||||
useTheme
|
||||
} from '@mui/material'
|
||||
import DeleteIcon from '@mui/icons-material/Delete'
|
||||
import SplitIcon from '@mui/icons-material/CallSplit'
|
||||
@@ -34,7 +36,8 @@ const WordRow = memo(function WordRow({
|
||||
onSplitWord,
|
||||
onRemoveWord,
|
||||
wordsLength,
|
||||
onTabNavigation
|
||||
onTabNavigation,
|
||||
isMobile
|
||||
}: {
|
||||
word: Word
|
||||
index: number
|
||||
@@ -43,11 +46,10 @@ const WordRow = memo(function WordRow({
|
||||
onRemoveWord: (index: number) => void
|
||||
wordsLength: number
|
||||
onTabNavigation: (currentIndex: number) => void
|
||||
isMobile: boolean
|
||||
}) {
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
// console.log('KeyDown event:', e.key, 'Shift:', e.shiftKey, 'Index:', index);
|
||||
if (e.key === 'Tab' && !e.shiftKey) {
|
||||
// console.log('Tab key detected, preventing default and navigating');
|
||||
e.preventDefault();
|
||||
onTabNavigation(index);
|
||||
}
|
||||
@@ -56,54 +58,99 @@ const WordRow = memo(function WordRow({
|
||||
return (
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
gap: 2,
|
||||
alignItems: 'center',
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
gap: isMobile ? 1 : 2,
|
||||
alignItems: isMobile ? 'stretch' : 'center',
|
||||
padding: '4px 0',
|
||||
}}>
|
||||
<TextField
|
||||
label={`Word ${index}`}
|
||||
value={word.text}
|
||||
onChange={(e) => onWordUpdate(index, { text: e.target.value })}
|
||||
onKeyDown={handleKeyDown}
|
||||
fullWidth
|
||||
size="small"
|
||||
id={`word-text-${index}`}
|
||||
/>
|
||||
<TextField
|
||||
label="Start Time"
|
||||
value={word.start_time?.toFixed(2) ?? ''}
|
||||
onChange={(e) => onWordUpdate(index, { start_time: parseFloat(e.target.value) })}
|
||||
type="number"
|
||||
inputProps={{ step: 0.01 }}
|
||||
sx={{ width: '150px' }}
|
||||
size="small"
|
||||
/>
|
||||
<TextField
|
||||
label="End Time"
|
||||
value={word.end_time?.toFixed(2) ?? ''}
|
||||
onChange={(e) => onWordUpdate(index, { end_time: parseFloat(e.target.value) })}
|
||||
type="number"
|
||||
inputProps={{ step: 0.01 }}
|
||||
sx={{ width: '150px' }}
|
||||
size="small"
|
||||
/>
|
||||
<IconButton
|
||||
onClick={() => onSplitWord(index)}
|
||||
title="Split Word"
|
||||
sx={{ color: 'primary.main' }}
|
||||
size="small"
|
||||
>
|
||||
<SplitIcon fontSize="small" />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => onRemoveWord(index)}
|
||||
disabled={wordsLength <= 1}
|
||||
title="Remove Word"
|
||||
sx={{ color: 'error.main' }}
|
||||
size="small"
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
{/* Word text field - full width on mobile */}
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
gap: 1,
|
||||
alignItems: 'center',
|
||||
flex: isMobile ? 'none' : 1
|
||||
}}>
|
||||
<TextField
|
||||
label={`Word ${index}`}
|
||||
value={word.text}
|
||||
onChange={(e) => onWordUpdate(index, { text: e.target.value })}
|
||||
onKeyDown={handleKeyDown}
|
||||
fullWidth
|
||||
size="small"
|
||||
id={`word-text-${index}`}
|
||||
/>
|
||||
{/* Action buttons inline with word on mobile */}
|
||||
{isMobile && (
|
||||
<>
|
||||
<IconButton
|
||||
onClick={() => onSplitWord(index)}
|
||||
title="Split Word"
|
||||
sx={{ color: 'primary.main' }}
|
||||
size="small"
|
||||
>
|
||||
<SplitIcon fontSize="small" />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => onRemoveWord(index)}
|
||||
disabled={wordsLength <= 1}
|
||||
title="Remove Word"
|
||||
sx={{ color: 'error.main' }}
|
||||
size="small"
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{/* Time fields - row on desktop, separate row on mobile */}
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
gap: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: isMobile ? 'flex-start' : 'flex-end'
|
||||
}}>
|
||||
<TextField
|
||||
label="Start"
|
||||
value={word.start_time?.toFixed(2) ?? ''}
|
||||
onChange={(e) => onWordUpdate(index, { start_time: parseFloat(e.target.value) })}
|
||||
type="number"
|
||||
inputProps={{ step: 0.01 }}
|
||||
sx={{ width: isMobile ? '80px' : '100px' }}
|
||||
size="small"
|
||||
/>
|
||||
<TextField
|
||||
label="End"
|
||||
value={word.end_time?.toFixed(2) ?? ''}
|
||||
onChange={(e) => onWordUpdate(index, { end_time: parseFloat(e.target.value) })}
|
||||
type="number"
|
||||
inputProps={{ step: 0.01 }}
|
||||
sx={{ width: isMobile ? '80px' : '100px' }}
|
||||
size="small"
|
||||
/>
|
||||
{/* Action buttons on desktop only */}
|
||||
{!isMobile && (
|
||||
<>
|
||||
<IconButton
|
||||
onClick={() => onSplitWord(index)}
|
||||
title="Split Word"
|
||||
sx={{ color: 'primary.main' }}
|
||||
size="small"
|
||||
>
|
||||
<SplitIcon fontSize="small" />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => onRemoveWord(index)}
|
||||
disabled={wordsLength <= 1}
|
||||
title="Remove Word"
|
||||
sx={{ color: 'error.main' }}
|
||||
size="small"
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
});
|
||||
@@ -122,7 +169,8 @@ const WordItem = memo(function WordItem({
|
||||
onMergeSegment,
|
||||
wordsLength,
|
||||
isGlobal,
|
||||
onTabNavigation
|
||||
onTabNavigation,
|
||||
isMobile
|
||||
}: {
|
||||
word: Word
|
||||
index: number
|
||||
@@ -137,6 +185,7 @@ const WordItem = memo(function WordItem({
|
||||
wordsLength: number
|
||||
isGlobal: boolean
|
||||
onTabNavigation: (currentIndex: number) => void
|
||||
isMobile: boolean
|
||||
}) {
|
||||
return (
|
||||
<Box key={word.id}>
|
||||
@@ -148,6 +197,7 @@ const WordItem = memo(function WordItem({
|
||||
onRemoveWord={onRemoveWord}
|
||||
wordsLength={wordsLength}
|
||||
onTabNavigation={onTabNavigation}
|
||||
isMobile={isMobile}
|
||||
/>
|
||||
|
||||
{/* Word divider with merge/split functionality */}
|
||||
@@ -168,16 +218,14 @@ const WordItem = memo(function WordItem({
|
||||
}
|
||||
canMerge={index < wordsLength - 1}
|
||||
isLast={index === wordsLength - 1}
|
||||
sx={{ ml: 15 }}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
{isGlobal && (
|
||||
<WordDivider
|
||||
onAddWord={() => onAddWord(index)}
|
||||
onMergeWords={index < wordsLength - 1 ? () => onMergeWords(index) : undefined}
|
||||
canMerge={index < wordsLength - 1}
|
||||
sx={{ ml: 15 }}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
@@ -195,6 +243,9 @@ export default function EditWordList({
|
||||
onMergeSegment,
|
||||
isGlobal = false
|
||||
}: EditWordListProps) {
|
||||
const theme = useTheme()
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
|
||||
|
||||
const [replacementText, setReplacementText] = useState('')
|
||||
const [page, setPage] = useState(1)
|
||||
const pageSize = isGlobal ? 50 : words.length // Use pagination only in global mode
|
||||
@@ -289,14 +340,12 @@ export default function EditWordList({
|
||||
onAddSegmentBefore={() => onAddSegment?.(0)}
|
||||
onMergeSegment={() => onMergeSegment?.(false)}
|
||||
isFirst={true}
|
||||
sx={{ ml: 15 }}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
{isGlobal && (
|
||||
<WordDivider
|
||||
onAddWord={() => onAddWord(-1)}
|
||||
sx={{ ml: 15 }}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Word list with scrolling */}
|
||||
@@ -312,7 +361,9 @@ export default function EditWordList({
|
||||
width: '8px',
|
||||
},
|
||||
'&::-webkit-scrollbar-thumb': {
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.2)', // slate-50 for dark mode
|
||||
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
||||
? 'rgba(248, 250, 252, 0.2)' // light scrollbar for dark mode
|
||||
: 'rgba(30, 41, 59, 0.3)', // dark scrollbar for light mode
|
||||
borderRadius: '4px',
|
||||
},
|
||||
scrollbarWidth: 'thin',
|
||||
@@ -336,6 +387,7 @@ export default function EditWordList({
|
||||
wordsLength={words.length}
|
||||
isGlobal={isGlobal}
|
||||
onTabNavigation={handleTabNavigation}
|
||||
isMobile={isMobile}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -39,6 +39,7 @@ interface HeaderProps {
|
||||
onFindReplace?: () => void
|
||||
onEditAll?: () => void
|
||||
onUnCorrectAll?: () => void
|
||||
onResetCorrections?: () => void
|
||||
onTimingOffset?: () => void
|
||||
timingOffsetMs?: number
|
||||
onUndo: () => void
|
||||
@@ -72,6 +73,7 @@ export default function Header({
|
||||
onFindReplace,
|
||||
onEditAll,
|
||||
onUnCorrectAll,
|
||||
onResetCorrections,
|
||||
onTimingOffset,
|
||||
timingOffsetMs = 0,
|
||||
onUndo,
|
||||
@@ -144,68 +146,44 @@ export default function Header({
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Review Mode toggle and Load File button */}
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
gap: 1,
|
||||
justifyContent: 'space-between',
|
||||
alignItems: isMobile ? 'stretch' : 'center',
|
||||
justifyContent: 'flex-end',
|
||||
alignItems: '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 && isAgenticMode && onReviewModeToggle && (
|
||||
<Tooltip title={reviewMode
|
||||
? "Hide inline correction actions"
|
||||
: "Show inline actions on all corrections for quick review"
|
||||
}>
|
||||
<Chip
|
||||
icon={<VisibilityIcon />}
|
||||
label={reviewMode ? "Review Mode" : "Review Off"}
|
||||
onClick={() => onReviewModeToggle(!reviewMode)}
|
||||
color={reviewMode ? "secondary" : "default"}
|
||||
variant={reviewMode ? "filled" : "outlined"}
|
||||
size="small"
|
||||
sx={{
|
||||
cursor: 'pointer',
|
||||
'& .MuiChip-icon': { fontSize: '1rem' }
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{!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"
|
||||
{!isReadOnly && isAgenticMode && onReviewModeToggle && (
|
||||
<Tooltip title={reviewMode
|
||||
? "Hide inline correction actions"
|
||||
: "Show inline actions on all corrections for quick review"
|
||||
}>
|
||||
<Chip
|
||||
icon={<VisibilityIcon />}
|
||||
label={reviewMode ? "Review Mode" : "Review Off"}
|
||||
onClick={() => onReviewModeToggle(!reviewMode)}
|
||||
color={reviewMode ? "secondary" : "default"}
|
||||
variant={reviewMode ? "filled" : "outlined"}
|
||||
size="small"
|
||||
startIcon={<UploadFileIcon />}
|
||||
onClick={onFileLoad}
|
||||
fullWidth={isMobile}
|
||||
>
|
||||
Load File
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
sx={{
|
||||
cursor: 'pointer',
|
||||
'& .MuiChip-icon': { fontSize: '1rem' }
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{isReadOnly && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
startIcon={<UploadFileIcon />}
|
||||
onClick={onFileLoad}
|
||||
fullWidth={isMobile}
|
||||
>
|
||||
Load File
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Box sx={{
|
||||
@@ -213,12 +191,14 @@ export default function Header({
|
||||
gap: 1,
|
||||
mb: 1,
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
height: '140px'
|
||||
height: isMobile ? 'auto' : '140px',
|
||||
minHeight: isMobile ? 'auto' : '140px'
|
||||
}}>
|
||||
<Box sx={{
|
||||
width: '280px',
|
||||
width: isMobile ? '100%' : '280px',
|
||||
minWidth: isMobile ? '100%' : '280px',
|
||||
position: 'relative',
|
||||
height: '100%'
|
||||
height: isMobile ? 'auto' : '100%'
|
||||
}}>
|
||||
{isAgenticMode ? (
|
||||
<AgenticCorrectionMetrics
|
||||
@@ -385,15 +365,30 @@ export default function Header({
|
||||
}}>
|
||||
<Box sx={{
|
||||
display: 'flex',
|
||||
gap: 1,
|
||||
flexDirection: isMobile ? 'column' : 'row',
|
||||
alignItems: isMobile ? 'flex-start' : 'center',
|
||||
height: '32px'
|
||||
gap: 0.5,
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
alignItems: 'center',
|
||||
minHeight: '32px'
|
||||
}}>
|
||||
<ModeSelector
|
||||
effectiveMode={effectiveMode}
|
||||
onChange={onModeChange}
|
||||
/>
|
||||
{!isReadOnly && onResetCorrections && (
|
||||
<Tooltip title="Undo all your changes">
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
color="warning"
|
||||
onClick={onResetCorrections}
|
||||
startIcon={<UndoIcon />}
|
||||
sx={{ minWidth: 'fit-content', height: '32px' }}
|
||||
>
|
||||
Undo All
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{!isReadOnly && (
|
||||
<Box sx={{ display: 'flex', height: '32px' }}>
|
||||
<Tooltip title="Undo">
|
||||
@@ -457,15 +452,17 @@ export default function Header({
|
||||
</Button>
|
||||
)}
|
||||
{!isReadOnly && onUnCorrectAll && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
onClick={onUnCorrectAll}
|
||||
startIcon={<RestoreIcon />}
|
||||
sx={{ minWidth: 'fit-content', height: '32px' }}
|
||||
>
|
||||
Un-Correct All
|
||||
</Button>
|
||||
<Tooltip title="Revert only automatic AI corrections (keeps your manual edits)">
|
||||
<Button
|
||||
variant="outlined"
|
||||
size="small"
|
||||
onClick={onUnCorrectAll}
|
||||
startIcon={<RestoreIcon />}
|
||||
sx={{ minWidth: 'fit-content', height: '32px' }}
|
||||
>
|
||||
Undo Auto Corrections
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
{!isReadOnly && onTimingOffset && (
|
||||
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
||||
@@ -480,10 +477,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
|
||||
}}
|
||||
@@ -493,6 +490,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}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
WordCorrection,
|
||||
CorrectionAnnotation
|
||||
} from '../types'
|
||||
import { Box, Button, Grid, useMediaQuery, useTheme } from '@mui/material'
|
||||
import { Box, Button, Grid, Typography, useMediaQuery, useTheme } from '@mui/material'
|
||||
import { ApiClient } from '../api'
|
||||
import ReferenceView from './ReferenceView'
|
||||
import TranscriptionView from './TranscriptionView'
|
||||
@@ -33,7 +33,7 @@ import { setupKeyboardHandlers, setModalHandler, getModalState } from './shared/
|
||||
import Header from './Header'
|
||||
import { getWordsFromIds } from './shared/utils/wordUtils'
|
||||
import AddLyricsModal from './AddLyricsModal'
|
||||
import { RestoreFromTrash, OndemandVideo } from '@mui/icons-material'
|
||||
import { OndemandVideo } from '@mui/icons-material'
|
||||
import FindReplaceModal from './FindReplaceModal'
|
||||
import TimingOffsetModal from './TimingOffsetModal'
|
||||
import { applyOffsetToCorrectionData, applyOffsetToSegment } from './shared/utils/timingUtils'
|
||||
@@ -216,6 +216,7 @@ interface MemoizedHeaderProps {
|
||||
canUndo: boolean
|
||||
canRedo: boolean
|
||||
onUnCorrectAll: () => void
|
||||
onResetCorrections: () => void
|
||||
annotationsEnabled: boolean
|
||||
onAnnotationsToggle: (enabled: boolean) => void
|
||||
// Review mode props
|
||||
@@ -250,6 +251,7 @@ const MemoizedHeader = memo(function MemoizedHeader({
|
||||
canUndo,
|
||||
canRedo,
|
||||
onUnCorrectAll,
|
||||
onResetCorrections,
|
||||
annotationsEnabled,
|
||||
onAnnotationsToggle,
|
||||
reviewMode,
|
||||
@@ -281,6 +283,7 @@ const MemoizedHeader = memo(function MemoizedHeader({
|
||||
canUndo={canUndo}
|
||||
canRedo={canRedo}
|
||||
onUnCorrectAll={onUnCorrectAll}
|
||||
onResetCorrections={onResetCorrections}
|
||||
annotationsEnabled={annotationsEnabled}
|
||||
onAnnotationsToggle={onAnnotationsToggle}
|
||||
reviewMode={reviewMode}
|
||||
@@ -1255,8 +1258,6 @@ export default function LyricsAnalyzer({ data: initialData, onFileLoad, apiClien
|
||||
|
||||
return (
|
||||
<Box sx={{
|
||||
p: 1,
|
||||
pb: 3,
|
||||
maxWidth: '100%',
|
||||
overflowX: 'hidden'
|
||||
}}>
|
||||
@@ -1282,6 +1283,7 @@ export default function LyricsAnalyzer({ data: initialData, onFileLoad, apiClien
|
||||
canUndo={canUndo}
|
||||
canRedo={canRedo}
|
||||
onUnCorrectAll={handleUnCorrectAll}
|
||||
onResetCorrections={handleResetCorrections}
|
||||
annotationsEnabled={annotationsEnabled}
|
||||
onAnnotationsToggle={handleAnnotationsToggle}
|
||||
reviewMode={reviewMode}
|
||||
@@ -1291,7 +1293,7 @@ export default function LyricsAnalyzer({ data: initialData, onFileLoad, apiClien
|
||||
onRevertAllCorrections={handleRevertAllCorrections}
|
||||
/>
|
||||
|
||||
<Grid container direction={isMobile ? 'column' : 'row'}>
|
||||
<Grid container direction={isMobile ? 'column' : 'row'} spacing={1}>
|
||||
<Grid item xs={12} md={6}>
|
||||
<MemoizedTranscriptionView
|
||||
data={displayData}
|
||||
@@ -1316,32 +1318,6 @@ export default function LyricsAnalyzer({ data: initialData, onFileLoad, apiClien
|
||||
onAcceptCorrection={handleAcceptCorrection}
|
||||
onShowCorrectionDetail={handleShowCorrectionDetail}
|
||||
/>
|
||||
{!isReadOnly && apiClient && (
|
||||
<Box sx={{
|
||||
mt: 2,
|
||||
mb: 3,
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
width: '100%'
|
||||
}}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="warning"
|
||||
onClick={handleResetCorrections}
|
||||
startIcon={<RestoreFromTrash />}
|
||||
>
|
||||
Reset Corrections
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={handleFinishReview}
|
||||
disabled={isReviewComplete}
|
||||
endIcon={<OndemandVideo />}
|
||||
>
|
||||
{isReviewComplete ? 'Review Complete' : 'Preview Video'}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
</Grid>
|
||||
<Grid item xs={12} md={6}>
|
||||
<MemoizedReferenceView
|
||||
@@ -1362,6 +1338,52 @@ export default function LyricsAnalyzer({ data: initialData, onFileLoad, apiClien
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
{/* Spacer for sticky footer */}
|
||||
{!isReadOnly && apiClient && <Box sx={{ height: 64 }} />}
|
||||
|
||||
{/* Sticky footer bar with Preview Video button */}
|
||||
{!isReadOnly && apiClient && (
|
||||
<Box
|
||||
sx={{
|
||||
position: 'fixed',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bgcolor: 'background.paper',
|
||||
borderTop: 1,
|
||||
borderColor: 'divider',
|
||||
boxShadow: '0 -2px 10px rgba(0,0,0,0.1)',
|
||||
py: 1.5,
|
||||
px: 2,
|
||||
zIndex: 1100,
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
gap: 2
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="body2"
|
||||
sx={{ color: 'text.secondary' }}
|
||||
>
|
||||
Lyrics look good?
|
||||
</Typography>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={handleFinishReview}
|
||||
disabled={isReviewComplete}
|
||||
endIcon={<OndemandVideo />}
|
||||
sx={{
|
||||
px: 2.5,
|
||||
py: 0.75,
|
||||
fontWeight: 500
|
||||
}}
|
||||
>
|
||||
{isReviewComplete ? 'Review Complete' : 'Preview Video'}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
|
||||
|
||||
<EditModal
|
||||
|
||||
@@ -2,8 +2,7 @@ import { memo } from 'react'
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Divider,
|
||||
Stack
|
||||
Divider
|
||||
} from '@mui/material'
|
||||
import PlayCircleOutlineIcon from '@mui/icons-material/PlayCircleOutline'
|
||||
import StopIcon from '@mui/icons-material/Stop'
|
||||
@@ -14,6 +13,7 @@ import EditNoteIcon from '@mui/icons-material/EditNote'
|
||||
import BlockIcon from '@mui/icons-material/Block'
|
||||
import EditIcon from '@mui/icons-material/Edit'
|
||||
import DeleteIcon from '@mui/icons-material/Delete'
|
||||
import TouchAppIcon from '@mui/icons-material/TouchApp'
|
||||
|
||||
interface SyncControlsProps {
|
||||
// Main buttons
|
||||
@@ -24,21 +24,27 @@ interface SyncControlsProps {
|
||||
onResumeSync: () => void
|
||||
onClearSync: () => void
|
||||
onEditLyrics: () => void
|
||||
|
||||
|
||||
// Playback controls
|
||||
onPlay: () => void
|
||||
onStop: () => void
|
||||
isPlaying: boolean
|
||||
|
||||
|
||||
// Word action buttons
|
||||
hasSelectedWords: boolean
|
||||
selectedWordCount: number
|
||||
onUnsyncFromCursor: () => void
|
||||
onEditSelectedWord: () => void
|
||||
onDeleteSelected: () => void
|
||||
|
||||
|
||||
// Additional state
|
||||
canUnsyncFromCursor: boolean
|
||||
|
||||
// Mobile tap support
|
||||
isMobile?: boolean
|
||||
onTapStart?: () => void
|
||||
onTapEnd?: () => void
|
||||
isTapping?: boolean
|
||||
}
|
||||
|
||||
const SyncControls = memo(function SyncControls({
|
||||
@@ -57,12 +63,16 @@ const SyncControls = memo(function SyncControls({
|
||||
onUnsyncFromCursor,
|
||||
onEditSelectedWord,
|
||||
onDeleteSelected,
|
||||
canUnsyncFromCursor
|
||||
canUnsyncFromCursor,
|
||||
isMobile = false,
|
||||
onTapStart,
|
||||
onTapEnd,
|
||||
isTapping = false
|
||||
}: SyncControlsProps) {
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
|
||||
{/* Row 1: Playback & Sync Mode Controls */}
|
||||
<Stack direction="row" spacing={1} alignItems="center" flexWrap="wrap">
|
||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, alignItems: 'center' }}>
|
||||
{/* Playback controls */}
|
||||
<Button
|
||||
variant="outlined"
|
||||
@@ -85,7 +95,7 @@ const SyncControls = memo(function SyncControls({
|
||||
Stop
|
||||
</Button>
|
||||
|
||||
<Divider orientation="vertical" flexItem sx={{ mx: 0.5 }} />
|
||||
{!isMobile && <Divider orientation="vertical" flexItem />}
|
||||
|
||||
{/* Sync Mode controls */}
|
||||
{isManualSyncing ? (
|
||||
@@ -108,6 +118,27 @@ const SyncControls = memo(function SyncControls({
|
||||
>
|
||||
{isPaused ? 'Resume' : 'Pause'}
|
||||
</Button>
|
||||
{/* TAP button for mobile - no spacebar on mobile */}
|
||||
{isMobile && !isPaused && onTapStart && onTapEnd && (
|
||||
<Button
|
||||
variant="contained"
|
||||
color={isTapping ? 'warning' : 'success'}
|
||||
onTouchStart={(e) => {
|
||||
e.preventDefault()
|
||||
onTapStart()
|
||||
}}
|
||||
onTouchEnd={(e) => {
|
||||
e.preventDefault()
|
||||
onTapEnd()
|
||||
}}
|
||||
onMouseDown={onTapStart}
|
||||
onMouseUp={onTapEnd}
|
||||
startIcon={<TouchAppIcon />}
|
||||
size="small"
|
||||
>
|
||||
{isTapping ? 'Release' : 'TAP'}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
@@ -120,10 +151,10 @@ const SyncControls = memo(function SyncControls({
|
||||
Start Sync
|
||||
</Button>
|
||||
)}
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
{/* Row 2: Editing & Word Actions */}
|
||||
<Stack direction="row" spacing={1} alignItems="center" flexWrap="wrap">
|
||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, alignItems: 'center' }}>
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="warning"
|
||||
@@ -145,7 +176,7 @@ const SyncControls = memo(function SyncControls({
|
||||
Edit Lyrics
|
||||
</Button>
|
||||
|
||||
<Divider orientation="vertical" flexItem sx={{ mx: 0.5 }} />
|
||||
{!isMobile && <Divider orientation="vertical" flexItem />}
|
||||
|
||||
<Button
|
||||
variant="outlined"
|
||||
@@ -177,7 +208,7 @@ const SyncControls = memo(function SyncControls({
|
||||
>
|
||||
Delete{hasSelectedWords && selectedWordCount > 0 ? ` (${selectedWordCount})` : ''}
|
||||
</Button>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -23,6 +23,7 @@ interface TimelineCanvasProps {
|
||||
audioDuration: number
|
||||
zoomSeconds: number
|
||||
height?: number
|
||||
isDarkMode?: boolean
|
||||
}
|
||||
|
||||
// Constants for rendering
|
||||
@@ -33,17 +34,25 @@ const CANVAS_PADDING = 8
|
||||
const TEXT_ABOVE_BLOCK = 14
|
||||
const RESIZE_HANDLE_SIZE = 8
|
||||
const RESIZE_HANDLE_HITAREA = 12
|
||||
// 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
|
||||
|
||||
// Theme-aware colors
|
||||
const getThemeColors = (isDarkMode: boolean) => ({
|
||||
playhead: '#f97316', // orange-500 - same for both themes
|
||||
wordBlock: isDarkMode ? '#dc2626' : '#ef4444', // red-600 dark, red-500 light
|
||||
wordBlockSelected: isDarkMode ? '#b91c1c' : '#dc2626', // red-700 dark, red-600 light
|
||||
wordBlockCurrent: isDarkMode ? '#ef4444' : '#f87171', // red-500 dark, red-400 light
|
||||
wordTextCurrent: isDarkMode ? '#fca5a5' : '#991b1b', // red-300 dark, red-800 light
|
||||
wordText: isDarkMode ? '#f8fafc' : '#1e293b', // slate-50 dark, slate-800 light
|
||||
upcomingWordBg: isDarkMode ? '#2a2a2a' : '#e5e7eb', // slate-700 dark, gray-200 light
|
||||
upcomingWordText: isDarkMode ? '#e5e5e5' : '#374151', // slate-50 dark, gray-700 light
|
||||
timeBarBg: isDarkMode ? '#1a1a1a' : '#f3f4f6', // slate-800 dark, gray-100 light
|
||||
timeBarText: isDarkMode ? '#888888' : '#6b7280', // slate-400 dark, gray-500 light
|
||||
timelineBg: isDarkMode ? '#0f0f0f' : '#ffffff', // slate-900 dark, white light
|
||||
gridLine: isDarkMode ? '#64748b' : '#94a3b8', // slate-500 dark, slate-400 light
|
||||
borderLine: isDarkMode ? '#2a2a2a' : '#cbd5e1', // slate-700 dark, slate-300 light
|
||||
handleStroke: isDarkMode ? '#0f0f0f' : '#ffffff', // stroke around handles
|
||||
playheadShadow: isDarkMode ? 'rgba(0,0,0,0.6)' : 'rgba(0,0,0,0.3)', // shadow behind playhead line
|
||||
})
|
||||
|
||||
// Drag modes
|
||||
type DragMode = 'none' | 'selection' | 'resize' | 'move'
|
||||
@@ -116,8 +125,11 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
onScrollChange,
|
||||
audioDuration,
|
||||
zoomSeconds,
|
||||
height = 200
|
||||
height = 200,
|
||||
isDarkMode = true
|
||||
}: TimelineCanvasProps) {
|
||||
// Get theme colors
|
||||
const colors = getThemeColors(isDarkMode)
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null)
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const [canvasWidth, setCanvasWidth] = useState(800)
|
||||
@@ -249,11 +261,11 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
ctx.scale(dpr, dpr)
|
||||
|
||||
// Clear canvas
|
||||
ctx.fillStyle = TIMELINE_BG
|
||||
ctx.fillStyle = colors.timelineBg
|
||||
ctx.fillRect(0, 0, canvasWidth, height)
|
||||
|
||||
// Draw time bar background
|
||||
ctx.fillStyle = TIME_BAR_BG
|
||||
ctx.fillStyle = colors.timeBarBg
|
||||
ctx.fillRect(0, 0, canvasWidth, TIME_BAR_HEIGHT)
|
||||
|
||||
// Draw time markers
|
||||
@@ -261,15 +273,15 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
const secondsPerTick = duration > 15 ? 2 : duration > 8 ? 1 : 0.5
|
||||
const startSecond = Math.ceil(visibleStartTime / secondsPerTick) * secondsPerTick
|
||||
|
||||
ctx.fillStyle = TIME_BAR_TEXT
|
||||
ctx.fillStyle = colors.timeBarText
|
||||
ctx.font = '11px system-ui, -apple-system, sans-serif'
|
||||
ctx.textAlign = 'center'
|
||||
|
||||
for (let t = startSecond; t <= visibleEndTime; t += secondsPerTick) {
|
||||
const x = timeToX(t)
|
||||
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = '#64748b' // slate-500 for dark mode
|
||||
ctx.strokeStyle = colors.gridLine
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(x, TIME_BAR_HEIGHT - 6)
|
||||
ctx.lineTo(x, TIME_BAR_HEIGHT)
|
||||
@@ -281,7 +293,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
}
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = '#2a2a2a' // slate-700 for dark mode
|
||||
ctx.strokeStyle = colors.borderLine
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(0, TIME_BAR_HEIGHT)
|
||||
ctx.lineTo(canvasWidth, TIME_BAR_HEIGHT)
|
||||
@@ -305,17 +317,17 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
|
||||
// Draw word block background
|
||||
if (isSelected) {
|
||||
ctx.fillStyle = WORD_BLOCK_SELECTED_COLOR
|
||||
ctx.fillStyle = colors.wordBlockSelected
|
||||
} else if (isCurrent) {
|
||||
ctx.fillStyle = WORD_BLOCK_CURRENT_COLOR
|
||||
ctx.fillStyle = colors.wordBlockCurrent
|
||||
} else {
|
||||
ctx.fillStyle = WORD_BLOCK_COLOR
|
||||
ctx.fillStyle = colors.wordBlock
|
||||
}
|
||||
ctx.fillRect(bounds.startX, bounds.y, bounds.blockWidth, WORD_BLOCK_HEIGHT)
|
||||
|
||||
// Draw selection border
|
||||
if (isSelected) {
|
||||
ctx.strokeStyle = '#f97316' // orange-500 for dark mode selection
|
||||
ctx.strokeStyle = colors.playhead
|
||||
ctx.lineWidth = 2
|
||||
ctx.strokeRect(bounds.startX, bounds.y, bounds.blockWidth, WORD_BLOCK_HEIGHT)
|
||||
|
||||
@@ -325,10 +337,10 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
const handleY = bounds.y + WORD_BLOCK_HEIGHT / 2
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.fillStyle = '#f97316' // orange-500 for dark mode
|
||||
ctx.fillStyle = colors.playhead
|
||||
ctx.arc(handleX, handleY, RESIZE_HANDLE_SIZE / 2, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
ctx.strokeStyle = '#0f0f0f' // slate-900 for dark mode
|
||||
ctx.strokeStyle = colors.handleStroke
|
||||
ctx.lineWidth = 1
|
||||
ctx.stroke()
|
||||
}
|
||||
@@ -369,7 +381,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
|
||||
if (textStartX < canvasWidth - 10) {
|
||||
const isCurrent = word.id === currentWordId
|
||||
ctx.fillStyle = isCurrent ? WORD_TEXT_CURRENT_COLOR : '#f8fafc' // slate-50 for dark mode
|
||||
ctx.fillStyle = isCurrent ? colors.wordTextCurrent : colors.wordText
|
||||
ctx.fillText(word.text, textStartX, textY)
|
||||
rightmostTextEnd = textStartX + textWidth
|
||||
}
|
||||
@@ -387,14 +399,14 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
for (let i = 0; i < Math.min(upcomingWords.length, 12); i++) {
|
||||
const word = upcomingWords[i]
|
||||
const textWidth = ctx.measureText(word.text).width + 10
|
||||
|
||||
ctx.fillStyle = UPCOMING_WORD_BG
|
||||
|
||||
ctx.fillStyle = colors.upcomingWordBg
|
||||
ctx.fillRect(offsetX, TIME_BAR_HEIGHT + CANVAS_PADDING + WORD_LEVEL_SPACING + 60, textWidth, 20)
|
||||
|
||||
ctx.fillStyle = UPCOMING_WORD_TEXT
|
||||
|
||||
ctx.fillStyle = colors.upcomingWordText
|
||||
ctx.textAlign = 'left'
|
||||
ctx.fillText(word.text, offsetX + 5, TIME_BAR_HEIGHT + CANVAS_PADDING + WORD_LEVEL_SPACING + 74)
|
||||
|
||||
|
||||
offsetX += textWidth + 3
|
||||
if (offsetX > canvasWidth - 20) break
|
||||
}
|
||||
@@ -403,10 +415,10 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
// Draw playhead
|
||||
if (currentTime >= visibleStartTime && currentTime <= visibleEndTime) {
|
||||
const playheadX = timeToX(currentTime)
|
||||
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.fillStyle = PLAYHEAD_COLOR
|
||||
ctx.strokeStyle = '#0f0f0f' // slate-900 for dark mode
|
||||
ctx.fillStyle = colors.playhead
|
||||
ctx.strokeStyle = colors.handleStroke
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(playheadX - 6, 2)
|
||||
ctx.lineTo(playheadX + 6, 2)
|
||||
@@ -416,14 +428,14 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
ctx.stroke()
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = PLAYHEAD_COLOR
|
||||
ctx.strokeStyle = colors.playhead
|
||||
ctx.lineWidth = 2
|
||||
ctx.moveTo(playheadX, TIME_BAR_HEIGHT)
|
||||
ctx.lineTo(playheadX, height)
|
||||
ctx.stroke()
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.strokeStyle = 'rgba(0,0,0,0.6)' // Darker shadow for dark mode visibility
|
||||
ctx.strokeStyle = colors.playheadShadow
|
||||
ctx.lineWidth = 1
|
||||
ctx.moveTo(playheadX + 1, TIME_BAR_HEIGHT)
|
||||
ctx.lineTo(playheadX + 1, height)
|
||||
@@ -447,7 +459,7 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
}, [
|
||||
canvasWidth, height, visibleStartTime, visibleEndTime, currentTime,
|
||||
words, segments, selectedWordIds, selectionRect, hoveredWordId,
|
||||
syncWordIndex, isManualSyncing, timeToX, getWordBounds
|
||||
syncWordIndex, isManualSyncing, timeToX, getWordBounds, colors
|
||||
])
|
||||
|
||||
// Animation frame
|
||||
@@ -653,13 +665,15 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.5 }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<Tooltip title="Scroll Left">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={handleScrollLeft}
|
||||
disabled={visibleStartTime <= 0}
|
||||
>
|
||||
<ArrowBackIcon fontSize="small" />
|
||||
</IconButton>
|
||||
<span>
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={handleScrollLeft}
|
||||
disabled={visibleStartTime <= 0}
|
||||
>
|
||||
<ArrowBackIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
|
||||
<Box
|
||||
@@ -689,13 +703,15 @@ const TimelineCanvas = memo(function TimelineCanvas({
|
||||
</Box>
|
||||
|
||||
<Tooltip title="Scroll Right">
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={handleScrollRight}
|
||||
disabled={visibleStartTime >= audioDuration - zoomSeconds}
|
||||
>
|
||||
<ArrowForwardIcon fontSize="small" />
|
||||
</IconButton>
|
||||
<span>
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={handleScrollRight}
|
||||
disabled={visibleStartTime >= audioDuration - zoomSeconds}
|
||||
>
|
||||
<ArrowForwardIcon fontSize="small" />
|
||||
</IconButton>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -10,7 +10,9 @@ import {
|
||||
TextField,
|
||||
Button,
|
||||
Paper,
|
||||
Alert
|
||||
Alert,
|
||||
useTheme,
|
||||
useMediaQuery
|
||||
} from '@mui/material'
|
||||
import ZoomInIcon from '@mui/icons-material/ZoomIn'
|
||||
import ZoomOutIcon from '@mui/icons-material/ZoomOut'
|
||||
@@ -38,7 +40,7 @@ interface LyricsSynchronizerProps {
|
||||
}
|
||||
|
||||
// Constants for zoom
|
||||
const MIN_ZOOM_SECONDS = 4.5 // Most zoomed in - 4.5 seconds visible
|
||||
const MIN_ZOOM_SECONDS = 2 // Most zoomed in - 2 seconds visible
|
||||
const MAX_ZOOM_SECONDS = 24 // Most zoomed out - 24 seconds visible
|
||||
const ZOOM_STEPS = 50 // Number of zoom levels
|
||||
|
||||
@@ -60,8 +62,12 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
onCancel,
|
||||
setModalSpacebarHandler
|
||||
}: LyricsSynchronizerProps) {
|
||||
const theme = useTheme()
|
||||
const isDarkMode = theme.palette.mode === 'dark'
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
|
||||
|
||||
// Working copy of segments
|
||||
const [workingSegments, setWorkingSegments] = useState<LyricsSegment[]>(() =>
|
||||
const [workingSegments, setWorkingSegments] = useState<LyricsSegment[]>(() =>
|
||||
cloneSegments(initialSegments)
|
||||
)
|
||||
|
||||
@@ -664,14 +670,80 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
spacebarHandlerRef.current(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setModalSpacebarHandler(() => handler)
|
||||
|
||||
|
||||
return () => {
|
||||
setModalSpacebarHandler(undefined)
|
||||
}
|
||||
}, [setModalSpacebarHandler])
|
||||
|
||||
// Tap handlers for mobile (simulate spacebar press/release)
|
||||
const handleTapStart = useCallback(() => {
|
||||
if (!isManualSyncing || isPaused) return
|
||||
if (syncWordIndex < 0 || syncWordIndex >= allWords.length) return
|
||||
if (isSpacebarPressed) return
|
||||
|
||||
setIsSpacebarPressed(true)
|
||||
wordStartTimeRef.current = currentTimeRef.current
|
||||
spacebarPressTimeRef.current = Date.now()
|
||||
|
||||
// Set start time for current word
|
||||
const newWords = [...allWords]
|
||||
const currentWord = newWords[syncWordIndex]
|
||||
currentWord.start_time = currentTimeRef.current
|
||||
|
||||
// Handle previous word's end time
|
||||
if (syncWordIndex > 0) {
|
||||
const prevWord = newWords[syncWordIndex - 1]
|
||||
if (prevWord.start_time !== null && prevWord.end_time === null) {
|
||||
const gap = currentTimeRef.current - prevWord.start_time
|
||||
if (gap > 1.0) {
|
||||
prevWord.end_time = prevWord.start_time + 0.5
|
||||
} else {
|
||||
prevWord.end_time = currentTimeRef.current - 0.005
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateWords(newWords)
|
||||
}, [isManualSyncing, isPaused, syncWordIndex, allWords, isSpacebarPressed, updateWords])
|
||||
|
||||
const handleTapEnd = useCallback(() => {
|
||||
if (!isManualSyncing || isPaused) return
|
||||
if (!isSpacebarPressed) return
|
||||
|
||||
setIsSpacebarPressed(false)
|
||||
|
||||
const pressDuration = spacebarPressTimeRef.current
|
||||
? Date.now() - spacebarPressTimeRef.current
|
||||
: 0
|
||||
const isTap = pressDuration < 200
|
||||
|
||||
const newWords = [...allWords]
|
||||
const currentWord = newWords[syncWordIndex]
|
||||
|
||||
if (isTap) {
|
||||
currentWord.end_time = (wordStartTimeRef.current || currentTimeRef.current) + 0.5
|
||||
} else {
|
||||
currentWord.end_time = currentTimeRef.current
|
||||
}
|
||||
|
||||
updateWords(newWords)
|
||||
|
||||
// Move to next word
|
||||
if (syncWordIndex < allWords.length - 1) {
|
||||
setSyncWordIndex(syncWordIndex + 1)
|
||||
} else {
|
||||
setIsManualSyncing(false)
|
||||
setSyncWordIndex(-1)
|
||||
handleStopAudio()
|
||||
}
|
||||
|
||||
wordStartTimeRef.current = null
|
||||
spacebarPressTimeRef.current = null
|
||||
}, [isManualSyncing, isPaused, isSpacebarPressed, syncWordIndex, allWords, updateWords, handleStopAudio])
|
||||
|
||||
// Handle save
|
||||
const handleSave = useCallback(() => {
|
||||
onSave(workingSegments)
|
||||
@@ -726,12 +798,14 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
flexShrink: 0
|
||||
}}
|
||||
>
|
||||
<Paper
|
||||
sx={{
|
||||
p: 1.5,
|
||||
<Paper
|
||||
sx={{
|
||||
p: 1.5,
|
||||
height: '100%',
|
||||
bgcolor: isManualSyncing ? 'info.main' : 'grey.100',
|
||||
color: isManualSyncing ? 'info.contrastText' : 'text.primary',
|
||||
bgcolor: isManualSyncing
|
||||
? 'success.main'
|
||||
: (isDarkMode ? 'grey.800' : 'grey.100'),
|
||||
color: isManualSyncing ? 'common.white' : 'text.primary',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
@@ -739,34 +813,53 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
boxSizing: 'border-box'
|
||||
}}
|
||||
>
|
||||
<Typography variant="body2" sx={{ fontWeight: 500, lineHeight: 1.3 }}>
|
||||
<Typography
|
||||
variant="body2"
|
||||
sx={{
|
||||
fontWeight: 500,
|
||||
lineHeight: 1.3,
|
||||
color: isManualSyncing ? 'common.white' : 'text.primary'
|
||||
}}
|
||||
>
|
||||
{instruction.primary}
|
||||
</Typography>
|
||||
<Typography variant="caption" sx={{ opacity: 0.85, display: 'block', lineHeight: 1.3 }}>
|
||||
<Typography
|
||||
variant="caption"
|
||||
sx={{
|
||||
opacity: 0.9,
|
||||
display: 'block',
|
||||
lineHeight: 1.3,
|
||||
color: isManualSyncing ? 'common.white' : 'text.secondary'
|
||||
}}
|
||||
>
|
||||
{instruction.secondary}
|
||||
</Typography>
|
||||
</Paper>
|
||||
</Box>
|
||||
|
||||
{/* Controls - fixed height section */}
|
||||
<Box sx={{ height: 88, flexShrink: 0 }}>
|
||||
{/* Controls section */}
|
||||
<Box sx={{ minHeight: 88, flexShrink: 0 }}>
|
||||
<SyncControls
|
||||
isManualSyncing={isManualSyncing}
|
||||
isPaused={isPaused}
|
||||
onStartSync={handleStartSync}
|
||||
onPauseSync={handlePauseSync}
|
||||
onResumeSync={handleResumeSync}
|
||||
onClearSync={handleClearSync}
|
||||
onEditLyrics={handleEditLyrics}
|
||||
onPlay={handlePlayAudio}
|
||||
onStop={handleStopAudio}
|
||||
isPlaying={isPlaying}
|
||||
hasSelectedWords={selectedWordIds.size > 0}
|
||||
selectedWordCount={selectedWordIds.size}
|
||||
onUnsyncFromCursor={handleUnsyncFromCursor}
|
||||
onEditSelectedWord={handleEditSelectedWord}
|
||||
onDeleteSelected={handleDeleteSelected}
|
||||
canUnsyncFromCursor={canUnsyncFromCursor}
|
||||
isManualSyncing={isManualSyncing}
|
||||
isPaused={isPaused}
|
||||
onStartSync={handleStartSync}
|
||||
onPauseSync={handlePauseSync}
|
||||
onResumeSync={handleResumeSync}
|
||||
onClearSync={handleClearSync}
|
||||
onEditLyrics={handleEditLyrics}
|
||||
onPlay={handlePlayAudio}
|
||||
onStop={handleStopAudio}
|
||||
isPlaying={isPlaying}
|
||||
hasSelectedWords={selectedWordIds.size > 0}
|
||||
selectedWordCount={selectedWordIds.size}
|
||||
onUnsyncFromCursor={handleUnsyncFromCursor}
|
||||
onEditSelectedWord={handleEditSelectedWord}
|
||||
onDeleteSelected={handleDeleteSelected}
|
||||
canUnsyncFromCursor={canUnsyncFromCursor}
|
||||
isMobile={isMobile}
|
||||
onTapStart={handleTapStart}
|
||||
onTapEnd={handleTapEnd}
|
||||
isTapping={isSpacebarPressed}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -802,6 +895,7 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
audioDuration={audioDuration}
|
||||
zoomSeconds={zoomSeconds}
|
||||
height={200}
|
||||
isDarkMode={isDarkMode}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ export default function ReferenceView({
|
||||
width: '100%',
|
||||
mb: 0,
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.04)' // slate-50 hover for dark mode
|
||||
backgroundColor: (theme) => theme.palette.action.hover
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -16,10 +16,13 @@ interface TimelineEditorProps {
|
||||
const TimelineContainer = styled(Box)(({ theme }) => ({
|
||||
position: 'relative',
|
||||
height: '75px',
|
||||
backgroundColor: theme.palette.grey[200],
|
||||
backgroundColor: theme.palette.mode === 'dark'
|
||||
? theme.palette.background.paper // Dark mode: use card background
|
||||
: theme.palette.grey[100], // Light mode: subtle gray
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
margin: theme.spacing(1, 0),
|
||||
padding: theme.spacing(0, 1),
|
||||
border: `1px solid ${theme.palette.divider}`,
|
||||
}))
|
||||
|
||||
const TimelineRuler = styled(Box)(({ theme }) => ({
|
||||
@@ -28,7 +31,7 @@ const TimelineRuler = styled(Box)(({ theme }) => ({
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: '40px',
|
||||
borderBottom: `1px solid ${theme.palette.grey[300]}`,
|
||||
borderBottom: `1px solid ${theme.palette.divider}`,
|
||||
cursor: 'pointer',
|
||||
}))
|
||||
|
||||
@@ -37,11 +40,11 @@ const TimelineMark = styled(Box)(({ theme }) => ({
|
||||
top: '20px',
|
||||
width: '1px',
|
||||
height: '18px',
|
||||
backgroundColor: theme.palette.grey[700],
|
||||
backgroundColor: theme.palette.text.secondary,
|
||||
'&.subsecond': {
|
||||
top: '25px',
|
||||
height: '13px',
|
||||
backgroundColor: theme.palette.grey[500],
|
||||
backgroundColor: theme.palette.text.disabled,
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -52,7 +55,11 @@ const TimelineLabel = styled(Box)(({ theme }) => ({
|
||||
fontSize: '0.8rem',
|
||||
color: theme.palette.text.primary,
|
||||
fontWeight: 700,
|
||||
backgroundColor: theme.palette.grey[200],
|
||||
backgroundColor: theme.palette.mode === 'dark'
|
||||
? theme.palette.background.paper
|
||||
: theme.palette.grey[100],
|
||||
padding: '0 4px',
|
||||
borderRadius: '2px',
|
||||
}))
|
||||
|
||||
const TimelineWord = styled(Box)(({ theme }) => ({
|
||||
|
||||
@@ -118,10 +118,10 @@ export default function TimingOffsetModal({
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={onClose}>Cancel</Button>
|
||||
<Button
|
||||
onClick={handleApply}
|
||||
<Button
|
||||
onClick={handleApply}
|
||||
variant="contained"
|
||||
color={offsetMs === 0 ? "warning" : "primary"}
|
||||
color="primary"
|
||||
>
|
||||
{offsetMs === 0 ? "Remove Offset" : "Apply Offset"}
|
||||
</Button>
|
||||
|
||||
@@ -187,7 +187,7 @@ export default function TranscriptionView({
|
||||
width: '100%',
|
||||
mb: 0,
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.04)' // slate-50 hover for dark mode
|
||||
backgroundColor: (theme) => theme.palette.action.hover
|
||||
}
|
||||
}}>
|
||||
<SegmentControls>
|
||||
|
||||
@@ -18,7 +18,7 @@ interface WordDividerProps {
|
||||
}
|
||||
|
||||
const buttonTextStyle = {
|
||||
color: 'rgba(248, 250, 252, 0.8)', // slate-50 with opacity for dark mode
|
||||
color: 'text.secondary',
|
||||
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
||||
fontWeight: 400,
|
||||
fontSize: '0.7rem',
|
||||
@@ -55,10 +55,12 @@ export default function WordDivider({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '20px',
|
||||
my: -0.5,
|
||||
width: '50%',
|
||||
backgroundColor: '#1a1a1a', // slate-800 for dark mode
|
||||
height: 'auto',
|
||||
minHeight: '20px',
|
||||
my: 0,
|
||||
width: '100%',
|
||||
bgcolor: 'background.paper',
|
||||
overflow: 'hidden',
|
||||
...sx
|
||||
}}
|
||||
>
|
||||
@@ -66,7 +68,9 @@ export default function WordDivider({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 1,
|
||||
backgroundColor: '#1a1a1a', // slate-800 for dark mode
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: 'center',
|
||||
bgcolor: 'background.paper',
|
||||
padding: '0 8px',
|
||||
zIndex: 1
|
||||
}}>
|
||||
@@ -184,4 +188,4 @@ export default function WordDivider({
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -41,14 +41,16 @@ export const WordComponent = React.memo(function Word({
|
||||
borderRadius: '2px',
|
||||
color: isCurrentlyPlaying ? '#ffffff' : 'inherit',
|
||||
textDecoration: correction ? 'underline dotted' : 'none',
|
||||
textDecorationColor: correction ? '#666666' : 'inherit', // slate-500 for dark mode
|
||||
textUnderlineOffset: '2px',
|
||||
fontSize: '0.85rem',
|
||||
lineHeight: 1.2
|
||||
}}
|
||||
sx={{
|
||||
textDecorationColor: correction ? 'text.disabled' : 'inherit', // Theme-aware underline color
|
||||
'&:hover': {
|
||||
backgroundColor: 'rgba(248, 250, 252, 0.08)' // slate-50 hover for dark mode
|
||||
backgroundColor: (theme) => theme.palette.mode === 'dark'
|
||||
? 'rgba(248, 250, 252, 0.08)' // light hover for dark mode
|
||||
: 'rgba(30, 41, 59, 0.08)' // dark hover for light mode
|
||||
}
|
||||
}}
|
||||
onClick={onClick}
|
||||
|
||||
@@ -353,6 +353,106 @@ export default function useManualSync({
|
||||
}
|
||||
}, [handleKeyDown, handleKeyUp])
|
||||
|
||||
// Touch-friendly handlers for mobile (simulates spacebar press/release)
|
||||
const handleTapStart = useCallback(() => {
|
||||
if (!isManualSyncing || !editedSegment || isSpacebarPressed || isPaused) return
|
||||
|
||||
console.log('useManualSync - Touch/tap started', {
|
||||
syncWordIndex,
|
||||
currentTime: currentTimeRef.current
|
||||
})
|
||||
|
||||
setIsSpacebarPressed(true)
|
||||
|
||||
// Record the start time of the current word
|
||||
wordStartTimeRef.current = currentTimeRef.current
|
||||
|
||||
// Record when the tap started (for tap detection)
|
||||
spacebarPressTimeRef.current = Date.now()
|
||||
|
||||
// Update the word's start time immediately
|
||||
if (syncWordIndex < editedSegment.words.length) {
|
||||
const newWords = [...wordsRef.current]
|
||||
const currentWord = newWords[syncWordIndex]
|
||||
const currentStartTime = currentTimeRef.current
|
||||
|
||||
// Set the start time for the current word
|
||||
currentWord.start_time = currentStartTime
|
||||
|
||||
// Handle the end time of the previous word (if it exists)
|
||||
if (syncWordIndex > 0) {
|
||||
const previousWord = newWords[syncWordIndex - 1]
|
||||
if (previousWord.start_time !== null) {
|
||||
const timeSincePreviousStart = currentStartTime - previousWord.start_time
|
||||
|
||||
const needsAdjustment = previousWord.end_time === null ||
|
||||
(previousWord.end_time !== null && previousWord.end_time > currentStartTime)
|
||||
|
||||
if (needsAdjustment) {
|
||||
if (timeSincePreviousStart > 1.0) {
|
||||
previousWord.end_time = previousWord.start_time + 0.5
|
||||
} else {
|
||||
previousWord.end_time = currentStartTime - 0.005
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update our ref
|
||||
wordsRef.current = newWords
|
||||
|
||||
// Mark that we need to update the segment
|
||||
needsSegmentUpdateRef.current = true
|
||||
}
|
||||
}, [isManualSyncing, editedSegment, syncWordIndex, isSpacebarPressed, isPaused])
|
||||
|
||||
const handleTapEnd = useCallback(() => {
|
||||
if (!isManualSyncing || !editedSegment || !isSpacebarPressed || isPaused) return
|
||||
|
||||
const pressDuration = spacebarPressTimeRef.current ? Date.now() - spacebarPressTimeRef.current : 0
|
||||
const isTap = pressDuration < TAP_THRESHOLD_MS
|
||||
|
||||
console.log('useManualSync - Touch/tap ended', {
|
||||
syncWordIndex,
|
||||
pressDuration: `${pressDuration}ms`,
|
||||
isTap
|
||||
})
|
||||
|
||||
setIsSpacebarPressed(false)
|
||||
|
||||
if (syncWordIndex < editedSegment.words.length) {
|
||||
const newWords = [...wordsRef.current]
|
||||
const currentWord = newWords[syncWordIndex]
|
||||
|
||||
// Set the end time for the current word based on whether it was a tap or hold
|
||||
if (isTap) {
|
||||
const defaultEndTime = (wordStartTimeRef.current || currentTimeRef.current) + DEFAULT_WORD_DURATION
|
||||
currentWord.end_time = defaultEndTime
|
||||
} else {
|
||||
currentWord.end_time = currentTimeRef.current
|
||||
}
|
||||
|
||||
// Update our ref
|
||||
wordsRef.current = newWords
|
||||
|
||||
// Move to the next word
|
||||
if (syncWordIndex === editedSegment.words.length - 1) {
|
||||
// If this was the last word, finish manual sync
|
||||
console.log('useManualSync - Completed manual sync for all words')
|
||||
setIsManualSyncing(false)
|
||||
setSyncWordIndex(-1)
|
||||
wordStartTimeRef.current = null
|
||||
spacebarPressTimeRef.current = null
|
||||
} else {
|
||||
// Otherwise, move to the next word
|
||||
setSyncWordIndex(syncWordIndex + 1)
|
||||
}
|
||||
|
||||
// Mark that we need to update the segment
|
||||
needsSegmentUpdateRef.current = true
|
||||
}
|
||||
}, [isManualSyncing, editedSegment, syncWordIndex, isSpacebarPressed, isPaused])
|
||||
|
||||
const startManualSync = useCallback(() => {
|
||||
if (isManualSyncing) {
|
||||
cleanupManualSync()
|
||||
@@ -430,6 +530,8 @@ export default function useManualSync({
|
||||
resumeManualSync,
|
||||
cleanupManualSync,
|
||||
handleSpacebar,
|
||||
isSpacebarPressed
|
||||
isSpacebarPressed,
|
||||
handleTapStart,
|
||||
handleTapEnd
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ const darkColors = {
|
||||
action: {
|
||||
active: '#f8fafc',
|
||||
hover: 'rgba(248, 250, 252, 0.08)',
|
||||
selected: 'rgba(249, 115, 22, 0.16)',
|
||||
selected: 'rgba(255, 122, 204, 0.16)',
|
||||
disabled: '#64748b',
|
||||
disabledBackground: 'rgba(100, 116, 139, 0.12)',
|
||||
},
|
||||
@@ -38,24 +38,26 @@ const lightColors = {
|
||||
action: {
|
||||
active: '#1e293b',
|
||||
hover: 'rgba(30, 41, 59, 0.08)',
|
||||
selected: 'rgba(249, 115, 22, 0.16)',
|
||||
selected: 'rgba(255, 122, 204, 0.16)',
|
||||
disabled: '#94a3b8',
|
||||
disabledBackground: 'rgba(148, 163, 184, 0.12)',
|
||||
},
|
||||
};
|
||||
|
||||
// Shared colors
|
||||
// Shared colors - Nomad Karaoke brand palette
|
||||
// Primary: Brand Pink (#ff7acc), Secondary: Brand Purple (#8b5cf6)
|
||||
// See docs/BRAND-STYLE-GUIDE.md for full brand guidelines
|
||||
const sharedColors = {
|
||||
primary: {
|
||||
main: '#f97316',
|
||||
light: '#fb923c',
|
||||
dark: '#ea580c',
|
||||
main: '#ff7acc',
|
||||
light: '#ff8fd4',
|
||||
dark: '#ff5bb8',
|
||||
contrastText: '#ffffff',
|
||||
},
|
||||
secondary: {
|
||||
main: '#6366f1',
|
||||
light: '#818cf8',
|
||||
dark: '#4f46e5',
|
||||
main: '#8b5cf6',
|
||||
light: '#a78bfa',
|
||||
dark: '#7c3aed',
|
||||
contrastText: '#ffffff',
|
||||
},
|
||||
error: {
|
||||
@@ -140,7 +142,7 @@ export function createAppTheme(mode: 'dark' | 'light'): Theme {
|
||||
borderColor: colors.divider,
|
||||
'&:hover': {
|
||||
borderColor: sharedColors.primary.main,
|
||||
backgroundColor: 'rgba(249, 115, 22, 0.08)',
|
||||
backgroundColor: 'rgba(255, 122, 204, 0.08)',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -158,19 +160,44 @@ export function createAppTheme(mode: 'dark' | 'light'): Theme {
|
||||
MuiTextField: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
'& .MuiInputBase-root': { minHeight: '32px', backgroundColor: colors.background.default },
|
||||
'& .MuiInputBase-root': {
|
||||
minHeight: '32px',
|
||||
backgroundColor: colors.background.default,
|
||||
},
|
||||
'& .MuiOutlinedInput-root': {
|
||||
backgroundColor: colors.background.default,
|
||||
'& fieldset': { borderColor: colors.divider },
|
||||
'&:hover fieldset': { borderColor: colors.text.secondary },
|
||||
'&.Mui-focused fieldset': { borderColor: sharedColors.primary.main },
|
||||
},
|
||||
'& .MuiFilledInput-root': {
|
||||
backgroundColor: colors.background.default,
|
||||
'&:hover': { backgroundColor: colors.background.elevated },
|
||||
'&.Mui-focused': { backgroundColor: colors.background.default },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiOutlinedInput: {
|
||||
styleOverrides: {
|
||||
root: {
|
||||
backgroundColor: colors.background.default,
|
||||
},
|
||||
input: {
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiInputBase: {
|
||||
styleOverrides: {
|
||||
root: { color: colors.text.primary },
|
||||
input: { '&::placeholder': { color: colors.text.disabled, opacity: 1 } },
|
||||
root: {
|
||||
color: colors.text.primary,
|
||||
backgroundColor: colors.background.default,
|
||||
},
|
||||
input: {
|
||||
'&::placeholder': { color: colors.text.disabled, opacity: 1 },
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
},
|
||||
},
|
||||
MuiDialog: {
|
||||
@@ -210,7 +237,7 @@ export function createAppTheme(mode: 'dark' | 'light'): Theme {
|
||||
'&:hover': { backgroundColor: colors.action.hover },
|
||||
'&.Mui-selected': {
|
||||
backgroundColor: colors.action.selected,
|
||||
'&:hover': { backgroundColor: 'rgba(249, 115, 22, 0.24)' },
|
||||
'&:hover': { backgroundColor: 'rgba(255, 122, 204, 0.24)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -288,7 +315,7 @@ export function createAppTheme(mode: 'dark' | 'light'): Theme {
|
||||
'&:hover': { backgroundColor: colors.action.hover },
|
||||
'&.Mui-selected': {
|
||||
backgroundColor: colors.action.selected,
|
||||
'&:hover': { backgroundColor: 'rgba(249, 115, 22, 0.24)' },
|
||||
'&:hover': { backgroundColor: 'rgba(255, 122, 204, 0.24)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index-BSMgOq4Z.js","sources":["../../node_modules/react/cjs/react.production.min.js","../../node_modules/react/index.js","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/react-dom/client.js","../../node_modules/@mui/utils/node_modules/react-is/cjs/react-is.production.js","../../node_modules/@mui/utils/node_modules/react-is/index.js","../../node_modules/@mui/utils/esm/deepmerge/deepmerge.js","../../node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js","../../node_modules/@mui/utils/esm/capitalize/capitalize.js","../../node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js","../../node_modules/@mui/utils/esm/debounce/debounce.js","../../node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js","../../node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js","../../node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js","../../node_modules/@mui/utils/esm/setRef/setRef.js","../../node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js","../../node_modules/@mui/utils/esm/useId/useId.js","../../node_modules/@mui/utils/esm/useControlled/useControlled.js","../../node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js","../../node_modules/@mui/utils/esm/useForkRef/useForkRef.js","../../node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js","../../node_modules/@mui/utils/esm/useOnMount/useOnMount.js","../../node_modules/@mui/utils/esm/useTimeout/useTimeout.js","../../node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js","../../node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js","../../node_modules/@mui/utils/esm/getValidReactChildren/getValidReactChildren.js","../../node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js","../../node_modules/@mui/utils/esm/resolveProps/resolveProps.js","../../node_modules/@mui/utils/esm/composeClasses/composeClasses.js","../../node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js","../../node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js","../../node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js","../../node_modules/@mui/utils/esm/clamp/clamp.js","../../node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js","../../node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js","../../node_modules/clsx/dist/clsx.mjs","../../node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js","../../node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js","../../node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js","../../node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js","../../node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js","../../node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js","../../node_modules/@mui/system/esm/merge/merge.js","../../node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js","../../node_modules/@mui/system/esm/breakpoints/breakpoints.js","../../node_modules/@mui/system/esm/style/style.js","../../node_modules/@mui/system/esm/memoize/memoize.js","../../node_modules/@mui/system/esm/spacing/spacing.js","../../node_modules/@mui/system/esm/compose/compose.js","../../node_modules/@mui/system/esm/borders/borders.js","../../node_modules/@mui/system/esm/cssGrid/cssGrid.js","../../node_modules/@mui/system/esm/palette/palette.js","../../node_modules/@mui/system/esm/sizing/sizing.js","../../node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js","../../node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js","../../node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../node_modules/stylis/src/Enum.js","../../node_modules/stylis/src/Utility.js","../../node_modules/stylis/src/Tokenizer.js","../../node_modules/stylis/src/Parser.js","../../node_modules/stylis/src/Serializer.js","../../node_modules/stylis/src/Middleware.js","../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-useLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index-V91xgc4E.js","sources":["../../node_modules/react/cjs/react.production.min.js","../../node_modules/react/index.js","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/react-dom/client.js","../../node_modules/@mui/utils/node_modules/react-is/cjs/react-is.production.js","../../node_modules/@mui/utils/node_modules/react-is/index.js","../../node_modules/@mui/utils/esm/deepmerge/deepmerge.js","../../node_modules/@mui/utils/esm/formatMuiErrorMessage/formatMuiErrorMessage.js","../../node_modules/@mui/utils/esm/capitalize/capitalize.js","../../node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js","../../node_modules/@mui/utils/esm/debounce/debounce.js","../../node_modules/@mui/utils/esm/isMuiElement/isMuiElement.js","../../node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js","../../node_modules/@mui/utils/esm/ownerWindow/ownerWindow.js","../../node_modules/@mui/utils/esm/setRef/setRef.js","../../node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js","../../node_modules/@mui/utils/esm/useId/useId.js","../../node_modules/@mui/utils/esm/useControlled/useControlled.js","../../node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js","../../node_modules/@mui/utils/esm/useForkRef/useForkRef.js","../../node_modules/@mui/utils/esm/useLazyRef/useLazyRef.js","../../node_modules/@mui/utils/esm/useOnMount/useOnMount.js","../../node_modules/@mui/utils/esm/useTimeout/useTimeout.js","../../node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js","../../node_modules/@mui/utils/esm/getScrollbarSize/getScrollbarSize.js","../../node_modules/@mui/utils/esm/getValidReactChildren/getValidReactChildren.js","../../node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js","../../node_modules/@mui/utils/esm/resolveProps/resolveProps.js","../../node_modules/@mui/utils/esm/composeClasses/composeClasses.js","../../node_modules/@mui/utils/esm/ClassNameGenerator/ClassNameGenerator.js","../../node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js","../../node_modules/@mui/utils/esm/generateUtilityClasses/generateUtilityClasses.js","../../node_modules/@mui/utils/esm/clamp/clamp.js","../../node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js","../../node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js","../../node_modules/clsx/dist/clsx.mjs","../../node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js","../../node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js","../../node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js","../../node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js","../../node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js","../../node_modules/@mui/utils/esm/getReactElementRef/getReactElementRef.js","../../node_modules/@mui/system/esm/merge/merge.js","../../node_modules/@mui/system/esm/cssContainerQueries/cssContainerQueries.js","../../node_modules/@mui/system/esm/breakpoints/breakpoints.js","../../node_modules/@mui/system/esm/style/style.js","../../node_modules/@mui/system/esm/memoize/memoize.js","../../node_modules/@mui/system/esm/spacing/spacing.js","../../node_modules/@mui/system/esm/compose/compose.js","../../node_modules/@mui/system/esm/borders/borders.js","../../node_modules/@mui/system/esm/cssGrid/cssGrid.js","../../node_modules/@mui/system/esm/palette/palette.js","../../node_modules/@mui/system/esm/sizing/sizing.js","../../node_modules/@mui/system/esm/styleFunctionSx/defaultSxConfig.js","../../node_modules/@mui/system/esm/styleFunctionSx/styleFunctionSx.js","../../node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js","../../node_modules/@babel/runtime/helpers/esm/extends.js","../../node_modules/@emotion/sheet/dist/emotion-sheet.esm.js","../../node_modules/stylis/src/Enum.js","../../node_modules/stylis/src/Utility.js","../../node_modules/stylis/src/Tokenizer.js","../../node_modules/stylis/src/Parser.js","../../node_modules/stylis/src/Serializer.js","../../node_modules/stylis/src/Middleware.js","../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../node_modules/@emotion/serialize/dist/emotion-serialize.esm.js","../../node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-useLine truncated
|
||||
@@ -14,7 +14,7 @@
|
||||
<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 Transcription Review</title>
|
||||
<script type="module" crossorigin src="/assets/index-V91xgc4E.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-BSMgOq4Z.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "lyrics-transcriber"
|
||||
version = "0.84.0"
|
||||
version = "0.86.0"
|
||||
description = "Automatically create synchronised lyrics files in ASS and MidiCo LRC formats with word-level timestamps, using Whisper and lyrics from Genius and Spotify"
|
||||
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.95.0"
|
||||
version = "0.96.0"
|
||||
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"
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Preview email templates by generating HTML files.
|
||||
|
||||
Usage:
|
||||
python scripts/preview-emails.py
|
||||
|
||||
This will create HTML files in /tmp/email-previews/ that can be opened in a browser.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add parent directory to path for imports
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
# Set dummy env vars before importing
|
||||
os.environ.setdefault("FRONTEND_URL", "https://gen.nomadkaraoke.com")
|
||||
|
||||
from backend.services.email_service import EmailService, PreviewEmailProvider
|
||||
from backend.services.template_service import TemplateService
|
||||
|
||||
|
||||
def main():
|
||||
output_dir = Path("/tmp/email-previews")
|
||||
output_dir.mkdir(exist_ok=True)
|
||||
|
||||
# Create email service with preview provider to capture HTML
|
||||
preview_provider = PreviewEmailProvider()
|
||||
email_service = EmailService()
|
||||
email_service.provider = preview_provider
|
||||
|
||||
# Create template service for realistic message content
|
||||
template_service = TemplateService()
|
||||
|
||||
print(f"Generating email previews in {output_dir}...")
|
||||
|
||||
# Magic link email
|
||||
email_service.send_magic_link("user@example.com", "abc123xyz")
|
||||
save_preview(output_dir, "magic_link", preview_provider)
|
||||
|
||||
# Credits added email
|
||||
email_service.send_credits_added("user@example.com", credits=5, total_credits=8)
|
||||
save_preview(output_dir, "credits_added", preview_provider)
|
||||
|
||||
# Welcome email
|
||||
email_service.send_welcome_email("user@example.com", credits=3)
|
||||
save_preview(output_dir, "welcome", preview_provider)
|
||||
|
||||
# Beta welcome email
|
||||
email_service.send_beta_welcome_email("user@example.com", credits=1)
|
||||
save_preview(output_dir, "beta_welcome", preview_provider)
|
||||
|
||||
# Feedback request email
|
||||
email_service.send_feedback_request_email(
|
||||
"user@example.com",
|
||||
feedback_url="https://forms.example.com/feedback",
|
||||
job_title="Taylor Swift - Love Story",
|
||||
)
|
||||
save_preview(output_dir, "feedback_request", preview_provider)
|
||||
|
||||
# Job completion email - use template service for realistic content
|
||||
job_completion_content = template_service.render_job_completion(
|
||||
name="there",
|
||||
youtube_url="https://www.youtube.com/watch?v=abc123",
|
||||
dropbox_url="https://www.dropbox.com/folder/example",
|
||||
artist="Taylor Swift",
|
||||
title="Love Story",
|
||||
job_id="abc123",
|
||||
feedback_url="https://forms.example.com/feedback",
|
||||
)
|
||||
email_service.send_job_completion(
|
||||
to_email="user@example.com",
|
||||
message_content=job_completion_content,
|
||||
artist="Taylor Swift",
|
||||
title="Love Story",
|
||||
brand_code="NOMAD-1234",
|
||||
)
|
||||
save_preview(output_dir, "job_completion", preview_provider)
|
||||
|
||||
# Action reminder (lyrics) email - use template service for realistic content
|
||||
lyrics_reminder_content = template_service.render_action_needed_lyrics(
|
||||
name="there",
|
||||
artist="Taylor Swift",
|
||||
title="Love Story",
|
||||
review_url="https://gen.nomadkaraoke.com/lyrics/?baseApiUrl=...",
|
||||
)
|
||||
email_service.send_action_reminder(
|
||||
to_email="user@example.com",
|
||||
message_content=lyrics_reminder_content,
|
||||
action_type="lyrics",
|
||||
artist="Taylor Swift",
|
||||
title="Love Story",
|
||||
)
|
||||
save_preview(output_dir, "action_reminder", preview_provider)
|
||||
|
||||
print(f"\nOpen these files in a browser to preview the emails.")
|
||||
print(f"Example: open {output_dir}/magic_link.html")
|
||||
|
||||
|
||||
def save_preview(output_dir: Path, name: str, provider: PreviewEmailProvider):
|
||||
"""Save the captured HTML to a file."""
|
||||
html = provider.get_last_html()
|
||||
if html:
|
||||
output_file = output_dir / f"{name}.html"
|
||||
output_file.write_text(html)
|
||||
print(f" Created: {output_file}")
|
||||
else:
|
||||
print(f" ERROR: No HTML captured for {name}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,383 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Test script for the Lyrics Review UI with sample correction data.
|
||||
|
||||
Usage:
|
||||
python scripts/test-lyrics-review.py [--audio /path/to/audio.mp3]
|
||||
|
||||
This will:
|
||||
1. Create mock correction data (or load from file)
|
||||
2. Start the lyrics review server
|
||||
3. Open your browser to the review UI
|
||||
|
||||
Note: Without an audio file, playback won't work but you can still test the UI modals.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
# Add the project root and lyrics_transcriber_temp to the path
|
||||
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, project_root)
|
||||
sys.path.insert(0, os.path.join(project_root, "lyrics_transcriber_temp"))
|
||||
|
||||
from lyrics_transcriber.types import (
|
||||
CorrectionResult,
|
||||
LyricsData,
|
||||
LyricsMetadata,
|
||||
LyricsSegment,
|
||||
Word,
|
||||
WordCorrection,
|
||||
)
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from lyrics_transcriber.review.server import ReviewServer
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_sample_correction_result() -> CorrectionResult:
|
||||
"""Create sample correction data for testing the UI."""
|
||||
|
||||
# Sample segments with words
|
||||
segments = [
|
||||
LyricsSegment(
|
||||
id="seg-1",
|
||||
text="Hello, is it me you're looking for?",
|
||||
words=[
|
||||
Word(id="w1", text="Hello,", start_time=0.0, end_time=0.5),
|
||||
Word(id="w2", text="is", start_time=0.5, end_time=0.7),
|
||||
Word(id="w3", text="it", start_time=0.7, end_time=0.9),
|
||||
Word(id="w4", text="me", start_time=0.9, end_time=1.1),
|
||||
Word(id="w5", text="you're", start_time=1.1, end_time=1.3),
|
||||
Word(id="w6", text="looking", start_time=1.3, end_time=1.6),
|
||||
Word(id="w7", text="for?", start_time=1.6, end_time=1.9),
|
||||
],
|
||||
start_time=0.0,
|
||||
end_time=1.9,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="seg-2",
|
||||
text="I can see it in your eyes",
|
||||
words=[
|
||||
Word(id="w8", text="I", start_time=2.0, end_time=2.2),
|
||||
Word(id="w9", text="can", start_time=2.2, end_time=2.4),
|
||||
Word(id="w10", text="see", start_time=2.4, end_time=2.6),
|
||||
Word(id="w11", text="it", start_time=2.6, end_time=2.8),
|
||||
Word(id="w12", text="in", start_time=2.8, end_time=3.0),
|
||||
Word(id="w13", text="your", start_time=3.0, end_time=3.2),
|
||||
Word(id="w14", text="eyes", start_time=3.2, end_time=3.5),
|
||||
],
|
||||
start_time=2.0,
|
||||
end_time=3.5,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="seg-3",
|
||||
text="I can see it in your smile",
|
||||
words=[
|
||||
Word(id="w15", text="I", start_time=4.0, end_time=4.2),
|
||||
Word(id="w16", text="can", start_time=4.2, end_time=4.4),
|
||||
Word(id="w17", text="see", start_time=4.4, end_time=4.6),
|
||||
Word(id="w18", text="it", start_time=4.6, end_time=4.8),
|
||||
Word(id="w19", text="in", start_time=4.8, end_time=5.0),
|
||||
Word(id="w20", text="your", start_time=5.0, end_time=5.2),
|
||||
Word(id="w21", text="smile", start_time=5.2, end_time=5.5),
|
||||
],
|
||||
start_time=4.0,
|
||||
end_time=5.5,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="seg-4",
|
||||
text="You're all I've ever wanted",
|
||||
words=[
|
||||
Word(id="w22", text="You're", start_time=6.0, end_time=6.3),
|
||||
Word(id="w23", text="all", start_time=6.3, end_time=6.5),
|
||||
Word(id="w24", text="I've", start_time=6.5, end_time=6.7),
|
||||
Word(id="w25", text="ever", start_time=6.7, end_time=6.9),
|
||||
Word(id="w26", text="wanted", start_time=6.9, end_time=7.3),
|
||||
],
|
||||
start_time=6.0,
|
||||
end_time=7.3,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="seg-5",
|
||||
text="And my arms are open wide",
|
||||
words=[
|
||||
Word(id="w27", text="And", start_time=8.0, end_time=8.2),
|
||||
Word(id="w28", text="my", start_time=8.2, end_time=8.4),
|
||||
Word(id="w29", text="arms", start_time=8.4, end_time=8.6),
|
||||
Word(id="w30", text="are", start_time=8.6, end_time=8.8),
|
||||
Word(id="w31", text="open", start_time=8.8, end_time=9.1),
|
||||
Word(id="w32", text="wide", start_time=9.1, end_time=9.5),
|
||||
],
|
||||
start_time=8.0,
|
||||
end_time=9.5,
|
||||
),
|
||||
]
|
||||
|
||||
# Sample corrections (simulating AI corrections)
|
||||
# WordCorrection fields: original_word, corrected_word, source, reason,
|
||||
# original_position (int), segment_index (int), confidence (float),
|
||||
# word_id (str), handler (str)
|
||||
corrections = [
|
||||
WordCorrection(
|
||||
original_word="your",
|
||||
corrected_word="you're",
|
||||
source="agentic",
|
||||
reason="Corrected contraction",
|
||||
original_position=5, # position in segment
|
||||
segment_index=1,
|
||||
confidence=0.95,
|
||||
word_id="w13",
|
||||
handler="SpellingHandler",
|
||||
reference_positions={"genius": 5, "musixmatch": 5},
|
||||
),
|
||||
WordCorrection(
|
||||
original_word="smile",
|
||||
corrected_word="smile,",
|
||||
source="agentic",
|
||||
reason="Added punctuation",
|
||||
original_position=6,
|
||||
segment_index=2,
|
||||
confidence=0.85,
|
||||
word_id="w21",
|
||||
handler="PunctuationHandler",
|
||||
reference_positions={"genius": 6},
|
||||
),
|
||||
]
|
||||
|
||||
# Reference lyrics from different sources (must be LyricsData objects)
|
||||
genius_metadata = LyricsMetadata(
|
||||
source="genius",
|
||||
track_name="Hello",
|
||||
artist_names="Lionel Richie",
|
||||
language="en",
|
||||
lyrics_provider="genius",
|
||||
lyrics_provider_id="123456",
|
||||
)
|
||||
musixmatch_metadata = LyricsMetadata(
|
||||
source="musixmatch",
|
||||
track_name="Hello",
|
||||
artist_names="Lionel Richie",
|
||||
language="en",
|
||||
lyrics_provider="musixmatch",
|
||||
lyrics_provider_id="789012",
|
||||
)
|
||||
|
||||
reference_lyrics = {
|
||||
"genius": LyricsData(
|
||||
segments=[
|
||||
LyricsSegment(
|
||||
id="ref-g-1",
|
||||
text="Hello, is it me you're looking for?",
|
||||
words=[],
|
||||
start_time=0.0,
|
||||
end_time=1.9,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="ref-g-2",
|
||||
text="I can see it in your eyes",
|
||||
words=[],
|
||||
start_time=2.0,
|
||||
end_time=3.5,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="ref-g-3",
|
||||
text="I can see it in your smile",
|
||||
words=[],
|
||||
start_time=4.0,
|
||||
end_time=5.5,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="ref-g-4",
|
||||
text="You're all I've ever wanted",
|
||||
words=[],
|
||||
start_time=6.0,
|
||||
end_time=7.3,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="ref-g-5",
|
||||
text="And my arms are open wide",
|
||||
words=[],
|
||||
start_time=8.0,
|
||||
end_time=9.5,
|
||||
),
|
||||
],
|
||||
metadata=genius_metadata,
|
||||
source="genius",
|
||||
),
|
||||
"musixmatch": LyricsData(
|
||||
segments=[
|
||||
LyricsSegment(
|
||||
id="ref-m-1",
|
||||
text="Hello, is it me you're looking for",
|
||||
words=[],
|
||||
start_time=0.0,
|
||||
end_time=1.9,
|
||||
),
|
||||
LyricsSegment(
|
||||
id="ref-m-2",
|
||||
text="I can see it in your eyes",
|
||||
words=[],
|
||||
start_time=2.0,
|
||||
end_time=3.5,
|
||||
),
|
||||
],
|
||||
metadata=musixmatch_metadata,
|
||||
source="musixmatch",
|
||||
),
|
||||
}
|
||||
|
||||
# Create the CorrectionResult with all required fields
|
||||
return CorrectionResult(
|
||||
original_segments=segments,
|
||||
corrected_segments=segments.copy(), # Would have corrections applied
|
||||
corrections=corrections,
|
||||
corrections_made=len(corrections),
|
||||
confidence=0.88,
|
||||
reference_lyrics=reference_lyrics,
|
||||
anchor_sequences=[], # Empty for simple test
|
||||
gap_sequences=[], # Empty for simple test
|
||||
resized_segments=segments.copy(),
|
||||
metadata={
|
||||
"title": "Hello",
|
||||
"artist": "Lionel Richie",
|
||||
"language": "en",
|
||||
"source": "whisper",
|
||||
"anchor_sequences_count": 0,
|
||||
"gap_sequences_count": 0,
|
||||
"total_words": 32,
|
||||
"correction_ratio": len(corrections) / 32, # 2 corrections out of 32 words
|
||||
},
|
||||
correction_steps=[], # Empty for simple test
|
||||
word_id_map={}, # Empty for simple test
|
||||
segment_id_map={}, # Empty for simple test
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Test the Lyrics Review UI locally"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--audio",
|
||||
default=None,
|
||||
help="Optional: Path to audio file for playback testing"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--port",
|
||||
type=int,
|
||||
default=8766,
|
||||
help="Port to run the server on (default: 8766)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-browser",
|
||||
action="store_true",
|
||||
help="Don't open browser automatically"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Create temp directory for outputs
|
||||
cache_dir = tempfile.mkdtemp(prefix="lyrics_review_test_")
|
||||
|
||||
# Handle audio file
|
||||
if args.audio:
|
||||
if not os.path.exists(args.audio):
|
||||
logger.error(f"Audio file not found: {args.audio}")
|
||||
sys.exit(1)
|
||||
audio_path = args.audio
|
||||
else:
|
||||
# Create a placeholder - UI will work but playback won't
|
||||
audio_path = os.path.join(cache_dir, "placeholder.mp3")
|
||||
with open(audio_path, "wb") as f:
|
||||
f.write(b"") # Empty file
|
||||
logger.warning("No audio file provided - playback will not work")
|
||||
|
||||
logger.info("=" * 60)
|
||||
logger.info("LYRICS REVIEW UI TEST")
|
||||
logger.info("=" * 60)
|
||||
logger.info(f"Cache dir: {cache_dir}")
|
||||
if args.audio:
|
||||
logger.info(f"Audio file: {args.audio}")
|
||||
logger.info("")
|
||||
|
||||
# Create correction result
|
||||
logger.info("[1/2] Creating sample correction data...")
|
||||
correction_result = create_sample_correction_result()
|
||||
logger.info(f" Segments: {len(correction_result.original_segments)}")
|
||||
logger.info(f" Corrections: {len(correction_result.corrections)}")
|
||||
logger.info(f" Reference sources: {list(correction_result.reference_lyrics.keys())}")
|
||||
logger.info("")
|
||||
|
||||
# Create output config
|
||||
output_config = OutputConfig(
|
||||
output_dir=cache_dir,
|
||||
cache_dir=cache_dir,
|
||||
output_styles_json="{}",
|
||||
styles={},
|
||||
)
|
||||
|
||||
# Start review server
|
||||
logger.info("[2/2] Starting review server...")
|
||||
logger.info(f" URL: http://localhost:{args.port}/")
|
||||
logger.info("")
|
||||
logger.info("=" * 60)
|
||||
logger.info("REVIEW UI READY")
|
||||
logger.info("=" * 60)
|
||||
logger.info("")
|
||||
logger.info("Test the following features:")
|
||||
logger.info(" - Word editing (click on words)")
|
||||
logger.info(" - Segment editing (edit mode)")
|
||||
logger.info(" - Reference lyrics comparison")
|
||||
logger.info(" - AI correction review")
|
||||
logger.info(" - Find/replace")
|
||||
logger.info("")
|
||||
logger.info("Press Ctrl+C to stop the server.")
|
||||
logger.info("")
|
||||
|
||||
server = ReviewServer(
|
||||
correction_result=correction_result,
|
||||
output_config=output_config,
|
||||
audio_filepath=audio_path,
|
||||
logger=logger,
|
||||
)
|
||||
|
||||
try:
|
||||
# Start server with proper browser URL (includes apiUrl param)
|
||||
import webbrowser
|
||||
import threading
|
||||
import urllib.parse
|
||||
|
||||
# Build the correct URL with apiUrl query parameter
|
||||
# Note: Backend routes are at /api/ (not /api/v1/)
|
||||
api_url = f"http://localhost:{args.port}/api"
|
||||
encoded_api_url = urllib.parse.quote(api_url, safe='')
|
||||
browser_url = f"http://localhost:{args.port}?baseApiUrl={encoded_api_url}"
|
||||
|
||||
if not args.no_browser:
|
||||
def open_browser():
|
||||
import time
|
||||
time.sleep(1) # Wait for server to start
|
||||
logger.info(f"Opening browser: {browser_url}")
|
||||
webbrowser.open(browser_url)
|
||||
|
||||
threading.Thread(target=open_browser, daemon=True).start()
|
||||
else:
|
||||
logger.info(f"Open in browser: {browser_url}")
|
||||
|
||||
import uvicorn
|
||||
uvicorn.run(server.app, host="0.0.0.0", port=args.port, log_level="warning")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logger.info("\nServer stopped by user.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||