feat: add Visibility step and rework Customize & Create flow (#480)

## Summary

- Add a dedicated **Visibility step** (Step 3) to the guided job
creation flow so users clearly understand public vs private delivery
before creating their video
- Rework the **Customize & Create step** (now Step 4) with conditional
UI based on visibility choice, side-by-side preview canvases, and new
style controls
- Document the **public video style consistency rule** in the brand
guide

## Changes

### New Visibility Step
- Two large selectable cards: Published (recommended) and Private
- Full explanations shown upfront — YouTube channel link, venue
distribution, Dropbox delivery, monetization caveats
- Encouraging copy for Published option

### Reworked Customize Step
- **Public mode**: Simple layout with only display artist/title text
overrides (brand consistency enforced)
- **Private mode**: Full customization with side-by-side preview
canvases
- Background mode toggle per canvas: Default / Image upload / Solid
color
- Color presets including Green Screen (#00b140)
- New lyrics color controls: highlight (sung) and text (unsung) colors
- Image upload thumbnails removed (canvas previews serve this purpose)

### Improved Karaoke Preview
- 4 centered lines matching real video output layout
- Configurable sung/unsung colors with live preview
- Solid color background support

### Documentation
- Added "Public Video Style Consistency Rule" to BRAND-STYLE-GUIDE.md
- Requirements doc in docs/archive/

## Test plan
- [x] All 540 Jest unit tests pass
- [x] CustomizeStep tests rewritten for new layout (14 tests covering
both public and private modes)
- [ ] Visual testing via dev server
- [ ] E2E flow test for both public and private paths

@coderabbitai ignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew Beveridge ☄️andClaude Opus 4.6 authored and GitHub committed 2026-03-04 18:47:08 -05:00
1 parent a286559cfd
commit f017ba7d77
11 files changed
+1019 -336

No files matched your search

+15
View File
@@ -664,6 +664,21 @@ export function PrimaryButton({ children, ...props }) {
---
## Public Video Style Consistency Rule
**All videos published to Nomad Karaoke distribution channels (YouTube, Google Drive, venue libraries) MUST use the standard Nomad Karaoke visual style.** No customization of colors, backgrounds, fonts, or other visual elements is permitted for public videos.
This ensures:
- Consistent brand identity across the entire Nomad Karaoke catalog
- Professional, recognizable appearance at venues worldwide
- Uniform experience for audiences browsing the YouTube channel or venue libraries
Only the **display artist name** and **display title** text can be overridden for public videos (e.g. to format a soundtrack or cover correctly).
Custom video styling (backgrounds, colors, fonts) is available exclusively for **private** deliveries where the user takes full responsibility for distribution.
---
## Checklist for Brand Compliance
### Landing Pages
@@ -0,0 +1,70 @@
# Visibility Step & Customize Rework
**Date:** 2026-03-04
**Branch:** feat/sess-20260304-1700-visibility-step-customize
## Overview
Rework the guided job creation flow to add a separate "Visibility" step before "Customize & Create", dedicated to deciding whether the created video should be published or private. Then rework the "Customize & Create" step based on the chosen visibility.
## New "Visibility" Step
On this step, we simply let the user choose between public or private, but we use it as an opportunity to ensure the user definitely understands what will happen.
### Published (Public)
Explain that "published" means:
- The resulting karaoke video will be automatically uploaded to the Nomad Karaoke YouTube channel (with a link to https://www.youtube.com/@nomadkaraoke/videos for them to check that out)
- It will also be uploaded to a Google Drive which is shared with various karaoke venues, meaning the song will be available to sing at a variety of karaoke bars/venues around the world
- The user will get all the source files and highest quality output formats via a Dropbox folder link too, which they can download for their safekeeping
- We should encourage the user to choose this option as it's the most convenient way to make their song available to sing (via YouTube) and they'll be helping out other fans of the same song, bringing joy to people all over the world who love that song
### Private
Explain that "private" means:
- The resulting karaoke video will NOT be uploaded to YouTube or Google Drive, and will only be provided via a Dropbox folder / via this site, for the user to download and use however they see fit
- If the user wants to perform the track at a venue, they'll be responsible for providing the files to the host at that venue
- If the user wants to upload the video to their own YouTube channel they can do so, but they likely won't be able to monetise it (the song licenses/copyrights are still owned by record labels in most cases)
- If the user wants to customise the video styles (e.g. background image, colors), they can do this if they choose private delivery
## Reworked "Customize & Create" Step
Once we have the new "Visibility" step in the flow, we also need to rework the "Customize & Create" flow:
### Remove Private Checkbox
The "private" checkbox on the current Customize & Create step is replaced by the new Visibility step.
### Conditional Options Based on Visibility
Since we'll now know already whether the video is private or public, we can show only the options which are allowed:
- **For public videos**: Only the title card artist/title should be customisable
- **For private videos**: Allow customising almost anything
### Side-by-Side Preview Canvases
Show the two preview canvases (title screen, main karaoke) side by side in this part of the flow, not below each other, so the user doesn't need to scroll down.
### Remove Redundant Thumbnails
Uploaded images for custom backgrounds don't need thumbnails - that's redundant since they're shown on the preview canvas(es).
### Improved Karaoke Preview Canvas
The text in the karaoke preview canvas needs to be centered in the thumbnail and show 4 lines so it's more similar to how the actual karaoke videos get rendered (see reference screenshot of actual video output).
### New Style Customisation Options
There should be a way to change more aspects of the styles:
- Change the text color and/or highlight color of the karaoke lyrics
- Use a solid color background (rather than an image) for either the title screen or karaoke video (or both with different colors)
- Add a few preset color buttons for both of these, including one which is the "green screen" color
## Reference Screenshots
- Current "Customize & Create" UI: see attached screenshot showing the existing layout with private checkbox, stacked canvases, and current style options
- Actual karaoke video output: see attached screenshot showing how lyrics appear in real videos (4 centered lines with highlight color)
+17 -6
View File
@@ -9,6 +9,7 @@ import { Button } from "@/components/ui/button"
import { BuyCreditsDialog } from "@/components/credits/BuyCreditsDialog"
import { SongInfoStep } from "./steps/SongInfoStep"
import { AudioSourceStep } from "./steps/AudioSourceStep"
import { VisibilityStep } from "./steps/VisibilityStep"
import { CustomizeStep } from "./steps/CustomizeStep"
import type { ColorOverrides } from "./steps/CustomizeStep"
@@ -16,9 +17,9 @@ interface GuidedJobFlowProps {
onJobCreated: () => void
}
type Step = 1 | 2 | 3
type Step = 1 | 2 | 3 | 4
const STEP_LABELS = ["Song Info", "Choose Audio", "Customize & Create"]
const STEP_LABELS = ["Song Info", "Choose Audio", "Visibility", "Customize & Create"]
/**
* Upload custom style assets to an already-created job.
@@ -75,7 +76,8 @@ async function uploadStyleAssets(
// Step 3: Finalize with uploaded file types + color overrides
const uploadedFileTypes = filesToUpload.map((f) => f.file_type)
const hasColorOverrides = colorOverrides.artist_color || colorOverrides.title_color
const hasColorOverrides = colorOverrides.artist_color || colorOverrides.title_color ||
colorOverrides.sung_lyrics_color || colorOverrides.unsung_lyrics_color
await api.completeStyleUploads(
jobId,
uploadedFileTypes,
@@ -163,7 +165,8 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
// Upload style assets in the background (non-blocking)
const hasStyleCustomizations = karaokeBackground || introBackground ||
colorOverrides.artist_color || colorOverrides.title_color
colorOverrides.artist_color || colorOverrides.title_color ||
colorOverrides.sung_lyrics_color || colorOverrides.unsung_lyrics_color
if (isPrivate && hasStyleCustomizations) {
uploadStyleAssets(response.job_id, karaokeBackground, introBackground, colorOverrides)
}
@@ -435,6 +438,15 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
)}
{step === 3 && (
<VisibilityStep
isPrivate={isPrivate}
onPrivateChange={setIsPrivate}
onNext={() => setStep(4)}
onBack={() => setStep(2)}
/>
)}
{step === 4 && (
<CustomizeStep
artist={artist}
title={title}
@@ -443,7 +455,6 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
onDisplayArtistChange={setDisplayArtist}
onDisplayTitleChange={setDisplayTitle}
isPrivate={isPrivate}
onPrivateChange={setIsPrivate}
karaokeBackground={karaokeBackground}
onKaraokeBackgroundChange={setKaraokeBackground}
introBackground={introBackground}
@@ -451,7 +462,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
colorOverrides={colorOverrides}
onColorOverridesChange={setColorOverrides}
onConfirm={handleConfirm}
onBack={() => setStep(2)}
onBack={() => setStep(3)}
isSubmitting={isSubmitting}
/>
)}
+4 -3
View File
@@ -10,6 +10,7 @@ interface ImageUploadFieldProps {
file: File | null
onChange: (file: File | null) => void
disabled?: boolean
hidePreview?: boolean // Hide the image thumbnail (when a canvas preview is shown instead)
}
const MAX_SIZE_BYTES = 10 * 1024 * 1024 // 10MB
@@ -21,7 +22,7 @@ function formatFileSize(bytes: number): string {
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
}
export function ImageUploadField({ label, description, file, onChange, disabled }: ImageUploadFieldProps) {
export function ImageUploadField({ label, description, file, onChange, disabled, hidePreview }: ImageUploadFieldProps) {
const inputRef = useRef<HTMLInputElement>(null)
const [dragOver, setDragOver] = useState(false)
const [error, setError] = useState<string | null>(null)
@@ -74,8 +75,8 @@ export function ImageUploadField({ label, description, file, onChange, disabled
{file ? (
<div className="relative rounded-lg overflow-hidden border" style={{ borderColor: 'var(--card-border)' }}>
{/* 16:9 preview thumbnail */}
{previewUrl && (
{/* 16:9 preview thumbnail (hidden when canvas preview is used instead) */}
{!hidePreview && previewUrl && (
// eslint-disable-next-line @next/next/no-img-element
<img
src={previewUrl}
@@ -3,44 +3,65 @@
import { useRef, useEffect, useCallback } from "react"
interface KaraokeBackgroundPreviewProps {
backgroundUrl: string // Object URL from File
backgroundUrl?: string // Object URL from File, or undefined for solid color
backgroundColor?: string // Solid color hex (used when no backgroundUrl)
sungColor?: string // Highlight color for sung lyrics
unsungColor?: string // Color for unsung lyrics
}
const CANVAS_W = 3840
const CANVAS_H = 2160
// Sample lyrics to show how text looks over the background
const SAMPLE_LINE_1 = "This is how your lyrics will look"
const SAMPLE_LINE_2 = "over the background image"
// 4 sample lines to match real karaoke video rendering
const SAMPLE_LINES = [
"Don't say that you don't understand",
"This is California Babylon my man",
"Don't say that you don't understand",
"Don't say that you can't comprehend",
]
// Default karaoke colors (matching Nomad theme)
const SUNG_COLOR = "#7070F7"
const UNSUNG_COLOR = "#ffffff"
const DEFAULT_SUNG_COLOR = "#7070F7"
const DEFAULT_UNSUNG_COLOR = "#ffffff"
export function KaraokeBackgroundPreview({ backgroundUrl }: KaraokeBackgroundPreviewProps) {
export function KaraokeBackgroundPreview({
backgroundUrl,
backgroundColor,
sungColor,
unsungColor,
}: KaraokeBackgroundPreviewProps) {
const canvasRef = useRef<HTMLCanvasElement>(null)
const effectiveSungColor = sungColor || DEFAULT_SUNG_COLOR
const effectiveUnsungColor = unsungColor || DEFAULT_UNSUNG_COLOR
const draw = useCallback(async () => {
const canvas = canvasRef.current
if (!canvas) return
const ctx = canvas.getContext("2d")
if (!ctx) return
// Draw background
try {
const img = await new Promise<HTMLImageElement>((resolve, reject) => {
const el = new Image()
el.onload = () => resolve(el)
el.onerror = reject
el.src = backgroundUrl
})
ctx.drawImage(img, 0, 0, CANVAS_W, CANVAS_H)
} catch {
ctx.fillStyle = "#000000"
// Draw background: custom image > solid color > default Nomad theme image
const bgSrc = backgroundUrl || (backgroundColor ? null : "/karaoke-bg.png")
if (bgSrc) {
try {
const img = await new Promise<HTMLImageElement>((resolve, reject) => {
const el = new Image()
el.onload = () => resolve(el)
el.onerror = reject
el.src = bgSrc
})
ctx.drawImage(img, 0, 0, CANVAS_W, CANVAS_H)
} catch {
ctx.fillStyle = backgroundColor || "#000000"
ctx.fillRect(0, 0, CANVAS_W, CANVAS_H)
}
} else {
ctx.fillStyle = backgroundColor || "#000000"
ctx.fillRect(0, 0, CANVAS_W, CANVAS_H)
}
// Draw sample lyrics in the lower third (where they typically appear)
// Draw 4 lines of sample lyrics, vertically centered
const fontSize = 120
const fontFamily = "'Arial', 'Helvetica', sans-serif"
ctx.font = `700 ${fontSize}px ${fontFamily}`
@@ -48,34 +69,54 @@ export function KaraokeBackgroundPreview({ backgroundUrl }: KaraokeBackgroundPre
ctx.textBaseline = "middle"
const centerX = CANVAS_W / 2
const lineHeight = fontSize * 1.4
const baseY = CANVAS_H * 0.75
const lineHeight = fontSize * 1.5
const totalHeight = lineHeight * SAMPLE_LINES.length
const startY = (CANVAS_H - totalHeight) / 2 + lineHeight / 2
// Line 1: partially "sung" (first half highlighted)
const words1 = SAMPLE_LINE_1.split(" ")
const midPoint = Math.ceil(words1.length / 2)
const sungPart = words1.slice(0, midPoint).join(" ")
const unsungPart = " " + words1.slice(midPoint).join(" ")
SAMPLE_LINES.forEach((line, i) => {
const y = startY + i * lineHeight
// Measure widths for positioning
const fullWidth1 = ctx.measureText(SAMPLE_LINE_1).width
const sungWidth = ctx.measureText(sungPart).width
const startX1 = centerX - fullWidth1 / 2
if (i === 1) {
// Line 2: partially "sung" — highlight first portion
const words = line.split(" ")
const midPoint = 3 // "This is Califor" split mid-word effect
const sungText = words.slice(0, midPoint).join(" ")
// Simulate mid-word highlight: "Califor" is partially sung
const sungPart = sungText.slice(0, -2)
const transitionChar = sungText.slice(-2)
const unsungPart = words.slice(midPoint).join(" ")
// Draw sung portion
ctx.fillStyle = SUNG_COLOR
ctx.textAlign = "left"
ctx.fillText(sungPart, startX1, baseY)
const fullText = line
const fullWidth = ctx.measureText(fullText).width
const lineStartX = centerX - fullWidth / 2
// Draw unsung portion
ctx.fillStyle = UNSUNG_COLOR
ctx.fillText(unsungPart, startX1 + sungWidth, baseY)
// Sung portion
ctx.fillStyle = effectiveSungColor
ctx.textAlign = "left"
ctx.fillText(sungPart, lineStartX, y)
// Line 2: all unsung
ctx.fillStyle = UNSUNG_COLOR
ctx.textAlign = "center"
ctx.fillText(SAMPLE_LINE_2, centerX, baseY + lineHeight)
}, [backgroundUrl])
// Transition characters (still sung color)
const sungPartWidth = ctx.measureText(sungPart).width
ctx.fillStyle = effectiveSungColor
ctx.fillText(transitionChar, lineStartX + sungPartWidth, y)
// Unsung portion
const transWidth = ctx.measureText(transitionChar).width
ctx.fillStyle = effectiveUnsungColor
ctx.fillText(" " + unsungPart, lineStartX + sungPartWidth + transWidth, y)
ctx.textAlign = "center"
} else if (i === 0) {
// Line 1: fully sung (already passed)
ctx.fillStyle = effectiveSungColor
ctx.fillText(line, centerX, y)
} else {
// Lines 3-4: unsung (upcoming)
ctx.fillStyle = effectiveUnsungColor
ctx.fillText(line, centerX, y)
}
})
}, [backgroundUrl, backgroundColor, effectiveSungColor, effectiveUnsungColor])
useEffect(() => {
draw()
+8 -4
View File
@@ -6,6 +6,7 @@ interface TitleCardPreviewProps {
artist: string
title: string
customBackgroundUrl?: string // Object URL from File for custom background
backgroundColor?: string // Solid color hex (used when no customBackgroundUrl)
titleColor?: string // Hex color override (default #ffffff)
artistColor?: string // Hex color override (default #ffdf6b)
}
@@ -121,7 +122,7 @@ function drawTextBlock(
}
}
export function TitleCardPreview({ artist, title, customBackgroundUrl, titleColor, artistColor }: TitleCardPreviewProps) {
export function TitleCardPreview({ artist, title, customBackgroundUrl, backgroundColor, titleColor, artistColor }: TitleCardPreviewProps) {
const canvasRef = useRef<HTMLCanvasElement>(null)
const effectiveTitleColor = titleColor || TITLE_COLOR
@@ -133,7 +134,7 @@ export function TitleCardPreview({ artist, title, customBackgroundUrl, titleColo
const ctx = canvas.getContext("2d")
if (!ctx) return
// Draw background image (custom or default)
// Draw background: custom image > solid color > default image
try {
if (customBackgroundUrl) {
const img = await new Promise<HTMLImageElement>((resolve, reject) => {
@@ -143,12 +144,15 @@ export function TitleCardPreview({ artist, title, customBackgroundUrl, titleColo
el.src = customBackgroundUrl
})
ctx.drawImage(img, 0, 0, CANVAS_W, CANVAS_H)
} else if (backgroundColor) {
ctx.fillStyle = backgroundColor
ctx.fillRect(0, 0, CANVAS_W, CANVAS_H)
} else {
const bgImg = await loadBgImage()
ctx.drawImage(bgImg, 0, 0, CANVAS_W, CANVAS_H)
}
} catch {
ctx.fillStyle = "#000000"
ctx.fillStyle = backgroundColor || "#000000"
ctx.fillRect(0, 0, CANVAS_W, CANVAS_H)
}
@@ -188,7 +192,7 @@ export function TitleCardPreview({ artist, title, customBackgroundUrl, titleColo
artist ? effectiveArtistColor : "rgba(255,223,107,0.25)",
fontFamily,
)
}, [artist, title, customBackgroundUrl, effectiveTitleColor, effectiveArtistColor])
}, [artist, title, customBackgroundUrl, backgroundColor, effectiveTitleColor, effectiveArtistColor])
useEffect(() => {
draw()
@@ -3,39 +3,46 @@ import { CustomizeStep } from "../steps/CustomizeStep"
// Mock canvas-based components — they require browser APIs not available in jsdom
jest.mock("../TitleCardPreview", () => ({
TitleCardPreview: ({ artist, title, customBackgroundUrl, titleColor, artistColor }: any) => (
TitleCardPreview: ({ artist, title, customBackgroundUrl, titleColor, artistColor, backgroundColor }: any) => (
<div data-testid="title-card-preview"
data-artist={artist}
data-title={title}
data-custom-bg={customBackgroundUrl || ""}
data-title-color={titleColor || ""}
data-artist-color={artistColor || ""}
data-bg-color={backgroundColor || ""}
/>
),
}))
jest.mock("../KaraokeBackgroundPreview", () => ({
KaraokeBackgroundPreview: ({ backgroundUrl }: any) => (
<div data-testid="karaoke-bg-preview" data-url={backgroundUrl} />
KaraokeBackgroundPreview: ({ backgroundUrl, backgroundColor, sungColor, unsungColor }: any) => (
<div data-testid="karaoke-bg-preview"
data-url={backgroundUrl || ""}
data-bg-color={backgroundColor || ""}
data-sung-color={sungColor || ""}
data-unsung-color={unsungColor || ""}
/>
),
}))
jest.mock("../ImageUploadField", () => ({
ImageUploadField: ({ label, file, onChange, disabled }: any) => (
<div data-testid={`upload-${label.replace(/\s+/g, "-").toLowerCase()}`}>
<span>{label}</span>
ImageUploadField: ({ label, description, file, onChange, disabled, hidePreview }: any) => (
<div data-testid={`upload-${(label || description || "field").replace(/\s+/g, "-").toLowerCase().slice(0, 30)}`}>
{label && <span>{label}</span>}
{description && <span>{description}</span>}
{file && <span data-testid="file-name">{file.name}</span>}
<button data-testid={`upload-btn-${label.replace(/\s+/g, "-").toLowerCase()}`}
<button
data-testid={`upload-btn`}
onClick={() => onChange(new File(["data"], "test.png", { type: "image/png" }))}
disabled={disabled}
>
Upload
</button>
<button data-testid={`clear-btn-${label.replace(/\s+/g, "-").toLowerCase()}`}
onClick={() => onChange(null)}
>
<button data-testid={`clear-btn`} onClick={() => onChange(null)}>
Clear
</button>
{hidePreview && <span data-testid="hide-preview" />}
</div>
),
}))
@@ -48,7 +55,6 @@ const defaultProps = {
onDisplayArtistChange: jest.fn(),
onDisplayTitleChange: jest.fn(),
isPrivate: false,
onPrivateChange: jest.fn(),
karaokeBackground: null as File | null,
onKaraokeBackgroundChange: jest.fn(),
introBackground: null as File | null,
@@ -63,93 +69,139 @@ const defaultProps = {
describe("CustomizeStep", () => {
beforeEach(() => {
jest.clearAllMocks()
// Mock URL.createObjectURL for the component's useMemo
global.URL.createObjectURL = jest.fn(() => "blob:mock")
global.URL.revokeObjectURL = jest.fn()
})
it("renders title card preview with artist and title", () => {
describe("public mode (isPrivate=false)", () => {
it("shows title card preview and display fields, but no style options", () => {
render(<CustomizeStep {...defaultProps} isPrivate={false} />)
// Display override fields are shown
expect(screen.getByLabelText(/Title Card Artist/)).toBeInTheDocument()
expect(screen.getByLabelText(/Title Card Title/)).toBeInTheDocument()
// Title card preview is shown
expect(screen.getByTestId("title-card-preview")).toBeInTheDocument()
// No style customization or karaoke preview
expect(screen.queryByText("Custom Video Style")).not.toBeInTheDocument()
expect(screen.queryByTestId("karaoke-bg-preview")).not.toBeInTheDocument()
})
it("calls onConfirm when create button is clicked", () => {
render(<CustomizeStep {...defaultProps} isPrivate={false} />)
fireEvent.click(screen.getByText("Create Karaoke Video"))
expect(defaultProps.onConfirm).toHaveBeenCalledTimes(1)
})
it("shows loading state when isSubmitting", () => {
render(<CustomizeStep {...defaultProps} isPrivate={false} isSubmitting={true} />)
expect(screen.getByText("Creating...")).toBeInTheDocument()
})
})
describe("private mode (isPrivate=true)", () => {
it("shows custom video style section with side-by-side previews", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
expect(screen.getByText("Custom Video Style")).toBeInTheDocument()
expect(screen.getByTestId("title-card-preview")).toBeInTheDocument()
expect(screen.getByTestId("karaoke-bg-preview")).toBeInTheDocument()
})
it("renders title card preview with artist and title", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
const preview = screen.getByTestId("title-card-preview")
expect(preview.getAttribute("data-artist")).toBe("Test Artist")
expect(preview.getAttribute("data-title")).toBe("Test Song")
})
it("uses displayArtist/displayTitle in preview when provided", () => {
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
displayArtist="Custom Artist"
displayTitle="Custom Title"
/>
)
const preview = screen.getByTestId("title-card-preview")
expect(preview.getAttribute("data-artist")).toBe("Custom Artist")
expect(preview.getAttribute("data-title")).toBe("Custom Title")
})
it("shows color pickers for title card and lyrics", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
expect(screen.getByText("Artist Color")).toBeInTheDocument()
expect(screen.getByText("Title Color")).toBeInTheDocument()
expect(screen.getByText("Highlight Color")).toBeInTheDocument()
expect(screen.getByText("Lyrics Color")).toBeInTheDocument()
})
it("passes color overrides to title card preview", () => {
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
colorOverrides={{ artist_color: "#ff0000", title_color: "#00ff00" }}
/>
)
const preview = screen.getByTestId("title-card-preview")
expect(preview.getAttribute("data-artist-color")).toBe("#ff0000")
expect(preview.getAttribute("data-title-color")).toBe("#00ff00")
})
it("passes lyrics color overrides to karaoke preview", () => {
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
colorOverrides={{ sung_lyrics_color: "#ff0000", unsung_lyrics_color: "#00ff00" }}
/>
)
const preview = screen.getByTestId("karaoke-bg-preview")
expect(preview.getAttribute("data-sung-color")).toBe("#ff0000")
expect(preview.getAttribute("data-unsung-color")).toBe("#00ff00")
})
it("shows background mode toggles", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
// Two sets of Default/Image/Color toggles (one per canvas)
const defaultBtns = screen.getAllByText("Default")
const imageBtns = screen.getAllByText("Image")
const colorBtns = screen.getAllByText("Color")
expect(defaultBtns).toHaveLength(2)
expect(imageBtns).toHaveLength(2)
expect(colorBtns).toHaveLength(2)
})
it("calls onConfirm when create button is clicked", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
fireEvent.click(screen.getByText("Create Karaoke Video"))
expect(defaultProps.onConfirm).toHaveBeenCalledTimes(1)
})
it("shows loading state when isSubmitting", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} isSubmitting={true} />)
expect(screen.getByText("Creating...")).toBeInTheDocument()
})
})
it("calls onBack when back button is clicked", () => {
render(<CustomizeStep {...defaultProps} />)
const preview = screen.getByTestId("title-card-preview")
expect(preview).toBeInTheDocument()
expect(preview.getAttribute("data-artist")).toBe("Test Artist")
expect(preview.getAttribute("data-title")).toBe("Test Song")
})
it("uses displayArtist/displayTitle in preview when provided", () => {
render(
<CustomizeStep
{...defaultProps}
displayArtist="Custom Artist"
displayTitle="Custom Title"
/>
)
const preview = screen.getByTestId("title-card-preview")
expect(preview.getAttribute("data-artist")).toBe("Custom Artist")
expect(preview.getAttribute("data-title")).toBe("Custom Title")
})
it("does NOT show custom video style section when isPrivate is false", () => {
render(<CustomizeStep {...defaultProps} isPrivate={false} />)
expect(screen.queryByText("Custom Video Style")).not.toBeInTheDocument()
expect(screen.queryByText("Karaoke Background")).not.toBeInTheDocument()
expect(screen.queryByText("Title Card Background")).not.toBeInTheDocument()
})
it("shows custom video style section when isPrivate is true", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
expect(screen.getByText("Custom Video Style")).toBeInTheDocument()
expect(screen.getByText("Karaoke Background")).toBeInTheDocument()
expect(screen.getByText("Title Card Background")).toBeInTheDocument()
})
it("shows color pickers when isPrivate is true", () => {
render(<CustomizeStep {...defaultProps} isPrivate={true} />)
expect(screen.getByText("Artist Color")).toBeInTheDocument()
expect(screen.getByText("Title Color")).toBeInTheDocument()
})
it("passes color overrides to title card preview", () => {
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
colorOverrides={{ artist_color: "#ff0000", title_color: "#00ff00" }}
/>
)
const preview = screen.getByTestId("title-card-preview")
expect(preview.getAttribute("data-artist-color")).toBe("#ff0000")
expect(preview.getAttribute("data-title-color")).toBe("#00ff00")
})
it("toggles private checkbox and triggers onPrivateChange", () => {
render(<CustomizeStep {...defaultProps} isPrivate={false} />)
const checkbox = screen.getByRole("checkbox")
fireEvent.click(checkbox)
expect(defaultProps.onPrivateChange).toHaveBeenCalledWith(true)
})
it("calls onConfirm when create button is clicked", () => {
render(<CustomizeStep {...defaultProps} />)
const button = screen.getByText("Create Karaoke Video")
fireEvent.click(button)
expect(defaultProps.onConfirm).toHaveBeenCalledTimes(1)
})
it("shows loading state when isSubmitting", () => {
render(<CustomizeStep {...defaultProps} isSubmitting={true} />)
expect(screen.getByText("Creating...")).toBeInTheDocument()
fireEvent.click(screen.getByText("Back"))
expect(defaultProps.onBack).toHaveBeenCalledTimes(1)
})
it("disables form controls when isSubmitting", () => {
@@ -158,55 +210,4 @@ describe("CustomizeStep", () => {
const createBtn = screen.getByText("Creating...").closest("button")
expect(createBtn).toBeDisabled()
})
it("calls onBack when back button is clicked", () => {
render(<CustomizeStep {...defaultProps} />)
const backBtn = screen.getByText("Back")
fireEvent.click(backBtn)
expect(defaultProps.onBack).toHaveBeenCalledTimes(1)
})
it("shows karaoke background preview when file is provided and isPrivate", () => {
const file = new File(["data"], "karaoke-bg.png", { type: "image/png" })
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
karaokeBackground={file}
/>
)
expect(screen.getByTestId("karaoke-bg-preview")).toBeInTheDocument()
})
it("does NOT show karaoke background preview when no file", () => {
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
karaokeBackground={null}
/>
)
expect(screen.queryByTestId("karaoke-bg-preview")).not.toBeInTheDocument()
})
it("passes custom intro background to title card preview", () => {
const file = new File(["data"], "intro-bg.png", { type: "image/png" })
render(
<CustomizeStep
{...defaultProps}
isPrivate={true}
introBackground={file}
/>
)
const preview = screen.getByTestId("title-card-preview")
// Should have a blob URL for the custom background
expect(preview.getAttribute("data-custom-bg")).toBe("blob:mock")
})
})
+472 -137
View File
@@ -1,10 +1,10 @@
"use client"
import { useEffect, useMemo, useRef } from "react"
import { useEffect, useMemo, useRef, useState } from "react"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { ArrowLeft, Loader2, Palette } from "lucide-react"
import { ArrowLeft, Loader2, Palette, Image as ImageIcon, Paintbrush } from "lucide-react"
import { TitleCardPreview } from "../TitleCardPreview"
import { KaraokeBackgroundPreview } from "../KaraokeBackgroundPreview"
import { ImageUploadField } from "../ImageUploadField"
@@ -12,6 +12,8 @@ import { ImageUploadField } from "../ImageUploadField"
export interface ColorOverrides {
artist_color?: string
title_color?: string
sung_lyrics_color?: string
unsung_lyrics_color?: string
}
interface CustomizeStepProps {
@@ -22,7 +24,6 @@ interface CustomizeStepProps {
onDisplayArtistChange: (value: string) => void
onDisplayTitleChange: (value: string) => void
isPrivate: boolean
onPrivateChange: (value: boolean) => void
karaokeBackground: File | null
onKaraokeBackgroundChange: (file: File | null) => void
introBackground: File | null
@@ -35,6 +36,163 @@ interface CustomizeStepProps {
disabled?: boolean
}
// Preset colors for solid backgrounds
const BG_PRESETS = [
{ label: "Black", color: "#000000" },
{ label: "Dark Blue", color: "#1a1a2e" },
{ label: "Dark Purple", color: "#16213e" },
{ label: "Green Screen", color: "#00b140" },
{ label: "White", color: "#ffffff" },
]
type BgMode = "default" | "image" | "solid"
/**
* Generate a tiny 4x4 solid color PNG blob for uploading as a background.
* The backend expects an image file, so we create one client-side.
*/
function generateSolidColorBlob(hexColor: string): Promise<File> {
return new Promise((resolve) => {
const canvas = document.createElement("canvas")
canvas.width = 4
canvas.height = 4
const ctx = canvas.getContext("2d")!
ctx.fillStyle = hexColor
ctx.fillRect(0, 0, 4, 4)
canvas.toBlob((blob) => {
resolve(new File([blob!], `solid-${hexColor.replace('#', '')}.png`, { type: "image/png" }))
}, "image/png")
})
}
function ColorPickerField({
id,
label,
value,
defaultColor,
onChange,
disabled,
}: {
id: string
label: string
value?: string
defaultColor: string
onChange: (val: string | undefined) => void
disabled?: boolean
}) {
return (
<div className="space-y-1.5">
<Label htmlFor={id} className="text-xs" style={{ color: 'var(--text-muted)' }}>
{label}
</Label>
<div className="flex items-center gap-2">
<input
type="color"
id={id}
value={value || defaultColor}
onChange={(e) => onChange(e.target.value)}
disabled={disabled}
className="w-8 h-8 rounded border cursor-pointer"
style={{ borderColor: 'var(--card-border)' }}
/>
<Input
value={value || ""}
placeholder={defaultColor}
onChange={(e) => {
const val = e.target.value
if (val === "" || /^#[0-9A-Fa-f]{0,6}$/.test(val)) {
onChange(val || undefined)
}
}}
disabled={disabled}
className="font-mono text-xs h-8"
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
</div>
</div>
)
}
function ColorPresetButtons({
presets,
value,
onChange,
disabled,
}: {
presets: typeof BG_PRESETS
value?: string
onChange: (color: string) => void
disabled?: boolean
}) {
return (
<div className="flex flex-wrap gap-1.5">
{presets.map((preset) => (
<button
key={preset.color}
type="button"
onClick={() => onChange(preset.color)}
disabled={disabled}
className={`flex items-center gap-1.5 px-2 py-1 rounded-md border text-[10px] transition-colors ${
value === preset.color
? 'border-[var(--brand-pink)]'
: 'border-[var(--card-border)] hover:border-[var(--text-muted)]'
}`}
style={{ backgroundColor: 'var(--secondary)' }}
title={preset.label}
>
<span
className="w-3 h-3 rounded-sm border shrink-0"
style={{
backgroundColor: preset.color,
borderColor: preset.color === "#000000" ? 'var(--card-border)' : preset.color,
}}
/>
<span style={{ color: 'var(--text-muted)' }}>{preset.label}</span>
</button>
))}
</div>
)
}
function BgModeToggle({
mode,
onChange,
disabled,
}: {
mode: BgMode
onChange: (mode: BgMode) => void
disabled?: boolean
}) {
const options: { value: BgMode; label: string; icon: React.ReactNode }[] = [
{ value: "default", label: "Default", icon: null },
{ value: "image", label: "Image", icon: <ImageIcon className="w-3 h-3" /> },
{ value: "solid", label: "Color", icon: <Paintbrush className="w-3 h-3" /> },
]
return (
<div className="flex rounded-md border overflow-hidden" style={{ borderColor: 'var(--card-border)' }}>
{options.map((opt) => (
<button
key={opt.value}
type="button"
onClick={() => onChange(opt.value)}
disabled={disabled}
className={`flex items-center gap-1 px-2.5 py-1 text-[10px] font-medium transition-colors ${
mode === opt.value ? 'text-white' : ''
}`}
style={{
backgroundColor: mode === opt.value ? 'var(--brand-pink)' : 'var(--secondary)',
color: mode === opt.value ? 'white' : 'var(--text-muted)',
}}
>
{opt.icon}
{opt.label}
</button>
))}
</div>
)
}
export function CustomizeStep({
artist,
title,
@@ -43,7 +201,6 @@ export function CustomizeStep({
onDisplayArtistChange,
onDisplayTitleChange,
isPrivate,
onPrivateChange,
karaokeBackground,
onKaraokeBackgroundChange,
introBackground,
@@ -55,13 +212,22 @@ export function CustomizeStep({
isSubmitting,
disabled,
}: CustomizeStepProps) {
// The displayed artist/title on the title card
const previewArtist = displayArtist.trim() || artist
const previewTitle = displayTitle.trim() || title
// Background mode state (private only)
const [karaokeBgMode, setKaraokeBgMode] = useState<BgMode>(
karaokeBackground ? "image" : "default"
)
const [introBgMode, setIntroBgMode] = useState<BgMode>(
introBackground ? "image" : "default"
)
const [karaokeSolidColor, setKaraokeSolidColor] = useState("#000000")
const [introSolidColor, setIntroSolidColor] = useState("#000000")
// Create stable object URLs for previews and revoke on cleanup
const prevKaraokeBlobUrl = useRef<string>()
const prevIntroBlobUrl = useRef<string>()
const prevKaraokeBlobUrl = useRef<string | undefined>(undefined)
const prevIntroBlobUrl = useRef<string | undefined>(undefined)
const karaokeBackgroundUrl = useMemo(
() => karaokeBackground ? URL.createObjectURL(karaokeBackground) : undefined,
@@ -88,6 +254,129 @@ export function CustomizeStep({
return () => { if (introBackgroundUrl) URL.revokeObjectURL(introBackgroundUrl) }
}, [introBackgroundUrl])
// When switching background modes, update the file state accordingly
function handleKaraokeBgModeChange(mode: BgMode) {
setKaraokeBgMode(mode)
if (mode === "default" || mode === "solid") {
onKaraokeBackgroundChange(null)
}
if (mode === "solid") {
// Generate solid color blob
generateSolidColorBlob(karaokeSolidColor).then(onKaraokeBackgroundChange)
}
}
function handleIntroBgModeChange(mode: BgMode) {
setIntroBgMode(mode)
if (mode === "default" || mode === "solid") {
onIntroBackgroundChange(null)
}
if (mode === "solid") {
generateSolidColorBlob(introSolidColor).then(onIntroBackgroundChange)
}
}
function handleKaraokeSolidColorChange(color: string) {
setKaraokeSolidColor(color)
generateSolidColorBlob(color).then(onKaraokeBackgroundChange)
}
function handleIntroSolidColorChange(color: string) {
setIntroSolidColor(color)
generateSolidColorBlob(color).then(onIntroBackgroundChange)
}
// === PUBLIC MODE: Simple layout ===
if (!isPrivate) {
return (
<div className="space-y-5">
<div className="flex items-center justify-between">
<div>
<h2 className="text-lg font-semibold" style={{ color: 'var(--text)' }}>
Customize & Create
</h2>
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
Confirm the artist and title for your title card.
</p>
</div>
<Button
variant="ghost"
size="sm"
onClick={onBack}
disabled={disabled || isSubmitting}
style={{ color: 'var(--text-muted)' }}
>
<ArrowLeft className="w-4 h-4 mr-1" />
Back
</Button>
</div>
{/* Title card preview */}
<div className="mx-auto w-full sm:w-2/3">
<TitleCardPreview
artist={previewArtist}
title={previewTitle}
/>
</div>
{/* Display override fields */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="space-y-1.5">
<Label htmlFor="guided-display-artist" className="text-xs" style={{ color: 'var(--text-muted)' }}>
Title Card Artist
{!displayArtist.trim() && artist.trim() && (
<span className="ml-1 opacity-50">(same as above)</span>
)}
</Label>
<Input
id="guided-display-artist"
placeholder={artist || "Artist on title card"}
value={displayArtist}
onChange={(e) => onDisplayArtistChange(e.target.value)}
disabled={disabled || isSubmitting}
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
</div>
<div className="space-y-1.5">
<Label htmlFor="guided-display-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>
Title Card Title
{!displayTitle.trim() && title.trim() && (
<span className="ml-1 opacity-50">(same as above)</span>
)}
</Label>
<Input
id="guided-display-title"
placeholder={title || "Title on title card"}
value={displayTitle}
onChange={(e) => onDisplayTitleChange(e.target.value)}
disabled={disabled || isSubmitting}
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
</div>
</div>
<p className="text-[10px]" style={{ color: 'var(--text-muted)' }}>
These default to your search values. Override for soundtracks, covers, or alternate formatting.
</p>
<Button
onClick={onConfirm}
disabled={disabled || isSubmitting}
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)] h-11 text-base"
>
{isSubmitting ? (
<>
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
Creating...
</>
) : (
"Create Karaoke Video"
)}
</Button>
</div>
)
}
// === PRIVATE MODE: Full customization ===
return (
<div className="space-y-5">
<div className="flex items-center justify-between">
@@ -96,7 +385,7 @@ export function CustomizeStep({
Customize & Create
</h2>
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
Preview your title card and confirm your settings.
Customize your private video&apos;s appearance.
</p>
</div>
<Button
@@ -111,20 +400,6 @@ export function CustomizeStep({
</Button>
</div>
{/* Title card preview - half width, centered */}
<div className="space-y-2">
<Label className="text-xs" style={{ color: 'var(--text-muted)' }}>Title Card Preview</Label>
<div className="mx-auto w-full sm:w-1/2">
<TitleCardPreview
artist={previewArtist}
title={previewTitle}
customBackgroundUrl={introBackgroundUrl}
titleColor={colorOverrides.title_color}
artistColor={colorOverrides.artist_color}
/>
</div>
</div>
{/* Display override fields */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div className="space-y-1.5">
@@ -164,137 +439,197 @@ export function CustomizeStep({
These default to your search values. Override for soundtracks, covers, or alternate formatting.
</p>
{/* Privacy toggle */}
<div className="space-y-2 pt-2 border-t" style={{ borderColor: 'var(--card-border)' }}>
<div className="flex items-start gap-3">
<input
type="checkbox"
id="guided-private"
checked={isPrivate}
onChange={(e) => onPrivateChange(e.target.checked)}
disabled={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="guided-private" className="cursor-pointer" style={{ color: 'var(--text)' }}>
Private (no YouTube upload)
</Label>
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
Files delivered via Dropbox only. No YouTube or Google Drive upload.
</p>
</div>
{/* Custom Video Style section */}
<div
className="space-y-4 rounded-lg border p-4"
style={{ borderColor: 'var(--card-border)', backgroundColor: 'rgba(255,255,255,0.02)' }}
>
<div className="flex items-center gap-2">
<Palette className="w-4 h-4" style={{ color: 'var(--brand-pink)' }} />
<h3 className="text-sm font-semibold" style={{ color: 'var(--text)' }}>
Custom Video Style
</h3>
</div>
</div>
{/* Custom Video Style section - only shown for private delivery */}
{isPrivate && (
<div
className="space-y-4 rounded-lg border p-4"
style={{ borderColor: 'var(--card-border)', backgroundColor: 'rgba(255,255,255,0.02)' }}
>
<div className="flex items-center gap-2">
<Palette className="w-4 h-4" style={{ color: 'var(--brand-pink)' }} />
<h3 className="text-sm font-semibold" style={{ color: 'var(--text)' }}>
Custom Video Style
</h3>
</div>
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
Upload custom backgrounds and choose colors for your branded karaoke video.
</p>
{/* Side-by-side preview canvases */}
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
{/* Title Card Preview + Controls */}
<div className="space-y-3">
<div className="flex items-center justify-between">
<Label className="text-xs font-medium" style={{ color: 'var(--text-muted)' }}>
Title Card
</Label>
<BgModeToggle
mode={introBgMode}
onChange={handleIntroBgModeChange}
disabled={disabled || isSubmitting}
/>
</div>
{/* Karaoke Background */}
<div className="space-y-2">
<ImageUploadField
label="Karaoke Background"
description="Replaces the starfield behind lyrics during the song."
file={karaokeBackground}
onChange={onKaraokeBackgroundChange}
disabled={disabled || isSubmitting}
<TitleCardPreview
artist={previewArtist}
title={previewTitle}
customBackgroundUrl={introBackgroundUrl}
backgroundColor={introBgMode === "solid" ? introSolidColor : undefined}
titleColor={colorOverrides.title_color}
artistColor={colorOverrides.artist_color}
/>
{karaokeBackgroundUrl && (
<div className="mx-auto w-full sm:w-2/3">
<KaraokeBackgroundPreview backgroundUrl={karaokeBackgroundUrl} />
{introBgMode === "image" && (
<ImageUploadField
label=""
description="PNG or JPG background for the title card."
file={introBackground}
onChange={onIntroBackgroundChange}
disabled={disabled || isSubmitting}
hidePreview
/>
)}
{introBgMode === "solid" && (
<div className="space-y-2">
<ColorPresetButtons
presets={BG_PRESETS}
value={introSolidColor}
onChange={handleIntroSolidColorChange}
disabled={disabled || isSubmitting}
/>
<div className="flex items-center gap-2">
<input
type="color"
value={introSolidColor}
onChange={(e) => handleIntroSolidColorChange(e.target.value)}
disabled={disabled || isSubmitting}
className="w-8 h-8 rounded border cursor-pointer"
style={{ borderColor: 'var(--card-border)' }}
/>
<Input
value={introSolidColor}
onChange={(e) => {
const val = e.target.value
if (/^#[0-9A-Fa-f]{0,6}$/.test(val)) {
handleIntroSolidColorChange(val)
}
}}
disabled={disabled || isSubmitting}
className="font-mono text-xs h-8"
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
</div>
</div>
)}
{/* Title card text colors */}
<div className="grid grid-cols-2 gap-3">
<ColorPickerField
id="artist-color"
label="Artist Color"
value={colorOverrides.artist_color}
defaultColor="#ffdf6b"
onChange={(val) => onColorOverridesChange({ ...colorOverrides, artist_color: val })}
disabled={disabled || isSubmitting}
/>
<ColorPickerField
id="title-color"
label="Title Color"
value={colorOverrides.title_color}
defaultColor="#ffffff"
onChange={(val) => onColorOverridesChange({ ...colorOverrides, title_color: val })}
disabled={disabled || isSubmitting}
/>
</div>
</div>
{/* Title Card Background */}
<div className="space-y-2">
<ImageUploadField
label="Title Card Background"
description="Background image for the intro/title card shown before the song starts."
file={introBackground}
onChange={onIntroBackgroundChange}
disabled={disabled || isSubmitting}
{/* Karaoke Preview + Controls */}
<div className="space-y-3">
<div className="flex items-center justify-between">
<Label className="text-xs font-medium" style={{ color: 'var(--text-muted)' }}>
Karaoke Video
</Label>
<BgModeToggle
mode={karaokeBgMode}
onChange={handleKaraokeBgModeChange}
disabled={disabled || isSubmitting}
/>
</div>
<KaraokeBackgroundPreview
backgroundUrl={karaokeBackgroundUrl}
backgroundColor={karaokeBgMode === "solid" ? karaokeSolidColor : undefined}
sungColor={colorOverrides.sung_lyrics_color}
unsungColor={colorOverrides.unsung_lyrics_color}
/>
</div>
{/* Color overrides */}
<div className="grid grid-cols-2 gap-4">
<div className="space-y-1.5">
<Label htmlFor="artist-color" className="text-xs" style={{ color: 'var(--text-muted)' }}>
Artist Color
</Label>
<div className="flex items-center gap-2">
<input
type="color"
id="artist-color"
value={colorOverrides.artist_color || "#ffdf6b"}
onChange={(e) => onColorOverridesChange({ ...colorOverrides, artist_color: e.target.value })}
{karaokeBgMode === "image" && (
<ImageUploadField
label=""
description="PNG or JPG background behind lyrics during the song."
file={karaokeBackground}
onChange={onKaraokeBackgroundChange}
disabled={disabled || isSubmitting}
hidePreview
/>
)}
{karaokeBgMode === "solid" && (
<div className="space-y-2">
<ColorPresetButtons
presets={BG_PRESETS}
value={karaokeSolidColor}
onChange={handleKaraokeSolidColorChange}
disabled={disabled || isSubmitting}
className="w-8 h-8 rounded border cursor-pointer"
style={{ borderColor: 'var(--card-border)' }}
/>
<Input
value={colorOverrides.artist_color || ""}
placeholder="#ffdf6b"
onChange={(e) => {
const val = e.target.value
if (val === "" || /^#[0-9A-Fa-f]{0,6}$/.test(val)) {
onColorOverridesChange({ ...colorOverrides, artist_color: val || undefined })
}
}}
disabled={disabled || isSubmitting}
className="font-mono text-xs h-8"
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
</div>
</div>
<div className="space-y-1.5">
<Label htmlFor="title-color" className="text-xs" style={{ color: 'var(--text-muted)' }}>
Title Color
</Label>
<div className="flex items-center gap-2">
<input
type="color"
id="title-color"
value={colorOverrides.title_color || "#ffffff"}
onChange={(e) => onColorOverridesChange({ ...colorOverrides, title_color: e.target.value })}
disabled={disabled || isSubmitting}
className="w-8 h-8 rounded border cursor-pointer"
style={{ borderColor: 'var(--card-border)' }}
/>
<Input
value={colorOverrides.title_color || ""}
placeholder="#ffffff"
onChange={(e) => {
const val = e.target.value
if (val === "" || /^#[0-9A-Fa-f]{0,6}$/.test(val)) {
onColorOverridesChange({ ...colorOverrides, title_color: val || undefined })
}
}}
disabled={disabled || isSubmitting}
className="font-mono text-xs h-8"
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
<div className="flex items-center gap-2">
<input
type="color"
value={karaokeSolidColor}
onChange={(e) => handleKaraokeSolidColorChange(e.target.value)}
disabled={disabled || isSubmitting}
className="w-8 h-8 rounded border cursor-pointer"
style={{ borderColor: 'var(--card-border)' }}
/>
<Input
value={karaokeSolidColor}
onChange={(e) => {
const val = e.target.value
if (/^#[0-9A-Fa-f]{0,6}$/.test(val)) {
handleKaraokeSolidColorChange(val)
}
}}
disabled={disabled || isSubmitting}
className="font-mono text-xs h-8"
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
/>
</div>
</div>
)}
{/* Lyrics colors */}
<div className="grid grid-cols-2 gap-3">
<ColorPickerField
id="sung-lyrics-color"
label="Highlight Color"
value={colorOverrides.sung_lyrics_color}
defaultColor="#7070F7"
onChange={(val) => onColorOverridesChange({ ...colorOverrides, sung_lyrics_color: val })}
disabled={disabled || isSubmitting}
/>
<ColorPickerField
id="unsung-lyrics-color"
label="Lyrics Color"
value={colorOverrides.unsung_lyrics_color}
defaultColor="#ffffff"
onChange={(val) => onColorOverridesChange({ ...colorOverrides, unsung_lyrics_color: val })}
disabled={disabled || isSubmitting}
/>
</div>
</div>
<p className="text-[10px]" style={{ color: 'var(--text-muted)' }}>
Leave blank to use default Nomad theme colors.
</p>
</div>
)}
<p className="text-[10px]" style={{ color: 'var(--text-muted)' }}>
Leave colors blank to use default Nomad theme. Previews are approximate &mdash; final rendering may differ slightly.
</p>
</div>
{/* Create button */}
<Button
@@ -0,0 +1,205 @@
"use client"
import { ArrowLeft, Globe, Lock, ExternalLink, Sparkles } from "lucide-react"
import { Button } from "@/components/ui/button"
interface VisibilityStepProps {
isPrivate: boolean
onPrivateChange: (value: boolean) => void
onNext: () => void
onBack: () => void
disabled?: boolean
}
export function VisibilityStep({
isPrivate,
onPrivateChange,
onNext,
onBack,
disabled,
}: VisibilityStepProps) {
return (
<div className="space-y-5">
<div className="flex items-center justify-between">
<div>
<h2 className="text-lg font-semibold" style={{ color: 'var(--text)' }}>
How should your video be shared?
</h2>
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
Choose how your finished karaoke video will be delivered.
</p>
</div>
<Button
variant="ghost"
size="sm"
onClick={onBack}
disabled={disabled}
style={{ color: 'var(--text-muted)' }}
>
<ArrowLeft className="w-4 h-4 mr-1" />
Back
</Button>
</div>
{/* Published option */}
<button
type="button"
onClick={() => onPrivateChange(false)}
disabled={disabled}
className={`w-full text-left rounded-lg border-2 p-4 transition-all ${
!isPrivate
? 'border-[var(--brand-pink)] shadow-[0_0_12px_rgba(255,122,204,0.2)]'
: 'border-[var(--card-border)] hover:border-[var(--text-muted)]'
}`}
style={{ backgroundColor: !isPrivate ? 'rgba(255,122,204,0.05)' : 'transparent' }}
>
<div className="flex items-start gap-3">
{/* Radio circle */}
<div
className={`mt-0.5 w-5 h-5 rounded-full border-2 flex items-center justify-center shrink-0 transition-colors ${
!isPrivate ? 'border-[var(--brand-pink)]' : 'border-[var(--text-muted)]'
}`}
>
{!isPrivate && (
<div className="w-2.5 h-2.5 rounded-full bg-[var(--brand-pink)]" />
)}
</div>
<div className="flex-1 space-y-3">
<div className="flex items-center gap-2">
<Globe className="w-4 h-4" style={{ color: !isPrivate ? 'var(--brand-pink)' : 'var(--text-muted)' }} />
<span className="font-semibold" style={{ color: 'var(--text)' }}>
Published
</span>
<span
className="text-[10px] px-1.5 py-0.5 rounded-full font-medium"
style={{ backgroundColor: 'rgba(255,122,204,0.15)', color: 'var(--brand-pink)' }}
>
Recommended
</span>
</div>
<div className="space-y-2 text-sm" style={{ color: 'var(--text-muted)' }}>
<p>Your karaoke video will be <span className="font-semibold" style={{ color: '#f59e0b' }}>shared with the world</span>:</p>
<ul className="space-y-2 ml-1">
<li className="flex items-start gap-2">
<Sparkles className="w-3.5 h-3.5 mt-0.5 shrink-0" style={{ color: 'var(--brand-pink)' }} />
<span>
<strong style={{ color: 'var(--text)' }}>Uploaded to YouTube</strong> on the{" "}
<a
href="https://www.youtube.com/@nomadkaraoke/videos"
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-0.5 underline"
style={{ color: 'var(--brand-pink)' }}
onClick={(e) => e.stopPropagation()}
>
Nomad Karaoke channel
<ExternalLink className="w-3 h-3" />
</a>
{" "}&mdash; the easiest way for you (and anyone else) to sing this song anytime
</span>
</li>
<li className="flex items-start gap-2">
<Sparkles className="w-3.5 h-3.5 mt-0.5 shrink-0" style={{ color: 'var(--brand-pink)' }} />
<span>
<strong style={{ color: 'var(--text)' }}>Shared with karaoke venues</strong> via Google Drive &mdash; your song will be available to sing at bars and venues around the world
</span>
</li>
<li className="flex items-start gap-2">
<Sparkles className="w-3.5 h-3.5 mt-0.5 shrink-0" style={{ color: 'var(--brand-pink)' }} />
<span>
<strong style={{ color: 'var(--text)' }}>Source files delivered to you</strong> via Dropbox &mdash; all stems, highest quality formats, ready to download
</span>
</li>
</ul>
<div
className="rounded-md p-2.5 mt-1 text-xs"
style={{ backgroundColor: 'rgba(255,122,204,0.08)', color: 'var(--text)' }}
>
By publishing, you&apos;re helping other fans of this song discover and enjoy it at karaoke nights everywhere. Share the joy!
</div>
</div>
</div>
</div>
</button>
{/* Private option */}
<button
type="button"
onClick={() => onPrivateChange(true)}
disabled={disabled}
className={`w-full text-left rounded-lg border-2 p-4 transition-all ${
isPrivate
? 'border-[var(--brand-pink)] shadow-[0_0_12px_rgba(255,122,204,0.2)]'
: 'border-[var(--card-border)] hover:border-[var(--text-muted)]'
}`}
style={{ backgroundColor: isPrivate ? 'rgba(255,122,204,0.05)' : 'transparent' }}
>
<div className="flex items-start gap-3">
{/* Radio circle */}
<div
className={`mt-0.5 w-5 h-5 rounded-full border-2 flex items-center justify-center shrink-0 transition-colors ${
isPrivate ? 'border-[var(--brand-pink)]' : 'border-[var(--text-muted)]'
}`}
>
{isPrivate && (
<div className="w-2.5 h-2.5 rounded-full bg-[var(--brand-pink)]" />
)}
</div>
<div className="flex-1 space-y-3">
<div className="flex items-center gap-2">
<Lock className="w-4 h-4" style={{ color: isPrivate ? 'var(--brand-pink)' : 'var(--text-muted)' }} />
<span className="font-semibold" style={{ color: 'var(--text)' }}>
Private
</span>
</div>
<div className="space-y-2 text-sm" style={{ color: 'var(--text-muted)' }}>
<p>Your karaoke video stays just with you:</p>
<ul className="space-y-2 ml-1">
<li className="flex items-start gap-2">
<span className="w-3.5 h-3.5 mt-0.5 shrink-0 flex items-center justify-center text-[10px]">&bull;</span>
<span>
<strong style={{ color: 'var(--text)' }}>Delivered via Dropbox only</strong> &mdash; no YouTube upload, no Google Drive sharing. Download and use however you see fit.
</span>
</li>
<li className="flex items-start gap-2">
<span className="w-3.5 h-3.5 mt-0.5 shrink-0 flex items-center justify-center text-[10px]">&bull;</span>
<span>
<strong style={{ color: 'var(--text)' }}>Venue use is up to you</strong> &mdash; if you want to perform this track at a venue, you&apos;ll need to provide the files to the host yourself.
</span>
</li>
<li className="flex items-start gap-2">
<span className="w-3.5 h-3.5 mt-0.5 shrink-0 flex items-center justify-center text-[10px]">&bull;</span>
<span>
<strong style={{ color: 'var(--text)' }}>YouTube self-upload</strong> &mdash; you can upload to your own channel, but monetization is unlikely as song copyrights are typically held by record labels.
</span>
</li>
<li className="flex items-start gap-2">
<span className="w-3.5 h-3.5 mt-0.5 shrink-0 flex items-center justify-center text-[10px]">&bull;</span>
<span>
<strong style={{ color: 'var(--text)' }}>Custom styling available</strong> &mdash; choose your own background images, colors, and text styles on the next step.
</span>
</li>
</ul>
</div>
</div>
</div>
</button>
{/* Continue button */}
<Button
onClick={onNext}
disabled={disabled}
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)] h-11 text-base"
>
Continue
</Button>
</div>
)
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-gen"
version = "0.131.0"
version = "0.132.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"