mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-21 13:28:08 +09:00
feat(ui): Simplify Create Karaoke form and fix brand color contrast (#234)
## Summary - Simplify the "Create Karaoke Video" form by hiding advanced options and improving UX - Fix brand pink color contrast for accessibility (WCAG compliance) - Fix E2E tests that were failing due to ambiguous form selectors - Reorganize job output links into logical sections ## Changes ### UI Simplification - Hide theme settings from user-facing UI (now admin-only) - Add collapsible "Display As" toggle for title screen overrides - Make non-interactive mode checkbox admin-only - Change placeholders to user-friendly language (removed "on trackers") ### Audio Search Dialog - Hide technical tracker names (RED, OPS), only show YouTube badge - Replace exact seeder count with "High/Medium/Low availability" badges - Rename "TOP SEEDED" category to "BEST CHOICE" - Add red VINYL badge for vinyl rips ### Brand Color Accessibility - Swap brand pink colors for better white text contrast - Default `--brand-pink`: #ff5bb8 (darker, better WCAG contrast) - Hover `--brand-pink-hover`: #ff7acc (lighter, original brand pink) - Apply brand pink to form tabs, buttons, and primary CTAs ### Output Links Reorganization - Organize into "Downloads", "Links", "Admin Tools" sections - 4K Video as primary CTA (brand pink), 720p as secondary - Secondary downloads use dark gray style with border - Dropbox uses Dropbox blue (#0061FE) - YouTube keeps red (platform branding) ### E2E Test Fixes - Add `data-testid` attributes to search form inputs - Update all tests to use `getByTestId` for robust selectors - Remove obsolete theme selection logic from production tests ## Test plan - [x] Regression tests pass (9/9 karaoke-generation, 28/28 mobile) - [x] Frontend builds successfully - [ ] Manual verification of UI changes in browser - [ ] Production E2E test after deployment ## Documentation - Updated `docs/BRAND-STYLE-GUIDE.md` to v1.2 with accessibility notes - Added testing lesson to `docs/LESSONS-LEARNED.md` - Updated `docs/README.md` with recent changes entry <!-- @coderabbitai ignore --> 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
37cfd734bc
commit
a573152606
15 files changed
+380
-352
No files matched your search
+21
-13
@@ -1,7 +1,7 @@
|
||||
# Nomad Karaoke Brand Style Guide
|
||||
|
||||
> **Version**: 1.1
|
||||
> **Last Updated**: 2026-01-07
|
||||
> **Version**: 1.2
|
||||
> **Last Updated**: 2026-01-08
|
||||
> **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.
|
||||
@@ -46,9 +46,12 @@ Nomad Karaoke is **approachable**, **professional**, and **modern**. We make sop
|
||||
|
||||
| Name | Hex | RGB | Usage |
|
||||
|------|-----|-----|-------|
|
||||
| **Hot Pink** | `#ff7acc` | rgb(255, 122, 204) | Primary brand color, logo, primary buttons, key accents |
|
||||
| **Hot Pink** | `#ff5bb8` | rgb(255, 91, 184) | Primary brand color, buttons with white text (better contrast) |
|
||||
| **Hot Pink Light** | `#ff7acc` | rgb(255, 122, 204) | Logo, hover states, accents where contrast is less critical |
|
||||
| **Gold** | `#ffdf6b` | rgb(255, 223, 107) | Secondary accent, highlights, success states, premium feel |
|
||||
|
||||
> **Accessibility Note**: We use the darker pink (`#ff5bb8`) as the default for UI elements with white text because it provides better contrast ratio (WCAG compliance). The lighter pink (`#ff7acc`) is used for hover states and decorative accents where white text contrast is less critical.
|
||||
|
||||
### Supporting Colors
|
||||
|
||||
| Name | Hex | RGB | Usage |
|
||||
@@ -259,7 +262,8 @@ Use [Lucide Icons](https://lucide.dev/) for UI icons. They are:
|
||||
|
||||
#### Primary Button (CTA)
|
||||
```css
|
||||
background-color: #ff7acc;
|
||||
/* Default state uses darker pink for better white text contrast */
|
||||
background-color: #ff5bb8;
|
||||
color: #ffffff;
|
||||
padding: 14px 28px;
|
||||
border-radius: 12px;
|
||||
@@ -267,8 +271,8 @@ font-weight: 600;
|
||||
box-shadow: 0 0 20px rgba(255, 122, 204, 0.4);
|
||||
transition: all 0.2s ease;
|
||||
|
||||
/* Hover */
|
||||
background-color: #ff5bb8;
|
||||
/* Hover - lightens to original brand pink */
|
||||
background-color: #ff7acc;
|
||||
box-shadow: 0 0 30px rgba(255, 122, 204, 0.6);
|
||||
```
|
||||
|
||||
@@ -560,9 +564,10 @@ export function ThemeToggle() {
|
||||
--text-muted: #64748b;
|
||||
}
|
||||
|
||||
/* Brand colors stay consistent */
|
||||
/* Brand colors stay consistent across themes */
|
||||
:root {
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-pink: #ff5bb8; /* Darker - better white text contrast */
|
||||
--brand-pink-hover: #ff7acc; /* Lighter - for hover states */
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
}
|
||||
@@ -585,8 +590,9 @@ export function ThemeToggle() {
|
||||
```css
|
||||
:root {
|
||||
/* Brand Colors */
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-pink-hover: #ff5bb8;
|
||||
/* Note: darker pink used as default for better white text contrast */
|
||||
--brand-pink: #ff5bb8; /* Default - better contrast with white text */
|
||||
--brand-pink-hover: #ff7acc; /* Hover - lighter, original brand pink */
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
--brand-blue: #3b82f6;
|
||||
@@ -627,8 +633,9 @@ module.exports = {
|
||||
extend: {
|
||||
colors: {
|
||||
brand: {
|
||||
pink: '#ff7acc',
|
||||
'pink-hover': '#ff5bb8',
|
||||
// Darker pink as default for better white text contrast
|
||||
pink: '#ff5bb8',
|
||||
'pink-hover': '#ff7acc', // Lighter for hover states
|
||||
gold: '#ffdf6b',
|
||||
purple: '#8b5cf6',
|
||||
blue: '#3b82f6',
|
||||
@@ -660,7 +667,7 @@ export function PrimaryButton({ children, ...props }) {
|
||||
## Checklist for Brand Compliance
|
||||
|
||||
### Landing Pages
|
||||
- [ ] Uses brand pink (#ff7acc) for primary CTAs
|
||||
- [ ] Uses brand pink (#ff5bb8) for primary CTAs with white text
|
||||
- [ ] Logo displayed correctly
|
||||
- [ ] Dark theme as default
|
||||
- [ ] Gradient text on hero headlines
|
||||
@@ -693,6 +700,7 @@ export function PrimaryButton({ children, ...props }) {
|
||||
|
||||
| Version | Date | Changes |
|
||||
|---------|------|---------|
|
||||
| 1.2 | 2026-01-08 | **Accessibility improvement**: Swapped brand pink colors for better white text contrast. Default `--brand-pink` is now `#ff5bb8` (darker) for buttons/CTAs, hover state `--brand-pink-hover` is now `#ff7acc` (lighter). The original lighter pink had insufficient contrast ratio with white text. |
|
||||
| 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 |
|
||||
|
||||
|
||||
@@ -449,6 +449,41 @@ interface UserProfileResponse {
|
||||
|
||||
**Lesson**: When writing E2E test mocks, check the TypeScript interface/type definition for the API response, not just what fields the UI displays. Silent failures from type mismatches are hard to debug.
|
||||
|
||||
### Use data-testid for Robust E2E Selectors
|
||||
|
||||
**Problem**: E2E test using `page.getByLabel('Artist')` started failing after UI changes added a second "Artist" input field (for "Display As" override).
|
||||
|
||||
```
|
||||
Error: strict mode violation: getByLabel('Artist') resolved to 2 elements:
|
||||
1) <input id="search-artist" ...>
|
||||
2) <input id="display-artist" ...>
|
||||
```
|
||||
|
||||
**Why it happened**: The test used label-based selectors (`getByLabel`) which are readable but brittle when forms evolve. Adding new fields with similar labels broke existing tests.
|
||||
|
||||
**Solution**: Add explicit `data-testid` attributes to form inputs and use `getByTestId()` in tests:
|
||||
|
||||
```tsx
|
||||
// Component
|
||||
<Input
|
||||
id="search-artist"
|
||||
data-testid="search-artist-input"
|
||||
placeholder="Artist name"
|
||||
...
|
||||
/>
|
||||
|
||||
// Test
|
||||
await page.getByTestId('search-artist-input').fill(TEST_SONG.artist);
|
||||
```
|
||||
|
||||
**Lesson**: For E2E tests, prefer `data-testid` attributes over label/text selectors. They're:
|
||||
- Explicit about test intent
|
||||
- Immune to label text changes
|
||||
- Won't break when similar fields are added
|
||||
- Self-documenting (shows which elements are tested)
|
||||
|
||||
Reserve `getByLabel`/`getByRole` for testing accessibility - they verify the UI is properly labeled - but use `getByTestId` for form interactions in integration tests.
|
||||
|
||||
### Emulator Tests Catch Real Bugs
|
||||
|
||||
Unit tests with mocks didn't catch the `input_media_gcs_path` bug. Emulator integration tests did because they use real Firestore behavior.
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
## Recent Changes
|
||||
|
||||
- **UI Simplification & Brand Accessibility** (2026-01-08): Simplified the "Create Karaoke Video" form by hiding advanced options (theme settings now admin-only, "Display As" behind toggle). Improved audio search dialog UX by hiding technical tracker names and showing user-friendly availability badges. Fixed brand pink color contrast for accessibility - swapped default/hover values so white text on pink buttons meets WCAG contrast ratio. See [BRAND-STYLE-GUIDE.md](BRAND-STYLE-GUIDE.md) v1.2.
|
||||
|
||||
- **SpaCy Preloading** (2026-01-08): Implemented SpaCy model preloading at container startup to eliminate 60+ second delay during agentic correction. The `en_core_web_sm` model is now loaded during FastAPI lifespan startup, and `PhraseAnalyzer`/`SyllablesMatchHandler` reuse the preloaded model. Added timing logs to verify performance. See [archive/2026-01-08-spacy-preload-plan.md](archive/2026-01-08-spacy-preload-plan.md).
|
||||
|
||||
- **Thread-Safe LangChain Model Initialization** (2026-01-08): Fixed race condition in `LangChainBridge` where parallel threads could all try to initialize the AI model simultaneously, causing 6+ minute delays. Added double-checked locking with `threading.Lock()`. PR #232. See [LESSONS-LEARNED.md](LESSONS-LEARNED.md#thread-safe-lazy-initialization-in-shared-components).
|
||||
|
||||
@@ -94,7 +94,7 @@ export default function AppPage() {
|
||||
// Show nothing while checking auth (prevents flash)
|
||||
if (isAuthenticated === null) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center" style={{ background: 'var(--bg)' }}>
|
||||
<div className="min-h-screen flex items-center justify-center animated-gradient">
|
||||
<Loader2 className="w-8 h-8 animate-spin" style={{ color: 'var(--text-muted)' }} />
|
||||
</div>
|
||||
)
|
||||
@@ -103,19 +103,19 @@ export default function AppPage() {
|
||||
// Show warming up loader during initial job load (cold start scenario)
|
||||
if (isInitialLoad && isLoadingJobs) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center" style={{ background: 'var(--bg)' }}>
|
||||
<div className="min-h-screen flex items-center justify-center animated-gradient">
|
||||
<WarmingUpLoader spinnerClassName="w-10 h-10" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen" style={{ background: 'var(--bg)' }}>
|
||||
<div className="min-h-screen animated-gradient">
|
||||
{/* AutoProcessor - handles non-interactive mode for jobs with that flag */}
|
||||
<AutoProcessor jobs={jobs} onJobsChanged={loadJobs} />
|
||||
|
||||
{/* Header */}
|
||||
<header className="border-b backdrop-blur-sm sticky top-0 z-10" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<header className="fixed top-0 left-0 right-0 z-50 bg-dark-900/80 backdrop-blur-md border-b border-dark-700">
|
||||
<div className="px-3 sm:px-4 py-2 sm:py-3 flex items-center justify-between gap-2">
|
||||
<div className="flex items-center gap-2 sm:gap-3 min-w-0">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-8 sm:h-10 shrink-0" />
|
||||
@@ -164,7 +164,7 @@ export default function AppPage() {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="px-4 py-8 space-y-6">
|
||||
<main className="px-4 pt-24 pb-8 space-y-6">
|
||||
<div className="grid lg:grid-cols-2 gap-8">
|
||||
{/* Submit Job Card */}
|
||||
<Card className="backdrop-blur" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
=========================================== */
|
||||
|
||||
/* Brand Primary Colors */
|
||||
--brand-pink: #ff7acc;
|
||||
--brand-pink-hover: #ff5bb8;
|
||||
/* Note: darker pink (#ff5bb8) used as default for better white text contrast */
|
||||
--brand-pink: #ff5bb8;
|
||||
--brand-pink-hover: #ff7acc;
|
||||
--brand-pink-glow: rgba(255, 122, 204, 0.4);
|
||||
--brand-gold: #ffdf6b;
|
||||
--brand-purple: #8b5cf6;
|
||||
|
||||
@@ -214,13 +214,13 @@ export default function LandingPage() {
|
||||
<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">
|
||||
<div className="flex items-center gap-3">
|
||||
<ThemeToggle />
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="text-sm text-dark-300 hover:text-white transition-colors"
|
||||
className="px-4 py-2 text-sm font-semibold rounded-lg bg-[var(--brand-pink)] text-white hover:bg-[var(--brand-pink-hover)] hover:scale-105 hover:shadow-[0_0_20px_rgba(255,122,204,0.5)] active:scale-95 transition-all duration-200"
|
||||
>
|
||||
Already have credits? Sign in
|
||||
Sign In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,7 @@ interface CategoryConfig {
|
||||
}
|
||||
|
||||
const CATEGORY_CONFIG: Record<string, CategoryConfig> = {
|
||||
'TOP SEEDED': { name: 'TOP SEEDED', maxDisplay: 3, color: 'text-amber-400', borderColor: 'border-amber-500/30' },
|
||||
'BEST CHOICE': { name: 'BEST CHOICE', maxDisplay: 3, color: 'text-amber-400', borderColor: 'border-amber-500/30' },
|
||||
'HI-RES 24-BIT': { name: 'HI-RES 24-BIT', maxDisplay: 3, color: 'text-purple-400', borderColor: 'border-purple-500/30' },
|
||||
'STUDIO ALBUMS': { name: 'STUDIO ALBUMS', maxDisplay: 3, color: 'text-blue-400', borderColor: 'border-blue-500/30' },
|
||||
'SINGLES': { name: 'SINGLES', maxDisplay: 2, color: 'text-cyan-400', borderColor: 'border-cyan-500/30' },
|
||||
@@ -56,7 +56,7 @@ const CATEGORY_CONFIG: Record<string, CategoryConfig> = {
|
||||
}
|
||||
|
||||
const CATEGORY_ORDER = [
|
||||
'TOP SEEDED',
|
||||
'BEST CHOICE',
|
||||
'HI-RES 24-BIT',
|
||||
'STUDIO ALBUMS',
|
||||
'SINGLES',
|
||||
@@ -81,9 +81,9 @@ function categorizeResult(result: ExtendedAudioSearchResult): string {
|
||||
return 'YOUTUBE/LOSSY'
|
||||
}
|
||||
|
||||
// Top seeded (50+ seeders, lossless)
|
||||
// Best choice (50+ seeders, lossless)
|
||||
if (isLossless && seeders >= 50) {
|
||||
return 'TOP SEEDED'
|
||||
return 'BEST CHOICE'
|
||||
}
|
||||
|
||||
// Hi-res 24-bit
|
||||
@@ -334,21 +334,23 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
|
||||
{/* Main content - 2 lines */}
|
||||
<div className="flex-1 min-w-0">
|
||||
{/* Line 1: badges + artist + title + quality + size + seeders */}
|
||||
{/* Line 1: badges + artist + title + quality + size + availability */}
|
||||
<div className="flex items-center gap-1 flex-wrap">
|
||||
{result.is_lossless && (
|
||||
<span className="text-[8px] px-1 py-0.5 rounded bg-green-600/20 text-green-400 font-medium">
|
||||
LOSSLESS
|
||||
</span>
|
||||
)}
|
||||
<span className={`text-[8px] px-1 py-0.5 rounded font-medium ${
|
||||
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-muted text-muted-foreground"
|
||||
}`}>
|
||||
{result.provider}
|
||||
</span>
|
||||
{result.quality_data?.media?.toLowerCase() === 'vinyl' && (
|
||||
<span className="text-[8px] px-1 py-0.5 rounded bg-red-600/20 text-red-400 font-medium">
|
||||
VINYL
|
||||
</span>
|
||||
)}
|
||||
{result.provider === "YouTube" && (
|
||||
<span className="text-[8px] px-1 py-0.5 rounded font-medium bg-red-600/20 text-red-400">
|
||||
YouTube
|
||||
</span>
|
||||
)}
|
||||
<span className="text-green-400 font-medium">{getDisplayName(result)}</span>
|
||||
<span className="text-muted-foreground">-</span>
|
||||
<span className="text-foreground">{result.title}</span>
|
||||
@@ -357,18 +359,18 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect }: AudioSearc
|
||||
</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' :
|
||||
result.seeders >= 10 ? 'text-yellow-400' :
|
||||
'text-red-400'
|
||||
<span className={`text-[8px] px-1 py-0.5 rounded font-medium ${
|
||||
result.seeders >= 50 ? 'bg-green-600/20 text-green-400' :
|
||||
result.seeders >= 10 ? 'bg-yellow-600/20 text-yellow-400' :
|
||||
'bg-red-600/20 text-red-400'
|
||||
}`}>
|
||||
{result.seeders} seed
|
||||
{result.seeders >= 50 ? 'High' : result.seeders >= 10 ? 'Medium' : 'Low'} availability
|
||||
</span>
|
||||
) : result.view_count !== undefined ? (
|
||||
<span className={`text-[10px] ${
|
||||
result.view_count >= 1000000 ? 'text-green-400' :
|
||||
result.view_count >= 10000 ? 'text-yellow-400' :
|
||||
'text-muted-foreground'
|
||||
<span className={`text-[8px] px-1 py-0.5 rounded font-medium ${
|
||||
result.view_count >= 1000000 ? 'bg-green-600/20 text-green-400' :
|
||||
result.view_count >= 10000 ? 'bg-yellow-600/20 text-yellow-400' :
|
||||
'bg-muted text-muted-foreground'
|
||||
}`}>
|
||||
{formatCount(result.view_count)} views
|
||||
</span>
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
import { useState } from "react"
|
||||
import { api, ApiError } from "@/lib/api"
|
||||
import type { ColorOverrides } from "@/lib/video-themes"
|
||||
import { cleanColorOverrides } from "@/lib/video-themes"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Label } from "@/components/ui/label"
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
||||
import { ThemeSelector } from "./ThemeSelector"
|
||||
import { ColorOverridesPanel } from "./ColorOverrides"
|
||||
import { Upload, Youtube, Music, Loader2 } from "lucide-react"
|
||||
import { Upload, Youtube, Music, Loader2, ChevronDown, ChevronRight } from "lucide-react"
|
||||
|
||||
interface JobSubmissionProps {
|
||||
onJobCreated: () => void
|
||||
}
|
||||
|
||||
export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
const { user } = useAuth()
|
||||
const isAdmin = user?.role === "admin"
|
||||
|
||||
const [activeTab, setActiveTab] = useState("search")
|
||||
const [error, setError] = useState("")
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
@@ -37,10 +37,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
// Display As overrides (optional - if empty, search values used for display)
|
||||
const [displayArtist, setDisplayArtist] = useState("")
|
||||
const [displayTitle, setDisplayTitle] = useState("")
|
||||
|
||||
// Theme selection (shared across all tabs)
|
||||
const [selectedTheme, setSelectedTheme] = useState<string | undefined>()
|
||||
const [colorOverrides, setColorOverrides] = useState<ColorOverrides>({})
|
||||
const [showDisplayAs, setShowDisplayAs] = useState(false)
|
||||
|
||||
// Non-interactive mode (shared across all tabs)
|
||||
const [nonInteractive, setNonInteractive] = useState(false)
|
||||
@@ -61,8 +58,6 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
setIsSubmitting(true)
|
||||
try {
|
||||
await api.uploadJob(uploadFile, uploadArtist.trim(), uploadTitle.trim(), {
|
||||
theme_id: selectedTheme,
|
||||
color_overrides: cleanColorOverrides(colorOverrides),
|
||||
non_interactive: nonInteractive,
|
||||
})
|
||||
setUploadFile(null)
|
||||
@@ -88,16 +83,18 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
setError("Please enter a URL")
|
||||
return
|
||||
}
|
||||
if (!youtubeArtist.trim() || !youtubeTitle.trim()) {
|
||||
setError("Please enter both artist and title")
|
||||
return
|
||||
}
|
||||
|
||||
setIsSubmitting(true)
|
||||
try {
|
||||
await api.createJobFromUrl(
|
||||
youtubeUrl.trim(),
|
||||
youtubeArtist.trim() || undefined,
|
||||
youtubeTitle.trim() || undefined,
|
||||
youtubeArtist.trim(),
|
||||
youtubeTitle.trim(),
|
||||
{
|
||||
theme_id: selectedTheme,
|
||||
color_overrides: cleanColorOverrides(colorOverrides),
|
||||
non_interactive: nonInteractive,
|
||||
}
|
||||
)
|
||||
@@ -128,8 +125,6 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
setIsSubmitting(true)
|
||||
try {
|
||||
await api.searchAudio(searchArtist.trim(), searchTitle.trim(), false, {
|
||||
theme_id: selectedTheme,
|
||||
color_overrides: cleanColorOverrides(colorOverrides),
|
||||
non_interactive: nonInteractive,
|
||||
// Display overrides (empty string means use search values)
|
||||
display_artist: displayArtist.trim() || undefined,
|
||||
@@ -164,7 +159,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<TabsList className="grid w-full grid-cols-3 h-auto rounded-lg p-1" style={{ backgroundColor: 'var(--secondary)' }}>
|
||||
<TabsTrigger
|
||||
value="search"
|
||||
className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm rounded-md data-[state=active]:!bg-amber-600 data-[state=active]:!text-white data-[state=active]:shadow-md data-[state=inactive]:hover:bg-amber-600/10"
|
||||
className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm rounded-md data-[state=active]:!bg-[var(--brand-pink)] data-[state=active]:!text-white data-[state=active]:shadow-md data-[state=inactive]:hover:bg-[var(--brand-pink)]/10"
|
||||
style={{ color: activeTab === 'search' ? 'white' : 'var(--text-muted)' }}
|
||||
>
|
||||
<Music className="w-4 h-4 shrink-0" />
|
||||
@@ -172,7 +167,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="upload"
|
||||
className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm rounded-md data-[state=active]:!bg-amber-600 data-[state=active]:!text-white data-[state=active]:shadow-md data-[state=inactive]:hover:bg-amber-600/10"
|
||||
className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm rounded-md data-[state=active]:!bg-[var(--brand-pink)] data-[state=active]:!text-white data-[state=active]:shadow-md data-[state=inactive]:hover:bg-[var(--brand-pink)]/10"
|
||||
style={{ color: activeTab === 'upload' ? 'white' : 'var(--text-muted)' }}
|
||||
>
|
||||
<Upload className="w-4 h-4 shrink-0" />
|
||||
@@ -180,7 +175,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</TabsTrigger>
|
||||
<TabsTrigger
|
||||
value="url"
|
||||
className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm rounded-md data-[state=active]:!bg-amber-600 data-[state=active]:!text-white data-[state=active]:shadow-md data-[state=inactive]:hover:bg-amber-600/10"
|
||||
className="gap-1.5 sm:gap-2 py-3 min-h-[44px] text-xs sm:text-sm rounded-md data-[state=active]:!bg-[var(--brand-pink)] data-[state=active]:!text-white data-[state=active]:shadow-md data-[state=inactive]:hover:bg-[var(--brand-pink)]/10"
|
||||
style={{ color: activeTab === 'url' ? 'white' : 'var(--text-muted)' }}
|
||||
>
|
||||
<Youtube className="w-4 h-4 shrink-0" />
|
||||
@@ -195,8 +190,8 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<div
|
||||
className="relative border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer"
|
||||
style={{
|
||||
borderColor: uploadFile ? 'rgb(245 158 11 / 0.5)' : 'var(--card-border)',
|
||||
backgroundColor: uploadFile ? 'rgb(245 158 11 / 0.05)' : 'var(--secondary)',
|
||||
borderColor: uploadFile ? 'rgba(255, 122, 204, 0.5)' : 'var(--card-border)',
|
||||
backgroundColor: uploadFile ? 'rgba(255, 122, 204, 0.05)' : 'var(--secondary)',
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
@@ -250,42 +245,30 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<span className="text-amber-500 font-medium">Note:</span> Format these exactly as you want them on the title card and video filename.
|
||||
</p>
|
||||
|
||||
{/* Theme Selection */}
|
||||
<div className="space-y-4 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<ThemeSelector
|
||||
value={selectedTheme}
|
||||
onChange={setSelectedTheme}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<ColorOverridesPanel
|
||||
value={colorOverrides}
|
||||
onChange={setColorOverrides}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Non-interactive mode */}
|
||||
<div className="space-y-2 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="non-interactive-upload"
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
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)' }}>
|
||||
Skip lyrics review (non-interactive)
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Warning:</span> auto lyrics correction isn't perfect.
|
||||
Skipping review will likely result in incorrect words in your karaoke video.
|
||||
</p>
|
||||
{/* Non-interactive mode (admin only) */}
|
||||
{isAdmin && (
|
||||
<div className="space-y-2 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="non-interactive-upload"
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary accent-[var(--brand-pink)] focus:ring-[var(--brand-pink)] focus:ring-offset-background"
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="non-interactive-upload" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
Skip lyrics review (non-interactive)
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Warning:</span> auto lyrics correction isn't perfect.
|
||||
Skipping review will likely result in incorrect words in your karaoke video.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && activeTab === "upload" && (
|
||||
<p className="text-sm text-red-400 bg-red-500/10 rounded p-2">{error}</p>
|
||||
@@ -293,7 +276,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full bg-amber-600 hover:bg-amber-500 text-white"
|
||||
className="w-full bg-[var(--brand-pink)] hover:bg-[var(--brand-pink-hover)] text-white shadow-[0_0_15px_rgba(255,122,204,0.3)] hover:shadow-[0_0_20px_rgba(255,122,204,0.5)]"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? (
|
||||
@@ -329,10 +312,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="youtube-artist" style={{ color: 'var(--text)' }}>Artist (optional)</Label>
|
||||
<Label htmlFor="youtube-artist" style={{ color: 'var(--text)' }}>Artist</Label>
|
||||
<Input
|
||||
id="youtube-artist"
|
||||
placeholder="Auto-detected"
|
||||
placeholder="Artist name"
|
||||
value={youtubeArtist}
|
||||
onChange={(e) => setYoutubeArtist(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
@@ -340,10 +323,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="youtube-title" style={{ color: 'var(--text)' }}>Title (optional)</Label>
|
||||
<Label htmlFor="youtube-title" style={{ color: 'var(--text)' }}>Title</Label>
|
||||
<Input
|
||||
id="youtube-title"
|
||||
placeholder="Auto-detected"
|
||||
placeholder="Song title"
|
||||
value={youtubeTitle}
|
||||
onChange={(e) => setYoutubeTitle(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
@@ -352,45 +335,33 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Note:</span> Override auto-detected values if needed. These appear on the title card and video filename.
|
||||
<span className="text-amber-500 font-medium">Note:</span> Format these exactly as you want them on the title card and video filename.
|
||||
</p>
|
||||
|
||||
{/* Theme Selection */}
|
||||
<div className="space-y-4 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<ThemeSelector
|
||||
value={selectedTheme}
|
||||
onChange={setSelectedTheme}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<ColorOverridesPanel
|
||||
value={colorOverrides}
|
||||
onChange={setColorOverrides}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Non-interactive mode */}
|
||||
<div className="space-y-2 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="non-interactive-url"
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
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)' }}>
|
||||
Skip lyrics review (non-interactive)
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Warning:</span> auto lyrics correction isn't perfect.
|
||||
Skipping review will likely result in incorrect words in your karaoke video.
|
||||
</p>
|
||||
{/* Non-interactive mode (admin only) */}
|
||||
{isAdmin && (
|
||||
<div className="space-y-2 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="non-interactive-url"
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary accent-[var(--brand-pink)] focus:ring-[var(--brand-pink)] focus:ring-offset-background"
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="non-interactive-url" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
Skip lyrics review (non-interactive)
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Warning:</span> auto lyrics correction isn't perfect.
|
||||
Skipping review will likely result in incorrect words in your karaoke video.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && activeTab === "url" && (
|
||||
<p className="text-sm text-red-400 bg-red-500/10 rounded p-2">{error}</p>
|
||||
@@ -398,7 +369,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full bg-amber-600 hover:bg-amber-500 text-white"
|
||||
className="w-full bg-[var(--brand-pink)] hover:bg-[var(--brand-pink-hover)] text-white shadow-[0_0_15px_rgba(255,122,204,0.3)] hover:shadow-[0_0_20px_rgba(255,122,204,0.5)]"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? (
|
||||
@@ -417,13 +388,14 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<form onSubmit={handleSearchSubmit} className="space-y-4">
|
||||
{/* Search For section */}
|
||||
<div className="space-y-2">
|
||||
<Label style={{ color: 'var(--text)' }}>Search For</Label>
|
||||
<Label style={{ color: 'var(--text)' }}>Search For Audio Online</Label>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="search-artist" className="text-xs" style={{ color: 'var(--text-muted)' }}>Artist</Label>
|
||||
<Input
|
||||
id="search-artist"
|
||||
placeholder="Artist name on trackers"
|
||||
data-testid="search-artist-input"
|
||||
placeholder="Artist name"
|
||||
value={searchArtist}
|
||||
onChange={(e) => setSearchArtist(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
@@ -434,7 +406,8 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<Label htmlFor="search-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>Title</Label>
|
||||
<Input
|
||||
id="search-title"
|
||||
placeholder="Song title on trackers"
|
||||
data-testid="search-title-input"
|
||||
placeholder="Song title"
|
||||
value={searchTitle}
|
||||
onChange={(e) => setSearchTitle(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
@@ -443,78 +416,83 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Note:</span> Format these exactly as you want them on the title card and video filename.
|
||||
</p>
|
||||
|
||||
{/* Display As section (optional) */}
|
||||
{/* Display As toggle (optional) */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label style={{ color: 'var(--text)' }}>Display As</Label>
|
||||
<span className="text-xs px-1.5 py-0.5 rounded" style={{ color: 'var(--text-muted)', backgroundColor: 'var(--secondary)' }}>optional</span>
|
||||
</div>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
Override how artist/title appear on the title card and filename. Leave empty to use search values.
|
||||
</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="display-artist" className="text-xs" style={{ color: 'var(--text-muted)' }}>Display Artist</Label>
|
||||
<Input
|
||||
id="display-artist"
|
||||
placeholder="e.g., Footloose (Broadway Cast)"
|
||||
value={displayArtist}
|
||||
onChange={(e) => setDisplayArtist(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="display-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>Display Title</Label>
|
||||
<Input
|
||||
id="display-title"
|
||||
placeholder="e.g., I Can't Stand Still"
|
||||
value={displayTitle}
|
||||
onChange={(e) => setDisplayTitle(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Theme Selection */}
|
||||
<div className="space-y-4 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<ThemeSelector
|
||||
value={selectedTheme}
|
||||
onChange={setSelectedTheme}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowDisplayAs(!showDisplayAs)}
|
||||
className="flex items-center gap-2 text-sm hover:opacity-80 transition-opacity"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<ColorOverridesPanel
|
||||
value={colorOverrides}
|
||||
onChange={setColorOverrides}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Non-interactive mode */}
|
||||
<div className="space-y-2 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="non-interactive-search"
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
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)' }}>
|
||||
Skip lyrics review (non-interactive)
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Warning:</span> auto lyrics correction isn't perfect.
|
||||
Skipping review will likely result in incorrect words in your karaoke video.
|
||||
>
|
||||
{showDisplayAs ? (
|
||||
<ChevronDown className="w-4 h-4" />
|
||||
) : (
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
)}
|
||||
Use different artist/title for title screen
|
||||
</button>
|
||||
{showDisplayAs && (
|
||||
<div className="space-y-2 pl-6">
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
Override how artist/title appear on the title screen and filename, e.g. for soundtracks.
|
||||
</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="display-artist" className="text-xs" style={{ color: 'var(--text-muted)' }}>Display Artist</Label>
|
||||
<Input
|
||||
id="display-artist"
|
||||
placeholder="e.g., Footloose (Broadway Cast)"
|
||||
value={displayArtist}
|
||||
onChange={(e) => setDisplayArtist(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="display-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>Display Title</Label>
|
||||
<Input
|
||||
id="display-title"
|
||||
placeholder="e.g., I Can't Stand Still"
|
||||
value={displayTitle}
|
||||
onChange={(e) => setDisplayTitle(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Non-interactive mode (admin only) */}
|
||||
{isAdmin && (
|
||||
<div className="space-y-2 pt-4 border-t" style={{ borderColor: 'var(--card-border)' }}>
|
||||
<div className="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="non-interactive-search"
|
||||
checked={nonInteractive}
|
||||
onChange={(e) => setNonInteractive(e.target.checked)}
|
||||
disabled={isSubmitting}
|
||||
className="mt-1 w-4 h-4 rounded border-border bg-secondary accent-[var(--brand-pink)] focus:ring-[var(--brand-pink)] focus:ring-offset-background"
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="non-interactive-search" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
Skip lyrics review (non-interactive)
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Warning:</span> auto lyrics correction isn't perfect.
|
||||
Skipping review will likely result in incorrect words in your karaoke video.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && activeTab === "search" && (
|
||||
<p className="text-sm text-red-400 bg-red-500/10 rounded p-2">{error}</p>
|
||||
@@ -522,7 +500,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full bg-amber-600 hover:bg-amber-500 text-white"
|
||||
className="w-full bg-[var(--brand-pink)] hover:bg-[var(--brand-pink-hover)] text-white shadow-[0_0_15px_rgba(255,122,204,0.3)] hover:shadow-[0_0_20px_rgba(255,122,204,0.5)]"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting ? (
|
||||
|
||||
@@ -169,85 +169,49 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
|
||||
const hasOutputs = youtubeUrl || dropboxUrl || (downloadUrls && Object.keys(downloadUrls).length > 0)
|
||||
|
||||
// Check if we have any downloads
|
||||
const hasDownloads = downloadUrls && (
|
||||
downloadUrls?.finals?.lossy_720p_mp4 ||
|
||||
downloadUrls?.finals?.lossy_4k_mp4 ||
|
||||
downloadUrls?.videos?.with_vocals ||
|
||||
downloadUrls?.packages?.cdg_zip ||
|
||||
downloadUrls?.packages?.txt_zip
|
||||
)
|
||||
|
||||
// Check if we have any external links
|
||||
const hasExternalLinks = youtubeUrl || dropboxUrl
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{/* Combined Output Links */}
|
||||
{hasOutputs && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-xs font-medium" style={{ color: 'var(--text-muted)' }}>Outputs:</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{/* Distribution Links */}
|
||||
{youtubeUrl && (
|
||||
<div className="flex gap-1">
|
||||
<a
|
||||
href={youtubeUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-red-600 hover:bg-red-500 text-white"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
View on YouTube
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyToClipboard(youtubeUrl) }}
|
||||
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-red-700 hover:bg-red-600 text-white"
|
||||
title="Copy YouTube URL"
|
||||
aria-label={copiedUrl === youtubeUrl ? "YouTube URL copied" : "Copy YouTube URL"}
|
||||
>
|
||||
{copiedUrl === youtubeUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{dropboxUrl && (
|
||||
<div className="flex gap-1">
|
||||
<a
|
||||
href={dropboxUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
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" />
|
||||
Dropbox Folder
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyToClipboard(dropboxUrl) }}
|
||||
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"}
|
||||
>
|
||||
{copiedUrl === dropboxUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{/* Download Links */}
|
||||
{downloadUrls?.finals?.lossy_720p_mp4 && (
|
||||
<a
|
||||
href={api.getDownloadUrl(jobId, "finals", "lossy_720p_mp4")}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-green-600 hover:bg-green-500 text-white"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
720p Video
|
||||
</a>
|
||||
)}
|
||||
<div className="space-y-3">
|
||||
{/* Downloads Section */}
|
||||
{hasDownloads && (
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-xs font-medium" style={{ color: 'var(--text-muted)' }}>Downloads</p>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{downloadUrls?.finals?.lossy_4k_mp4 && (
|
||||
<a
|
||||
href={api.getDownloadUrl(jobId, "finals", "lossy_4k_mp4")}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-green-600 hover:bg-green-500 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[var(--brand-pink)] hover:bg-[var(--brand-pink-hover)] text-white transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
4K Video
|
||||
</a>
|
||||
)}
|
||||
{downloadUrls?.finals?.lossy_720p_mp4 && (
|
||||
<a
|
||||
href={api.getDownloadUrl(jobId, "finals", "lossy_720p_mp4")}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[#252525] hover:bg-[#333333] text-[var(--text)] border border-[var(--card-border)] transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
720p Video
|
||||
</a>
|
||||
)}
|
||||
{downloadUrls?.videos?.with_vocals && (
|
||||
<a
|
||||
href={api.getDownloadUrl(jobId, "videos", "with_vocals")}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-purple-600 hover:bg-purple-500 text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[#252525] hover:bg-[#333333] text-[var(--text)] border border-[var(--card-border)] transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
@@ -257,7 +221,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-secondary hover:bg-muted text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[#252525] hover:bg-[#333333] text-[var(--text)] border border-[var(--card-border)] transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
@@ -267,7 +231,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-secondary hover:bg-muted text-white"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[#252525] hover:bg-[#333333] text-[var(--text)] border border-[var(--card-border)] transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
@@ -275,35 +239,93 @@ export function OutputLinks({ jobId }: OutputLinksProps) {
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Admin-only buttons */}
|
||||
{isAdmin && (
|
||||
<div className="flex flex-wrap gap-2 pt-1 border-t border-border/50 mt-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyCompletionMessage() }}
|
||||
disabled={isLoadingMessage}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-amber-600 hover:bg-amber-500 text-white disabled:opacity-50"
|
||||
title="Copy completion message to clipboard"
|
||||
>
|
||||
{isLoadingMessage ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
) : (
|
||||
<MessageSquare className="w-3 h-3" />
|
||||
)}
|
||||
{copiedMessage ? "Copied!" : "Copy Message"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); setShowEmailDialog(true) }}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-teal-600 hover:bg-teal-500 text-white"
|
||||
title="Send completion email"
|
||||
>
|
||||
<Mail className="w-3 h-3" />
|
||||
Send Email
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{/* Actions Section */}
|
||||
{hasExternalLinks && (
|
||||
<div className="space-y-1.5">
|
||||
<p className="text-xs font-medium" style={{ color: 'var(--text-muted)' }}>Links</p>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{youtubeUrl && (
|
||||
<div className="flex">
|
||||
<a
|
||||
href={youtubeUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-red-600 hover:bg-red-500 text-white transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
YouTube
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyToClipboard(youtubeUrl) }}
|
||||
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-red-700 hover:bg-red-600 text-white transition-colors"
|
||||
title="Copy YouTube URL"
|
||||
aria-label={copiedUrl === youtubeUrl ? "YouTube URL copied" : "Copy YouTube URL"}
|
||||
>
|
||||
{copiedUrl === youtubeUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{dropboxUrl && (
|
||||
<div className="flex">
|
||||
<a
|
||||
href={dropboxUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded-l bg-[#0061FE] hover:bg-[#0052d6] text-white transition-colors"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<FolderOpen className="w-3 h-3" />
|
||||
Dropbox
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyToClipboard(dropboxUrl) }}
|
||||
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-[#0052d6] hover:bg-[#0047ba] text-white transition-colors"
|
||||
title="Copy Dropbox URL"
|
||||
aria-label={copiedUrl === dropboxUrl ? "Dropbox URL copied" : "Copy Dropbox URL"}
|
||||
>
|
||||
{copiedUrl === dropboxUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Admin-only tools */}
|
||||
{isAdmin && hasOutputs && (
|
||||
<div className="space-y-1.5 pt-2 border-t border-[var(--card-border)]">
|
||||
<p className="text-xs font-medium" style={{ color: 'var(--text-muted)' }}>Admin Tools</p>
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyCompletionMessage() }}
|
||||
disabled={isLoadingMessage}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[#252525] hover:bg-[#333333] text-[var(--text)] border border-[var(--card-border)] disabled:opacity-50 transition-colors"
|
||||
title="Copy completion message to clipboard"
|
||||
>
|
||||
{isLoadingMessage ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
) : (
|
||||
<MessageSquare className="w-3 h-3" />
|
||||
)}
|
||||
{copiedMessage ? "Copied!" : "Copy Message"}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); setShowEmailDialog(true) }}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-[#252525] hover:bg-[#333333] text-[var(--text)] border border-[var(--card-border)] transition-colors"
|
||||
title="Send completion email"
|
||||
>
|
||||
<Mail className="w-3 h-3" />
|
||||
Send Email
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -298,22 +298,9 @@ test.describe('Production E2E - Full User Journey', () => {
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Select a theme if required
|
||||
const themeSelect = page.locator('button[role="combobox"]').first();
|
||||
if (await themeSelect.isVisible({ timeout: 3000 }).catch(() => false)) {
|
||||
const currentTheme = await themeSelect.textContent();
|
||||
if (currentTheme?.toLowerCase().includes('select')) {
|
||||
await themeSelect.click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('[role="option"]').first().click();
|
||||
await page.waitForTimeout(500);
|
||||
console.log(' Selected first theme');
|
||||
}
|
||||
}
|
||||
|
||||
// Fill artist and title
|
||||
await page.getByLabel('Artist').fill(TEST_SONG.artist);
|
||||
await page.getByLabel('Title').fill(TEST_SONG.title);
|
||||
// Fill artist and title (using data-testid for robust selectors)
|
||||
await page.getByTestId('search-artist-input').fill(TEST_SONG.artist);
|
||||
await page.getByTestId('search-title-input').fill(TEST_SONG.title);
|
||||
console.log(` Searching for: ${TEST_SONG.artist} - ${TEST_SONG.title}`);
|
||||
|
||||
await page.screenshot({ path: 'test-results/04a-search-form.png' });
|
||||
|
||||
@@ -353,22 +353,9 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Select a theme if required
|
||||
const themeSelect = page.locator('button[role="combobox"]').first();
|
||||
if (await themeSelect.isVisible({ timeout: 3000 }).catch(() => false)) {
|
||||
const currentTheme = await themeSelect.textContent();
|
||||
if (currentTheme?.toLowerCase().includes('select')) {
|
||||
await themeSelect.click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('[role="option"]').first().click();
|
||||
await page.waitForTimeout(500);
|
||||
console.log(' Selected first theme');
|
||||
}
|
||||
}
|
||||
|
||||
// Fill artist and title
|
||||
await page.getByLabel('Artist').fill(TEST_SONG.artist);
|
||||
await page.getByLabel('Title').fill(TEST_SONG.title);
|
||||
// Fill artist and title (using data-testid for robust test selectors)
|
||||
await page.getByTestId('search-artist-input').fill(TEST_SONG.artist);
|
||||
await page.getByTestId('search-title-input').fill(TEST_SONG.title);
|
||||
console.log(` Searching for: ${TEST_SONG.artist} - ${TEST_SONG.title}`);
|
||||
|
||||
await page.screenshot({ path: 'test-results/04a-search-form.png' });
|
||||
|
||||
@@ -90,9 +90,9 @@ test.describe('Karaoke Generation - Search Tab', () => {
|
||||
// Click Search tab
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
|
||||
// Verify inputs
|
||||
await expect(page.getByLabel('Artist')).toBeVisible();
|
||||
await expect(page.getByLabel('Title')).toBeVisible();
|
||||
// Verify inputs (using data-testid for robust selectors)
|
||||
await expect(page.getByTestId('search-artist-input')).toBeVisible();
|
||||
await expect(page.getByTestId('search-title-input')).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: /search.*create/i })).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -134,9 +134,9 @@ test.describe('Karaoke Generation - Search Tab', () => {
|
||||
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
|
||||
// Fill form
|
||||
await page.getByLabel('Artist').fill('piri');
|
||||
await page.getByLabel('Title').fill('dog');
|
||||
// Fill form (using data-testid for robust selectors)
|
||||
await page.getByTestId('search-artist-input').fill('piri');
|
||||
await page.getByTestId('search-title-input').fill('dog');
|
||||
|
||||
// Submit
|
||||
await page.getByRole('button', { name: /search.*create/i }).click();
|
||||
|
||||
@@ -159,7 +159,7 @@ test.describe('Mobile - App Page', () => {
|
||||
|
||||
// Should be clickable
|
||||
await searchTab.click();
|
||||
await expect(page.getByLabel('Artist')).toBeVisible();
|
||||
await expect(page.getByTestId('search-artist-input')).toBeVisible();
|
||||
});
|
||||
|
||||
test(`${deviceName}: Form inputs fit viewport`, async ({ page }) => {
|
||||
@@ -173,7 +173,7 @@ test.describe('Mobile - App Page', () => {
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
|
||||
// Input should fit within viewport
|
||||
const artistInput = page.getByLabel('Artist');
|
||||
const artistInput = page.getByTestId('search-artist-input');
|
||||
const box = await artistInput.boundingBox();
|
||||
|
||||
if (box) {
|
||||
@@ -225,7 +225,7 @@ test.describe('Mobile - Touch Targets', () => {
|
||||
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
|
||||
const artistInput = page.getByLabel('Artist');
|
||||
const artistInput = page.getByTestId('search-artist-input');
|
||||
const box = await artistInput.boundingBox();
|
||||
|
||||
if (box) {
|
||||
@@ -249,7 +249,7 @@ test.describe('Mobile - Interactions', () => {
|
||||
|
||||
await page.getByRole('tab', { name: /search/i }).click();
|
||||
|
||||
const artistInput = page.getByLabel('Artist');
|
||||
const artistInput = page.getByTestId('search-artist-input');
|
||||
await artistInput.focus();
|
||||
await artistInput.fill('Test Artist');
|
||||
|
||||
|
||||
+4
-2
@@ -603,9 +603,11 @@ export const api = {
|
||||
|
||||
/**
|
||||
* Get backend service info including version
|
||||
* Note: Uses /backend-info in dev (proxied to production /) to avoid proxying all routes
|
||||
*/
|
||||
async getBackendInfo(): Promise<{ service: string; version: string; status: string }> {
|
||||
const response = await fetch(`${API_BASE_URL}/`, {
|
||||
const url = API_BASE_URL ? `${API_BASE_URL}/` : '/backend-info';
|
||||
const response = await fetch(url, {
|
||||
headers: getAuthHeaders()
|
||||
});
|
||||
return handleResponse(response);
|
||||
@@ -615,7 +617,7 @@ export const api = {
|
||||
* Get encoding worker health status
|
||||
*/
|
||||
async getEncodingWorkerHealth(): Promise<EncodingWorkerHealth> {
|
||||
const response = await fetch(`${API_BASE_URL}/health/encoding-worker`);
|
||||
const response = await fetch(`${API_BASE_URL}/api/health/encoding-worker`);
|
||||
return handleResponse(response);
|
||||
},
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ const nextConfig = {
|
||||
source: '/api/:path*',
|
||||
destination: `${backendUrl}/api/:path*`,
|
||||
},
|
||||
{
|
||||
source: '/backend-info',
|
||||
destination: `${backendUrl}/`,
|
||||
},
|
||||
];
|
||||
},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user