mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
feat(i18n): Phase 3 frontend — next-intl infrastructure + 1062 strings (en/es/de) (#656)
@coderabbitai ignore
## Summary
- Phase 3 of the i18n multilingual initiative — makes the karaoke-gen
frontend fully multilingual (English, Spanish, German)
- Installs `next-intl` with `[locale]` path-based routing,
LanguageSwitcher, and `Accept-Language` API header
- Extracts **1,062 strings** from ~70 components into `messages/en.json`
across 31 namespaces
- Wires `useTranslations()` into all user-facing components (landing,
dashboard, auth, job flow, lyrics review, instrumental review, audio
editor, etc.)
- Admin pages (`/admin/*`) stay outside locale routing — intentionally
excluded from i18n scope
- Static export generates `/en/`, `/es/`, `/de/` directories (45 total
pages) for Cloudflare Pages
- `es.json`/`de.json` are English placeholders — translation via Gemini
pipeline pending
- Translation pipeline (`scripts/translate.py`) and glossary (55
karaoke-specific terms) included
## Key architecture decisions
- Root layout keeps ThemeProvider/TenantProvider (needed by admin pages
outside `[locale]`)
- Only NextIntlClientProvider added to `[locale]/layout.tsx`
- `job-status.ts` labels converted to translation keys; consumers
translate via `useTranslations('jobStatus')`
- Jest mock loads actual `en.json` so existing tests validate i18n
wiring without assertion changes
## Test plan
- [x] All 707 frontend tests pass (39 suites)
- [x] Static build generates all 45 pages across 3 locales
- [x] Admin pages render at `/admin/` without locale prefix
- [x] CodeRabbit review: 4 issues fixed, 7 pre-existing noted
- [ ] Post-deploy: verify `/en/` landing page renders correctly
- [ ] Post-deploy: verify LanguageSwitcher redirects to `/es/` and
`/de/`
- [ ] Post-deploy: verify `/admin/` still works without locale context
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
105a5b28fd
commit
8c1dfe5460
101 files changed
+8550
-1953
No files matched your search
@@ -0,0 +1 @@
|
||||
[{"name":"generate-buildid","duration":272,"timestamp":244518298649,"id":4,"parentId":1,"tags":{},"startTime":1775262331361,"traceId":"b3ef0d179e8acedf"},{"name":"load-custom-routes","duration":314,"timestamp":244518299029,"id":5,"parentId":1,"tags":{},"startTime":1775262331361,"traceId":"b3ef0d179e8acedf"},{"name":"create-dist-dir","duration":333,"timestamp":244518299363,"id":6,"parentId":1,"tags":{},"startTime":1775262331362,"traceId":"b3ef0d179e8acedf"},{"name":"clean","duration":358,"timestamp":244518300558,"id":7,"parentId":1,"tags":{},"startTime":1775262331363,"traceId":"b3ef0d179e8acedf"},{"name":"next-build","duration":1670851,"timestamp":244516630180,"id":1,"tags":{"buildMode":"default","version":"16.2.2","bundler":"turbopack","failed":true},"startTime":1775262329693,"traceId":"b3ef0d179e8acedf"}]
|
||||
@@ -0,0 +1 @@
|
||||
[{"name":"next-build","duration":1670851,"timestamp":244516630180,"id":1,"tags":{"buildMode":"default","version":"16.2.2","bundler":"turbopack","failed":true},"startTime":1775262329693,"traceId":"b3ef0d179e8acedf"}]
|
||||
@@ -1070,3 +1070,19 @@ For this bug, the missing test was: "does `transcribe_lyrics()` return `lyrics_d
|
||||
**Fix:** (1) Root cause: Don't write `corrections_updated.json` unless the payload actually contains a `"corrections"` key. (2) Defensive: Both GCE and Cloud Run workers validate the downloaded JSON has the expected structure before processing, falling back to base result if not.
|
||||
|
||||
**Key insight:** When a file's existence is used as a boolean signal ("corrections were updated"), never write it with empty/invalid content. The existence check and content processing must agree on what constitutes a valid file. Apply defense in depth: fix the writer AND validate in readers.
|
||||
|
||||
### i18n: Keep Providers in Root Layout When Admin Pages Exist (Apr 2026)
|
||||
|
||||
**Problem:** The Phase 1/2 i18n pattern (public-website, karaoke-decide) stripped the root `app/layout.tsx` bare and moved all providers into `app/[locale]/layout.tsx`. This doesn't work for karaoke-gen because admin pages at `app/admin/` sit outside the `[locale]` route segment and need ThemeProvider/TenantProvider.
|
||||
|
||||
**Fix:** Keep shared providers (ThemeProvider, TenantProvider, ImpersonationBannerWrapper, ServiceWorkerRegistration, GoogleAnalytics) in root layout. Only add NextIntlClientProvider to `[locale]/layout.tsx`. Admin pages inherit root providers without locale context.
|
||||
|
||||
**Key insight:** When adding `[locale]` routing to a project with routes that should NOT be locale-prefixed (admin, API, etc.), don't blindly follow the "strip root layout" pattern. Keep shared providers in root so all route segments can access them.
|
||||
|
||||
### i18n: Mock next-intl in Jest by Loading en.json (Apr 2026)
|
||||
|
||||
**Problem:** Adding `useTranslations` to components caused 27 test suites to fail — Jest can't handle ESM exports from `next-intl`, and even after fixing that, tests that assert on English text (e.g., `screen.getByText("Review Lyrics")`) fail because the mock returns translation keys instead of English strings.
|
||||
|
||||
**Fix:** Mock `next-intl` in `jest.setup.js` with a function that loads the actual `messages/en.json` and resolves dotted key paths to real English strings. Tests see the same text users see, no test assertions need updating. The mock supports interpolation (`{count}`, ICU plurals).
|
||||
|
||||
**Key insight:** For i18n refactors, make the test mock return real translations, not keys. This lets existing tests validate that the i18n wiring produces correct output without changing every assertion. The mock is ~20 lines and eliminates hundreds of test updates.
|
||||
@@ -36,6 +36,7 @@
|
||||
| **Community version detection** | Working (via karaokenerds.com) |
|
||||
| **Review session backup/restore** | Working (auto-save + restore UI) |
|
||||
| **Review reminder & auto-expiry** | Working (24h reminder, 48h cancel + refund) |
|
||||
| **i18n / Multilingual (frontend)** | Working (next-intl, en/es/de, 1062 strings, [locale] routing) |
|
||||
|
||||
## Known Issues
|
||||
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
# Plan: Karaoke-Gen i18n Multilingual (Phase 3)
|
||||
|
||||
**Created:** 2026-04-03
|
||||
**Branch:** `feat/sess-20260403-1115-i18n-multilingual`
|
||||
**Worktree:** `/Users/andrew/Projects/nomadkaraoke/karaoke-gen-i18n-multilingual`
|
||||
**Status:** Draft
|
||||
|
||||
## Context
|
||||
|
||||
This is Phase 3 of the i18n multilingual initiative. Phases 1+2 shipped successfully for public-website (205 strings) and karaoke-decide (811 frontend + 47 backend strings). The patterns are proven — we're replicating them in karaoke-gen, the most complex project (many frontend surfaces + multi-layered backend).
|
||||
|
||||
## Scope Decisions
|
||||
|
||||
| Decision | Choice | Rationale |
|
||||
|----------|--------|-----------|
|
||||
| Admin pages (`/admin/*`) | **Exclude** from i18n | Internal-only, ~30% more strings for zero user impact. Can add later. |
|
||||
| Tenant default locale | **Out of scope** | Orthogonal to user locale; user's localStorage/browser detection suffices |
|
||||
| Hash routing compatibility | **No conflict** | Hash (`#/jobId/review`) is client-side only, preserved across locale changes |
|
||||
| Providers in root layout | **Keep in root** | Unlike Phase 1/2, karaoke-gen has admin pages outside `[locale]` that need ThemeProvider/TenantProvider. Only NextIntlClientProvider moves to `[locale]/layout.tsx`. |
|
||||
|
||||
## Architecture: Frontend Key Difference from Phase 1/2
|
||||
|
||||
karaoke-gen has admin pages at `app/admin/` that must NOT be under `[locale]` routing. So:
|
||||
|
||||
- **Root `app/layout.tsx`**: Keeps `<html>`, `<body>`, ThemeProvider, TenantProvider, ImpersonationBannerWrapper, ServiceWorkerRegistration, GoogleAnalytics. Remove hardcoded `lang="en"`.
|
||||
- **`app/[locale]/layout.tsx`**: Adds NextIntlClientProvider + inline `<script>` to set `document.documentElement.lang`. Uses `generateStaticParams` for locale pre-rendering.
|
||||
- **`app/admin/layout.tsx`**: Unchanged — inherits root providers, no locale context needed.
|
||||
|
||||
## PR Breakdown (4 PRs)
|
||||
|
||||
### PR 1: Frontend Infrastructure + Page Migration (~250 strings)
|
||||
**Goal:** Set up next-intl, `[locale]` routing, move all user-facing pages under locale prefix.
|
||||
|
||||
**Create:**
|
||||
- `frontend/i18n/routing.ts` — locale config, `createNavigation`
|
||||
- `frontend/i18n/request.ts` — message loading for next-intl
|
||||
- `frontend/messages/en.json` — all user-facing strings (namespaced: `common`, `landing`, `dashboard`, `auth`, `payment`, `jobFlow`, `lyricsReview`, `instrumentalReview`, `audioEditor`, `audioSearch`, `credits`, `feedback`, `push`, `status`)
|
||||
- `frontend/app/[locale]/layout.tsx` — NextIntlClientProvider, `generateStaticParams`, lang script
|
||||
- `frontend/app/[locale]/page.tsx` — landing page (moved from `app/page.tsx`)
|
||||
- `frontend/app/[locale]/app/page.tsx` — dashboard
|
||||
- `frontend/app/[locale]/app/jobs/[[...slug]]/page.tsx` — job router
|
||||
- `frontend/app/[locale]/app/jobs/[[...slug]]/client.tsx` — job client component
|
||||
- `frontend/app/[locale]/auth/verify/page.tsx` — magic link verify
|
||||
- `frontend/app/[locale]/payment/success/page.tsx` — payment success
|
||||
- `frontend/app/[locale]/order/success/page.tsx` — order success
|
||||
- `frontend/components/LanguageSwitcher.tsx` — dropdown in header
|
||||
- `frontend/scripts/translate.py` — copy from karaoke-decide
|
||||
- `frontend/scripts/glossary.json` — extended with karaoke-gen terms
|
||||
|
||||
**Modify:**
|
||||
- `frontend/app/layout.tsx` — remove `lang="en"` from `<html>`, keep all providers
|
||||
- `frontend/app/page.tsx` — replace with client-side locale redirect (localStorage > navigator.language > 'en')
|
||||
- `frontend/next.config.mjs` — wrap with `createNextIntlPlugin` from `next-intl/plugin`
|
||||
- `frontend/package.json` — add `next-intl`
|
||||
- `frontend/lib/api.ts` — add `Accept-Language` header via `getLocaleFromPath()`
|
||||
- `frontend/components/app-header.tsx` — add LanguageSwitcher
|
||||
|
||||
**String extraction in this PR:** Extract ALL user-facing strings from ALL components (landing, dashboard, job flow, lyrics review, instrumental review, audio editor, audio search, credits, feedback, push, auth, status, common). Write the complete `en.json` upfront so PR 2 is just wiring `useTranslations()` into components.
|
||||
|
||||
**Why extract all strings in PR 1?** The en.json file defines the complete translation surface. Having it complete lets us run translate.py once to generate es.json/de.json, and subsequent PRs just add `useTranslations()` calls without needing to re-translate.
|
||||
|
||||
### PR 2: Component i18n Wiring (~50 components)
|
||||
**Goal:** Wire `useTranslations()` into all user-facing components.
|
||||
|
||||
**Components to convert (by area):**
|
||||
|
||||
*Job creation (~14 files):*
|
||||
- `components/job/GuidedJobFlow.tsx`, `TenantJobFlow.tsx`
|
||||
- `components/job/steps/SongInfoStep.tsx`, `AudioSourceStep.tsx`, `CustomizeStep.tsx`, `VisibilityStep.tsx`
|
||||
- `components/job/JobCard.tsx`, `JobActions.tsx`, `OutputLinks.tsx`, `JobSubmission.tsx`
|
||||
- `components/job/ThemeSelector.tsx`, `TitleCardPreview.tsx`, `EditTrackModal.tsx`, `CommunityVersionBanner.tsx`
|
||||
|
||||
*Lyrics review (~20 files):*
|
||||
- `components/lyrics-review/Header.tsx`, `LyricsAnalyzer.tsx`, `GuidancePanel.tsx`, `TranscriptionView.tsx`
|
||||
- `components/lyrics-review/EditActionBar.tsx`, `EditFeedbackBar.tsx`, `EditWordList.tsx`
|
||||
- `components/lyrics-review/ModeSelector.tsx`, `ReferenceView.tsx`, `ReferenceEmptyState.tsx`
|
||||
- `components/lyrics-review/SessionRestoreDialog.tsx`, `PreviewVideoSection.tsx`, `GapNavigator.tsx`
|
||||
- `components/lyrics-review/modals/*.tsx` (8 files)
|
||||
- `components/lyrics-review/synchronizer/*.tsx` (4 files)
|
||||
|
||||
*Instrumental review (~7 files):*
|
||||
- `components/instrumental-review/InstrumentalSelector.tsx`, `InstrumentalSelectorEmbedded.tsx`
|
||||
- `components/instrumental-review/InstrumentalGuidancePanel.tsx`, `SelectionOptions.tsx`
|
||||
- `components/instrumental-review/StemComparison.tsx`, `CustomUpload.tsx`, `MuteRegionEditor.tsx`
|
||||
|
||||
*Other (~10 files):*
|
||||
- `components/audio-editor/AudioEditor.tsx`, `AudioEditRestoreDialog.tsx`
|
||||
- `components/audio-search/AudioSearchDialog.tsx`
|
||||
- `components/credits/BuyCreditsDialog.tsx`
|
||||
- `components/feedback/FeedbackDialog.tsx`
|
||||
- `components/auth/AuthDialog.tsx`, `AuthStatus.tsx`
|
||||
- `components/push-notification-prompt.tsx`, `push-settings.tsx`
|
||||
- `components/TenantLandingPage.tsx`, `WarmingUpLoader.tsx`, `status-badge.tsx`
|
||||
|
||||
**Pattern:** Each component gets `const t = useTranslations('namespace')` and replaces hardcoded strings with `t('key')`.
|
||||
|
||||
### PR 3: Backend i18n Infrastructure + Route Localization (~150-200 strings)
|
||||
**Goal:** Add `backend/i18n.py`, translation files, convert all route files.
|
||||
|
||||
**Create:**
|
||||
- `backend/i18n.py` — `t(locale, key, **kwargs)`, `get_locale_from_request(request)`, `get_locale_prefix(locale)` (copy from karaoke-decide)
|
||||
- `backend/translations/en.json` — all backend strings
|
||||
- `backend/translations/es.json`, `de.json` — via translate.py
|
||||
|
||||
**Modify:**
|
||||
- `backend/models/user.py` — add `locale: Optional[str] = None` to User model
|
||||
- `backend/services/user_service.py` — persist locale on create/update
|
||||
- All user-facing route files (10 files): `auth.py`, `jobs.py`, `review.py`, `audio_search.py`, `users.py`, `push.py`, `file_upload.py`, `catalog.py`, `themes.py`, `tenant.py`
|
||||
- `backend/main.py` — localize `InsufficientCreditsError` handler
|
||||
|
||||
**Pattern:**
|
||||
```python
|
||||
from backend.i18n import t, get_locale_from_request
|
||||
locale = get_locale_from_request(request)
|
||||
raise HTTPException(status_code=404, detail=t(locale, "jobs.notFound"))
|
||||
```
|
||||
|
||||
### PR 4: Email + Push Notification Localization (~50-80 strings)
|
||||
**Goal:** Localize all 5 email types and 3 push notification types.
|
||||
|
||||
**Modify:**
|
||||
- `backend/services/email_service.py` — pass locale to all email methods, use `t()` for subjects/headings/buttons
|
||||
- `backend/services/template_service.py` — locale-aware GCS template paths (`templates/{locale}/...`)
|
||||
- `backend/services/job_notification_service.py` — fetch user locale, pass to email service; localize URL prefixes
|
||||
- `backend/services/push_notification_service.py` — locale-aware notification titles/bodies
|
||||
|
||||
**Add to translations:** `emails.*` and `push.*` namespaces in backend translation files.
|
||||
|
||||
## Implementation Order
|
||||
|
||||
```
|
||||
PR 1 (Frontend Infra) ──→ PR 2 (Component Wiring)
|
||||
│
|
||||
└──→ PR 3 (Backend Infra) ──→ PR 4 (Emails + Push)
|
||||
```
|
||||
|
||||
PRs 2 and 3 can be developed in parallel after PR 1 lands.
|
||||
|
||||
## Key Technical Details
|
||||
|
||||
### Accept-Language Header (frontend → backend)
|
||||
```typescript
|
||||
// frontend/lib/api.ts
|
||||
function getLocaleFromPath(): string {
|
||||
if (typeof window === 'undefined') return 'en';
|
||||
const match = window.location.pathname.match(/^\/(en|es|de)\//);
|
||||
return match ? match[1] : 'en';
|
||||
}
|
||||
```
|
||||
Added to `getAuthHeaders()` so every API call includes locale.
|
||||
|
||||
### User Locale Persistence
|
||||
- **Frontend:** `localStorage.setItem('locale', newLocale)` on language switch
|
||||
- **Backend:** `User.locale` field in Firestore (`gen_users` collection), set on magic link verify from `Accept-Language`, updated on explicit language change
|
||||
- **Emails/push:** Read `User.locale` from Firestore, fallback to `'en'`
|
||||
|
||||
### Static Export with Locale Routing
|
||||
`generateStaticParams` on `[locale]/layout.tsx` returns `[{locale:'en'},{locale:'es'},{locale:'de'}]`. Combined with `output: 'export'` and `trailingSlash: true`, Next.js generates `/en/`, `/es/`, `/de/` directories — compatible with Cloudflare Pages.
|
||||
|
||||
### Backend-Generated URLs
|
||||
All backend URLs that point to frontend must include locale prefix:
|
||||
```python
|
||||
f"{frontend_url}/{get_locale_prefix(user_locale)}/app/jobs#{job_id}/review"
|
||||
```
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Unit Tests
|
||||
- **Backend:** Test `i18n.py` — `t()` function with valid/invalid keys, interpolation, fallback to English, unsupported locale handling
|
||||
- **Backend:** Test locale extraction from `Accept-Language` header
|
||||
- **Frontend:** Jest tests for `getLocaleFromPath()` helper
|
||||
|
||||
### Integration Tests
|
||||
- **Backend:** Verify routes return localized error messages when `Accept-Language: es` is sent
|
||||
- **Backend:** Verify emails are sent with correct locale strings
|
||||
|
||||
### E2E Tests (Playwright)
|
||||
- **Production E2E:** Navigate to `/es/` and `/de/`, verify page renders in correct language
|
||||
- **Production E2E:** Switch language via LanguageSwitcher, verify localStorage persistence and page reload
|
||||
- **Production E2E:** Verify root `/` redirects to correct locale based on browser language
|
||||
|
||||
### Manual Verification
|
||||
Convert to automated E2E tests per TESTING.md guidelines:
|
||||
- Verify static export generates all 3 locale directories
|
||||
- Verify admin pages still work at `/admin/` (no locale prefix)
|
||||
- Verify tenant subdomains work with locale routing
|
||||
|
||||
## Estimated String Counts
|
||||
|
||||
| Area | Strings | PR |
|
||||
|------|---------|-----|
|
||||
| Frontend: landing, dashboard, auth, payment | ~100 | 1 |
|
||||
| Frontend: common (buttons, errors, loading) | ~50 | 1 |
|
||||
| Frontend: job flow | ~80 | 1 (extracted), 2 (wired) |
|
||||
| Frontend: lyrics review | ~120 | 1 (extracted), 2 (wired) |
|
||||
| Frontend: instrumental review | ~40 | 1 (extracted), 2 (wired) |
|
||||
| Frontend: other components | ~60 | 1 (extracted), 2 (wired) |
|
||||
| **Frontend total** | **~450-550** | |
|
||||
| Backend: route messages | ~150-200 | 3 |
|
||||
| Backend: emails + push | ~50-80 | 4 |
|
||||
| **Backend total** | **~200-280** | |
|
||||
| **Grand total** | **~650-830** | |
|
||||
|
||||
## Open Questions
|
||||
|
||||
- [ ] Should we store locale preference in a cookie too (for pre-auth pages where we don't have a user document)?
|
||||
- [ ] The landing page (`app/page.tsx`) currently has a lot of marketing content — confirm it should be fully translated vs. just the chrome
|
||||
- [ ] Any karaoke-gen-specific glossary terms beyond what's in karaoke-decide's glossary? (e.g., "stem separation", "instrumental track", "lyrics review")
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
Each PR is independently revertable:
|
||||
- PR 1: Revert moves pages back to non-locale paths. Admin pages unaffected.
|
||||
- PR 3: Revert removes `i18n.py` and translation files. Routes return English strings.
|
||||
- Cloudflare Pages: Previous deployment is one click to restore.
|
||||
@@ -24,7 +24,7 @@ describe('getJobStep', () => {
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(1);
|
||||
expect(result.total).toBe(10);
|
||||
expect(result.label).toBe('Setting up');
|
||||
expect(result.label).toBe('settingUp');
|
||||
expect(result.isBlocking).toBe(false);
|
||||
expect(result.color).toBe('text-muted-foreground');
|
||||
});
|
||||
@@ -35,7 +35,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('searching_audio');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(2);
|
||||
expect(result.label).toBe('Searching for audio');
|
||||
expect(result.label).toBe('searchingForAudio');
|
||||
expect(result.isBlocking).toBe(false);
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('awaiting_audio_selection');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(2);
|
||||
expect(result.label).toBe('Select audio source');
|
||||
expect(result.label).toBe('selectAudioSource');
|
||||
expect(result.isBlocking).toBe(true);
|
||||
expect(result.color).toBe('text-amber-400');
|
||||
});
|
||||
@@ -54,21 +54,21 @@ describe('getJobStep', () => {
|
||||
const job = createJob('downloading_audio');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(3);
|
||||
expect(result.label).toBe('Downloading audio');
|
||||
expect(result.label).toBe('downloadingAudio');
|
||||
});
|
||||
|
||||
it('returns step 3 for downloading status without worker progress', () => {
|
||||
const job = createJob('downloading');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(3);
|
||||
expect(result.label).toBe('Downloading');
|
||||
expect(result.label).toBe('downloading');
|
||||
});
|
||||
|
||||
it('returns step 3 for downloading with empty state_data', () => {
|
||||
const job = createJob('downloading', {});
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(3);
|
||||
expect(result.label).toBe('Downloading');
|
||||
expect(result.label).toBe('downloading');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ describe('getJobStep', () => {
|
||||
});
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toMatch(/Audio.*\+.*Transcribing|Transcribing.*\+.*Audio/);
|
||||
expect(result.label).toMatch(/audio.*\+.*transcribing|transcribing.*\+.*audio/);
|
||||
});
|
||||
|
||||
it('shows only active worker when one is complete', () => {
|
||||
@@ -112,7 +112,7 @@ describe('getJobStep', () => {
|
||||
});
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toBe('Transcribing');
|
||||
expect(result.label).toBe('transcribing');
|
||||
});
|
||||
|
||||
it('shows processing complete when both workers done', () => {
|
||||
@@ -124,7 +124,7 @@ describe('getJobStep', () => {
|
||||
});
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toBe('Processing complete');
|
||||
expect(result.label).toBe('processingComplete');
|
||||
});
|
||||
|
||||
it('returns step 3 when state_data has no stage info', () => {
|
||||
@@ -135,7 +135,7 @@ describe('getJobStep', () => {
|
||||
});
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(3);
|
||||
expect(result.label).toBe('Downloading');
|
||||
expect(result.label).toBe('downloading');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -144,28 +144,28 @@ describe('getJobStep', () => {
|
||||
const job = createJob('separating_stage1');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toBe('Separating audio (1/2)');
|
||||
expect(result.label).toBe('separatingAudio1');
|
||||
});
|
||||
|
||||
it('returns step 4 for separating_stage2', () => {
|
||||
const job = createJob('separating_stage2');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toBe('Separating audio (2/2)');
|
||||
expect(result.label).toBe('separatingAudio2');
|
||||
});
|
||||
|
||||
it('returns step 4 for transcribing', () => {
|
||||
const job = createJob('transcribing');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toBe('Transcribing lyrics');
|
||||
expect(result.label).toBe('transcribingLyrics');
|
||||
});
|
||||
|
||||
it('returns step 4 for correcting', () => {
|
||||
const job = createJob('correcting');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
expect(result.label).toBe('Correcting lyrics');
|
||||
expect(result.label).toBe('correctingLyrics');
|
||||
});
|
||||
|
||||
it('shows combined progress when both audio and lyrics are in progress', () => {
|
||||
@@ -176,7 +176,7 @@ describe('getJobStep', () => {
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(4);
|
||||
// Should show combined label
|
||||
expect(result.label).toMatch(/Audio|Transcribing/);
|
||||
expect(result.label).toMatch(/audio|transcribing/);
|
||||
});
|
||||
|
||||
it('shows combined status when audio done but lyrics in progress', () => {
|
||||
@@ -195,14 +195,14 @@ describe('getJobStep', () => {
|
||||
const job = createJob('generating_screens');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(5);
|
||||
expect(result.label).toBe('Generating screens');
|
||||
expect(result.label).toBe('generatingScreens');
|
||||
});
|
||||
|
||||
it('returns step 5 for applying_padding', () => {
|
||||
const job = createJob('applying_padding');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(5);
|
||||
expect(result.label).toBe('Syncing countdown');
|
||||
expect(result.label).toBe('syncingCountdown');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -211,7 +211,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('awaiting_review');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(6);
|
||||
expect(result.label).toBe('Review lyrics');
|
||||
expect(result.label).toBe('reviewLyrics');
|
||||
expect(result.isBlocking).toBe(true);
|
||||
expect(result.color).toBe('text-amber-400');
|
||||
});
|
||||
@@ -220,7 +220,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('in_review');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(6);
|
||||
expect(result.label).toBe('In review');
|
||||
expect(result.label).toBe('inReview');
|
||||
expect(result.isBlocking).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -230,14 +230,14 @@ describe('getJobStep', () => {
|
||||
const job = createJob('review_complete');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(7);
|
||||
expect(result.label).toBe('Starting render');
|
||||
expect(result.label).toBe('startingRender');
|
||||
});
|
||||
|
||||
it('returns step 7 for rendering_video', () => {
|
||||
const job = createJob('rendering_video');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(7);
|
||||
expect(result.label).toBe('Rendering video');
|
||||
expect(result.label).toBe('renderingVideo');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -246,7 +246,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('awaiting_instrumental_selection');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(8);
|
||||
expect(result.label).toBe('Select instrumental');
|
||||
expect(result.label).toBe('selectInstrumental');
|
||||
expect(result.isBlocking).toBe(true);
|
||||
expect(result.color).toBe('text-amber-400');
|
||||
});
|
||||
@@ -257,28 +257,28 @@ describe('getJobStep', () => {
|
||||
const job = createJob('instrumental_selected');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(9);
|
||||
expect(result.label).toBe('Starting final encode');
|
||||
expect(result.label).toBe('startingFinalEncode');
|
||||
});
|
||||
|
||||
it('returns step 9 for generating_video', () => {
|
||||
const job = createJob('generating_video');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(9);
|
||||
expect(result.label).toBe('Generating final video');
|
||||
expect(result.label).toBe('generatingFinalVideo');
|
||||
});
|
||||
|
||||
it('returns step 9 for encoding', () => {
|
||||
const job = createJob('encoding');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(9);
|
||||
expect(result.label).toBe('Encoding video');
|
||||
expect(result.label).toBe('encodingVideo');
|
||||
});
|
||||
|
||||
it('returns step 9 for packaging', () => {
|
||||
const job = createJob('packaging');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(9);
|
||||
expect(result.label).toBe('Packaging files');
|
||||
expect(result.label).toBe('packagingFiles');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -287,7 +287,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('uploading');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(10);
|
||||
expect(result.label).toBe('Uploading');
|
||||
expect(result.label).toBe('uploading');
|
||||
expect(result.color).toBe('text-green-400');
|
||||
});
|
||||
|
||||
@@ -295,14 +295,14 @@ describe('getJobStep', () => {
|
||||
const job = createJob('notifying');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(10);
|
||||
expect(result.label).toBe('Sending notifications');
|
||||
expect(result.label).toBe('sendingNotifications');
|
||||
});
|
||||
|
||||
it('returns step 10 for complete', () => {
|
||||
const job = createJob('complete');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(10);
|
||||
expect(result.label).toBe('Complete');
|
||||
expect(result.label).toBe('complete');
|
||||
expect(result.color).toBe('text-green-400');
|
||||
});
|
||||
|
||||
@@ -310,7 +310,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('prep_complete');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(10);
|
||||
expect(result.label).toBe('Prep complete');
|
||||
expect(result.label).toBe('prepComplete');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -319,7 +319,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('failed');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(0);
|
||||
expect(result.label).toBe('Failed');
|
||||
expect(result.label).toBe('failed');
|
||||
expect(result.color).toBe('text-red-400');
|
||||
});
|
||||
|
||||
@@ -327,7 +327,7 @@ describe('getJobStep', () => {
|
||||
const job = createJob('cancelled');
|
||||
const result = getJobStep(job);
|
||||
expect(result.step).toBe(0);
|
||||
expect(result.label).toBe('Cancelled');
|
||||
expect(result.label).toBe('cancelled');
|
||||
expect(result.color).toBe('text-muted-foreground');
|
||||
});
|
||||
});
|
||||
@@ -372,19 +372,19 @@ describe('getJobStep', () => {
|
||||
|
||||
describe('formatStepIndicator', () => {
|
||||
it('formats active step correctly', () => {
|
||||
expect(formatStepIndicator(4, 10, 'Processing')).toBe('[4/10] Processing');
|
||||
expect(formatStepIndicator(4, 10, 'processing')).toBe('[4/10] processing');
|
||||
});
|
||||
|
||||
it('omits step number for terminal states (step 0)', () => {
|
||||
expect(formatStepIndicator(0, 10, 'Failed')).toBe('Failed');
|
||||
expect(formatStepIndicator(0, 10, 'failed')).toBe('failed');
|
||||
});
|
||||
|
||||
it('formats first step correctly', () => {
|
||||
expect(formatStepIndicator(1, 10, 'Setting up')).toBe('[1/10] Setting up');
|
||||
expect(formatStepIndicator(1, 10, 'settingUp')).toBe('[1/10] settingUp');
|
||||
});
|
||||
|
||||
it('formats last step correctly', () => {
|
||||
expect(formatStepIndicator(10, 10, 'Complete')).toBe('[10/10] Complete');
|
||||
expect(formatStepIndicator(10, 10, 'complete')).toBe('[10/10] complete');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,446 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect, useState, useCallback } from "react"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { api, Job, createLyricsReviewApiClient, lyricsReviewApi } from "@/lib/api"
|
||||
import { Spinner } from "@/components/ui/spinner"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { ArrowLeft, AlertCircle } from "lucide-react"
|
||||
import Link from "next/link"
|
||||
import { LyricsAnalyzer } from "@/components/lyrics-review"
|
||||
import { InstrumentalSelector } from "@/components/instrumental-review"
|
||||
import { AudioEditor } from "@/components/audio-editor/AudioEditor"
|
||||
import { ThemeToggle } from "@/components/ThemeToggle"
|
||||
import type { CorrectionData } from "@/lib/lyrics-review/types"
|
||||
import { isLocalMode, createLocalModeJob } from "@/lib/local-mode"
|
||||
|
||||
type RouteType = "review" | "instrumental" | "audio-edit" | "unknown"
|
||||
|
||||
type AccessState =
|
||||
| { status: "loading" }
|
||||
| { status: "not_authenticated" }
|
||||
| { status: "not_authorized"; reason: string }
|
||||
| { status: "job_not_found" }
|
||||
| { status: "wrong_state"; currentState: string; expectedStates: string[] }
|
||||
| { status: "invalid_route" }
|
||||
| { status: "authorized"; job: Job; routeType: RouteType }
|
||||
| { status: "local_mode"; job: Job; routeType: RouteType }
|
||||
|
||||
// Parse route from window.location.pathname (used for local mode with path-based routing)
|
||||
// For static exports, useParams() returns empty - we must parse the URL directly
|
||||
function parseRouteFromPathname(pathname: string): { jobId: string | null; routeType: RouteType } {
|
||||
if (!pathname) {
|
||||
return { jobId: null, routeType: "unknown" }
|
||||
}
|
||||
|
||||
// Expected format: /app/jobs/{jobId}/{action}
|
||||
// e.g., /app/jobs/local/review or /app/jobs/local/instrumental
|
||||
const match = pathname.match(/^\/app\/jobs\/([^/]+)\/(review|instrumental|audio-edit)\/?$/)
|
||||
|
||||
if (match) {
|
||||
const [, jobId, action] = match
|
||||
return { jobId, routeType: action as RouteType }
|
||||
}
|
||||
|
||||
return { jobId: null, routeType: "unknown" }
|
||||
}
|
||||
|
||||
// Parse route from URL hash (used for cloud mode)
|
||||
// Expected format: #/{jobId}/review or #/{jobId}/instrumental
|
||||
function parseRouteFromHash(hash: string): { jobId: string | null; routeType: RouteType } {
|
||||
if (!hash || hash.length <= 1) {
|
||||
return { jobId: null, routeType: "unknown" }
|
||||
}
|
||||
|
||||
// Remove the leading '#' and parse
|
||||
const hashPath = hash.substring(1)
|
||||
// Support BOTH review and instrumental routes
|
||||
const match = hashPath.match(/^\/?([^/]+)\/(review|instrumental|audio-edit)\/?$/)
|
||||
|
||||
if (match) {
|
||||
const [, jobId, action] = match
|
||||
return { jobId, routeType: action as RouteType }
|
||||
}
|
||||
return { jobId: null, routeType: "unknown" }
|
||||
}
|
||||
|
||||
function getExpectedStates(routeType: RouteType): string[] {
|
||||
switch (routeType) {
|
||||
case "review":
|
||||
return ["awaiting_review", "in_review"]
|
||||
case "instrumental":
|
||||
return ["awaiting_review", "in_review"] // Same states for now
|
||||
case "audio-edit":
|
||||
return ["awaiting_audio_edit", "in_audio_edit"]
|
||||
default:
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export function JobRouterClient() {
|
||||
// For static exports, useParams() returns empty object
|
||||
// We need to parse the URL path directly instead
|
||||
const [pathname, setPathname] = useState(() =>
|
||||
typeof window !== 'undefined' ? window.location.pathname : ''
|
||||
)
|
||||
|
||||
// Track hash for re-renders when hash changes (cloud mode)
|
||||
const [hash, setHash] = useState(() =>
|
||||
typeof window !== 'undefined' ? window.location.hash : ''
|
||||
)
|
||||
|
||||
// Listen for hash changes
|
||||
useEffect(() => {
|
||||
const handleHashChange = () => {
|
||||
setHash(window.location.hash)
|
||||
}
|
||||
window.addEventListener('hashchange', handleHashChange)
|
||||
return () => window.removeEventListener('hashchange', handleHashChange)
|
||||
}, [])
|
||||
|
||||
// Update pathname on mount (needed for SSR hydration)
|
||||
useEffect(() => {
|
||||
setPathname(window.location.pathname)
|
||||
}, [])
|
||||
|
||||
// Determine routing mode and parse route
|
||||
// - Local mode: Use path-based routing parsed from window.location.pathname
|
||||
// - Cloud mode: Use hash-based routing (e.g., /app/jobs/#/{jobId}/review)
|
||||
const inLocalMode = isLocalMode()
|
||||
const { jobId, routeType } = inLocalMode
|
||||
? parseRouteFromPathname(pathname)
|
||||
: parseRouteFromHash(hash)
|
||||
|
||||
const { user, isLoading: authLoading, hasHydrated } = useAuth()
|
||||
const [accessState, setAccessState] = useState<AccessState>({ status: "loading" })
|
||||
|
||||
useEffect(() => {
|
||||
async function checkAccess() {
|
||||
// Handle local mode (skip all auth checks)
|
||||
if (inLocalMode) {
|
||||
// In local mode, always use review (combined lyrics + instrumental)
|
||||
const localRouteType: RouteType = routeType === "unknown" ? "review" : routeType
|
||||
|
||||
// Create mock job for local mode
|
||||
const localJob = createLocalModeJob({ routeType: localRouteType }) as Job
|
||||
setAccessState({ status: "local_mode", job: localJob, routeType: localRouteType })
|
||||
return
|
||||
}
|
||||
|
||||
// Cloud mode: Check hash-based route
|
||||
if (!jobId || routeType === "unknown") {
|
||||
setAccessState({ status: "invalid_route" })
|
||||
return
|
||||
}
|
||||
|
||||
// Wait for auth to finish loading and hydration to complete
|
||||
// This prevents a flash of "Sign in required" before auth state is restored from localStorage
|
||||
if (authLoading || !hasHydrated) return
|
||||
|
||||
// Must be authenticated
|
||||
if (!user) {
|
||||
setAccessState({ status: "not_authenticated" })
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// Fetch job details
|
||||
const job = await api.getJob(jobId)
|
||||
|
||||
// Check ownership: user must own the job or be admin
|
||||
const isOwner = job.user_email === user.email
|
||||
const isAdmin = user.role === "admin"
|
||||
|
||||
if (!isOwner && !isAdmin) {
|
||||
setAccessState({
|
||||
status: "not_authorized",
|
||||
reason: "You don't have permission to access this job"
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Check job is in correct state
|
||||
const expectedStates = getExpectedStates(routeType)
|
||||
if (!expectedStates.includes(job.status)) {
|
||||
setAccessState({
|
||||
status: "wrong_state",
|
||||
currentState: job.status,
|
||||
expectedStates
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// All checks passed
|
||||
setAccessState({ status: "authorized", job, routeType })
|
||||
} catch (error: unknown) {
|
||||
// Job not found or API error
|
||||
if (error && typeof error === "object" && "status" in error && error.status === 404) {
|
||||
setAccessState({ status: "job_not_found" })
|
||||
} else {
|
||||
setAccessState({
|
||||
status: "not_authorized",
|
||||
reason: "Failed to load job details"
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkAccess()
|
||||
}, [inLocalMode, jobId, routeType, user, authLoading, hasHydrated])
|
||||
|
||||
// Loading state
|
||||
if (accessState.status === "loading") {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center">
|
||||
<Spinner className="w-8 h-8 mx-auto mb-4" />
|
||||
<p className="text-muted-foreground">Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Invalid route
|
||||
if (accessState.status === "invalid_route") {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-red-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Page not found</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
The page you're looking for doesn't exist.
|
||||
</p>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Not authenticated
|
||||
if (accessState.status === "not_authenticated") {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-amber-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Sign in required</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
You need to sign in to access this page.
|
||||
</p>
|
||||
<Button asChild>
|
||||
<Link href="/app">Sign in</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Not authorized
|
||||
if (accessState.status === "not_authorized") {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-red-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Access denied</h1>
|
||||
<p className="text-muted-foreground mb-4">{accessState.reason}</p>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Job not found
|
||||
if (accessState.status === "job_not_found") {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-red-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Job not found</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
The job you're looking for doesn't exist or has been deleted.
|
||||
</p>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Wrong state
|
||||
if (accessState.status === "wrong_state") {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-amber-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Not available</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
This job is currently in "{accessState.currentState}" state and is not ready for review.
|
||||
</p>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Authorized or local mode - render the appropriate UI
|
||||
const { job } = accessState
|
||||
|
||||
// Get route type from access state (which validated and stored it during checkAccess)
|
||||
const currentRouteType = accessState.status === "authorized" || accessState.status === "local_mode"
|
||||
? accessState.routeType
|
||||
: "review" // Fallback (shouldn't happen since we return early for other statuses)
|
||||
|
||||
if (currentRouteType === "audio-edit") {
|
||||
return <AudioEditor job={job} />
|
||||
}
|
||||
|
||||
if (currentRouteType === "instrumental") {
|
||||
return <InstrumentalReviewWrapper job={job} isLocalMode={inLocalMode} />
|
||||
}
|
||||
|
||||
return <LyricsReviewWrapper job={job} isLocalMode={inLocalMode} />
|
||||
}
|
||||
|
||||
// Lyrics Review Component Wrapper
|
||||
function LyricsReviewWrapper({ job, isLocalMode = false }: { job: Job; isLocalMode?: boolean }) {
|
||||
const [correctionData, setCorrectionData] = useState<CorrectionData | null>(null)
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
// Create the API client for this job
|
||||
const apiClient = createLyricsReviewApiClient(job.job_id)
|
||||
|
||||
// Load correction data
|
||||
useEffect(() => {
|
||||
async function loadData() {
|
||||
try {
|
||||
setIsLoading(true)
|
||||
setError(null)
|
||||
const data = await lyricsReviewApi.getCorrectionData(job.job_id)
|
||||
setCorrectionData(data)
|
||||
} catch (err) {
|
||||
console.error("Failed to load correction data:", err)
|
||||
setError(err instanceof Error ? err.message : "Failed to load lyrics data")
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
loadData()
|
||||
}, [job.job_id])
|
||||
|
||||
// File load handler (opens file picker for local file)
|
||||
const handleFileLoad = useCallback(() => {
|
||||
// For now, this is a no-op since we load from API
|
||||
// Could be extended to allow loading from local files
|
||||
console.log("File load requested")
|
||||
}, [])
|
||||
|
||||
// Metadata handler
|
||||
const handleShowMetadata = useCallback(() => {
|
||||
// Could show a modal with job metadata
|
||||
console.log("Show metadata requested", job)
|
||||
}, [job])
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center">
|
||||
<Spinner className="w-8 h-8 mx-auto mb-4" />
|
||||
<p className="text-muted-foreground">Loading lyrics data...</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (error || !correctionData) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-red-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Failed to load lyrics</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
{error || "Could not load lyrics data for this job."}
|
||||
</p>
|
||||
{!isLocalMode && (
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background">
|
||||
{/* App Header - matches old frontend's AppHeader */}
|
||||
<header className="border-b bg-card/80 backdrop-blur-sm sticky top-0 z-50 px-4 py-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
{!isLocalMode && (
|
||||
<Button variant="ghost" size="sm" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src="/nomad-karaoke-logo.svg"
|
||||
alt="Nomad Karaoke"
|
||||
style={{ height: 40 }}
|
||||
/>
|
||||
<h1 className="text-lg font-bold">Lyrics Transcription Review</h1>
|
||||
</div>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="px-4 py-2">
|
||||
<LyricsAnalyzer
|
||||
data={correctionData}
|
||||
onFileLoad={handleFileLoad}
|
||||
onShowMetadata={handleShowMetadata}
|
||||
apiClient={apiClient}
|
||||
isReadOnly={false}
|
||||
audioHash={correctionData.metadata?.audio_hash || job.audio_hash || job.job_id}
|
||||
isLocalMode={isLocalMode}
|
||||
jobId={job.job_id}
|
||||
hasExistingInstrumental={!!job.existing_instrumental_gcs_path}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Instrumental Review Component Wrapper
|
||||
// The InstrumentalSelector component handles its own data fetching and submission
|
||||
// It uses the appropriate API based on isLocalMode
|
||||
function InstrumentalReviewWrapper({ job, isLocalMode = false }: { job: Job; isLocalMode?: boolean }) {
|
||||
return (
|
||||
<InstrumentalSelector job={job} isLocalMode={isLocalMode} />
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { JobRouterClient } from "./client"
|
||||
|
||||
// Required for static export with catch-all routes
|
||||
// Returns params array for paths to pre-render at build time
|
||||
export async function generateStaticParams(): Promise<{ slug?: string[] }[]> {
|
||||
return [
|
||||
{ slug: undefined }, // /app/jobs/
|
||||
// Local mode paths - pre-rendered for karaoke-gen CLI local review
|
||||
{ slug: ['local', 'review'] }, // /app/jobs/local/review
|
||||
{ slug: ['local', 'instrumental'] }, // /app/jobs/local/instrumental
|
||||
]
|
||||
}
|
||||
|
||||
export default function JobsPage() {
|
||||
return <JobRouterClient />
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect, useCallback, useMemo, Suspense, useRef } from "react"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
import { api, Job, getAccessToken } from "@/lib/api"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { useAdminSettings } from "@/lib/admin-settings"
|
||||
import { useJobNotifications, useVisibilityRefresh } from "@/hooks/use-notifications"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select"
|
||||
import { Music2, RefreshCw, Loader2, Moon, Sun, Search, Gift, X, Shield, ShieldOff, HelpCircle, Mail, Phone } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
import { sortJobsByDate } from "@/lib/job-status"
|
||||
import { WarmingUpLoader } from "@/components/WarmingUpLoader"
|
||||
import { JobCard } from "@/components/job"
|
||||
import { GuidedJobFlow } from "@/components/job/GuidedJobFlow"
|
||||
import { TenantJobFlow } from "@/components/job/TenantJobFlow"
|
||||
import { TenantLogo } from "@/components/tenant-logo"
|
||||
import { AuthStatus } from "@/components/auth"
|
||||
import { AutoProcessor } from "@/components/AutoProcessor"
|
||||
import { VersionFooter } from "@/components/version-footer"
|
||||
import { PushNotificationPrompt } from "@/components/push-notification-prompt"
|
||||
import { FeedbackDialog } from "@/components/feedback/FeedbackDialog"
|
||||
import { useTheme } from "@/lib/theme"
|
||||
import { useTenant } from "@/lib/tenant"
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
|
||||
function AppPageContent() {
|
||||
const t = useTranslations('dashboard')
|
||||
const tHeader = useTranslations('header')
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
const [allJobs, setAllJobs] = useState<Job[]>([])
|
||||
const [isLoadingJobs, setIsLoadingJobs] = useState(true)
|
||||
const [isInitialLoad, setIsInitialLoad] = useState(true)
|
||||
const [hasFetchedSuccessfully, setHasFetchedSuccessfully] = useState(false)
|
||||
const [isAuthenticated, setIsAuthenticated] = useState<boolean | null>(null)
|
||||
const [isVerifyingToken, setIsVerifyingToken] = useState(false)
|
||||
const adminTokenHandled = useRef(false) // Track if admin_token was already processed
|
||||
const { isDarkMode, toggleTheme, mounted } = useTheme()
|
||||
const { user, fetchUser, verifyMagicLink } = useAuth()
|
||||
const { isDefault: isDefaultTenant, branding } = useTenant()
|
||||
const { showTestData } = useAdminSettings()
|
||||
const [jobLimit, setJobLimit] = useState<number>(() => {
|
||||
if (typeof window === "undefined") return 10
|
||||
const saved = localStorage.getItem("nomad-karaoke-job-limit")
|
||||
return saved ? Number(saved) : 10
|
||||
})
|
||||
const [statusFilter, setStatusFilter] = useState<string>(() => {
|
||||
if (typeof window === "undefined") return "all"
|
||||
return localStorage.getItem("nomad-karaoke-status-filter") || "all"
|
||||
})
|
||||
const [searchInput, setSearchInput] = useState("")
|
||||
const [searchQuery, setSearchQuery] = useState("")
|
||||
const [showAdminControls, setShowAdminControls] = useState<boolean>(() => {
|
||||
if (typeof window === "undefined") return false
|
||||
return localStorage.getItem("nomad-karaoke-admin-controls") === "true"
|
||||
})
|
||||
const [feedbackBannerDismissed, setFeedbackBannerDismissed] = useState(() => {
|
||||
if (typeof window === "undefined") return false
|
||||
return localStorage.getItem("nomad-feedback-banner-dismissed") === "true"
|
||||
})
|
||||
const [showFeedbackDialog, setShowFeedbackDialog] = useState(false)
|
||||
|
||||
// Check if user is admin (for exclude_test parameter)
|
||||
const isAdmin = user?.role === "admin" || user?.email?.endsWith("@nomadkaraoke.com")
|
||||
|
||||
// Filter out in-progress search jobs (managed by the guided flow, not standalone cards)
|
||||
const jobs = useMemo(
|
||||
() => allJobs.filter(job => job.status !== 'awaiting_audio_selection'),
|
||||
[allJobs]
|
||||
)
|
||||
|
||||
// Debounce search input — only update the query (which triggers API calls) after 300ms
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => setSearchQuery(searchInput), 300)
|
||||
return () => clearTimeout(timer)
|
||||
}, [searchInput])
|
||||
|
||||
// Memoize loadJobs for use with visibility refresh
|
||||
const loadJobs = useCallback(async () => {
|
||||
if (!getAccessToken()) {
|
||||
setIsLoadingJobs(false)
|
||||
setIsInitialLoad(false)
|
||||
return
|
||||
}
|
||||
try {
|
||||
const data = await api.listJobs({
|
||||
limit: jobLimit,
|
||||
exclude_test: isAdmin ? !showTestData : undefined,
|
||||
fields: 'summary',
|
||||
status: statusFilter !== 'all' && statusFilter !== 'active' ? statusFilter : undefined,
|
||||
hide_completed: statusFilter === 'active' ? true : undefined,
|
||||
search: searchQuery || undefined,
|
||||
})
|
||||
setAllJobs(sortJobsByDate(data))
|
||||
} catch (err: any) {
|
||||
if (err?.status !== 401) {
|
||||
console.error("Failed to load jobs:", err)
|
||||
}
|
||||
} finally {
|
||||
setIsLoadingJobs(false)
|
||||
setIsInitialLoad(false)
|
||||
setHasFetchedSuccessfully(true)
|
||||
}
|
||||
}, [isAdmin, showTestData, jobLimit, statusFilter, searchQuery])
|
||||
|
||||
// Enable notifications for job status changes (sound + title animation)
|
||||
useJobNotifications(allJobs)
|
||||
|
||||
// Refresh jobs immediately when tab becomes visible (after returning from review UIs)
|
||||
useVisibilityRefresh(loadJobs, isAuthenticated === true)
|
||||
|
||||
// Handle admin_token URL parameter for one-click login from email
|
||||
useEffect(() => {
|
||||
const adminToken = searchParams.get("admin_token")
|
||||
|
||||
// Only process admin_token once (use ref to prevent repeated calls)
|
||||
if (adminToken && !adminTokenHandled.current) {
|
||||
adminTokenHandled.current = true
|
||||
setIsVerifyingToken(true)
|
||||
|
||||
verifyMagicLink(adminToken).then((success) => {
|
||||
// Clean URL by removing the token
|
||||
window.history.replaceState({}, '', '/app')
|
||||
setIsVerifyingToken(false)
|
||||
if (success) {
|
||||
setIsAuthenticated(true)
|
||||
} else {
|
||||
router.replace('/')
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Normal auth check (skip if admin_token is being processed)
|
||||
if (adminToken || isVerifyingToken) return
|
||||
|
||||
const token = getAccessToken()
|
||||
if (!token) {
|
||||
// Redirect to landing page if not authenticated
|
||||
router.replace('/')
|
||||
return
|
||||
}
|
||||
setIsAuthenticated(true)
|
||||
}, [router, searchParams, verifyMagicLink, isVerifyingToken])
|
||||
|
||||
// Ensure user data is loaded after authentication
|
||||
// This handles the case where user navigates via client-side navigation
|
||||
// (e.g., after beta enrollment) and the module-level fetchUser() didn't run
|
||||
useEffect(() => {
|
||||
const token = getAccessToken()
|
||||
if (token && !user) {
|
||||
fetchUser()
|
||||
}
|
||||
}, [user, fetchUser])
|
||||
|
||||
// Load jobs on mount (only if authenticated)
|
||||
useEffect(() => {
|
||||
if (isAuthenticated !== true) {
|
||||
setIsLoadingJobs(false)
|
||||
return
|
||||
}
|
||||
loadJobs()
|
||||
// Poll for updates every 10 seconds
|
||||
const interval = setInterval(loadJobs, 10000)
|
||||
return () => clearInterval(interval)
|
||||
}, [isAuthenticated, loadJobs])
|
||||
|
||||
// Show nothing while checking auth or verifying admin token (prevents flash)
|
||||
if (isAuthenticated === null || isVerifyingToken) {
|
||||
return (
|
||||
<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>
|
||||
)
|
||||
}
|
||||
|
||||
// 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 animated-gradient">
|
||||
<WarmingUpLoader spinnerClassName="w-10 h-10" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen animated-gradient">
|
||||
{/* AutoProcessor - handles non-interactive mode for jobs with that flag */}
|
||||
<AutoProcessor jobs={allJobs} onJobsChanged={loadJobs} />
|
||||
|
||||
{/* Header */}
|
||||
<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">
|
||||
{isDefaultTenant ? (
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-8 sm:h-10 shrink-0" />
|
||||
) : (
|
||||
<TenantLogo size="sm" />
|
||||
)}
|
||||
<div className="min-w-0">
|
||||
<h1 className="text-base sm:text-xl font-bold truncate" style={{ color: 'var(--text)' }}>
|
||||
{isDefaultTenant ? t('title') : branding.site_title}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-1 sm:gap-2 shrink-0">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={loadJobs}
|
||||
disabled={isLoadingJobs || !isAuthenticated}
|
||||
className="min-h-[40px] px-2 sm:px-3"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<RefreshCw className={`w-4 h-4 sm:mr-2 ${isLoadingJobs ? 'animate-spin' : ''}`} />
|
||||
<span className="hidden sm:inline">{t('refresh')}</span>
|
||||
</Button>
|
||||
{isAdmin && (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
const next = !showAdminControls
|
||||
setShowAdminControls(next)
|
||||
localStorage.setItem("nomad-karaoke-admin-controls", String(next))
|
||||
}}
|
||||
className={`min-h-[40px] px-2 sm:px-3 ${showAdminControls ? 'text-amber-400' : ''}`}
|
||||
style={showAdminControls ? undefined : { color: 'var(--text-muted)' }}
|
||||
>
|
||||
{showAdminControls ? <Shield className="w-4 h-4" /> : <ShieldOff className="w-4 h-4" />}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">
|
||||
<p>{showAdminControls ? t('hideAdminControls') : t('showAdminControls')}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="min-h-[40px] px-2 sm:px-3"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<HelpCircle className="w-4 h-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-64">
|
||||
<DropdownMenuLabel className="text-sm font-normal">
|
||||
{tHeader('helpPrompt')}
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem asChild>
|
||||
<a href="mailto:andrew@nomadkaraoke.com">
|
||||
<Mail className="w-4 h-4 mr-2" />
|
||||
andrew@nomadkaraoke.com
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<a href="tel:+18036363267">
|
||||
<Phone className="w-4 h-4 mr-2" />
|
||||
+1 (803) 636-3267
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
<AuthStatus />
|
||||
{mounted && (
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={toggleTheme}
|
||||
className="min-h-[40px] px-2 sm:px-3"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
{isDarkMode ? (
|
||||
<Sun className="w-4 h-4" />
|
||||
) : (
|
||||
<Moon className="w-4 h-4" />
|
||||
)}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="bottom">
|
||||
<p>{isDarkMode ? t('switchToLightMode') : t('switchToDarkMode')}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Feedback dialog */}
|
||||
<FeedbackDialog
|
||||
open={showFeedbackDialog}
|
||||
onClose={() => setShowFeedbackDialog(false)}
|
||||
/>
|
||||
|
||||
<main className="px-4 pt-24 pb-8 space-y-6">
|
||||
{/* Push notification prompt - shows once when appropriate */}
|
||||
<PushNotificationPrompt />
|
||||
|
||||
{/* Feedback-for-credits banner (consumer portal only) */}
|
||||
{isDefaultTenant && user?.feedback_eligible && !feedbackBannerDismissed && (
|
||||
<div className="flex items-center justify-between gap-3 rounded-lg border px-4 py-3"
|
||||
style={{
|
||||
borderColor: 'var(--accent)',
|
||||
backgroundColor: 'rgba(34, 197, 94, 0.05)',
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center gap-3 min-w-0">
|
||||
<Gift className="w-5 h-5 text-green-500 shrink-0" />
|
||||
<p className="text-sm" style={{ color: 'var(--text)' }}>
|
||||
<strong>{t('earnFreeCredit')}</strong>{' '}
|
||||
<span style={{ color: 'var(--text-muted)' }}>
|
||||
{t('feedbackPrompt')}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setShowFeedbackDialog(true)}
|
||||
className="text-green-500 border-green-500/30 hover:bg-green-500/10"
|
||||
>
|
||||
{t('giveFeedback')}
|
||||
</Button>
|
||||
<button
|
||||
onClick={() => {
|
||||
localStorage.setItem("nomad-feedback-banner-dismissed", "true")
|
||||
setFeedbackBannerDismissed(true)
|
||||
}}
|
||||
className="p-1 rounded hover:bg-secondary transition-colors"
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid lg:grid-cols-2 gap-8">
|
||||
{/* Submit Job Card */}
|
||||
<Card className="backdrop-blur min-w-0" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<CardHeader>
|
||||
<CardTitle style={{ color: 'var(--text)' }}>
|
||||
{isDefaultTenant ? t('createKaraokeVideo') : t('submitTrack')}
|
||||
</CardTitle>
|
||||
<CardDescription style={{ color: 'var(--text-muted)' }}>
|
||||
{isDefaultTenant
|
||||
? t('createDescription')
|
||||
: t('submitDescription')}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{isDefaultTenant ? (
|
||||
<GuidedJobFlow onJobCreated={loadJobs} />
|
||||
) : (
|
||||
<TenantJobFlow onJobCreated={loadJobs} />
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Jobs List Card */}
|
||||
<Card className="backdrop-blur min-w-0" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--card)' }}>
|
||||
<CardHeader className="px-3 sm:px-6">
|
||||
<div className="flex items-center justify-between gap-2 flex-wrap">
|
||||
<div className="flex items-center gap-2">
|
||||
<CardTitle style={{ color: 'var(--text)' }}>{t('recentJobs')}</CardTitle>
|
||||
{isLoadingJobs && <Loader2 className="w-4 h-4 animate-spin" style={{ color: 'var(--text-muted)' }} />}
|
||||
</div>
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<div className="relative">
|
||||
<Search className="absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5" style={{ color: 'var(--text-muted)' }} />
|
||||
<input
|
||||
type="text"
|
||||
placeholder={t('searchPlaceholder')}
|
||||
aria-label={t('searchPlaceholder')}
|
||||
value={searchInput}
|
||||
onChange={(e) => setSearchInput(e.target.value)}
|
||||
className="h-7 w-[160px] sm:w-[200px] text-xs rounded-md border pl-7 pr-2"
|
||||
style={{
|
||||
backgroundColor: 'var(--input)',
|
||||
borderColor: 'var(--border)',
|
||||
color: 'var(--text)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Select value={statusFilter} onValueChange={(v) => {
|
||||
setStatusFilter(v)
|
||||
localStorage.setItem("nomad-karaoke-status-filter", v)
|
||||
}}>
|
||||
<SelectTrigger className="h-7 w-[130px] text-xs" aria-label={t('filterByStatus')}>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">{t('allStatuses')}</SelectItem>
|
||||
<SelectItem value="active">{t('active')}</SelectItem>
|
||||
<SelectItem value="failed">{t('failed')}</SelectItem>
|
||||
<SelectItem value="complete">{t('completed')}</SelectItem>
|
||||
<SelectItem value="cancelled">{t('cancelled')}</SelectItem>
|
||||
<SelectItem value="awaiting_review">{t('awaitingReview')}</SelectItem>
|
||||
<SelectItem value="processing">{t('processing')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select value={String(jobLimit)} onValueChange={(v) => {
|
||||
const val = Number(v)
|
||||
setJobLimit(val)
|
||||
localStorage.setItem("nomad-karaoke-job-limit", String(val))
|
||||
}}>
|
||||
<SelectTrigger className="h-7 w-[70px] text-xs" aria-label={t('resultsPerPage')}>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="5">5</SelectItem>
|
||||
<SelectItem value="10">10</SelectItem>
|
||||
<SelectItem value="20">20</SelectItem>
|
||||
<SelectItem value="50">50</SelectItem>
|
||||
<SelectItem value="100">100</SelectItem>
|
||||
<SelectItem value="1000">1000</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
<CardDescription style={{ color: 'var(--text-muted)' }}>
|
||||
{!hasFetchedSuccessfully
|
||||
? t('loadingJobs')
|
||||
: searchQuery || (statusFilter !== 'all' && statusFilter !== 'active')
|
||||
? t('jobsMatchingFilters', { count: jobs.length })
|
||||
: t('jobsCount', { count: jobs.length })}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="px-3 sm:px-6">
|
||||
{jobs.length === 0 ? (
|
||||
<div className="text-center py-8" style={{ color: 'var(--text-muted)' }}>
|
||||
{!hasFetchedSuccessfully ? (
|
||||
<>
|
||||
<Loader2 className="w-12 h-12 mx-auto mb-3 opacity-50 animate-spin" />
|
||||
<p>{t('loadingJobs')}</p>
|
||||
</>
|
||||
) : searchQuery || (statusFilter !== 'all' && statusFilter !== 'active') ? (
|
||||
<>
|
||||
<Search className="w-12 h-12 mx-auto mb-3 opacity-50" />
|
||||
<p>{t('noJobsMatchFilters')}</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Music2 className="w-12 h-12 mx-auto mb-3 opacity-50" />
|
||||
<p>{t('noJobsYet')}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{jobs.map((job) => (
|
||||
<JobCard key={job.job_id} job={job} onRefresh={loadJobs} showAdminControls={isAdmin && showAdminControls} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<VersionFooter />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Wrap with Suspense for useSearchParams
|
||||
export default function AppPage() {
|
||||
return (
|
||||
<Suspense fallback={
|
||||
<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>
|
||||
}>
|
||||
<AppPageContent />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
"use client"
|
||||
|
||||
import { Suspense, useEffect, useState, useRef } from "react"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
import { Loader2, CheckCircle, XCircle, Gift, ShoppingCart } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
type VerifyState = "verifying" | "preparing" | "credits_granted" | "credits_denied" | "credits_pending" | "success" | "error"
|
||||
|
||||
function VerifyMagicLinkContent() {
|
||||
const t = useTranslations('auth')
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
const [state, setState] = useState<VerifyState>("verifying")
|
||||
const [errorMessage, setErrorMessage] = useState("")
|
||||
const [creditsGranted, setCreditsGranted] = useState(0)
|
||||
const [creditStatus, setCreditStatus] = useState<string>("not_applicable")
|
||||
const hasVerified = useRef(false)
|
||||
|
||||
const { verifyMagicLink, user, error } = useAuth()
|
||||
|
||||
useEffect(() => {
|
||||
if (hasVerified.current) return
|
||||
hasVerified.current = true
|
||||
|
||||
const token = searchParams.get("token")
|
||||
|
||||
if (!token) {
|
||||
setState("error")
|
||||
setErrorMessage(t('noVerificationToken'))
|
||||
return
|
||||
}
|
||||
|
||||
const verify = async () => {
|
||||
// Show "preparing your account" while the backend runs AI evaluation
|
||||
setState("preparing")
|
||||
|
||||
const success = await verifyMagicLink(token)
|
||||
if (success) {
|
||||
const lastVerifyResponse = (window as any).__LAST_VERIFY_RESPONSE__
|
||||
const credits = lastVerifyResponse?.credits_granted || 0
|
||||
const status = lastVerifyResponse?.credit_status || "not_applicable"
|
||||
setCreditsGranted(credits)
|
||||
setCreditStatus(status)
|
||||
|
||||
// Check for tenant subdomain redirect
|
||||
if (lastVerifyResponse?.tenant_subdomain) {
|
||||
const currentHost = window.location.hostname.toLowerCase()
|
||||
const tenantSubdomain = lastVerifyResponse.tenant_subdomain.toLowerCase()
|
||||
if (currentHost !== tenantSubdomain) {
|
||||
setState("success")
|
||||
setTimeout(() => {
|
||||
window.location.href = `https://${tenantSubdomain}/app`
|
||||
}, 1500)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Show appropriate interstitial based on credit status
|
||||
if (status === "granted" && credits > 0) {
|
||||
setState("credits_granted")
|
||||
} else if (status === "denied") {
|
||||
setState("credits_denied")
|
||||
} else if (status === "pending_review") {
|
||||
setState("credits_pending")
|
||||
} else {
|
||||
// Returning user or not applicable — go straight to app
|
||||
setState("success")
|
||||
setTimeout(() => {
|
||||
router.push("/app")
|
||||
}, 1500)
|
||||
}
|
||||
} else {
|
||||
setState("error")
|
||||
const authStore = useAuth.getState()
|
||||
setErrorMessage(authStore.error || t('linkExpiredOrUsed'))
|
||||
}
|
||||
}
|
||||
|
||||
verify()
|
||||
}, [searchParams, verifyMagicLink, router, t])
|
||||
|
||||
const goToApp = () => router.push("/app")
|
||||
const goToBuy = () => router.push("/app?buy=true")
|
||||
|
||||
return (
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
{/* Verifying token */}
|
||||
{state === "verifying" && (
|
||||
<>
|
||||
<Loader2 className="w-12 h-12 text-primary animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('verifying')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
{t('verifyingWait')}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Preparing account (AI evaluation running) */}
|
||||
{state === "preparing" && (
|
||||
<>
|
||||
<Loader2 className="w-12 h-12 text-primary animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('preparingAccount')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
{t('preparingWait')}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Credits granted - celebratory interstitial */}
|
||||
{state === "credits_granted" && (
|
||||
<>
|
||||
<div className="relative mx-auto mb-4 w-16 h-16">
|
||||
<Gift className="w-16 h-16 text-primary" />
|
||||
</div>
|
||||
<h1 className="text-2xl font-bold text-foreground mb-2">
|
||||
{t('welcomeTitle')}
|
||||
</h1>
|
||||
<div className="bg-primary/10 border border-primary/20 rounded-lg p-4 mb-4">
|
||||
<p className="text-3xl font-bold text-primary">{creditsGranted}</p>
|
||||
<p className="text-sm font-medium text-primary/80">{t('freeCreditsGranted', { count: creditsGranted })}</p>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground mb-2">
|
||||
{t('freeCreditsExplanation')}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground mb-6">
|
||||
{t('freeCreditsRequest')}
|
||||
</p>
|
||||
<Button
|
||||
onClick={goToApp}
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
{t('startCreating')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Credits denied - friendly rejection interstitial */}
|
||||
{state === "credits_denied" && (
|
||||
<>
|
||||
<XCircle className="w-12 h-12 text-muted-foreground mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('welcomeBack')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
{t('creditsDeniedExplanation')}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground mb-6">
|
||||
{t('creditsDeniedHelp')}
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
<Button
|
||||
onClick={goToBuy}
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
<ShoppingCart className="w-4 h-4 mr-2" />
|
||||
{t('buyCredits')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={goToApp}
|
||||
variant="ghost"
|
||||
className="w-full"
|
||||
>
|
||||
{t('goToDashboard')}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Credits pending review - friendly holding message */}
|
||||
{state === "credits_pending" && (
|
||||
<>
|
||||
<Loader2 className="w-12 h-12 text-muted-foreground mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('creditsPendingTitle')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
{t('creditsPendingExplanation')}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground mb-6">
|
||||
{t('creditsPendingHint')}
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
<Button
|
||||
onClick={goToBuy}
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
<ShoppingCart className="w-4 h-4 mr-2" />
|
||||
{t('buyCredits')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={goToApp}
|
||||
variant="ghost"
|
||||
className="w-full"
|
||||
>
|
||||
{t('exploreApp')}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Simple success (returning user) */}
|
||||
{state === "success" && (
|
||||
<>
|
||||
<CheckCircle className="w-12 h-12 text-success mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('successSignedIn')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground mb-4">
|
||||
{t('welcomeBackUser', { email: user?.email ? `, ${user.email}` : "" })}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('redirectingToApp')}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Error */}
|
||||
{state === "error" && (
|
||||
<>
|
||||
<XCircle className="w-12 h-12 text-destructive mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('signInFailed')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground mb-6">
|
||||
{errorMessage || t('linkExpiredOrUsed')}
|
||||
</p>
|
||||
<div className="space-y-2">
|
||||
<Button
|
||||
onClick={() => router.push("/app")}
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
{t('goToApp')}
|
||||
</Button>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('requestNewLink')}
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function VerifyLoadingFallback() {
|
||||
const t = useTranslations('auth')
|
||||
return (
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-12 h-12 text-primary animate-spin mx-auto mb-4" />
|
||||
<h1 className="text-xl font-semibold text-foreground mb-2">
|
||||
{t('pleaseWait')}
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
{t('pleaseWait')}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function VerifyMagicLinkPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<Suspense fallback={<VerifyLoadingFallback />}>
|
||||
<VerifyMagicLinkContent />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { NextIntlClientProvider } from 'next-intl';
|
||||
import { getMessages, setRequestLocale } from 'next-intl/server';
|
||||
import { hasLocale } from 'next-intl';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { routing } from '@/i18n/routing';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return routing.locales.map((locale) => ({ locale }));
|
||||
}
|
||||
|
||||
export default async function LocaleLayout({
|
||||
children,
|
||||
params,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
params: Promise<{ locale: string }>;
|
||||
}) {
|
||||
const { locale } = await params;
|
||||
|
||||
if (!hasLocale(routing.locales, locale)) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
setRequestLocale(locale);
|
||||
|
||||
const messages = await getMessages();
|
||||
|
||||
return (
|
||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `document.documentElement.lang="${locale}";`,
|
||||
}}
|
||||
/>
|
||||
{children}
|
||||
</NextIntlClientProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
"use client"
|
||||
|
||||
import { Suspense } from "react"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { CheckCircle, Loader2, Mail, Clock } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
function OrderSuccessContent() {
|
||||
const t = useTranslations('order')
|
||||
const searchParams = useSearchParams()
|
||||
const sessionId = searchParams.get("session_id")
|
||||
|
||||
return (
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<CheckCircle className="w-16 h-16 text-success mx-auto mb-4" />
|
||||
|
||||
<h1 className="text-2xl font-bold text-foreground mb-2">
|
||||
{t('title')}
|
||||
</h1>
|
||||
|
||||
<p className="text-muted-foreground mb-6">
|
||||
{t('description')}
|
||||
</p>
|
||||
|
||||
<div className="space-y-4 mb-6">
|
||||
<div className="flex items-center gap-3 text-left p-3 bg-secondary rounded-lg">
|
||||
<Clock className="w-5 h-5 text-primary flex-shrink-0" />
|
||||
<div>
|
||||
<p className="font-medium text-foreground">{t('deliveryTime')}</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('deliveryNote')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3 text-left p-3 bg-secondary rounded-lg">
|
||||
<Mail className="w-5 h-5 text-primary flex-shrink-0" />
|
||||
<div>
|
||||
<p className="font-medium text-foreground">{t('checkEmail')}</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('checkEmailNote')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<Button
|
||||
asChild
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
<a href="https://nomadkaraoke.com">
|
||||
{t('backToNomadKaraoke')}
|
||||
</a>
|
||||
</Button>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('questionsEmail')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function OrderLoadingFallback() {
|
||||
const tCommon = useTranslations('common')
|
||||
return (
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-16 h-16 text-primary mx-auto mb-4 animate-spin" />
|
||||
<p className="text-muted-foreground">{tCommon('loading')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function OrderSuccessPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<Suspense fallback={<OrderLoadingFallback />}>
|
||||
<OrderSuccessContent />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,863 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import Image from 'next/image';
|
||||
import {
|
||||
Music,
|
||||
Sparkles,
|
||||
Video,
|
||||
Youtube,
|
||||
Check,
|
||||
Gift,
|
||||
Mail,
|
||||
Loader2,
|
||||
Search,
|
||||
Link as LinkIcon,
|
||||
Upload,
|
||||
Clock,
|
||||
FileVideo,
|
||||
CreditCard,
|
||||
} from 'lucide-react';
|
||||
import { api, setAccessToken, getAccessToken, CreditPackage } from '@/lib/api';
|
||||
import { AuthDialog } from '@/components/auth/AuthDialog';
|
||||
import { WarmingUpLoader } from '@/components/WarmingUpLoader';
|
||||
import { ThemeToggle } from '@/components/ThemeToggle';
|
||||
import { useTenant } from '@/lib/tenant';
|
||||
import { TenantLandingPage } from '@/components/TenantLandingPage';
|
||||
|
||||
// Build-time constant: when true, this build is for tenant portals only
|
||||
const IS_TENANT_PORTAL = process.env.NEXT_PUBLIC_TENANT_PORTAL === 'true';
|
||||
|
||||
export default function LandingPage() {
|
||||
// Tenant portal builds always render the tenant landing page
|
||||
// This is a build-time constant so the consumer code gets tree-shaken
|
||||
if (IS_TENANT_PORTAL) {
|
||||
return <TenantLandingPage />;
|
||||
}
|
||||
|
||||
return <ConsumerLandingPage />;
|
||||
}
|
||||
|
||||
function ConsumerLandingPage() {
|
||||
const router = useRouter();
|
||||
const t = useTranslations('landing');
|
||||
const { isDefault: isDefaultTenant, isLoading: tenantLoading, isInitialized: tenantInitialized } = useTenant();
|
||||
const [isCheckingAuth, setIsCheckingAuth] = useState(true);
|
||||
const [isMounted, setIsMounted] = useState(false);
|
||||
const [packages, setPackages] = useState<CreditPackage[]>([]);
|
||||
const [packagesLoading, setPackagesLoading] = useState(true);
|
||||
const [packagesError, setPackagesError] = useState<string | null>(null);
|
||||
const [selectedPackage, setSelectedPackage] = useState<CreditPackage | null>(null);
|
||||
const [email, setEmail] = useState('');
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
// Made For You form state
|
||||
const [mfyArtist, setMfyArtist] = useState('');
|
||||
const [mfyTitle, setMfyTitle] = useState('');
|
||||
const [mfySourceType, setMfySourceType] = useState<'search' | 'youtube' | 'upload'>('search');
|
||||
const [mfyYoutubeUrl, setMfyYoutubeUrl] = useState('');
|
||||
const [mfyEmail, setMfyEmail] = useState('');
|
||||
const [mfyNotes, setMfyNotes] = useState('');
|
||||
const [mfyLoading, setMfyLoading] = useState(false);
|
||||
const [mfyError, setMfyError] = useState<string | null>(null);
|
||||
|
||||
// Auth dialog state
|
||||
const [showAuthDialog, setShowAuthDialog] = useState(false);
|
||||
|
||||
// FAQ data (uses translation keys)
|
||||
const faqs = [
|
||||
{ question: t('faq.faq1Question'), answer: t('faq.faq1Answer') },
|
||||
{ question: t('faq.faq2Question'), answer: t('faq.faq2Answer') },
|
||||
{ question: t('faq.faq3Question'), answer: t('faq.faq3Answer') },
|
||||
{ question: t('faq.faq4Question'), answer: t('faq.faq4Answer') },
|
||||
{ question: t('faq.faq5Question'), answer: t('faq.faq5Answer') },
|
||||
];
|
||||
|
||||
// Track client-side mount to avoid hydration mismatch
|
||||
useEffect(() => {
|
||||
setIsMounted(true);
|
||||
}, []);
|
||||
|
||||
// Check if already logged in and redirect to app
|
||||
useEffect(() => {
|
||||
const token = getAccessToken();
|
||||
if (token) {
|
||||
router.replace('/app');
|
||||
return;
|
||||
}
|
||||
setIsCheckingAuth(false);
|
||||
}, [router]);
|
||||
|
||||
// Handle successful auth from dialog
|
||||
const handleAuthSuccess = () => {
|
||||
setShowAuthDialog(false);
|
||||
router.push('/app');
|
||||
};
|
||||
|
||||
// Load credit packages on mount
|
||||
useEffect(() => {
|
||||
if (isCheckingAuth) return;
|
||||
|
||||
async function loadPackages() {
|
||||
try {
|
||||
const pkgs = await api.getCreditPackages();
|
||||
setPackages(pkgs);
|
||||
// Default to 5 credits (best value)
|
||||
const bestValue = pkgs.find((p) => p.credits === 5);
|
||||
setSelectedPackage(bestValue || pkgs[0]);
|
||||
} catch (err) {
|
||||
console.error('Failed to load packages:', err);
|
||||
setPackagesError('Failed to load pricing. Please refresh the page.');
|
||||
} finally {
|
||||
setPackagesLoading(false);
|
||||
}
|
||||
}
|
||||
loadPackages();
|
||||
}, [isCheckingAuth]);
|
||||
|
||||
// Tenant portals get a minimal landing page (just logo + sign in)
|
||||
// Only check after mount to avoid hydration mismatch with static export
|
||||
// Must be AFTER all hooks to comply with React Rules of Hooks
|
||||
if (isMounted && tenantInitialized && !isDefaultTenant) {
|
||||
return <TenantLandingPage />;
|
||||
}
|
||||
|
||||
// Handle checkout
|
||||
const handleCheckout = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!selectedPackage || !email) return;
|
||||
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const checkoutUrl = await api.createCheckout(selectedPackage.id, email);
|
||||
// Validate that the URL is a Stripe checkout URL
|
||||
if (!checkoutUrl.startsWith('https://checkout.stripe.com/')) {
|
||||
throw new Error('Invalid checkout URL received');
|
||||
}
|
||||
window.location.href = checkoutUrl;
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create checkout session');
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// Handle Made For You checkout
|
||||
const handleMadeForYouSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setMfyError(null);
|
||||
|
||||
// Validation
|
||||
if (!mfyArtist.trim()) {
|
||||
setMfyError(t('madeForYou.artistRequired'));
|
||||
return;
|
||||
}
|
||||
if (!mfyTitle.trim()) {
|
||||
setMfyError(t('madeForYou.titleRequired'));
|
||||
return;
|
||||
}
|
||||
if (!mfyEmail.trim()) {
|
||||
setMfyError(t('madeForYou.emailRequired'));
|
||||
return;
|
||||
}
|
||||
if (mfySourceType === 'youtube' && !mfyYoutubeUrl.trim()) {
|
||||
setMfyError(t('madeForYou.youtubeUrlRequired'));
|
||||
return;
|
||||
}
|
||||
|
||||
setMfyLoading(true);
|
||||
|
||||
try {
|
||||
const checkoutUrl = await api.createMadeForYouCheckout({
|
||||
email: mfyEmail,
|
||||
artist: mfyArtist,
|
||||
title: mfyTitle,
|
||||
source_type: mfySourceType,
|
||||
youtube_url: mfySourceType === 'youtube' ? mfyYoutubeUrl : undefined,
|
||||
notes: mfyNotes || undefined,
|
||||
});
|
||||
|
||||
// Redirect to Stripe Checkout
|
||||
window.location.href = checkoutUrl;
|
||||
} catch (err) {
|
||||
setMfyError(err instanceof Error ? err.message : t('madeForYou.submitError'));
|
||||
setMfyLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const formatPrice = (cents: number) => `$${(cents / 100).toFixed(0)}`;
|
||||
const pricePerVideo = (pkg: CreditPackage) =>
|
||||
`$${(pkg.price_cents / 100 / pkg.credits).toFixed(2)}`;
|
||||
|
||||
// Show loading while checking auth
|
||||
if (isCheckingAuth) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center animated-gradient">
|
||||
<Loader2 className="w-8 h-8 animate-spin text-white" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen animated-gradient">
|
||||
{/* Navigation */}
|
||||
<nav className="fixed top-0 left-0 right-0 z-50 bg-dark-900/80 backdrop-blur-md border-b border-dark-700">
|
||||
<div className="max-w-6xl mx-auto px-4 py-4 flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-10" />
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<ThemeToggle />
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
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"
|
||||
>
|
||||
{t('navigation.signIn')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{/* Hero Section */}
|
||||
<section className="pt-32 pb-6 px-4">
|
||||
<div className="max-w-4xl mx-auto text-center">
|
||||
<h1 className="text-4xl sm:text-5xl md:text-6xl font-extrabold mb-6 leading-tight">
|
||||
{t('hero.title')}
|
||||
</h1>
|
||||
<p className="text-xl text-dark-300 mb-8 max-w-2xl mx-auto">
|
||||
{t('hero.subtitle')}
|
||||
</p>
|
||||
|
||||
{/* Two pricing options */}
|
||||
<div className="flex flex-col sm:flex-row items-center justify-center gap-6 mb-6">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="inline-flex items-center gap-2 bg-primary-500 hover:bg-primary-600 text-white font-semibold px-8 py-4 rounded-xl transition-all btn-glow"
|
||||
>
|
||||
<Video className="w-5 h-5" />
|
||||
{t('heroCTA.createYourself')}
|
||||
<span className="ml-1 px-2 py-0.5 bg-white/20 rounded-full text-sm">{t('heroCTA.createYourselfPrice')}</span>
|
||||
</button>
|
||||
<span className="text-green-400 text-sm">{t('heroCTA.createYourselfNote')}</span>
|
||||
</div>
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<a
|
||||
href="#made-for-you"
|
||||
className="inline-flex items-center gap-2 bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40 font-semibold px-8 py-4 rounded-xl transition-all"
|
||||
>
|
||||
<Gift className="w-5 h-5" />
|
||||
{t('heroCTA.makeForYou')}
|
||||
<span className="ml-1 px-2 py-0.5 bg-yellow-500/20 rounded-full text-sm">{t('heroCTA.makeForYouPrice')}</span>
|
||||
</a>
|
||||
<span className="text-yellow-400/70 text-sm">{t('heroCTA.makeForYouNote')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Demo Video Section */}
|
||||
<section className="py-8 px-4">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-2 overflow-hidden">
|
||||
<div className="aspect-video">
|
||||
<iframe
|
||||
className="w-full h-full rounded-xl"
|
||||
src="https://www.youtube.com/embed/RLkIEHGwFcU"
|
||||
title={t('demoVideo.title')}
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
referrerPolicy="strict-origin-when-cross-origin"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* How It Works */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">{t('howItWorks.title')}</h2>
|
||||
<div className="grid md:grid-cols-4 gap-8">
|
||||
{[
|
||||
{ icon: Music, title: t('howItWorks.step1Title'), desc: t('howItWorks.step1Desc') },
|
||||
{ icon: Sparkles, title: t('howItWorks.step2Title'), desc: t('howItWorks.step2Desc') },
|
||||
{ icon: Video, title: t('howItWorks.step3Title'), desc: t('howItWorks.step3Desc') },
|
||||
{ icon: Youtube, title: t('howItWorks.step4Title'), desc: t('howItWorks.step4Desc') },
|
||||
].map((step, i) => (
|
||||
<div key={i} className="text-center">
|
||||
<div className="w-16 h-16 bg-primary-500/20 rounded-2xl flex items-center justify-center mx-auto mb-4">
|
||||
<step.icon className="w-8 h-8 text-primary-400" />
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg mb-2">{step.title}</h3>
|
||||
<p className="text-dark-400 text-sm">{step.desc}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Full Tutorial Video */}
|
||||
<div className="mt-12 text-center">
|
||||
<h3 className="text-xl font-semibold mb-2">{t('howItWorks.tutorialTitle')}</h3>
|
||||
<p className="text-dark-400 text-sm mb-6 max-w-xl mx-auto">
|
||||
{t('howItWorks.tutorialDesc')}
|
||||
</p>
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-2 overflow-hidden">
|
||||
<div className="aspect-video">
|
||||
<iframe
|
||||
className="w-full h-full rounded-xl"
|
||||
src="https://www.youtube.com/embed/-dI3r7qXo3A"
|
||||
title={t('howItWorks.tutorialVideoTitle')}
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
referrerPolicy="strict-origin-when-cross-origin"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Features */}
|
||||
<section className="py-16 px-4 bg-dark-800/50">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">{t('features.title')}</h2>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{[
|
||||
{ title: t('features.feature1Title'), desc: t('features.feature1Desc') },
|
||||
{ title: t('features.feature2Title'), desc: t('features.feature2Desc') },
|
||||
{ title: t('features.feature3Title'), desc: t('features.feature3Desc') },
|
||||
{ title: t('features.feature4Title'), desc: t('features.feature4Desc') },
|
||||
{ title: t('features.feature5Title'), desc: t('features.feature5Desc') },
|
||||
{ title: t('features.feature6Title'), desc: t('features.feature6Desc') },
|
||||
].map((feature, i) => (
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl p-6 card-hover">
|
||||
<h3 className="font-semibold text-lg mb-2">{feature.title}</h3>
|
||||
<p className="text-dark-400 text-sm">{feature.desc}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Screenshots Section */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-4">{t('screenshots.title')}</h2>
|
||||
<p className="text-dark-400 text-center mb-12 max-w-xl mx-auto">
|
||||
{t('screenshots.subtitle')}
|
||||
</p>
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
{/* Job Creation Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/job-dashboard.avif"
|
||||
alt={t('screenshots.jobCreationAlt')}
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">{t('screenshots.jobCreationTitle')}</h3>
|
||||
<p className="text-dark-400 text-sm">{t('screenshots.jobCreationDesc')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Lyrics Review Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/lyrics-review.avif"
|
||||
alt={t('screenshots.lyricsReviewAlt')}
|
||||
fill
|
||||
className="object-cover object-top"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">{t('screenshots.lyricsReviewTitle')}</h3>
|
||||
<p className="text-dark-400 text-sm">{t('screenshots.lyricsReviewDesc')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Instrumental Selection Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/instrumental-review.avif"
|
||||
alt={t('screenshots.instrumentalReviewAlt')}
|
||||
fill
|
||||
className="object-cover object-top"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">{t('screenshots.instrumentalReviewTitle')}</h3>
|
||||
<p className="text-dark-400 text-sm">{t('screenshots.instrumentalReviewDesc')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Example Output Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/example-output.avif"
|
||||
alt={t('screenshots.exampleOutputAlt')}
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">{t('screenshots.exampleOutputTitle')}</h3>
|
||||
<p className="text-dark-400 text-sm">{t('screenshots.exampleOutputDesc')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Pricing */}
|
||||
<section id="pricing" className="py-20 px-4">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-4">{t('pricing.title')}</h2>
|
||||
<p className="text-dark-400 text-center mb-4 max-w-xl mx-auto">
|
||||
{t('pricing.subtitle')}
|
||||
</p>
|
||||
|
||||
<div className="bg-green-500/10 border border-green-500/30 rounded-2xl p-6 text-center mb-10 max-w-sm mx-auto">
|
||||
<div className="text-sm text-green-400 font-medium mb-1">{t('pricing.freeCreditLabel')}</div>
|
||||
<div className="text-4xl font-bold text-green-400 mb-1">{t('pricing.freeCredit')}</div>
|
||||
<div className="text-sm text-dark-400 mb-4">{t('pricing.freeCreditNote')}</div>
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="inline-flex items-center gap-2 bg-green-500 hover:bg-green-600 text-white font-semibold px-6 py-3 rounded-xl transition-all"
|
||||
>
|
||||
{t('pricing.signUpFree')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Package Selection */}
|
||||
{packagesLoading && (
|
||||
<WarmingUpLoader className="py-8" />
|
||||
)}
|
||||
{packagesError && (
|
||||
<div className="text-center py-8 text-red-400">
|
||||
{packagesError}
|
||||
</div>
|
||||
)}
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
|
||||
{packages.map((pkg) => {
|
||||
const isSelected = selectedPackage?.id === pkg.id;
|
||||
const isBestValue = pkg.credits === 5;
|
||||
const savings = pkg.credits > 1 ? Math.round((1 - pkg.price_cents / (pkg.credits * 500)) * 100) : 0;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={pkg.id}
|
||||
onClick={() => setSelectedPackage(pkg)}
|
||||
className={`relative p-4 rounded-xl border-2 transition-all ${
|
||||
isSelected
|
||||
? 'border-primary-500 bg-primary-500/10'
|
||||
: 'border-dark-700 hover:border-dark-500 bg-dark-800/50'
|
||||
}`}
|
||||
>
|
||||
{isBestValue && (
|
||||
<span className="absolute -top-3 left-1/2 -translate-x-1/2 bg-primary-500 text-white text-xs font-semibold px-3 py-1 rounded-full">
|
||||
{t('pricing.bestValue')}
|
||||
</span>
|
||||
)}
|
||||
<div className="text-2xl font-bold mb-1">{pkg.credits}</div>
|
||||
<div className="text-sm text-dark-400 mb-2">
|
||||
{pkg.credits === 1 ? t('pricing.creditUnit') : t('pricing.creditsUnit')}
|
||||
</div>
|
||||
<div className="text-xl font-semibold text-primary-400">
|
||||
{formatPrice(pkg.price_cents)}
|
||||
</div>
|
||||
<div className="text-xs text-dark-500">{pricePerVideo(pkg)}{t('pricing.perVideo')}</div>
|
||||
{savings > 0 && (
|
||||
<div className="text-xs text-green-400 mt-1">{t('pricing.saveFmt', { savings })}</div>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Checkout Form */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-8 max-w-md mx-auto">
|
||||
<div className="text-center mb-6">
|
||||
<div className="text-sm text-dark-400 mb-1">{t('pricing.selectedPackage')}</div>
|
||||
<div className="text-2xl font-bold">
|
||||
{selectedPackage?.credits} {selectedPackage && selectedPackage.credits === 1 ? t('pricing.creditUnit') : t('pricing.creditsUnit')}
|
||||
</div>
|
||||
<div className="text-3xl font-bold text-primary-400">
|
||||
{selectedPackage && formatPrice(selectedPackage.price_cents)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleCheckout} className="space-y-4">
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('pricing.emailLabel')}
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Mail className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground" />
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
placeholder={t('pricing.emailPlaceholder')}
|
||||
className="w-full pl-10 pr-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<p className="text-xs text-dark-500 mt-2">
|
||||
{t('pricing.emailHint')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{error && <p className="text-red-400 text-sm">{error}</p>}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || !selectedPackage}
|
||||
className="w-full bg-primary-500 hover:bg-primary-600 disabled:bg-primary-500/50 text-white font-semibold py-4 rounded-xl transition-all btn-glow flex items-center justify-center gap-2"
|
||||
>
|
||||
{isLoading ? t('pricing.redirecting') : t('pricing.continuePayment')}
|
||||
{!isLoading && <Check className="w-5 h-5" />}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="mt-4 flex items-center justify-center gap-4 text-xs text-dark-500">
|
||||
<span>{t('pricing.secureCheckout')}</span>
|
||||
<span>{t('pricing.poweredByStripe')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Made For You Section */}
|
||||
<section id="made-for-you" className="py-20 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
{/* Section Header */}
|
||||
<div className="text-center mb-12">
|
||||
<div className="inline-flex items-center gap-2 bg-yellow-500/20 text-yellow-400 px-4 py-2 rounded-full text-sm font-medium mb-4">
|
||||
<Gift className="w-4 h-4" />
|
||||
{t('madeForYou.badgeLabel')}
|
||||
</div>
|
||||
<h2 className="text-3xl font-bold mb-4">{t('madeForYou.title')}</h2>
|
||||
<p className="text-dark-400 max-w-2xl mx-auto mb-4">
|
||||
{t('madeForYou.subtitle')}
|
||||
</p>
|
||||
<p className="text-dark-500 text-sm max-w-xl mx-auto">
|
||||
{t('madeForYou.secondarySubtitle')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-2 gap-12 items-start">
|
||||
{/* Benefits */}
|
||||
<div>
|
||||
<h3 className="text-xl font-semibold mb-6">{t('madeForYou.benefitsTitle')}</h3>
|
||||
<div className="space-y-4">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-primary-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<FileVideo className="w-5 h-5 text-primary-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium">{t('madeForYou.benefit1Title')}</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
{t('madeForYou.benefit1Desc')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-purple-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<Clock className="w-5 h-5 text-purple-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium">{t('madeForYou.benefit2Title')}</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
{t('madeForYou.benefit2Desc')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-yellow-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<Gift className="w-5 h-5 text-yellow-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium">{t('madeForYou.benefit3Title')}</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
{t('madeForYou.benefit3Desc')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href="https://www.youtube.com/@nomadkaraoke"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4 hover:border-red-500/40 transition-colors group"
|
||||
>
|
||||
<div className="w-10 h-10 bg-red-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<Youtube className="w-5 h-5 text-red-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium group-hover:text-red-400 transition-colors">{t('madeForYou.benefit4Title')}</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
{t('madeForYou.benefit4Desc')}
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Delivery includes */}
|
||||
<div className="mt-8 p-4 bg-dark-800 border border-dark-700 rounded-xl">
|
||||
<h4 className="font-medium mb-3">{t('madeForYou.deliveryIncludesTitle')}</h4>
|
||||
<ul className="space-y-2 text-sm text-dark-400">
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
{t('madeForYou.delivery1')}
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
{t('madeForYou.delivery2')}
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
{t('madeForYou.delivery3')}
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
{t('madeForYou.delivery4')}
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
{t('madeForYou.delivery5')}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Order Form */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-6 sm:p-8">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h3 className="text-xl font-semibold">{t('madeForYou.orderFormTitle')}</h3>
|
||||
<div className="text-2xl font-bold text-primary-400">{t('madeForYou.orderPrice')}</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleMadeForYouSubmit} className="space-y-5">
|
||||
{/* Artist */}
|
||||
<div>
|
||||
<label htmlFor="mfy-artist" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('madeForYou.artistLabel')} <span className="text-red-400">{t('madeForYou.requiredField')}</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="mfy-artist"
|
||||
value={mfyArtist}
|
||||
onChange={(e) => setMfyArtist(e.target.value)}
|
||||
placeholder={t('madeForYou.artistPlaceholder')}
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<div>
|
||||
<label htmlFor="mfy-title" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('madeForYou.titleLabel')} <span className="text-red-400">{t('madeForYou.requiredField')}</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="mfy-title"
|
||||
value={mfyTitle}
|
||||
onChange={(e) => setMfyTitle(e.target.value)}
|
||||
placeholder={t('madeForYou.titlePlaceholder')}
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Source Type */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('madeForYou.audioSourceLabel')}
|
||||
</label>
|
||||
<div className="grid grid-cols-3 gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMfySourceType('search')}
|
||||
className={`flex flex-col items-center gap-1 p-3 rounded-lg border transition-all ${
|
||||
mfySourceType === 'search'
|
||||
? 'border-primary-500 bg-primary-500/10 text-primary-400'
|
||||
: 'border-dark-700 text-dark-400 hover:border-dark-500'
|
||||
}`}
|
||||
>
|
||||
<Search className="w-5 h-5" />
|
||||
<span className="text-xs">{t('madeForYou.autoSearchLabel')}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMfySourceType('youtube')}
|
||||
className={`flex flex-col items-center gap-1 p-3 rounded-lg border transition-all ${
|
||||
mfySourceType === 'youtube'
|
||||
? 'border-primary-500 bg-primary-500/10 text-primary-400'
|
||||
: 'border-dark-700 text-dark-400 hover:border-dark-500'
|
||||
}`}
|
||||
>
|
||||
<LinkIcon className="w-5 h-5" />
|
||||
<span className="text-xs">{t('madeForYou.youtubeUrlLabel')}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMfySourceType('upload')}
|
||||
className={`flex flex-col items-center gap-1 p-3 rounded-lg border transition-all ${
|
||||
mfySourceType === 'upload'
|
||||
? 'border-primary-500 bg-primary-500/10 text-primary-400'
|
||||
: 'border-dark-700 text-dark-400 hover:border-dark-500'
|
||||
}`}
|
||||
>
|
||||
<Upload className="w-5 h-5" />
|
||||
<span className="text-xs">{t('madeForYou.fileUploadLabel')}</span>
|
||||
</button>
|
||||
</div>
|
||||
<p className="mt-2 text-xs text-dark-500">
|
||||
{mfySourceType === 'search' && t('madeForYou.autoSearchHint')}
|
||||
{mfySourceType === 'youtube' && t('madeForYou.youtubeUrlHint')}
|
||||
{mfySourceType === 'upload' && t('madeForYou.fileUploadHint')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* YouTube URL (conditional) */}
|
||||
{mfySourceType === 'youtube' && (
|
||||
<div>
|
||||
<label htmlFor="mfy-youtube" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('madeForYou.youtubeUrlFieldLabel')}
|
||||
</label>
|
||||
<input
|
||||
type="url"
|
||||
id="mfy-youtube"
|
||||
value={mfyYoutubeUrl}
|
||||
onChange={(e) => setMfyYoutubeUrl(e.target.value)}
|
||||
placeholder={t('madeForYou.youtubeUrlPlaceholder')}
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Email */}
|
||||
<div>
|
||||
<label htmlFor="mfy-email" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('madeForYou.emailLabel2')} <span className="text-red-400">{t('madeForYou.requiredField')}</span>
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
id="mfy-email"
|
||||
value={mfyEmail}
|
||||
onChange={(e) => setMfyEmail(e.target.value)}
|
||||
placeholder={t('madeForYou.emailPlaceholder2')}
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
<p className="mt-1 text-xs text-dark-500">
|
||||
{t('madeForYou.emailHint2')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Notes (optional) */}
|
||||
<div>
|
||||
<label htmlFor="mfy-notes" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
{t('madeForYou.notesLabel')} <span className="text-dark-500">{t('madeForYou.notesOptional')}</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="mfy-notes"
|
||||
value={mfyNotes}
|
||||
onChange={(e) => setMfyNotes(e.target.value)}
|
||||
rows={3}
|
||||
placeholder={t('madeForYou.notesPlaceholder')}
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground resize-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{mfyError && <p className="text-red-400 text-sm">{mfyError}</p>}
|
||||
|
||||
{/* Submit */}
|
||||
<button
|
||||
type="submit"
|
||||
disabled={mfyLoading}
|
||||
className="w-full bg-primary-500 hover:bg-primary-600 disabled:bg-primary-500/50 text-white font-semibold py-4 rounded-xl transition-all btn-glow flex items-center justify-center gap-2"
|
||||
>
|
||||
{mfyLoading ? (
|
||||
<>
|
||||
<Loader2 className="w-5 h-5 animate-spin" />
|
||||
{t('madeForYou.processing')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<CreditCard className="w-5 h-5" />
|
||||
{t('madeForYou.submitButton')}
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
|
||||
<p className="text-xs text-center text-dark-500">
|
||||
{t('madeForYou.paymentDisclaimer')}
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* FAQ */}
|
||||
<section className="py-16 px-4 bg-dark-800/50">
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">{t('faq.title')}</h2>
|
||||
<div className="space-y-4">
|
||||
{faqs.map((faq, i) => (
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl p-6">
|
||||
<h3 className="font-medium mb-2">{faq.question}</h3>
|
||||
<p className="text-dark-400 text-sm">{faq.answer}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Footer */}
|
||||
<footer className="py-12 px-4 border-t border-primary-500/30">
|
||||
<div className="max-w-6xl mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-8" />
|
||||
</div>
|
||||
<div className="text-sm text-dark-500">
|
||||
{t('footer.copyright', { year: new Date().getFullYear() })}
|
||||
</div>
|
||||
<div className="flex gap-6 text-sm text-dark-400">
|
||||
<a href="mailto:support@nomadkaraoke.com" className="hover:text-primary-400 transition-colors">
|
||||
{t('footer.supportLink')}
|
||||
</a>
|
||||
<a href="https://nomadkaraoke.com" className="hover:text-primary-400 transition-colors">
|
||||
{t('footer.aboutLink')}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{/* Auth Dialog for sign-in */}
|
||||
<AuthDialog
|
||||
open={showAuthDialog}
|
||||
onClose={() => setShowAuthDialog(false)}
|
||||
onSuccess={handleAuthSuccess}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
"use client"
|
||||
|
||||
import { Suspense, useEffect, useState } from "react"
|
||||
import { useRouter, useSearchParams } from "next/navigation"
|
||||
import { CheckCircle, Loader2, Coins } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
function PaymentSuccessContent() {
|
||||
const t = useTranslations('payment')
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
|
||||
const { user, fetchUser } = useAuth()
|
||||
|
||||
useEffect(() => {
|
||||
// Refresh user data to get updated credits
|
||||
const refreshUser = async () => {
|
||||
await fetchUser()
|
||||
setIsLoading(false)
|
||||
}
|
||||
refreshUser()
|
||||
}, [fetchUser])
|
||||
|
||||
const sessionId = searchParams.get("session_id")
|
||||
|
||||
return (
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<CheckCircle className="w-16 h-16 text-success mx-auto mb-4" />
|
||||
|
||||
<h1 className="text-2xl font-bold text-foreground mb-2">
|
||||
{t('title')}
|
||||
</h1>
|
||||
|
||||
<p className="text-muted-foreground mb-6">
|
||||
{t('description')}
|
||||
</p>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="flex items-center justify-center gap-2 text-muted-foreground mb-6">
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
{t('loadingBalance')}
|
||||
</div>
|
||||
) : user ? (
|
||||
<div className="bg-secondary rounded-lg p-4 mb-6">
|
||||
<div className="flex items-center justify-center gap-2 text-warning">
|
||||
<Coins className="w-5 h-5" />
|
||||
<span className="text-2xl font-bold">{user.credits}</span>
|
||||
<span className="text-muted-foreground">{t('creditsAvailable')}</span>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="space-y-3">
|
||||
<Button
|
||||
onClick={() => router.push("/app")}
|
||||
className="w-full bg-primary hover:bg-primary/90"
|
||||
>
|
||||
{t('startCreating')}
|
||||
</Button>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('confirmationEmail')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function PaymentLoadingFallback() {
|
||||
const tCommon = useTranslations('common')
|
||||
return (
|
||||
<div className="max-w-md w-full bg-card border border-border rounded-xl p-8 text-center">
|
||||
<Loader2 className="w-16 h-16 text-primary mx-auto mb-4 animate-spin" />
|
||||
<p className="text-muted-foreground">{tCommon('loading')}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function PaymentSuccessPage() {
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<Suspense fallback={<PaymentLoadingFallback />}>
|
||||
<PaymentSuccessContent />
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
+26
-872
@@ -1,883 +1,37 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import Image from 'next/image';
|
||||
import {
|
||||
Music,
|
||||
Sparkles,
|
||||
Video,
|
||||
Youtube,
|
||||
Check,
|
||||
Gift,
|
||||
Mail,
|
||||
Loader2,
|
||||
Search,
|
||||
Link as LinkIcon,
|
||||
Upload,
|
||||
Clock,
|
||||
FileVideo,
|
||||
CreditCard,
|
||||
} from 'lucide-react';
|
||||
import { api, setAccessToken, getAccessToken, CreditPackage } from '@/lib/api';
|
||||
import { AuthDialog } from '@/components/auth/AuthDialog';
|
||||
import { WarmingUpLoader } from '@/components/WarmingUpLoader';
|
||||
import { ThemeToggle } from '@/components/ThemeToggle';
|
||||
import { useTenant } from '@/lib/tenant';
|
||||
import { TenantLandingPage } from '@/components/TenantLandingPage';
|
||||
import { routing } from '@/i18n/routing';
|
||||
|
||||
// Build-time constant: when true, this build is for tenant portals only
|
||||
const IS_TENANT_PORTAL = process.env.NEXT_PUBLIC_TENANT_PORTAL === 'true';
|
||||
|
||||
// FAQ data
|
||||
const faqs = [
|
||||
{
|
||||
question: 'How does it work?',
|
||||
answer:
|
||||
'Enter an artist and song title (or paste a YouTube link, or upload your own audio file). Our system finds the audio, separates the vocals from the instrumental, transcribes the lyrics, and syncs them to the music. You then review and correct any transcription errors before we generate your final karaoke video.',
|
||||
},
|
||||
{
|
||||
question: 'What songs can I use?',
|
||||
answer:
|
||||
'Any song! Search by artist and title, paste a YouTube URL, or upload your own audio file. If you can get the audio, we can make it into karaoke.',
|
||||
},
|
||||
{
|
||||
question: 'What format is the output?',
|
||||
answer:
|
||||
'You get multiple files: a 4K MP4 karaoke video, a "With Vocals" version for sing-along practice, and a CDG+MP3 ZIP for older karaoke systems. All videos are also published to our YouTube channel for easy sharing.',
|
||||
},
|
||||
{
|
||||
question: 'Do I need to do anything, or is it fully automatic?',
|
||||
answer:
|
||||
"The lyrics transcription is very accurate, but you'll need to review it and correct any misheard words before the final video is generated. For songs with clear vocals, there may be few or no corrections needed. For complex songs, expect to spend 5-10 minutes fixing errors. The word timing/sync is handled automatically and is very precise.",
|
||||
},
|
||||
{
|
||||
question: 'Do credits expire?',
|
||||
answer:
|
||||
'No! Your credits never expire. Use them whenever you want.',
|
||||
},
|
||||
];
|
||||
|
||||
export default function LandingPage() {
|
||||
// Tenant portal builds always render the tenant landing page
|
||||
// This is a build-time constant so the consumer code gets tree-shaken
|
||||
if (IS_TENANT_PORTAL) {
|
||||
return <TenantLandingPage />;
|
||||
}
|
||||
|
||||
return <ConsumerLandingPage />;
|
||||
}
|
||||
|
||||
function ConsumerLandingPage() {
|
||||
export default function RootPage() {
|
||||
const router = useRouter();
|
||||
const { isDefault: isDefaultTenant, isLoading: tenantLoading, isInitialized: tenantInitialized } = useTenant();
|
||||
const [isCheckingAuth, setIsCheckingAuth] = useState(true);
|
||||
const [isMounted, setIsMounted] = useState(false);
|
||||
const [packages, setPackages] = useState<CreditPackage[]>([]);
|
||||
const [packagesLoading, setPackagesLoading] = useState(true);
|
||||
const [packagesError, setPackagesError] = useState<string | null>(null);
|
||||
const [selectedPackage, setSelectedPackage] = useState<CreditPackage | null>(null);
|
||||
const [email, setEmail] = useState('');
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
// Made For You form state
|
||||
const [mfyArtist, setMfyArtist] = useState('');
|
||||
const [mfyTitle, setMfyTitle] = useState('');
|
||||
const [mfySourceType, setMfySourceType] = useState<'search' | 'youtube' | 'upload'>('search');
|
||||
const [mfyYoutubeUrl, setMfyYoutubeUrl] = useState('');
|
||||
const [mfyEmail, setMfyEmail] = useState('');
|
||||
const [mfyNotes, setMfyNotes] = useState('');
|
||||
const [mfyLoading, setMfyLoading] = useState(false);
|
||||
const [mfyError, setMfyError] = useState<string | null>(null);
|
||||
|
||||
// Auth dialog state
|
||||
const [showAuthDialog, setShowAuthDialog] = useState(false);
|
||||
|
||||
// Track client-side mount to avoid hydration mismatch
|
||||
useEffect(() => {
|
||||
setIsMounted(true);
|
||||
}, []);
|
||||
|
||||
// Check if already logged in and redirect to app
|
||||
useEffect(() => {
|
||||
const token = getAccessToken();
|
||||
if (token) {
|
||||
router.replace('/app');
|
||||
return;
|
||||
// 1. Check localStorage for saved preference
|
||||
try {
|
||||
const saved = localStorage.getItem('locale');
|
||||
if (saved && routing.locales.includes(saved as typeof routing.locales[number])) {
|
||||
router.replace(`/${saved}/`);
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// localStorage not available
|
||||
}
|
||||
setIsCheckingAuth(false);
|
||||
|
||||
// 2. Detect from browser language
|
||||
const browserLangs = navigator.languages || [navigator.language];
|
||||
for (const lang of browserLangs) {
|
||||
const prefix = lang.split('-')[0].toLowerCase();
|
||||
if (routing.locales.includes(prefix as typeof routing.locales[number])) {
|
||||
router.replace(`/${prefix}/`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Fallback to default
|
||||
router.replace(`/${routing.defaultLocale}/`);
|
||||
}, [router]);
|
||||
|
||||
// Handle successful auth from dialog
|
||||
const handleAuthSuccess = () => {
|
||||
setShowAuthDialog(false);
|
||||
router.push('/app');
|
||||
};
|
||||
|
||||
// Load credit packages on mount
|
||||
useEffect(() => {
|
||||
if (isCheckingAuth) return;
|
||||
|
||||
async function loadPackages() {
|
||||
try {
|
||||
const pkgs = await api.getCreditPackages();
|
||||
setPackages(pkgs);
|
||||
// Default to 5 credits (best value)
|
||||
const bestValue = pkgs.find((p) => p.credits === 5);
|
||||
setSelectedPackage(bestValue || pkgs[0]);
|
||||
} catch (err) {
|
||||
console.error('Failed to load packages:', err);
|
||||
setPackagesError('Failed to load pricing. Please refresh the page.');
|
||||
} finally {
|
||||
setPackagesLoading(false);
|
||||
}
|
||||
}
|
||||
loadPackages();
|
||||
}, [isCheckingAuth]);
|
||||
|
||||
// Tenant portals get a minimal landing page (just logo + sign in)
|
||||
// Only check after mount to avoid hydration mismatch with static export
|
||||
// Must be AFTER all hooks to comply with React Rules of Hooks
|
||||
if (isMounted && tenantInitialized && !isDefaultTenant) {
|
||||
return <TenantLandingPage />;
|
||||
}
|
||||
|
||||
// Handle checkout
|
||||
const handleCheckout = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!selectedPackage || !email) return;
|
||||
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const checkoutUrl = await api.createCheckout(selectedPackage.id, email);
|
||||
// Validate that the URL is a Stripe checkout URL
|
||||
if (!checkoutUrl.startsWith('https://checkout.stripe.com/')) {
|
||||
throw new Error('Invalid checkout URL received');
|
||||
}
|
||||
window.location.href = checkoutUrl;
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create checkout session');
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// Handle Made For You checkout
|
||||
const handleMadeForYouSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setMfyError(null);
|
||||
|
||||
// Validation
|
||||
if (!mfyArtist.trim()) {
|
||||
setMfyError('Please enter the artist name');
|
||||
return;
|
||||
}
|
||||
if (!mfyTitle.trim()) {
|
||||
setMfyError('Please enter the song title');
|
||||
return;
|
||||
}
|
||||
if (!mfyEmail.trim()) {
|
||||
setMfyError('Please enter your email address');
|
||||
return;
|
||||
}
|
||||
if (mfySourceType === 'youtube' && !mfyYoutubeUrl.trim()) {
|
||||
setMfyError('Please enter a YouTube URL');
|
||||
return;
|
||||
}
|
||||
|
||||
setMfyLoading(true);
|
||||
|
||||
try {
|
||||
const checkoutUrl = await api.createMadeForYouCheckout({
|
||||
email: mfyEmail,
|
||||
artist: mfyArtist,
|
||||
title: mfyTitle,
|
||||
source_type: mfySourceType,
|
||||
youtube_url: mfySourceType === 'youtube' ? mfyYoutubeUrl : undefined,
|
||||
notes: mfyNotes || undefined,
|
||||
});
|
||||
|
||||
// Redirect to Stripe Checkout
|
||||
window.location.href = checkoutUrl;
|
||||
} catch (err) {
|
||||
setMfyError(err instanceof Error ? err.message : 'Something went wrong. Please try again.');
|
||||
setMfyLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const formatPrice = (cents: number) => `$${(cents / 100).toFixed(0)}`;
|
||||
const pricePerVideo = (pkg: CreditPackage) =>
|
||||
`$${(pkg.price_cents / 100 / pkg.credits).toFixed(2)}`;
|
||||
|
||||
// Show loading while checking auth
|
||||
if (isCheckingAuth) {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center animated-gradient">
|
||||
<Loader2 className="w-8 h-8 animate-spin text-white" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen animated-gradient">
|
||||
{/* Navigation */}
|
||||
<nav className="fixed top-0 left-0 right-0 z-50 bg-dark-900/80 backdrop-blur-md border-b border-dark-700">
|
||||
<div className="max-w-6xl mx-auto px-4 py-4 flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-10" />
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<ThemeToggle />
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
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"
|
||||
>
|
||||
Sign In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{/* Hero Section */}
|
||||
<section className="pt-32 pb-6 px-4">
|
||||
<div className="max-w-4xl mx-auto text-center">
|
||||
<h1 className="text-4xl sm:text-5xl md:text-6xl font-extrabold mb-6 leading-tight">
|
||||
Create a <span className="gradient-text">Karaoke Video</span> for Any Song
|
||||
</h1>
|
||||
<p className="text-xl text-dark-300 mb-8 max-w-2xl mx-auto">
|
||||
Create professional karaoke videos in under 30 minutes. Real instrumentals
|
||||
from the original song, precise lyrics sync, and 4K video output.
|
||||
</p>
|
||||
|
||||
{/* Two pricing options */}
|
||||
<div className="flex flex-col sm:flex-row items-center justify-center gap-6 mb-6">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="inline-flex items-center gap-2 bg-primary-500 hover:bg-primary-600 text-white font-semibold px-8 py-4 rounded-xl transition-all btn-glow"
|
||||
>
|
||||
<Video className="w-5 h-5" />
|
||||
Create It Yourself
|
||||
<span className="ml-1 px-2 py-0.5 bg-white/20 rounded-full text-sm">$5</span>
|
||||
</button>
|
||||
<span className="text-green-400 text-sm">1 free credit included - no payment required</span>
|
||||
</div>
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<a
|
||||
href="#made-for-you"
|
||||
className="inline-flex items-center gap-2 bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40 font-semibold px-8 py-4 rounded-xl transition-all"
|
||||
>
|
||||
<Gift className="w-5 h-5" />
|
||||
We'll Make It For You
|
||||
<span className="ml-1 px-2 py-0.5 bg-yellow-500/20 rounded-full text-sm">$50</span>
|
||||
</a>
|
||||
<span className="text-yellow-400/70 text-sm">We handle everything, delivered in 24h</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Demo Video Section */}
|
||||
<section className="py-8 px-4">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-2 overflow-hidden">
|
||||
<div className="aspect-video">
|
||||
<iframe
|
||||
className="w-full h-full rounded-xl"
|
||||
src="https://www.youtube.com/embed/RLkIEHGwFcU"
|
||||
title="Nomad Karaoke Demo"
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
referrerPolicy="strict-origin-when-cross-origin"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* How It Works */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">How It Works</h2>
|
||||
<div className="grid md:grid-cols-4 gap-8">
|
||||
{[
|
||||
{ icon: Music, title: 'Choose a Song', desc: 'Search, paste a YouTube link, or upload audio' },
|
||||
{ icon: Sparkles, title: 'We Do the Heavy Lifting', desc: 'Vocals removed, lyrics transcribed & synced' },
|
||||
{ icon: Video, title: 'Review & Correct', desc: 'Fix any transcription errors (usually 5-10 min)' },
|
||||
{ icon: Youtube, title: 'Get Your Video', desc: 'Download files or watch on our YouTube' },
|
||||
].map((step, i) => (
|
||||
<div key={i} className="text-center">
|
||||
<div className="w-16 h-16 bg-primary-500/20 rounded-2xl flex items-center justify-center mx-auto mb-4">
|
||||
<step.icon className="w-8 h-8 text-primary-400" />
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg mb-2">{step.title}</h3>
|
||||
<p className="text-dark-400 text-sm">{step.desc}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Full Tutorial Video */}
|
||||
<div className="mt-12 text-center">
|
||||
<h3 className="text-xl font-semibold mb-2">Want a deeper walkthrough?</h3>
|
||||
<p className="text-dark-400 text-sm mb-6 max-w-xl mx-auto">
|
||||
Watch the full tutorial to see every step in detail — from creating a job to downloading your finished video.
|
||||
</p>
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-2 overflow-hidden">
|
||||
<div className="aspect-video">
|
||||
<iframe
|
||||
className="w-full h-full rounded-xl"
|
||||
src="https://www.youtube.com/embed/-dI3r7qXo3A"
|
||||
title="Nomad Karaoke Full Tutorial"
|
||||
frameBorder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
referrerPolicy="strict-origin-when-cross-origin"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Features */}
|
||||
<section className="py-16 px-4 bg-dark-800/50">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">What You Get</h2>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{[
|
||||
{ title: 'Real Instrumentals', desc: "Uses the actual instrumental from your song—not a cover band or MIDI recreation." },
|
||||
{ title: 'Precise Lyrics Sync', desc: 'Word-by-word timing that highlights exactly when to sing. You review the lyrics for accuracy.' },
|
||||
{ title: 'Keep or Remove Backing Vocals', desc: 'Choose a clean instrumental or one that preserves backing vocals for a fuller sound.' },
|
||||
{ title: '4K Video + Multiple Formats', desc: 'Get a 4K karaoke video, a sing-along version with vocals, and CDG+MP3 for older systems.' },
|
||||
{ title: 'Published to YouTube', desc: 'Every video is automatically published to our YouTube channel for easy sharing.' },
|
||||
{ title: 'Full Control Before Export', desc: 'Review and correct any transcription errors before the final video is generated.' },
|
||||
].map((feature, i) => (
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl p-6 card-hover">
|
||||
<h3 className="font-semibold text-lg mb-2">{feature.title}</h3>
|
||||
<p className="text-dark-400 text-sm">{feature.desc}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Screenshots Section */}
|
||||
<section className="py-16 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-4">See It In Action</h2>
|
||||
<p className="text-dark-400 text-center mb-12 max-w-xl mx-auto">
|
||||
Here's what the process looks like at each step
|
||||
</p>
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
{/* Job Creation Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/job-dashboard.avif"
|
||||
alt="Guided job creation flow with artist and title entry"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Create Your Video</h3>
|
||||
<p className="text-dark-400 text-sm">Enter any song and we find the best audio automatically</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Lyrics Review Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/lyrics-review.avif"
|
||||
alt="Lyrics review with synced lyrics alongside reference lyrics for correction"
|
||||
fill
|
||||
className="object-cover object-top"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Review Lyrics</h3>
|
||||
<p className="text-dark-400 text-sm">Compare synced lyrics with references and fix any errors</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Instrumental Selection Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/instrumental-review.avif"
|
||||
alt="Instrumental review with waveform visualization and backing vocal options"
|
||||
fill
|
||||
className="object-cover object-top"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Choose Your Instrumental</h3>
|
||||
<p className="text-dark-400 text-sm">Listen to audio options and pick the best backing track</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Example Output Screenshot */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl overflow-hidden">
|
||||
<div className="aspect-video bg-dark-900 relative">
|
||||
<Image
|
||||
src="/screenshots/example-output.avif"
|
||||
alt="Completed karaoke job with download options for 4K, 720p, CDG, and more"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width: 768px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold mb-1">Download & Share</h3>
|
||||
<p className="text-dark-400 text-sm">Get your 4K video, 720p, CDG, and more in minutes</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Pricing */}
|
||||
<section id="pricing" className="py-20 px-4">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-4">Simple Pricing</h2>
|
||||
<p className="text-dark-400 text-center mb-4 max-w-xl mx-auto">
|
||||
Start with 1 free credit, then buy more to save more.
|
||||
</p>
|
||||
|
||||
<div className="bg-green-500/10 border border-green-500/30 rounded-2xl p-6 text-center mb-10 max-w-sm mx-auto">
|
||||
<div className="text-sm text-green-400 font-medium mb-1">Every new account includes</div>
|
||||
<div className="text-4xl font-bold text-green-400 mb-1">1 Free Credit</div>
|
||||
<div className="text-sm text-dark-400 mb-4">No payment required</div>
|
||||
<button
|
||||
onClick={() => setShowAuthDialog(true)}
|
||||
className="inline-flex items-center gap-2 bg-green-500 hover:bg-green-600 text-white font-semibold px-6 py-3 rounded-xl transition-all"
|
||||
>
|
||||
Sign Up Free
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Package Selection */}
|
||||
{packagesLoading && (
|
||||
<WarmingUpLoader className="py-8" />
|
||||
)}
|
||||
{packagesError && (
|
||||
<div className="text-center py-8 text-red-400">
|
||||
{packagesError}
|
||||
</div>
|
||||
)}
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
|
||||
{packages.map((pkg) => {
|
||||
const isSelected = selectedPackage?.id === pkg.id;
|
||||
const isBestValue = pkg.credits === 5;
|
||||
const savings = pkg.credits > 1 ? Math.round((1 - pkg.price_cents / (pkg.credits * 500)) * 100) : 0;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={pkg.id}
|
||||
onClick={() => setSelectedPackage(pkg)}
|
||||
className={`relative p-4 rounded-xl border-2 transition-all ${
|
||||
isSelected
|
||||
? 'border-primary-500 bg-primary-500/10'
|
||||
: 'border-dark-700 hover:border-dark-500 bg-dark-800/50'
|
||||
}`}
|
||||
>
|
||||
{isBestValue && (
|
||||
<span className="absolute -top-3 left-1/2 -translate-x-1/2 bg-primary-500 text-white text-xs font-semibold px-3 py-1 rounded-full">
|
||||
Best Value
|
||||
</span>
|
||||
)}
|
||||
<div className="text-2xl font-bold mb-1">{pkg.credits}</div>
|
||||
<div className="text-sm text-dark-400 mb-2">
|
||||
{pkg.credits === 1 ? 'credit' : 'credits'}
|
||||
</div>
|
||||
<div className="text-xl font-semibold text-primary-400">
|
||||
{formatPrice(pkg.price_cents)}
|
||||
</div>
|
||||
<div className="text-xs text-dark-500">{pricePerVideo(pkg)}/video</div>
|
||||
{savings > 0 && (
|
||||
<div className="text-xs text-green-400 mt-1">Save {savings}%</div>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Checkout Form */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-8 max-w-md mx-auto">
|
||||
<div className="text-center mb-6">
|
||||
<div className="text-sm text-dark-400 mb-1">Selected package</div>
|
||||
<div className="text-2xl font-bold">
|
||||
{selectedPackage?.credits} Credits
|
||||
</div>
|
||||
<div className="text-3xl font-bold text-primary-400">
|
||||
{selectedPackage && formatPrice(selectedPackage.price_cents)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleCheckout} className="space-y-4">
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
Email address
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Mail className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground" />
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
placeholder="you@example.com"
|
||||
className="w-full pl-10 pr-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<p className="text-xs text-dark-500 mt-2">
|
||||
We'll send your login link to this email
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{error && <p className="text-red-400 text-sm">{error}</p>}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || !selectedPackage}
|
||||
className="w-full bg-primary-500 hover:bg-primary-600 disabled:bg-primary-500/50 text-white font-semibold py-4 rounded-xl transition-all btn-glow flex items-center justify-center gap-2"
|
||||
>
|
||||
{isLoading ? 'Redirecting...' : 'Continue to Payment'}
|
||||
{!isLoading && <Check className="w-5 h-5" />}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="mt-4 flex items-center justify-center gap-4 text-xs text-dark-500">
|
||||
<span>Secure checkout</span>
|
||||
<span>powered by Stripe</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Made For You Section */}
|
||||
<section id="made-for-you" className="py-20 px-4">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
{/* Section Header */}
|
||||
<div className="text-center mb-12">
|
||||
<div className="inline-flex items-center gap-2 bg-yellow-500/20 text-yellow-400 px-4 py-2 rounded-full text-sm font-medium mb-4">
|
||||
<Gift className="w-4 h-4" />
|
||||
Full-Service Option
|
||||
</div>
|
||||
<h2 className="text-3xl font-bold mb-4">We'll Make It For You</h2>
|
||||
<p className="text-dark-400 max-w-2xl mx-auto mb-4">
|
||||
Don't want to use the Generator and review the lyrics yourself? No problem.
|
||||
Tell us the song, pay $50, and we'll deliver your karaoke video within 24 hours.
|
||||
</p>
|
||||
<p className="text-dark-500 text-sm max-w-xl mx-auto">
|
||||
Don't want to spend 10 minutes reviewing lyrics? For just $10 more than DIY, we handle everything.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid lg:grid-cols-2 gap-12 items-start">
|
||||
{/* Benefits */}
|
||||
<div>
|
||||
<h3 className="text-xl font-semibold mb-6">What You Get</h3>
|
||||
<div className="space-y-4">
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-primary-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<FileVideo className="w-5 h-5 text-primary-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium">Professional 4K Video</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
High-quality karaoke video with perfectly synced lyrics
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-purple-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<Clock className="w-5 h-5 text-purple-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium">24-Hour Delivery</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
We handle everything — just wait for your video to arrive
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-yellow-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<Gift className="w-5 h-5 text-yellow-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium">All Formats Included</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
MP4 video, CDG+MP3 for karaoke machines, audio stems
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<a
|
||||
href="https://www.youtube.com/@nomadkaraoke"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="bg-dark-800 border border-dark-700 rounded-xl p-4 flex items-start gap-4 hover:border-red-500/40 transition-colors group"
|
||||
>
|
||||
<div className="w-10 h-10 bg-red-500/20 rounded-lg flex items-center justify-center shrink-0">
|
||||
<Youtube className="w-5 h-5 text-red-400" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-medium group-hover:text-red-400 transition-colors">1000+ Real Examples on YouTube</h4>
|
||||
<p className="text-dark-400 text-sm mt-1">
|
||||
Browse our YouTube channel to see exactly what you'll get
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Delivery includes */}
|
||||
<div className="mt-8 p-4 bg-dark-800 border border-dark-700 rounded-xl">
|
||||
<h4 className="font-medium mb-3">Your delivery includes:</h4>
|
||||
<ul className="space-y-2 text-sm text-dark-400">
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
4K lossless MP4 video with title screen
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
720p web-optimized version
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
CDG+MP3 for karaoke machines
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
Instrumental audio (with or without backing vocals)
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<Check className="w-4 h-4 text-green-400" />
|
||||
"Sing along" version with original vocals
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Order Form */}
|
||||
<div className="bg-dark-800 border border-dark-700 rounded-2xl p-6 sm:p-8">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h3 className="text-xl font-semibold">Order a Video</h3>
|
||||
<div className="text-2xl font-bold text-primary-400">$50</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleMadeForYouSubmit} className="space-y-5">
|
||||
{/* Artist */}
|
||||
<div>
|
||||
<label htmlFor="mfy-artist" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
Artist <span className="text-red-400">*</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="mfy-artist"
|
||||
value={mfyArtist}
|
||||
onChange={(e) => setMfyArtist(e.target.value)}
|
||||
placeholder="e.g. Taylor Swift"
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<div>
|
||||
<label htmlFor="mfy-title" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
Song Title <span className="text-red-400">*</span>
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="mfy-title"
|
||||
value={mfyTitle}
|
||||
onChange={(e) => setMfyTitle(e.target.value)}
|
||||
placeholder="e.g. Anti-Hero"
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Source Type */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-dark-300 mb-2">
|
||||
Audio Source
|
||||
</label>
|
||||
<div className="grid grid-cols-3 gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMfySourceType('search')}
|
||||
className={`flex flex-col items-center gap-1 p-3 rounded-lg border transition-all ${
|
||||
mfySourceType === 'search'
|
||||
? 'border-primary-500 bg-primary-500/10 text-primary-400'
|
||||
: 'border-dark-700 text-dark-400 hover:border-dark-500'
|
||||
}`}
|
||||
>
|
||||
<Search className="w-5 h-5" />
|
||||
<span className="text-xs">Auto Search</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMfySourceType('youtube')}
|
||||
className={`flex flex-col items-center gap-1 p-3 rounded-lg border transition-all ${
|
||||
mfySourceType === 'youtube'
|
||||
? 'border-primary-500 bg-primary-500/10 text-primary-400'
|
||||
: 'border-dark-700 text-dark-400 hover:border-dark-500'
|
||||
}`}
|
||||
>
|
||||
<LinkIcon className="w-5 h-5" />
|
||||
<span className="text-xs">YouTube URL</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMfySourceType('upload')}
|
||||
className={`flex flex-col items-center gap-1 p-3 rounded-lg border transition-all ${
|
||||
mfySourceType === 'upload'
|
||||
? 'border-primary-500 bg-primary-500/10 text-primary-400'
|
||||
: 'border-dark-700 text-dark-400 hover:border-dark-500'
|
||||
}`}
|
||||
>
|
||||
<Upload className="w-5 h-5" />
|
||||
<span className="text-xs">File Upload</span>
|
||||
</button>
|
||||
</div>
|
||||
<p className="mt-2 text-xs text-dark-500">
|
||||
{mfySourceType === 'search' && "We'll automatically find the best quality audio for your song."}
|
||||
{mfySourceType === 'youtube' && 'Provide a YouTube link to the song you want.'}
|
||||
{mfySourceType === 'upload' && 'Upload your own audio file (contact us after ordering).'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* YouTube URL (conditional) */}
|
||||
{mfySourceType === 'youtube' && (
|
||||
<div>
|
||||
<label htmlFor="mfy-youtube" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
YouTube URL
|
||||
</label>
|
||||
<input
|
||||
type="url"
|
||||
id="mfy-youtube"
|
||||
value={mfyYoutubeUrl}
|
||||
onChange={(e) => setMfyYoutubeUrl(e.target.value)}
|
||||
placeholder="https://youtube.com/watch?v=..."
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Email */}
|
||||
<div>
|
||||
<label htmlFor="mfy-email" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
Your Email <span className="text-red-400">*</span>
|
||||
</label>
|
||||
<input
|
||||
type="email"
|
||||
id="mfy-email"
|
||||
value={mfyEmail}
|
||||
onChange={(e) => setMfyEmail(e.target.value)}
|
||||
placeholder="you@example.com"
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
<p className="mt-1 text-xs text-dark-500">
|
||||
We'll send your video files to this address
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Notes (optional) */}
|
||||
<div>
|
||||
<label htmlFor="mfy-notes" className="block text-sm font-medium text-dark-300 mb-2">
|
||||
Special Requests <span className="text-dark-500">(optional)</span>
|
||||
</label>
|
||||
<textarea
|
||||
id="mfy-notes"
|
||||
value={mfyNotes}
|
||||
onChange={(e) => setMfyNotes(e.target.value)}
|
||||
rows={3}
|
||||
placeholder="Any special requests or notes about the song..."
|
||||
className="w-full px-4 py-3 bg-secondary border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground resize-none"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{mfyError && <p className="text-red-400 text-sm">{mfyError}</p>}
|
||||
|
||||
{/* Submit */}
|
||||
<button
|
||||
type="submit"
|
||||
disabled={mfyLoading}
|
||||
className="w-full bg-primary-500 hover:bg-primary-600 disabled:bg-primary-500/50 text-white font-semibold py-4 rounded-xl transition-all btn-glow flex items-center justify-center gap-2"
|
||||
>
|
||||
{mfyLoading ? (
|
||||
<>
|
||||
<Loader2 className="w-5 h-5 animate-spin" />
|
||||
Processing...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<CreditCard className="w-5 h-5" />
|
||||
Pay $50 & Order
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
|
||||
<p className="text-xs text-center text-dark-500">
|
||||
Secure payment via Stripe. 24-hour delivery guaranteed or your money back.
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* FAQ */}
|
||||
<section className="py-16 px-4 bg-dark-800/50">
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-center mb-12">Questions?</h2>
|
||||
<div className="space-y-4">
|
||||
{faqs.map((faq, i) => (
|
||||
<div key={i} className="bg-dark-800 border border-dark-700 rounded-xl p-6">
|
||||
<h3 className="font-medium mb-2">{faq.question}</h3>
|
||||
<p className="text-dark-400 text-sm">{faq.answer}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Footer */}
|
||||
<footer className="py-12 px-4 border-t border-primary-500/30">
|
||||
<div className="max-w-6xl mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<img src="/nomad-karaoke-logo.svg" alt="Nomad Karaoke" className="h-8" />
|
||||
</div>
|
||||
<div className="text-sm text-dark-500">
|
||||
© {new Date().getFullYear()} Nomad Karaoke. All rights reserved.
|
||||
</div>
|
||||
<div className="flex gap-6 text-sm text-dark-400">
|
||||
<a href="mailto:support@nomadkaraoke.com" className="hover:text-primary-400 transition-colors">
|
||||
Support
|
||||
</a>
|
||||
<a href="https://nomadkaraoke.com" className="hover:text-primary-400 transition-colors">
|
||||
About
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{/* Auth Dialog for sign-in */}
|
||||
<AuthDialog
|
||||
open={showAuthDialog}
|
||||
onClose={() => setShowAuthDialog(false)}
|
||||
onSuccess={handleAuthSuccess}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
'use client';
|
||||
|
||||
import { useLocale, useTranslations } from 'next-intl';
|
||||
import { usePathname, useRouter, routing } from '@/i18n/routing';
|
||||
|
||||
const localeNames: Record<string, string> = {
|
||||
en: 'English',
|
||||
es: 'Español',
|
||||
de: 'Deutsch',
|
||||
};
|
||||
|
||||
export default function LanguageSwitcher() {
|
||||
const locale = useLocale();
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const t = useTranslations('languageSwitcher');
|
||||
|
||||
function handleChange(e: React.ChangeEvent<HTMLSelectElement>) {
|
||||
const newLocale = e.target.value;
|
||||
try { localStorage.setItem('locale', newLocale); } catch {}
|
||||
router.replace(pathname, { locale: newLocale });
|
||||
}
|
||||
|
||||
return (
|
||||
<select
|
||||
value={locale}
|
||||
onChange={handleChange}
|
||||
aria-label={t('label')}
|
||||
className="bg-transparent border border-border/50 rounded-md px-2 py-1 text-sm cursor-pointer text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
{routing.locales.map((loc) => (
|
||||
<option key={loc} value={loc}>{localeNames[loc]}</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { TenantLogo } from '@/components/tenant-logo'
|
||||
import { AuthDialog } from '@/components/auth/AuthDialog'
|
||||
import { useTenant } from '@/lib/tenant'
|
||||
import { ThemeToggle } from '@/components/ThemeToggle'
|
||||
import { useTranslations } from 'next-intl'
|
||||
|
||||
/**
|
||||
* Minimal landing page for whitelabel tenant portals.
|
||||
@@ -13,6 +14,7 @@ import { ThemeToggle } from '@/components/ThemeToggle'
|
||||
* No pricing, marketing content, or payment options.
|
||||
*/
|
||||
export function TenantLandingPage() {
|
||||
const t = useTranslations('tenant')
|
||||
const router = useRouter()
|
||||
const { tenant, branding } = useTenant()
|
||||
const [showAuthDialog, setShowAuthDialog] = useState(false)
|
||||
@@ -48,8 +50,7 @@ export function TenantLandingPage() {
|
||||
|
||||
{/* Title */}
|
||||
<h1 className="text-2xl md:text-3xl font-semibold text-center mb-3" style={{ color: '#ffffff' }}>
|
||||
Karaoke Generator for{' '}
|
||||
<span style={{ color: primaryColor }}>{tenantName}</span>
|
||||
{t('title', { tenantName })}
|
||||
</h1>
|
||||
|
||||
{/* Tagline */}
|
||||
@@ -61,7 +62,7 @@ export function TenantLandingPage() {
|
||||
|
||||
{!branding.tagline && (
|
||||
<p className="text-muted-foreground text-center text-lg mb-10 max-w-md">
|
||||
Create professional karaoke videos with real instrumentals, precise lyrics sync, and 4K output.
|
||||
{t('description')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -74,7 +75,7 @@ export function TenantLandingPage() {
|
||||
color: 'var(--primary-foreground)',
|
||||
}}
|
||||
>
|
||||
Sign In
|
||||
{t('signIn')}
|
||||
</button>
|
||||
|
||||
{/* Domain hint */}
|
||||
@@ -83,7 +84,7 @@ export function TenantLandingPage() {
|
||||
if (externalDomains.length === 0) return null
|
||||
return (
|
||||
<p className="text-muted-foreground text-sm mt-4">
|
||||
Sign in with your {externalDomains.map(d => `@${d}`).join(' or ')} email
|
||||
{t('signInWithDomain', { domains: externalDomains.map(d => `@${d}`).join(' or ') })}
|
||||
</p>
|
||||
)
|
||||
})()}
|
||||
@@ -92,14 +93,13 @@ export function TenantLandingPage() {
|
||||
{/* Footer */}
|
||||
<footer className="w-full px-6 py-6 text-center">
|
||||
<p className="text-muted-foreground text-xs">
|
||||
Powered by{' '}
|
||||
<a
|
||||
href="https://gen.nomadkaraoke.com"
|
||||
className="underline hover:text-foreground transition-colors"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Nomad Karaoke
|
||||
{t('poweredBy')}
|
||||
</a>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
interface WarmingUpLoaderProps {
|
||||
/** Custom class name for the container */
|
||||
@@ -24,6 +25,7 @@ export function WarmingUpLoader({
|
||||
warmUpDelay = 5000,
|
||||
almostThereDelay = 15000,
|
||||
}: WarmingUpLoaderProps) {
|
||||
const t = useTranslations('warmingUp');
|
||||
const [phase, setPhase] = useState<'initial' | 'warming' | 'almost'>('initial');
|
||||
|
||||
useEffect(() => {
|
||||
@@ -49,14 +51,14 @@ export function WarmingUpLoader({
|
||||
/>
|
||||
{phase === 'warming' && (
|
||||
<p className="text-sm animate-fade-in" style={{ color: 'var(--text-muted)' }}>
|
||||
Warming up the generator...
|
||||
{t('title')}
|
||||
</p>
|
||||
)}
|
||||
{phase === 'almost' && (
|
||||
<div className="text-center animate-fade-in">
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>Almost there...</p>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>{t('almostThere')}</p>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)', opacity: 0.7 }}>
|
||||
First load can take up to 30 seconds
|
||||
{t('firstLoadNote')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('AuthStatus', () => {
|
||||
|
||||
// Should show user email and credits
|
||||
expect(screen.getByText('test@example.com')).toBeInTheDocument()
|
||||
expect(screen.getByText('5 credits')).toBeInTheDocument()
|
||||
expect(screen.getByText('5 credits available')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('opens auth dialog when Login is clicked', () => {
|
||||
|
||||
@@ -226,7 +226,7 @@ describe('PushNotificationToggle', () => {
|
||||
|
||||
render(<PushNotificationToggle />)
|
||||
|
||||
expect(screen.getByText('Enable')).toBeInTheDocument()
|
||||
expect(screen.getByText('Enable notifications')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows Disable button when subscribed', () => {
|
||||
@@ -237,7 +237,7 @@ describe('PushNotificationToggle', () => {
|
||||
|
||||
render(<PushNotificationToggle />)
|
||||
|
||||
expect(screen.getByText('Disable')).toBeInTheDocument()
|
||||
expect(screen.getByText('Disable on this device')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('calls subscribe when Enable clicked', async () => {
|
||||
@@ -250,7 +250,7 @@ describe('PushNotificationToggle', () => {
|
||||
|
||||
render(<PushNotificationToggle />)
|
||||
|
||||
fireEvent.click(screen.getByText('Enable'))
|
||||
fireEvent.click(screen.getByText('Enable notifications'))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockSubscribe).toHaveBeenCalledTimes(1)
|
||||
@@ -267,7 +267,7 @@ describe('PushNotificationToggle', () => {
|
||||
|
||||
render(<PushNotificationToggle />)
|
||||
|
||||
fireEvent.click(screen.getByText('Disable'))
|
||||
fireEvent.click(screen.getByText('Disable on this device'))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockUnsubscribe).toHaveBeenCalledTimes(1)
|
||||
|
||||
@@ -14,8 +14,11 @@ import {
|
||||
} from "./ui/dropdown-menu"
|
||||
import { User, LogOut, Settings, Shield, Mail, Phone, HelpCircle, Eye } from "lucide-react"
|
||||
import Link from "next/link"
|
||||
import LanguageSwitcher from "./LanguageSwitcher"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
export function AppHeader() {
|
||||
const t = useTranslations('header')
|
||||
const { user, logout, isImpersonating, impersonatedUserEmail, endImpersonation } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
@@ -40,19 +43,21 @@ export function AppHeader() {
|
||||
|
||||
<nav className="hidden md:flex items-center gap-6">
|
||||
<Link href="/app" className="text-sm font-medium hover:text-primary transition-colors">
|
||||
Dashboard
|
||||
{t('dashboard')}
|
||||
</Link>
|
||||
<Link href="/jobs" className="text-sm font-medium hover:text-primary transition-colors">
|
||||
My Jobs
|
||||
{t('myJobs')}
|
||||
</Link>
|
||||
{(user.role === "admin" || user.email?.endsWith("@nomadkaraoke.com")) && (
|
||||
<Link href="/admin" className="text-sm font-medium hover:text-primary transition-colors">
|
||||
Admin
|
||||
{t('admin')}
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<LanguageSwitcher />
|
||||
|
||||
{isImpersonating && (
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -61,7 +66,7 @@ export function AppHeader() {
|
||||
className="h-8 gap-1.5 border-purple-500/40 text-purple-300 hover:text-white hover:bg-purple-800/40"
|
||||
>
|
||||
<Shield className="w-3.5 h-3.5" />
|
||||
Back to Admin
|
||||
{t('backToAdmin')}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -69,12 +74,12 @@ export function AppHeader() {
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="hidden lg:flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors">
|
||||
<HelpCircle className="w-3.5 h-3.5" />
|
||||
<span>Need help?</span>
|
||||
<span>{t('needHelp')}</span>
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-64">
|
||||
<DropdownMenuLabel className="text-sm">
|
||||
Something confusing or not working? Reach out anytime!
|
||||
{t('helpPrompt')}
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem asChild>
|
||||
@@ -94,7 +99,7 @@ export function AppHeader() {
|
||||
|
||||
<div className="hidden sm:flex items-center gap-2 px-4 py-2 rounded-lg bg-primary/10 border border-primary/20">
|
||||
<div className="w-2 h-2 rounded-full bg-primary animate-pulse" />
|
||||
<span className="text-sm font-medium text-primary">{user.credits} credits</span>
|
||||
<span className="text-sm font-medium text-primary">{t('credits', { count: user.credits })}</span>
|
||||
</div>
|
||||
|
||||
<DropdownMenu>
|
||||
@@ -106,28 +111,28 @@ export function AppHeader() {
|
||||
<DropdownMenuContent align="end" className="w-56">
|
||||
<DropdownMenuLabel>
|
||||
<div className="flex flex-col gap-1">
|
||||
<p className="text-sm font-medium">Account</p>
|
||||
<p className="text-xs text-muted-foreground">{user.role === "admin" ? "Admin" : "User"}</p>
|
||||
<p className="text-sm font-medium">{t('account')}</p>
|
||||
<p className="text-xs text-muted-foreground">{user.role === "admin" ? t('adminRole') : t('userRole')}</p>
|
||||
</div>
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem className="sm:hidden">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-2 h-2 rounded-full bg-primary" />
|
||||
<span>{user.credits} credits</span>
|
||||
<span>{t('credits', { count: user.credits })}</span>
|
||||
</div>
|
||||
</DropdownMenuItem>
|
||||
{(user.role === "admin" || user.email?.endsWith("@nomadkaraoke.com")) && (
|
||||
<DropdownMenuItem asChild>
|
||||
<Link href="/admin">
|
||||
<Shield className="w-4 h-4 mr-2" />
|
||||
Admin Dashboard
|
||||
{t('adminDashboard')}
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem>
|
||||
<Settings className="w-4 h-4 mr-2" />
|
||||
Settings
|
||||
{t('settings')}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<a href="mailto:andrew@nomadkaraoke.com">
|
||||
@@ -144,7 +149,7 @@ export function AppHeader() {
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem onClick={handleLogout} className="text-destructive focus:text-destructive">
|
||||
<LogOut className="w-4 h-4 mr-2" />
|
||||
Logout
|
||||
{t('logout')}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api, AudioEditSessionMeta, AudioEditSessionWithData, AudioEditEntry } from "@/lib/api"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Spinner } from "@/components/ui/spinner"
|
||||
@@ -35,6 +36,7 @@ export function AudioEditRestoreDialog({
|
||||
onRestore,
|
||||
onStartFresh,
|
||||
}: AudioEditRestoreDialogProps) {
|
||||
const t = useTranslations('audioEditRestore')
|
||||
const [sessions, setSessions] = useState<AudioEditSessionMeta[]>([])
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [selectedSessionId, setSelectedSessionId] = useState<string | null>(null)
|
||||
@@ -91,7 +93,7 @@ export function AudioEditRestoreDialog({
|
||||
style={{ borderColor: "var(--card-border)", backgroundColor: "var(--card)" }}
|
||||
>
|
||||
<Spinner className="w-6 h-6 mx-auto mb-2" />
|
||||
<p className="text-sm text-muted-foreground">Checking for saved sessions...</p>
|
||||
<p className="text-sm text-muted-foreground">{t('checking')}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -108,7 +110,7 @@ export function AudioEditRestoreDialog({
|
||||
<div className="flex items-center gap-2">
|
||||
<History className="w-5 h-5 text-blue-400" />
|
||||
<h2 className="text-lg font-semibold" style={{ color: "var(--text)" }}>
|
||||
Saved Audio Edit Sessions
|
||||
{t('title')}
|
||||
</h2>
|
||||
</div>
|
||||
<button onClick={onStartFresh} className="text-muted-foreground hover:text-foreground">
|
||||
@@ -142,7 +144,7 @@ export function AudioEditRestoreDialog({
|
||||
<p className="text-muted-foreground">
|
||||
{session.edit_count} edit{session.edit_count !== 1 ? "s" : ""} · {session.trigger}
|
||||
{i === 0 && (
|
||||
<span className="ml-1 text-blue-400">[Latest]</span>
|
||||
<span className="ml-1 text-blue-400">{t('latest')}</span>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@@ -160,7 +162,7 @@ export function AudioEditRestoreDialog({
|
||||
) : selectedSession?.edit_data?.entries ? (
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>
|
||||
Operations applied:
|
||||
{t('editsApplied')}
|
||||
</p>
|
||||
<div className="space-y-1.5">
|
||||
{selectedSession.edit_data.entries.map((entry: AudioEditEntry, i: number) => (
|
||||
@@ -180,17 +182,16 @@ export function AudioEditRestoreDialog({
|
||||
{selectedSession.summary && (
|
||||
<div className="text-xs text-muted-foreground pt-2 border-t" style={{ borderColor: "var(--card-border)" }}>
|
||||
<p>
|
||||
Duration change: {formatDuration(selectedSession.summary.duration_change_seconds)}
|
||||
{t('durationChange', { change: formatDuration(selectedSession.summary.duration_change_seconds) })}
|
||||
</p>
|
||||
<p>
|
||||
Net duration: {Math.floor(selectedSession.summary.net_duration_seconds / 60)}:
|
||||
{String(Math.floor(selectedSession.summary.net_duration_seconds % 60)).padStart(2, "0")}
|
||||
{t('netDuration', { duration: `${Math.floor(selectedSession.summary.net_duration_seconds / 60)}:${String(Math.floor(selectedSession.summary.net_duration_seconds % 60)).padStart(2, "0")}` })}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-sm text-muted-foreground">Select a session to preview</p>
|
||||
<p className="text-sm text-muted-foreground">{t('selectToPreview')}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -198,7 +199,7 @@ export function AudioEditRestoreDialog({
|
||||
{/* Footer */}
|
||||
<div className="flex items-center justify-end gap-2 p-4 border-t" style={{ borderColor: "var(--card-border)" }}>
|
||||
<Button variant="outline" onClick={onStartFresh} disabled={isRestoring}>
|
||||
Start Fresh
|
||||
{t('startFresh')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleRestore}
|
||||
@@ -207,10 +208,10 @@ export function AudioEditRestoreDialog({
|
||||
{isRestoring ? (
|
||||
<>
|
||||
<Spinner className="w-4 h-4 mr-1" />
|
||||
Restoring...
|
||||
{t('restoring')}
|
||||
</>
|
||||
) : (
|
||||
"Restore Selected"
|
||||
t('restoreSelected')
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect, useRef, useCallback } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api, Job, AudioEditInfo, AudioEditResponse, AudioEditEntry, AudioEditSessionMeta } from "@/lib/api"
|
||||
import { useAudioEditAutoSave } from "@/hooks/use-audio-edit-autosave"
|
||||
import { AudioEditRestoreDialog } from "./AudioEditRestoreDialog"
|
||||
@@ -325,6 +326,8 @@ interface AudioEditorProps {
|
||||
}
|
||||
|
||||
export function AudioEditor({ job }: AudioEditorProps) {
|
||||
const t = useTranslations('audioEditor')
|
||||
const tc = useTranslations('common')
|
||||
// Loading state
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
@@ -551,7 +554,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
const resp = await api.applyAudioEdit(job.job_id, operation, params)
|
||||
updateFromResponse(resp)
|
||||
} catch (err) {
|
||||
setOperationError(err instanceof Error ? err.message : "Edit failed")
|
||||
setOperationError(err instanceof Error ? err.message : t('editFailed'))
|
||||
} finally {
|
||||
setIsOperating(false)
|
||||
}
|
||||
@@ -565,7 +568,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
const resp = await api.undoAudioEdit(job.job_id)
|
||||
updateFromResponse(resp)
|
||||
} catch (err) {
|
||||
setOperationError(err instanceof Error ? err.message : "Undo failed")
|
||||
setOperationError(err instanceof Error ? err.message : t('undoFailed'))
|
||||
} finally {
|
||||
setIsOperating(false)
|
||||
}
|
||||
@@ -579,7 +582,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
const resp = await api.redoAudioEdit(job.job_id)
|
||||
updateFromResponse(resp)
|
||||
} catch (err) {
|
||||
setOperationError(err instanceof Error ? err.message : "Redo failed")
|
||||
setOperationError(err instanceof Error ? err.message : t('redoFailed'))
|
||||
} finally {
|
||||
setIsOperating(false)
|
||||
}
|
||||
@@ -629,7 +632,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
setShowJoinDialog(false)
|
||||
setJoinFile(null)
|
||||
} catch (err) {
|
||||
setOperationError(err instanceof Error ? err.message : "Join failed")
|
||||
setOperationError(err instanceof Error ? err.message : t('editFailed'))
|
||||
} finally {
|
||||
setIsUploading(false)
|
||||
}
|
||||
@@ -649,7 +652,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
updateFromResponse(resp)
|
||||
}
|
||||
} catch (err) {
|
||||
setOperationError(err instanceof Error ? err.message : "Restore failed — some edits may not have been applied")
|
||||
setOperationError(err instanceof Error ? err.message : t('restoreFailed'))
|
||||
} finally {
|
||||
setIsRestoringSession(false)
|
||||
}
|
||||
@@ -668,7 +671,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
setSubmitSuccess(true)
|
||||
setShowSubmitConfirm(false)
|
||||
} catch (err) {
|
||||
setOperationError(err instanceof Error ? err.message : "Submit failed")
|
||||
setOperationError(err instanceof Error ? err.message : t('submitFailed'))
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
}
|
||||
@@ -705,7 +708,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center">
|
||||
<Spinner className="w-8 h-8 mx-auto mb-4" />
|
||||
<p className="text-muted-foreground">Loading audio editor...</p>
|
||||
<p className="text-muted-foreground">{t('loading')}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -716,12 +719,12 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md p-6">
|
||||
<AlertCircle className="w-12 h-12 mx-auto mb-4 text-red-500" />
|
||||
<h1 className="text-xl font-semibold mb-2">Failed to load audio</h1>
|
||||
<p className="text-muted-foreground mb-4">{error || "Could not load audio data."}</p>
|
||||
<h1 className="text-xl font-semibold mb-2">{t('failedToLoad')}</h1>
|
||||
<p className="text-muted-foreground mb-4">{error || t('couldNotLoadData')}</p>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
{t('backToDashboard')}
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
@@ -739,16 +742,15 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
>
|
||||
<Check className="w-8 h-8 text-green-500" />
|
||||
</div>
|
||||
<h1 className="text-xl font-semibold">Audio edit complete!</h1>
|
||||
<h1 className="text-xl font-semibold">{t('editComplete')}</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Processing will continue with your edited audio.
|
||||
You'll receive an email when lyrics are ready for review.
|
||||
{t('editsWillBeReviewed')}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Redirecting in {redirectCountdown}...
|
||||
{t('redirectingIn', { count: redirectCountdown })}
|
||||
</p>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">Back to dashboard</Link>
|
||||
<Link href="/app">{t('backToDashboard')}</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -807,14 +809,13 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
<div className="flex items-start gap-2">
|
||||
<Scissors className="w-4 h-4 mt-0.5 shrink-0 text-blue-400" />
|
||||
<div className="space-y-1.5">
|
||||
<p className="font-medium" style={{ color: "var(--text)" }}>Audio Editor Tips</p>
|
||||
<p className="font-medium" style={{ color: "var(--text)" }}>{t('keyboardShortcuts')}</p>
|
||||
<ul className="space-y-1 text-xs text-muted-foreground">
|
||||
<li><strong>Select:</strong> Click and drag on the waveform to select a region</li>
|
||||
<li><strong>Trim:</strong> Select a region near the start or end, then click Trim Start/End</li>
|
||||
<li><strong>Cut:</strong> Select a region and press Delete or click Cut</li>
|
||||
<li><strong>Mute:</strong> Select a region and press M or click Mute</li>
|
||||
<li><strong>Undo/Redo:</strong> Ctrl+Z / Ctrl+Shift+Z</li>
|
||||
<li><strong>Play/Pause:</strong> Spacebar or click anywhere to seek</li>
|
||||
<li>{t('shortcutSpace')}</li>
|
||||
<li>{t('shortcutUndo')}</li>
|
||||
<li>{t('shortcutRedo')}</li>
|
||||
<li>{t('shortcutDelete')}</li>
|
||||
<li>{t('shortcutMute')}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -841,7 +842,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
size="sm"
|
||||
disabled={!canUndo || isOperating}
|
||||
onClick={handleUndo}
|
||||
title="Undo (Ctrl+Z)"
|
||||
title={t('undo')}
|
||||
>
|
||||
<Undo2 className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -850,7 +851,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
size="sm"
|
||||
disabled={!canRedo || isOperating}
|
||||
onClick={handleRedo}
|
||||
title="Redo (Ctrl+Shift+Z)"
|
||||
title={t('redo')}
|
||||
>
|
||||
<Redo2 className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -873,7 +874,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
onClick={handleTrimStart}
|
||||
className="text-xs h-7"
|
||||
>
|
||||
Trim Start
|
||||
{t('trimStart')}
|
||||
</Button>
|
||||
)}
|
||||
{selection.endSeconds > currentDuration - 1 && (
|
||||
@@ -884,7 +885,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
onClick={handleTrimEnd}
|
||||
className="text-xs h-7"
|
||||
>
|
||||
Trim End
|
||||
{t('trimEnd')}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
@@ -893,7 +894,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
disabled={isOperating}
|
||||
onClick={handleCut}
|
||||
className="text-xs h-7"
|
||||
title="Cut selection (Delete)"
|
||||
title={t('cutSelection')}
|
||||
>
|
||||
<Scissors className="w-3 h-3 mr-1" />
|
||||
Cut
|
||||
@@ -904,7 +905,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
disabled={isOperating}
|
||||
onClick={handleMute}
|
||||
className="text-xs h-7"
|
||||
title="Mute selection (M)"
|
||||
title={t('muteSelection')}
|
||||
>
|
||||
<VolumeX className="w-3 h-3 mr-1" />
|
||||
Mute
|
||||
@@ -968,7 +969,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
className="text-xs h-7 bg-green-600 hover:bg-green-700 text-white"
|
||||
>
|
||||
<Check className="w-3 h-3 mr-1" />
|
||||
{hasEdits ? "Submit & Continue" : "Continue Without Editing"}
|
||||
{hasEdits ? t('submitForReview') : t('continueWithoutEditing')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -982,7 +983,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Original ({formatTime(audioInfo.original_duration_seconds)})
|
||||
{t('original')} ({formatTime(audioInfo.original_duration_seconds)})
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab("edited")}
|
||||
@@ -992,7 +993,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
Edited ({formatTime(audioInfo.current_duration_seconds)})
|
||||
{t('edited')} ({formatTime(audioInfo.current_duration_seconds)})
|
||||
{hasEdits && durationChange !== 0 && (
|
||||
<span className={`ml-1 ${durationChange < 0 ? "text-green-400" : "text-amber-400"}`}>
|
||||
({durationChange > 0 ? "+" : ""}{formatTimePrecise(durationChange)})
|
||||
@@ -1090,7 +1091,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
style={{ borderColor: "var(--card-border)", backgroundColor: "var(--card)" }}
|
||||
>
|
||||
<h2 className="text-lg font-semibold" style={{ color: "var(--text)" }}>
|
||||
Submit Edited Audio?
|
||||
{t('submitConfirmation')}
|
||||
</h2>
|
||||
<div className="space-y-1 text-sm text-muted-foreground">
|
||||
<p>Original duration: {formatTime(audioInfo.original_duration_seconds)}</p>
|
||||
@@ -1174,7 +1175,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
onClick={() => handleJoin("start")}
|
||||
disabled={isUploading}
|
||||
>
|
||||
{isUploading ? <Spinner className="w-4 h-4" /> : "Add to Start"}
|
||||
{isUploading ? <Spinner className="w-4 h-4" /> : t('addToStart')}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
@@ -1182,7 +1183,7 @@ export function AudioEditor({ job }: AudioEditorProps) {
|
||||
onClick={() => handleJoin("end")}
|
||||
disabled={isUploading}
|
||||
>
|
||||
{isUploading ? <Spinner className="w-4 h-4" /> : "Add to End"}
|
||||
{isUploading ? <Spinner className="w-4 h-4" /> : t('addToEnd')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -155,7 +155,7 @@ describe("AudioEditor", () => {
|
||||
mockApi.getInputAudioInfo.mockResolvedValue(mockAudioInfo)
|
||||
render(<AudioEditor job={mockJob} />)
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Audio Editor Tips")).toBeInTheDocument()
|
||||
expect(screen.getByText("Keyboard shortcuts:")).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -186,7 +186,7 @@ describe("AudioEditor", () => {
|
||||
mockApi.getInputAudioInfo.mockResolvedValue(infoWithEdits)
|
||||
render(<AudioEditor job={mockJob} />)
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Submit & Continue")).toBeInTheDocument()
|
||||
expect(screen.getByText("Submit for Review")).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -229,12 +229,12 @@ describe("AudioEditor", () => {
|
||||
mockApi.getInputAudioInfo.mockResolvedValue(infoWithEdits)
|
||||
render(<AudioEditor job={mockJob} />)
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Submit & Continue")).toBeInTheDocument()
|
||||
expect(screen.getByText("Submit for Review")).toBeInTheDocument()
|
||||
})
|
||||
|
||||
fireEvent.click(screen.getByText("Submit & Continue"))
|
||||
fireEvent.click(screen.getByText("Submit for Review"))
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Submit Edited Audio?")).toBeInTheDocument()
|
||||
expect(screen.getByText("Submit your audio edits for review?")).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect, useMemo } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api } from "@/lib/api"
|
||||
import {
|
||||
ExtendedAudioSearchResult,
|
||||
@@ -28,6 +29,7 @@ interface AudioSearchDialogProps {
|
||||
}
|
||||
|
||||
export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle }: AudioSearchDialogProps) {
|
||||
const t = useTranslations('audioSearch')
|
||||
const [results, setResults] = useState<ExtendedAudioSearchResult[]>([])
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [isSelecting, setIsSelecting] = useState<number | null>(null)
|
||||
@@ -105,10 +107,10 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
<DialogContent className="max-w-7xl w-[95vw] max-h-[90vh] flex flex-col bg-card border-border !p-0 gap-0 overflow-hidden">
|
||||
<div className="px-4 py-2.5 border-b border-border shrink-0 bg-card flex items-center justify-between">
|
||||
<DialogTitle className="text-foreground text-sm font-semibold flex items-center gap-2">
|
||||
Select Audio Source
|
||||
{t('selectAudioSource')}
|
||||
<span className="text-[10px] px-1.5 py-0.5 rounded bg-secondary text-muted-foreground font-mono">v{APP_VERSION}</span>
|
||||
<span className="text-muted-foreground font-normal text-xs">
|
||||
({results.length} results across {totalCategories} categories)
|
||||
({t('resultsCount', { count: results.length, categories: totalCategories })})
|
||||
</span>
|
||||
</DialogTitle>
|
||||
</div>
|
||||
@@ -121,16 +123,16 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
className="flex items-center gap-1.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<Lightbulb className="w-3 h-3" />
|
||||
Tips for choosing
|
||||
{t('tipsForChoosing')}
|
||||
{showGuidance ? <ChevronUp className="w-3 h-3" /> : <ChevronDown className="w-3 h-3" />}
|
||||
</button>
|
||||
{showGuidance && (
|
||||
<ul className="text-[10px] text-muted-foreground mt-1.5 ml-5 space-y-0.5 pb-1">
|
||||
<li>Check the filename matches your song title</li>
|
||||
<li>Green availability badge = more reliable download</li>
|
||||
<li>Studio album versions produce the best karaoke results</li>
|
||||
<li>Avoid vinyl rips (surface noise affects separation)</li>
|
||||
<li>YouTube is a last resort — lossless sources sound better</li>
|
||||
<li>{t('tipFilename')}</li>
|
||||
<li>{t('tipAvailability')}</li>
|
||||
<li>{t('tipStudioAlbum')}</li>
|
||||
<li>{t('tipVinylRips')}</li>
|
||||
<li>{t('tipYoutube')}</li>
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
@@ -150,7 +152,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
) : results.length === 0 ? (
|
||||
<div className="flex-1 flex flex-col items-center justify-center py-12 text-muted-foreground">
|
||||
<Music2 className="w-8 h-8 mb-2 opacity-50" />
|
||||
<p className="text-sm">No audio sources found</p>
|
||||
<p className="text-sm">{t('noAudioSources')}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex-1 overflow-y-auto min-h-0 p-4">
|
||||
@@ -178,7 +180,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
{isExpanded ? (
|
||||
<>Show less <ChevronUp className="w-3 h-3" /></>
|
||||
) : (
|
||||
<>+{hiddenCount} more <ChevronDown className="w-3 h-3" /></>
|
||||
<>{t('moreVersions', { count: hiddenCount })} <ChevronDown className="w-3 h-3" /></>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
@@ -208,12 +210,12 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
<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
|
||||
{t('lossless')}
|
||||
</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
|
||||
{t('vinyl')}
|
||||
</span>
|
||||
)}
|
||||
{result.provider === "YouTube" && (
|
||||
@@ -226,7 +228,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
title={`Expected "${searchTitle}" but filename is "${mismatch!.filename}"${mismatch!.suggestedTrack ? ` (looks like "${mismatch!.suggestedTrack}")` : ''}`}
|
||||
className="text-[8px] px-1 py-0.5 rounded font-medium bg-yellow-600/20 text-yellow-400 cursor-help"
|
||||
>
|
||||
Wrong track?
|
||||
{t('wrongTrack')}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-green-400 font-medium">{getDisplayName(result)}</span>
|
||||
@@ -248,7 +250,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
'bg-red-600/20 text-red-400'
|
||||
}`}
|
||||
>
|
||||
{text} availability
|
||||
{text} {t('availability')}
|
||||
</span>
|
||||
)
|
||||
})()
|
||||
@@ -258,7 +260,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
result.view_count >= 10000 ? 'bg-yellow-600/20 text-yellow-400' :
|
||||
'bg-muted text-muted-foreground'
|
||||
}`}>
|
||||
{formatCount(result.view_count)} views
|
||||
{t('views', { count: formatCount(result.view_count) })}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
@@ -286,7 +288,7 @@ export function AudioSearchDialog({ jobId, open, onClose, onSelect, searchTitle
|
||||
{isSelecting === result.index ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
) : (
|
||||
"Select"
|
||||
t('select')
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
interface AuthDialogProps {
|
||||
open: boolean
|
||||
@@ -22,6 +23,8 @@ interface AuthDialogProps {
|
||||
type AuthStep = "email" | "sent" | "token"
|
||||
|
||||
export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
const t = useTranslations('auth.dialog')
|
||||
const tCommon = useTranslations('common')
|
||||
const [step, setStep] = useState<AuthStep>("email")
|
||||
const [email, setEmail] = useState("")
|
||||
const [token, setToken] = useState("")
|
||||
@@ -85,17 +88,17 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<Mail className="w-5 h-5 text-primary" />
|
||||
Sign In
|
||||
{t('title')}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-muted-foreground">
|
||||
Enter your email to receive a sign-in link
|
||||
{t('emailPrompt')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form onSubmit={handleSendMagicLink} className="space-y-4">
|
||||
<div>
|
||||
<Input
|
||||
type="email"
|
||||
placeholder="you@example.com"
|
||||
placeholder={t('emailPlaceholder')}
|
||||
value={email}
|
||||
onChange={(e) => {
|
||||
setEmail(e.target.value)
|
||||
@@ -109,14 +112,12 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
{displayError && (
|
||||
displayError === "disposable_email_not_allowed" ? (
|
||||
<div className="mt-2 p-3 rounded-md bg-amber-500/10 border border-amber-500/30 text-sm space-y-2">
|
||||
<p className="font-medium text-amber-400">We don't support disposable email addresses</p>
|
||||
<p className="font-medium text-amber-400">{t('disposableEmailWarning')}</p>
|
||||
<p className="text-muted-foreground">
|
||||
We'd love to help you create karaoke videos! Please use your regular email
|
||||
address so we can send you a notification when your video is ready.
|
||||
{t('disposableEmailExplanation')}
|
||||
</p>
|
||||
<p className="text-muted-foreground">
|
||||
We promise — no spam, no marketing emails, ever. We only email you about
|
||||
your karaoke videos.
|
||||
{t('noSpamPromise')}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
@@ -133,10 +134,10 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
{isLoading ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Sending...
|
||||
{t('sending')}
|
||||
</>
|
||||
) : (
|
||||
"Send Sign-In Link"
|
||||
t('sendSignInLink')
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -146,11 +147,11 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<KeyRound className="w-4 h-4 mr-2" />
|
||||
Use Access Token Instead
|
||||
{t('useAccessToken')}
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground text-center">
|
||||
No account? Just enter your email to get started.
|
||||
{t('noAccount')}
|
||||
</p>
|
||||
</form>
|
||||
</>
|
||||
@@ -161,18 +162,18 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<CheckCircle className="w-5 h-5 text-success" />
|
||||
Check Your Email
|
||||
{t('checkEmailTitle')}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4 py-4">
|
||||
<p className="text-foreground">
|
||||
We sent a sign-in link to:
|
||||
{t('checkEmailSent')}
|
||||
</p>
|
||||
<p className="text-foreground font-medium bg-secondary px-4 py-2 rounded-md">
|
||||
{email}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Click the link in the email to sign in. The link expires in 15 minutes.
|
||||
{t('checkEmailExpiry')}
|
||||
</p>
|
||||
<div className="pt-4 border-t border-border space-y-2">
|
||||
<Button
|
||||
@@ -181,14 +182,14 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
className="w-full border-border text-foreground hover:text-foreground"
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Try a Different Email
|
||||
{t('tryDifferentEmail')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={handleClose}
|
||||
className="w-full text-muted-foreground"
|
||||
>
|
||||
Close
|
||||
{tCommon('close')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -200,17 +201,17 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<KeyRound className="w-5 h-5 text-warning" />
|
||||
Access Token
|
||||
{t('accessTokenTitle')}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-muted-foreground">
|
||||
Enter your access token to authenticate
|
||||
{t('accessTokenPrompt')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form onSubmit={handleTokenSubmit} className="space-y-4">
|
||||
<div>
|
||||
<Input
|
||||
type="password"
|
||||
placeholder="Enter access token"
|
||||
placeholder={t('accessTokenPlaceholder')}
|
||||
value={token}
|
||||
onChange={(e) => {
|
||||
setToken(e.target.value)
|
||||
@@ -234,10 +235,10 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
{isLoading ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Authenticating...
|
||||
{t('authenticating')}
|
||||
</>
|
||||
) : (
|
||||
"Authenticate"
|
||||
t('authenticate')
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -247,11 +248,11 @@ export function AuthDialog({ open, onClose, onSuccess }: AuthDialogProps) {
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to Email Sign-In
|
||||
{t('backToEmail')}
|
||||
</Button>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground text-center">
|
||||
Contact an admin to get an access token
|
||||
{t('contactAdmin')}
|
||||
</p>
|
||||
</form>
|
||||
</>
|
||||
|
||||
@@ -18,12 +18,15 @@ import { useAdminSettings } from "@/lib/admin-settings"
|
||||
import { AuthDialog } from "./AuthDialog"
|
||||
import { FeedbackDialog } from "@/components/feedback/FeedbackDialog"
|
||||
import { BuyCreditsDialog } from "@/components/credits/BuyCreditsDialog"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
interface AuthStatusProps {
|
||||
onAuthChange?: () => void
|
||||
}
|
||||
|
||||
export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
const t = useTranslations('auth.status')
|
||||
const tHeader = useTranslations('header')
|
||||
const { user, logout } = useAuth()
|
||||
const { showTestData, setShowTestData } = useAdminSettings()
|
||||
const [showAuthDialog, setShowAuthDialog] = useState(false)
|
||||
@@ -77,10 +80,10 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
handleBuyCredits()
|
||||
}}
|
||||
className="flex items-center gap-1 text-warning font-medium hover:text-warning/80 transition-colors cursor-pointer"
|
||||
title="Buy more credits"
|
||||
title={t('buyMoreCredits')}
|
||||
>
|
||||
<Coins className="w-3 h-3" />
|
||||
{user.credits} {user.credits === 1 ? 'credit' : 'credits'}
|
||||
{t('creditsAvailable', { count: user.credits })}
|
||||
</span>
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
@@ -88,7 +91,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
<DropdownMenuLabel className="text-muted-foreground font-normal">
|
||||
<div className="flex flex-col space-y-1">
|
||||
<p className="text-sm font-medium text-foreground">
|
||||
{user.display_name || "Karaoke Fan"}
|
||||
{user.display_name || t('defaultName')}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground truncate">{user.email}</p>
|
||||
</div>
|
||||
@@ -99,14 +102,14 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
disabled
|
||||
>
|
||||
<Coins className="w-4 h-4 mr-2 text-warning" />
|
||||
<span>{user.credits} credits available</span>
|
||||
<span>{t('creditsAvailable', { count: user.credits })}</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={handleBuyCredits}
|
||||
className="text-muted-foreground focus:text-foreground focus:bg-secondary"
|
||||
>
|
||||
<CreditCard className="w-4 h-4 mr-2" />
|
||||
<span>Buy More Credits</span>
|
||||
<span>{t('buyMoreCredits')}</span>
|
||||
</DropdownMenuItem>
|
||||
{user.feedback_eligible && (
|
||||
<DropdownMenuItem
|
||||
@@ -114,7 +117,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
className="text-green-500 focus:text-green-400 focus:bg-secondary"
|
||||
>
|
||||
<Gift className="w-4 h-4 mr-2" />
|
||||
<span>Earn 1 Free Credit</span>
|
||||
<span>{t('earnFreeCredit')}</span>
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
{(user.role === "admin" || user.email?.endsWith("@nomadkaraoke.com")) && (
|
||||
@@ -123,7 +126,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
<DropdownMenuItem asChild className="text-muted-foreground focus:text-foreground focus:bg-secondary">
|
||||
<Link href="/admin">
|
||||
<Shield className="w-4 h-4 mr-2" />
|
||||
<span>Admin Dashboard</span>
|
||||
<span>{tHeader('adminDashboard')}</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
@@ -131,7 +134,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
className="text-muted-foreground focus:text-foreground focus:bg-secondary"
|
||||
>
|
||||
<FlaskConical className="w-4 h-4 mr-2" />
|
||||
<span className="flex-1">Show Test Jobs</span>
|
||||
<span className="flex-1">{t('showTestJobs')}</span>
|
||||
<Switch
|
||||
checked={showTestData}
|
||||
onCheckedChange={setShowTestData}
|
||||
@@ -146,7 +149,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
className="text-destructive focus:text-destructive focus:bg-secondary"
|
||||
>
|
||||
<LogOut className="w-4 h-4 mr-2" />
|
||||
<span>Sign Out</span>
|
||||
<span>{t('signOut')}</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
@@ -171,7 +174,7 @@ export function AuthStatus({ onAuthChange }: AuthStatusProps) {
|
||||
className="text-warning hover:text-warning/80 min-h-[40px] px-2 sm:px-3"
|
||||
>
|
||||
<KeyRound className="w-4 h-4 sm:mr-2" />
|
||||
<span className="hidden sm:inline">Login</span>
|
||||
<span className="hidden sm:inline">{t('login')}</span>
|
||||
</Button>
|
||||
<AuthDialog
|
||||
open={showAuthDialog}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } f
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { api, CreditPackage } from '@/lib/api'
|
||||
import { useAuth } from '@/lib/auth'
|
||||
import { useTranslations } from 'next-intl'
|
||||
|
||||
interface BuyCreditsDialogProps {
|
||||
open: boolean
|
||||
@@ -17,6 +18,8 @@ const pricePerVideo = (pkg: CreditPackage) =>
|
||||
`$${(pkg.price_cents / 100 / pkg.credits).toFixed(2)}`
|
||||
|
||||
export function BuyCreditsDialog({ open, onClose }: BuyCreditsDialogProps) {
|
||||
const t = useTranslations('credits')
|
||||
const tCommon = useTranslations('common')
|
||||
const { user } = useAuth()
|
||||
const [packages, setPackages] = useState<CreditPackage[]>([])
|
||||
const [selectedPackage, setSelectedPackage] = useState<CreditPackage | null>(null)
|
||||
@@ -60,10 +63,10 @@ export function BuyCreditsDialog({ open, onClose }: BuyCreditsDialogProps) {
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<CreditCard className="w-5 h-5 text-primary" />
|
||||
Buy More Credits
|
||||
{t('title')}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-muted-foreground">
|
||||
Each credit creates one karaoke video. Pick a package below.
|
||||
{t('description')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -100,19 +103,19 @@ export function BuyCreditsDialog({ open, onClose }: BuyCreditsDialogProps) {
|
||||
>
|
||||
{isBestValue && (
|
||||
<span className="absolute -top-2.5 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground text-xs font-semibold px-2 py-0.5 rounded-full">
|
||||
Best Value
|
||||
{t('bestValue')}
|
||||
</span>
|
||||
)}
|
||||
<div className="text-2xl font-bold">{pkg.credits}</div>
|
||||
<div className="text-sm text-muted-foreground mb-1">
|
||||
{pkg.credits === 1 ? 'credit' : 'credits'}
|
||||
{pkg.credits === 1 ? tCommon('credit') : tCommon('credits')}
|
||||
</div>
|
||||
<div className="text-lg font-semibold text-primary">
|
||||
{formatPrice(pkg.price_cents)}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">{pricePerVideo(pkg)}/video</div>
|
||||
<div className="text-xs text-muted-foreground">{t('pricePerVideo', { price: pricePerVideo(pkg) })}</div>
|
||||
{savings > 0 && (
|
||||
<div className="text-xs text-green-500 mt-1">Save {savings}%</div>
|
||||
<div className="text-xs text-green-500 mt-1">{t('savePct', { savings })}</div>
|
||||
)}
|
||||
</button>
|
||||
)
|
||||
@@ -127,12 +130,12 @@ export function BuyCreditsDialog({ open, onClose }: BuyCreditsDialogProps) {
|
||||
{checkoutLoading ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Redirecting to payment...
|
||||
{t('redirecting')}
|
||||
</>
|
||||
) : selectedPackage ? (
|
||||
`Continue to Payment — ${formatPrice(selectedPackage.price_cents)}`
|
||||
t('continuePayment', { price: formatPrice(selectedPackage.price_cents) })
|
||||
) : (
|
||||
'Select a package'
|
||||
t('selectPackage')
|
||||
)}
|
||||
</Button>
|
||||
</>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Label } from '@/components/ui/label'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import { api } from '@/lib/api'
|
||||
import { useAuth } from '@/lib/auth'
|
||||
import { useTranslations } from 'next-intl'
|
||||
|
||||
interface FeedbackDialogProps {
|
||||
open: boolean
|
||||
@@ -46,6 +47,7 @@ function StarRating({ value, onChange, label }: {
|
||||
}
|
||||
|
||||
export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
const t = useTranslations('feedback')
|
||||
const { fetchUser } = useAuth()
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
const [isSuccess, setIsSuccess] = useState(false)
|
||||
@@ -138,17 +140,17 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
<div className="text-center py-6 space-y-4">
|
||||
<CheckCircle className="w-16 h-16 text-green-500 mx-auto" />
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground text-xl">Thank You!</DialogTitle>
|
||||
<DialogTitle className="text-foreground text-xl">{t('thankYou')}</DialogTitle>
|
||||
<DialogDescription className="text-muted-foreground text-base">
|
||||
Your feedback helps us improve Nomad Karaoke for everyone.
|
||||
{t('thankYouDesc')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="bg-green-500/10 border border-green-500/30 rounded-lg p-4 mx-auto max-w-xs">
|
||||
<p className="text-2xl font-bold text-green-500">+{creditsGranted}</p>
|
||||
<p className="text-sm text-muted-foreground">credits added to your account</p>
|
||||
<p className="text-sm text-muted-foreground">{t('creditsAdded', { count: creditsGranted })}</p>
|
||||
</div>
|
||||
<Button onClick={handleClose} className="mt-4">
|
||||
Done
|
||||
{t('done')}
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
@@ -156,10 +158,10 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground flex items-center gap-2">
|
||||
<Gift className="w-5 h-5 text-green-500" />
|
||||
Share Your Feedback — Earn 1 Free Credit
|
||||
{t('title')}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="text-muted-foreground">
|
||||
Tell us about your experience creating karaoke videos. Your feedback directly shapes what we build next.
|
||||
{t('description')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -167,22 +169,22 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
{/* Star Ratings */}
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<StarRating
|
||||
label="Overall Experience"
|
||||
label={t('overallExperience')}
|
||||
value={overallRating}
|
||||
onChange={setOverallRating}
|
||||
/>
|
||||
<StarRating
|
||||
label="Ease of Use"
|
||||
label={t('easeOfUse')}
|
||||
value={easeOfUseRating}
|
||||
onChange={setEaseOfUseRating}
|
||||
/>
|
||||
<StarRating
|
||||
label="Lyrics Accuracy"
|
||||
label={t('lyricsAccuracy')}
|
||||
value={lyricsAccuracyRating}
|
||||
onChange={setLyricsAccuracyRating}
|
||||
/>
|
||||
<StarRating
|
||||
label="Correction Experience"
|
||||
label={t('correctionExperience')}
|
||||
value={correctionRating}
|
||||
onChange={setCorrectionRating}
|
||||
/>
|
||||
@@ -191,38 +193,38 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
{/* Text Fields */}
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="went-well">What went well?</Label>
|
||||
<Label htmlFor="went-well">{t('whatWentWell')}</Label>
|
||||
<Textarea
|
||||
id="went-well"
|
||||
value={whatWentWell}
|
||||
onChange={(e) => setWhatWentWell(e.target.value)}
|
||||
placeholder="What did you enjoy about creating karaoke videos?"
|
||||
placeholder={t('whatWentWellPlaceholder')}
|
||||
rows={2}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="could-improve">What could be better?</Label>
|
||||
<Label htmlFor="could-improve">{t('whatCouldBeBetter')}</Label>
|
||||
<Textarea
|
||||
id="could-improve"
|
||||
value={whatCouldImprove}
|
||||
onChange={(e) => setWhatCouldImprove(e.target.value)}
|
||||
placeholder="What would make the experience better?"
|
||||
placeholder={t('whatCouldBeBetterPlaceholder')}
|
||||
rows={2}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="additional">Additional comments</Label>
|
||||
<Label htmlFor="additional">{t('additionalComments')}</Label>
|
||||
<Textarea
|
||||
id="additional"
|
||||
value={additionalComments}
|
||||
onChange={(e) => setAdditionalComments(e.target.value)}
|
||||
placeholder="Anything else you'd like us to know?"
|
||||
placeholder={t('additionalCommentsPlaceholder')}
|
||||
rows={2}
|
||||
/>
|
||||
</div>
|
||||
{!hasDetailedFeedback && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Please write at least 50 characters in one of the fields above ({longestText}/50)
|
||||
{t('minCharsWarning', { count: longestText })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -236,7 +238,7 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
onCheckedChange={(checked) => setWouldRecommend(checked === true)}
|
||||
/>
|
||||
<Label htmlFor="would-recommend" className="text-sm font-normal cursor-pointer">
|
||||
I would recommend Nomad Karaoke to others
|
||||
{t('wouldRecommend')}
|
||||
</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -246,7 +248,7 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
onCheckedChange={(checked) => setWouldUseAgain(checked === true)}
|
||||
/>
|
||||
<Label htmlFor="would-use-again" className="text-sm font-normal cursor-pointer">
|
||||
I would use Nomad Karaoke again
|
||||
{t('wouldUseAgain')}
|
||||
</Label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -265,10 +267,10 @@ export function FeedbackDialog({ open, onClose }: FeedbackDialogProps) {
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Submitting...
|
||||
{t('submitting')}
|
||||
</>
|
||||
) : (
|
||||
'Submit Feedback & Earn 1 Credit'
|
||||
t('submitButton')
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useRef } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Upload } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
@@ -15,6 +16,7 @@ export function CustomUpload({
|
||||
isUploading,
|
||||
acceptedFormats = [".flac", ".mp3", ".wav", ".m4a", ".ogg"],
|
||||
}: CustomUploadProps) {
|
||||
const t = useTranslations('instrumentalReview.customUpload')
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
@@ -41,7 +43,7 @@ export function CustomUpload({
|
||||
>
|
||||
<label className="cursor-pointer">
|
||||
<Upload className="w-3.5 h-3.5 mr-1.5" />
|
||||
{isUploading ? "Uploading..." : "Upload"}
|
||||
{isUploading ? t('uploading') : t('upload')}
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="file"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { ExternalLink, Lightbulb, X } from "lucide-react"
|
||||
import type { BackingVocalAnalysis, AudibleSegment } from "@/lib/api"
|
||||
|
||||
@@ -13,6 +14,7 @@ export function InstrumentalGuidancePanel({
|
||||
analysis,
|
||||
audibleSegments,
|
||||
}: InstrumentalGuidancePanelProps) {
|
||||
const t = useTranslations('instrumentalReview.guidance')
|
||||
const [guidanceDismissed, setGuidanceDismissed] = useState(() => {
|
||||
if (typeof window === "undefined") return false
|
||||
return localStorage.getItem("instrumentalReviewGuidanceDismissed") === "true"
|
||||
@@ -43,7 +45,7 @@ export function InstrumentalGuidancePanel({
|
||||
className="text-amber-500 hover:text-amber-400 transition-colors"
|
||||
onClick={handleShowTips}
|
||||
>
|
||||
Show tips
|
||||
{t('showTips')}
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
@@ -56,19 +58,13 @@ export function InstrumentalGuidancePanel({
|
||||
<Lightbulb className="h-4 w-4 text-amber-500 shrink-0 mt-0.5" />
|
||||
<div className="text-xs text-muted-foreground flex-1 leading-relaxed space-y-1.5">
|
||||
<p>
|
||||
<strong>Choose your karaoke backing track.</strong> The AI separated
|
||||
the vocals from the music — now pick which version sounds best.
|
||||
<strong>{t('chooseBackingTrack')}</strong>
|
||||
</p>
|
||||
<p>
|
||||
This track has very little backing vocal content ({percentage.toFixed(0)}%).
|
||||
We recommend the <strong>Clean Instrumental</strong> — just confirm
|
||||
below to proceed.
|
||||
{t('littleBackingVocals', { percentage: percentage.toFixed(0) })}
|
||||
</p>
|
||||
<p className="text-muted-foreground/70">
|
||||
Want to hear the difference? Use the audio buttons above to compare,
|
||||
or click the{" "}
|
||||
<span className="inline-block w-2 h-2 rounded-full bg-pink-500/60 align-middle" />{" "}
|
||||
pink sections in the waveform to listen to the backing vocals.
|
||||
{t('hearDifference')}
|
||||
</p>
|
||||
<a
|
||||
href="https://www.youtube.com/watch?v=-dI3r7qXo3A"
|
||||
@@ -77,13 +73,13 @@ export function InstrumentalGuidancePanel({
|
||||
className="inline-flex items-center gap-1 text-amber-500 hover:text-amber-400 transition-colors mt-1"
|
||||
>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
Watch full tutorial
|
||||
{t('watchFullTutorial')}
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
className="text-muted-foreground hover:text-foreground transition-colors shrink-0"
|
||||
onClick={handleDismiss}
|
||||
aria-label="Dismiss tip"
|
||||
aria-label={t('dismissTip')}
|
||||
>
|
||||
<X className="h-3.5 w-3.5" />
|
||||
</button>
|
||||
@@ -97,33 +93,20 @@ export function InstrumentalGuidancePanel({
|
||||
<Lightbulb className="h-4 w-4 text-amber-500 shrink-0 mt-0.5" />
|
||||
<div className="text-xs text-muted-foreground flex-1 leading-relaxed space-y-1.5">
|
||||
<p>
|
||||
<strong>Choose your karaoke backing track.</strong> The AI separated
|
||||
the vocals from the music — now pick which version sounds best.
|
||||
<strong>{t('chooseBackingTrack')}</strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Backing vocals</strong> are the harmony/chorus voices that sing
|
||||
along with the lead. Some karaoke singers prefer to keep them for guidance,
|
||||
others prefer a clean instrumental.
|
||||
{t('backingVocalsExplanation')}
|
||||
</p>
|
||||
<div className="space-y-1 pl-2 border-l-2 border-amber-500/30">
|
||||
<p>
|
||||
<strong>Step 1:</strong> Click the{" "}
|
||||
<span className="inline-block w-2 h-2 rounded-full bg-pink-500/60 align-middle" />{" "}
|
||||
pink sections in the waveform to hear the backing vocals
|
||||
{hasSegments && ` (${audibleSegments.length} detected)`}.
|
||||
{t('step1', { segments: hasSegments ? ` (${audibleSegments.length} detected)` : '' })}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Step 2:</strong> Decide — keep them or use the clean
|
||||
instrumental? Use the audio toggle buttons above to compare.
|
||||
{t('step2')}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Step 3</strong> (if needed): If you want backing vocals but
|
||||
some sections have unwanted lead vocal bleed,{" "}
|
||||
<kbd className="px-1 py-0.5 rounded bg-muted text-[0.65rem] font-mono">
|
||||
Shift
|
||||
</kbd>
|
||||
+drag on the waveform to mark those sections, then click{" "}
|
||||
<strong>Create Custom</strong>.
|
||||
{t('step3')}
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
@@ -133,13 +116,13 @@ export function InstrumentalGuidancePanel({
|
||||
className="inline-flex items-center gap-1 text-amber-500 hover:text-amber-400 transition-colors mt-1"
|
||||
>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
Watch full tutorial
|
||||
{t('watchFullTutorial')}
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
className="text-muted-foreground hover:text-foreground transition-colors shrink-0"
|
||||
onClick={handleDismiss}
|
||||
aria-label="Dismiss tip"
|
||||
aria-label={t('dismissTip')}
|
||||
>
|
||||
<X className="h-3.5 w-3.5" />
|
||||
</button>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState, useEffect, useRef, useCallback, useMemo } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Spinner } from "@/components/ui/spinner"
|
||||
import { ArrowLeft, Play, Pause, Check } from "lucide-react"
|
||||
@@ -49,6 +50,7 @@ function formatTime(seconds: number): string {
|
||||
|
||||
export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalSelectorProps) {
|
||||
const router = useRouter()
|
||||
const t = useTranslations('instrumentalReview')
|
||||
const audioRef = useRef<HTMLAudioElement>(null)
|
||||
|
||||
// Data state
|
||||
@@ -518,10 +520,9 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center max-w-md">
|
||||
<Spinner className="w-8 h-8 mx-auto mb-4" />
|
||||
<h2 className="text-lg font-semibold mb-2">Audio Separation In Progress</h2>
|
||||
<h2 className="text-lg font-semibold mb-2">{t('separationInProgress')}</h2>
|
||||
<p className="text-muted-foreground">
|
||||
The audio stems are still being separated. This usually takes a few minutes.
|
||||
This page will automatically update when the separation is complete.
|
||||
{t('separationInProgressDesc')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -534,7 +535,7 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
<div className="flex items-center justify-center min-h-screen">
|
||||
<div className="text-center">
|
||||
<Spinner className="w-8 h-8 mx-auto mb-4" />
|
||||
<p className="text-muted-foreground">Loading instrumental analysis...</p>
|
||||
<p className="text-muted-foreground">{t('loadingAnalysis')}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -550,7 +551,7 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
<Button variant="outline" asChild>
|
||||
<Link href="/app">
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
Back to dashboard
|
||||
{t('backToDashboard')}
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
@@ -562,11 +563,11 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
// Success screen
|
||||
if (showSuccess) {
|
||||
const selectionLabels: Record<string, string> = {
|
||||
clean: "Clean Instrumental",
|
||||
with_backing: "With Backing Vocals",
|
||||
custom: "Custom",
|
||||
uploaded: "Uploaded Instrumental",
|
||||
original: "Original Audio",
|
||||
clean: t('options.cleanInstrumental'),
|
||||
with_backing: t('options.withBackingVocals'),
|
||||
custom: t('options.custom'),
|
||||
uploaded: t('options.uploaded'),
|
||||
original: t('options.originalAudio'),
|
||||
}
|
||||
const selectionLabel = selectionLabels[selectedOption] || selectedOption
|
||||
|
||||
@@ -575,19 +576,19 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
<div className="text-center">
|
||||
<h2 className="text-2xl font-semibold text-green-500 mb-4">
|
||||
<Check className="w-8 h-8 inline-block mr-2" />
|
||||
Selection Submitted
|
||||
{t('selectionSubmitted')}
|
||||
</h2>
|
||||
<p className="mb-2">
|
||||
You selected: <strong>{selectionLabel}</strong>
|
||||
{t('youSelected', { label: selectionLabel })}
|
||||
</p>
|
||||
<p className="text-muted-foreground">
|
||||
{countdown > 0
|
||||
? isLocalMode
|
||||
? `Closing in ${countdown}s...`
|
||||
: `Redirecting in ${countdown}s...`
|
||||
? t('closingIn', { countdown })
|
||||
: t('redirectingIn', { countdown })
|
||||
: isLocalMode
|
||||
? "You can close this window now."
|
||||
: "Redirecting..."}
|
||||
? t('canCloseWindow')
|
||||
: t('redirecting')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -610,8 +611,8 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
e.currentTarget.style.display = "none"
|
||||
}}
|
||||
/>
|
||||
<span className="sm:hidden">Review</span>
|
||||
<span className="hidden sm:inline">Instrumental Review</span>
|
||||
<span className="sm:hidden">{t('review')}</span>
|
||||
<span className="hidden sm:inline">{t('title')}</span>
|
||||
</span>
|
||||
<span className="text-xs md:text-sm text-muted-foreground truncate">
|
||||
{job.artist} {job.artist && job.title ? "-" : ""} {job.title}
|
||||
@@ -626,8 +627,8 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
}`}
|
||||
>
|
||||
{analysisData?.analysis.recommended_selection === "clean"
|
||||
? "Clean recommended"
|
||||
: "Review backing vocals"}
|
||||
? t('cleanRecommended')
|
||||
: t('reviewBackingVocals')}
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
@@ -693,13 +694,10 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
))}
|
||||
</div>
|
||||
<span className="hidden md:inline text-[10px] text-muted-foreground">
|
||||
<kbd className="px-1.5 py-0.5 bg-background border border-border rounded text-[10px] font-mono">
|
||||
Shift
|
||||
</kbd>
|
||||
+drag
|
||||
{t('shiftDrag')}
|
||||
</span>
|
||||
<kbd className="hidden md:inline px-1.5 py-0.5 bg-background border border-border rounded text-[10px] font-mono">
|
||||
Space
|
||||
{t('space')}
|
||||
</kbd>
|
||||
</div>
|
||||
</div>
|
||||
@@ -722,7 +720,7 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
<div className="absolute inset-0 flex items-center justify-center bg-background/50 backdrop-blur-sm">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Spinner className="w-4 h-4" />
|
||||
Loading audio...
|
||||
{t('loadingAudio')}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -757,17 +755,15 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
{/* Alternate Instrumental section */}
|
||||
<div className="bg-card border border-border rounded-lg p-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm font-semibold">Alternate Instrumental</span>
|
||||
<span className="text-sm font-semibold">{t('alternateInstrumental')}</span>
|
||||
<CustomUpload onUpload={handleUpload} isUploading={isUploading} />
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground mt-1.5">
|
||||
Have your own instrumental track? Upload it here. The file must be the
|
||||
same duration as the original audio ({formatTime(duration)}) so the
|
||||
synced lyrics stay aligned.
|
||||
{t('uploadYourOwn', { duration: formatTime(duration) })}
|
||||
</p>
|
||||
{hasUploaded && uploadedFilename && (
|
||||
<p className="text-xs text-green-500 mt-1">
|
||||
✓ Using: {uploadedFilename}
|
||||
✓ {t('usingFile', { filename: uploadedFilename })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -794,7 +790,7 @@ export function InstrumentalSelector({ job, isLocalMode = false }: InstrumentalS
|
||||
className="mt-auto w-full min-h-[44px] text-base font-semibold"
|
||||
>
|
||||
<Check className="w-5 h-5 mr-2" />
|
||||
{isSubmitting ? "Submitting..." : "Confirm & Continue"}
|
||||
{isSubmitting ? t('submitting') : t('confirmContinue')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useCallback, useMemo } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Card } from "@/components/ui/card"
|
||||
import { Label } from "@/components/ui/label"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -41,11 +42,6 @@ interface InstrumentalSelectorEmbeddedProps {
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
const OPTION_DESCRIPTIONS: Record<string, string> = {
|
||||
clean: "No backing vocals - pure instrumental",
|
||||
with_backing: "Includes backing vocals from original",
|
||||
}
|
||||
|
||||
export function InstrumentalSelectorEmbedded({
|
||||
options,
|
||||
analysis,
|
||||
@@ -54,6 +50,7 @@ export function InstrumentalSelectorEmbedded({
|
||||
compact = false,
|
||||
disabled = false,
|
||||
}: InstrumentalSelectorEmbeddedProps) {
|
||||
const t = useTranslations('instrumentalReview')
|
||||
const [playingId, setPlayingId] = useState<string | null>(null)
|
||||
const [audioElement] = useState<HTMLAudioElement | null>(() =>
|
||||
typeof window !== 'undefined' ? new Audio() : null
|
||||
@@ -95,7 +92,7 @@ export function InstrumentalSelectorEmbedded({
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<div className="text-sm text-muted-foreground">
|
||||
No instrumental options available.
|
||||
{t('noOptionsAvailable')}
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
@@ -106,11 +103,11 @@ export function InstrumentalSelectorEmbedded({
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<Music className="h-4 w-4 text-muted-foreground" />
|
||||
<Label className={cn("font-semibold", compact ? "text-sm" : "text-base")}>
|
||||
Select Instrumental Track
|
||||
{t('selectTrack')}
|
||||
</Label>
|
||||
{!value && (
|
||||
<Badge variant="destructive" className="ml-auto text-xs">
|
||||
Required
|
||||
{t('required')}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
@@ -119,10 +116,10 @@ export function InstrumentalSelectorEmbedded({
|
||||
{analysis && (analysis.audible_percentage ?? 0) > 0 && (
|
||||
<div className="mb-3 text-xs text-muted-foreground">
|
||||
<span className="font-medium">
|
||||
{(analysis.audible_percentage ?? 0).toFixed(0)}% backing vocals detected
|
||||
{t('backingVocalsDetected', { percentage: (analysis.audible_percentage ?? 0).toFixed(0) })}
|
||||
</span>
|
||||
{(analysis.audible_segments?.length ?? 0) > 0 && (
|
||||
<span> ({analysis.audible_segments?.length ?? 0} segments)</span>
|
||||
<span> {t('segmentsCount', { count: analysis.audible_segments?.length ?? 0 })}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -173,12 +170,12 @@ export function InstrumentalSelectorEmbedded({
|
||||
{option.label}
|
||||
{isRecommended && (
|
||||
<Badge variant="secondary" className="text-xs bg-green-500/20 text-green-600">
|
||||
Recommended
|
||||
{t('options.recommended')}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className={cn("text-muted-foreground", compact ? "text-xs" : "text-xs")}>
|
||||
{OPTION_DESCRIPTIONS[option.id] || `Instrumental option: ${option.id}`}
|
||||
{option.id === 'clean' ? t('cleanDescription') : option.id === 'with_backing' ? t('backingVocalsIncluded') : option.label}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { X } from "lucide-react"
|
||||
import type { MuteRegion, AudibleSegment } from "@/lib/api"
|
||||
@@ -38,6 +39,7 @@ export function MuteRegionEditor({
|
||||
onHoverRegion,
|
||||
onHoverSegment,
|
||||
}: MuteRegionEditorProps) {
|
||||
const t = useTranslations('instrumentalReview.muteRegion')
|
||||
const hasRegions = regions.length > 0
|
||||
const hasSegments = audibleSegments.length > 0
|
||||
|
||||
@@ -46,7 +48,7 @@ export function MuteRegionEditor({
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm font-semibold">
|
||||
Custom Mix {hasRegions && `(${regions.length} muted)`}
|
||||
{hasRegions ? t('titleWithCount', { count: regions.length }) : t('title')}
|
||||
</span>
|
||||
{hasRegions && (
|
||||
<div className="flex gap-1.5">
|
||||
@@ -56,7 +58,7 @@ export function MuteRegionEditor({
|
||||
onClick={onClearAll}
|
||||
className="h-7 text-xs"
|
||||
>
|
||||
Clear
|
||||
{t('clear')}
|
||||
</Button>
|
||||
{!hasCustom && (
|
||||
<Button
|
||||
@@ -65,7 +67,7 @@ export function MuteRegionEditor({
|
||||
disabled={isCreatingCustom}
|
||||
className="h-7 text-xs"
|
||||
>
|
||||
{isCreatingCustom ? "Creating..." : "Create Custom"}
|
||||
{isCreatingCustom ? t('creating') : t('createCustom')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -104,19 +106,14 @@ export function MuteRegionEditor({
|
||||
{hasSegments ? (
|
||||
<>
|
||||
<p>
|
||||
Want backing vocals but hear lead vocal bleed in some sections?
|
||||
Mute those sections to create a custom mix.
|
||||
{t('explanation')}
|
||||
</p>
|
||||
<p className="text-muted-foreground/70">
|
||||
Click a segment below to mute it, or{" "}
|
||||
<kbd className="px-1 py-0.5 rounded bg-muted text-[0.65rem] font-mono">
|
||||
Shift
|
||||
</kbd>
|
||||
+drag on the waveform to mark a custom region.
|
||||
{t('clickSegment')}
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<p>No backing vocals detected — clean instrumental recommended.</p>
|
||||
<p>{t('noBackingDetected')}</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -131,7 +128,7 @@ export function MuteRegionEditor({
|
||||
onClick={() => onAddSegment(index)}
|
||||
onMouseEnter={() => onHoverSegment?.(index)}
|
||||
onMouseLeave={() => onHoverSegment?.(null)}
|
||||
title="Add to mute regions"
|
||||
title={t('addToMuteRegions')}
|
||||
className="px-1.5 py-0.5 bg-background border border-border rounded text-[10px] text-muted-foreground hover:border-primary hover:text-primary transition-colors"
|
||||
>
|
||||
{formatTime(segment.start_seconds)} - {formatTime(segment.end_seconds)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Label } from "@/components/ui/label"
|
||||
import { cn } from "@/lib/utils"
|
||||
import type { InstrumentalSelectionType, BackingVocalAnalysis, MuteRegion } from "@/lib/api"
|
||||
@@ -34,35 +35,36 @@ export function SelectionOptions({
|
||||
muteRegionsCount,
|
||||
backingVocalAnalysis,
|
||||
}: SelectionOptionsProps) {
|
||||
const t = useTranslations('instrumentalReview.options')
|
||||
const options: SelectionOption[] = [
|
||||
{
|
||||
value: "clean",
|
||||
label: "Clean Instrumental",
|
||||
description: "No backing vocals",
|
||||
label: t('cleanInstrumental'),
|
||||
description: t('noBackingVocals'),
|
||||
available: true,
|
||||
},
|
||||
{
|
||||
value: "with_backing",
|
||||
label: "With Backing Vocals",
|
||||
description: "All backing vocals included",
|
||||
label: t('withBackingVocals'),
|
||||
description: t('allBackingVocalsIncluded'),
|
||||
available: hasWithBacking,
|
||||
},
|
||||
{
|
||||
value: "original",
|
||||
label: "Original Audio",
|
||||
description: "Full original with lead vocals",
|
||||
label: t('originalAudio'),
|
||||
description: t('fullOriginalWithVocals'),
|
||||
available: hasOriginal,
|
||||
},
|
||||
{
|
||||
value: "custom",
|
||||
label: "Custom",
|
||||
description: `${muteRegionsCount} region${muteRegionsCount !== 1 ? "s" : ""} muted`,
|
||||
label: t('custom'),
|
||||
description: t('customRegionsMuted', { count: muteRegionsCount }),
|
||||
available: hasCustom,
|
||||
},
|
||||
{
|
||||
value: "uploaded",
|
||||
label: "Uploaded",
|
||||
description: uploadedFilename || "Custom instrumental file",
|
||||
label: t('uploaded'),
|
||||
description: uploadedFilename || t('customFile'),
|
||||
available: hasUploaded,
|
||||
},
|
||||
]
|
||||
@@ -71,7 +73,7 @@ export function SelectionOptions({
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
<Label className="text-sm font-semibold">Final Selection</Label>
|
||||
<Label className="text-sm font-semibold">{t('finalSelection')}</Label>
|
||||
<div className="flex flex-col gap-2">
|
||||
{availableOptions.map((option) => (
|
||||
<button
|
||||
@@ -103,7 +105,7 @@ export function SelectionOptions({
|
||||
{option.label}
|
||||
{backingVocalAnalysis?.recommended_selection === option.value && (
|
||||
<span className="text-xs px-1.5 py-0.5 bg-green-500/20 text-green-500 rounded">
|
||||
Recommended
|
||||
{t('recommended')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -113,8 +115,8 @@ export function SelectionOptions({
|
||||
{backingVocalAnalysis?.recommended_selection === option.value && (
|
||||
<div className="text-[10px] text-green-500/80 mt-0.5">
|
||||
{option.value === "clean"
|
||||
? `Very few backing vocals detected (${backingVocalAnalysis.audible_percentage.toFixed(0)}%)`
|
||||
: `Significant backing vocals (${backingVocalAnalysis.audible_percentage.toFixed(0)}%) — may enhance the karaoke experience`}
|
||||
? t('veryFewVocals', { percentage: backingVocalAnalysis.audible_percentage.toFixed(0) })
|
||||
: t('significantVocals', { percentage: backingVocalAnalysis.audible_percentage.toFixed(0) })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Loader2 } from "lucide-react"
|
||||
|
||||
@@ -33,13 +34,14 @@ export function StemComparison({
|
||||
uploadedFilename,
|
||||
isLoading = false,
|
||||
}: StemComparisonProps) {
|
||||
const t = useTranslations('instrumentalReview.stemComparison')
|
||||
const options: AudioOption[] = [
|
||||
{ type: "original", label: "Original", available: hasOriginal },
|
||||
{ type: "backing", label: "Backing Vocals Only", available: true },
|
||||
{ type: "clean", label: "Pure Instrumental", available: true },
|
||||
{ type: "with_backing", label: "Instrumental + Backing", available: hasWithBacking },
|
||||
{ type: "custom", label: "Custom", available: hasCustom },
|
||||
{ type: "uploaded", label: "Uploaded", available: hasUploaded, title: uploadedFilename },
|
||||
{ type: "original", label: t('original'), available: hasOriginal },
|
||||
{ type: "backing", label: t('backingVocalsOnly'), available: true },
|
||||
{ type: "clean", label: t('pureInstrumental'), available: true },
|
||||
{ type: "with_backing", label: t('instrumentalPlusBacking'), available: hasWithBacking },
|
||||
{ type: "custom", label: t('custom'), available: hasCustom },
|
||||
{ type: "uploaded", label: t('uploaded'), available: hasUploaded, title: uploadedFilename },
|
||||
]
|
||||
|
||||
const availableOptions = options.filter((opt) => opt.available)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import type { ColorOverrides } from "@/lib/video-themes"
|
||||
import { Label } from "@/components/ui/label"
|
||||
import { Input } from "@/components/ui/input"
|
||||
@@ -28,6 +29,7 @@ interface ColorFieldProps {
|
||||
}
|
||||
|
||||
function ColorField({ id, label, description, value, onChange, disabled }: ColorFieldProps) {
|
||||
const t = useTranslations('colorOverrides')
|
||||
return (
|
||||
<div className="space-y-1">
|
||||
<div className="flex items-center justify-between">
|
||||
@@ -42,7 +44,7 @@ function ColorField({ id, label, description, value, onChange, disabled }: Color
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
disabled={disabled}
|
||||
>
|
||||
Reset
|
||||
{t('reset')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
@@ -82,6 +84,7 @@ function ColorField({ id, label, description, value, onChange, disabled }: Color
|
||||
}
|
||||
|
||||
export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverridesProps) {
|
||||
const t = useTranslations('colorOverrides')
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
|
||||
const hasAnyOverrides = !!(
|
||||
@@ -113,10 +116,10 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
<Paintbrush className="w-4 h-4" />
|
||||
Customize Colors
|
||||
{t('title')}
|
||||
{hasAnyOverrides && (
|
||||
<span className="text-xs bg-amber-500/20 text-amber-400 px-1.5 py-0.5 rounded">
|
||||
Modified
|
||||
{t('modified')}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
@@ -132,7 +135,7 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
<div className="space-y-4 p-4 rounded-lg border" style={{ borderColor: 'var(--card-border)', backgroundColor: 'var(--secondary)' }}>
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
Override theme colors (optional)
|
||||
{t('overrideThemeColors')}
|
||||
</p>
|
||||
{hasAnyOverrides && (
|
||||
<Button
|
||||
@@ -144,7 +147,7 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<RotateCcw className="w-3 h-3 mr-1" />
|
||||
Reset All
|
||||
{t('resetAll')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -152,8 +155,8 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<ColorField
|
||||
id="artist-color"
|
||||
label="Artist Color"
|
||||
description="Color for artist name on title/end screens"
|
||||
label={t('artistColor')}
|
||||
description={t('artistColorDesc')}
|
||||
value={value.artist_color}
|
||||
onChange={(v) => updateField("artist_color", v)}
|
||||
disabled={disabled}
|
||||
@@ -161,8 +164,8 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
|
||||
<ColorField
|
||||
id="title-color"
|
||||
label="Title Color"
|
||||
description="Color for song title on title/end screens"
|
||||
label={t('titleColor')}
|
||||
description={t('titleColorDesc')}
|
||||
value={value.title_color}
|
||||
onChange={(v) => updateField("title_color", v)}
|
||||
disabled={disabled}
|
||||
@@ -170,8 +173,8 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
|
||||
<ColorField
|
||||
id="sung-lyrics-color"
|
||||
label="Sung Lyrics Color"
|
||||
description="Color for lyrics being sung (highlighted)"
|
||||
label={t('sungLyricsColor')}
|
||||
description={t('sungLyricsColorDesc')}
|
||||
value={value.sung_lyrics_color}
|
||||
onChange={(v) => updateField("sung_lyrics_color", v)}
|
||||
disabled={disabled}
|
||||
@@ -179,8 +182,8 @@ export function ColorOverridesPanel({ value, onChange, disabled }: ColorOverride
|
||||
|
||||
<ColorField
|
||||
id="unsung-lyrics-color"
|
||||
label="Unsung Lyrics Color"
|
||||
description="Color for lyrics not yet sung"
|
||||
label={t('unsungLyricsColor')}
|
||||
description={t('unsungLyricsColorDesc')}
|
||||
value={value.unsung_lyrics_color}
|
||||
onChange={(v) => updateField("unsung_lyrics_color", v)}
|
||||
disabled={disabled}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { X, ExternalLink, Youtube, AlertTriangle } from "lucide-react"
|
||||
import type { CommunityCheckResponse } from "@/lib/api"
|
||||
|
||||
@@ -9,6 +10,7 @@ interface CommunityVersionBannerProps {
|
||||
}
|
||||
|
||||
export function CommunityVersionBanner({ data, onDismiss }: CommunityVersionBannerProps) {
|
||||
const t = useTranslations('communityVersion')
|
||||
if (!data.has_community || data.songs.length === 0) return null
|
||||
|
||||
// Collect all community tracks across songs, take top 3
|
||||
@@ -42,10 +44,10 @@ export function CommunityVersionBanner({ data, onDismiss }: CommunityVersionBann
|
||||
<div className="pr-6">
|
||||
<p className="text-sm font-medium flex items-center gap-1.5" style={{ color: "rgb(34, 197, 94)" }}>
|
||||
<AlertTriangle className="w-4 h-4 shrink-0" />
|
||||
A karaoke version of this song already exists!
|
||||
{t('exists')}
|
||||
</p>
|
||||
<p className="text-xs mt-1" style={{ color: "var(--text-muted)" }}>
|
||||
Check if an existing version works for you before using a credit.
|
||||
{t('checkFirst')}
|
||||
</p>
|
||||
|
||||
<div className="mt-2 space-y-1.5">
|
||||
@@ -69,13 +71,13 @@ export function CommunityVersionBanner({ data, onDismiss }: CommunityVersionBann
|
||||
color: "rgb(34, 197, 94)",
|
||||
}}
|
||||
>
|
||||
Community
|
||||
{t('community')}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="ml-auto shrink-0 text-[10px] flex items-center gap-1" style={{ color: "var(--text-muted)" }}>
|
||||
<Youtube className="w-3 h-3 text-red-500" />
|
||||
Watch on YouTube
|
||||
{t('watchOnYoutube')}
|
||||
</span>
|
||||
</a>
|
||||
))}
|
||||
@@ -83,7 +85,7 @@ export function CommunityVersionBanner({ data, onDismiss }: CommunityVersionBann
|
||||
|
||||
{allTracks.length > 3 && (
|
||||
<p className="text-[10px] mt-1.5" style={{ color: "var(--text-muted)" }}>
|
||||
+{allTracks.length - 3} more version{allTracks.length - 3 > 1 ? "s" : ""}
|
||||
{t('moreVersions', { count: allTracks.length - 3 })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api, Job } from "@/lib/api"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Loader2 } from "lucide-react"
|
||||
@@ -23,6 +24,8 @@ interface EditTrackModalProps {
|
||||
}
|
||||
|
||||
export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditTrackModalProps) {
|
||||
const t = useTranslations('editTrack')
|
||||
const tc = useTranslations('common')
|
||||
const [updateMetadata, setUpdateMetadata] = useState(false)
|
||||
const [artist, setArtist] = useState(job.artist || "")
|
||||
const [title, setTitle] = useState(job.title || "")
|
||||
@@ -77,10 +80,9 @@ export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditT
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="sm:max-w-[480px]" onClick={(e) => e.stopPropagation()}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Edit Completed Track</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
<DialogDescription>
|
||||
This will remove the current video from YouTube, Dropbox, and Google Drive.
|
||||
After you complete the review again, a new version will be rendered and re-distributed.
|
||||
{t('description')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
@@ -94,7 +96,7 @@ export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditT
|
||||
className="rounded"
|
||||
/>
|
||||
<Label htmlFor="update-metadata" className="cursor-pointer">
|
||||
I need to update the artist or title
|
||||
{t('updateArtistTitle')}
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
@@ -102,7 +104,7 @@ export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditT
|
||||
<div className="grid gap-3 pl-6">
|
||||
<div className="grid grid-cols-4 items-center gap-4">
|
||||
<Label htmlFor="edit-artist" className="text-right">
|
||||
Artist
|
||||
{t('artist')}
|
||||
</Label>
|
||||
<Input
|
||||
id="edit-artist"
|
||||
@@ -113,7 +115,7 @@ export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditT
|
||||
</div>
|
||||
<div className="grid grid-cols-4 items-center gap-4">
|
||||
<Label htmlFor="edit-title" className="text-right">
|
||||
Title
|
||||
{t('songTitle')}
|
||||
</Label>
|
||||
<Input
|
||||
id="edit-title"
|
||||
@@ -137,7 +139,7 @@ export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditT
|
||||
onClick={() => handleOpenChange(false)}
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
Cancel
|
||||
{tc('cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@@ -147,10 +149,10 @@ export function EditTrackModal({ job, open, onOpenChange, onEditStarted }: EditT
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Cleaning up...
|
||||
{t('cleaningUp')}
|
||||
</>
|
||||
) : (
|
||||
"Confirm & Edit"
|
||||
t('confirmEdit')
|
||||
)}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { useTenant } from "@/lib/tenant"
|
||||
import { api, ApiError } from "@/lib/api"
|
||||
@@ -19,7 +20,7 @@ interface GuidedJobFlowProps {
|
||||
|
||||
type Step = 1 | 2 | 3 | 4
|
||||
|
||||
const STEP_LABELS = ["Song Info", "Choose Audio", "Visibility", "Customize & Create"]
|
||||
const STEP_LABEL_KEYS = ["songInfo", "chooseAudio", "visibility", "customizeCreate"] as const
|
||||
|
||||
/**
|
||||
* Upload custom style assets to an already-created job.
|
||||
@@ -90,6 +91,7 @@ async function uploadStyleAssets(
|
||||
}
|
||||
|
||||
export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
const t = useTranslations('jobFlow')
|
||||
const { user } = useAuth()
|
||||
const { features } = useTenant()
|
||||
const isAdmin = user?.role === "admin"
|
||||
@@ -191,7 +193,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
})
|
||||
createdJobId = response.job_id
|
||||
} else {
|
||||
setSubmitError("Missing audio source. Please go back and try again.")
|
||||
setSubmitError(t('missingAudioSource'))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -213,12 +215,12 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
setSearchSessionId(null)
|
||||
setSelectedResultIndex(null)
|
||||
setStep(2)
|
||||
setSubmitError("Your search results expired. Please search again — your song info is still saved.")
|
||||
setSubmitError(t('searchExpired'))
|
||||
} else {
|
||||
setSubmitError(err.message)
|
||||
}
|
||||
} else {
|
||||
setSubmitError("Failed to start processing. Please try again.")
|
||||
setSubmitError(t('failedToStartProcessing'))
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
@@ -272,7 +274,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
</div>
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold" style={{ color: 'var(--text)' }}>
|
||||
Job Created
|
||||
{t('jobCreated')}
|
||||
</h2>
|
||||
<p className="text-sm mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="font-medium" style={{ color: 'var(--text)' }}>{effectiveArtist} - {effectiveTitle}</span>
|
||||
@@ -286,7 +288,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
</div>
|
||||
|
||||
{/* Timeline */}
|
||||
<p className="text-xs font-semibold uppercase tracking-wider" style={{ color: 'var(--text-muted)' }}>What happens next</p>
|
||||
<p className="text-xs font-semibold uppercase tracking-wider" style={{ color: 'var(--text-muted)' }}>{t('whatsHappensNext')}</p>
|
||||
<div className="space-y-0 mt-3">
|
||||
{/* Step 1: Automated processing */}
|
||||
<div className="flex gap-3">
|
||||
@@ -300,12 +302,12 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
<div className="w-px flex-1 min-h-[20px]" style={{ backgroundColor: 'var(--card-border)' }} />
|
||||
</div>
|
||||
<div className="pb-4 pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>Audio processing</p>
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>{t('audioProcessing')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: 'var(--text-muted)' }}>
|
||||
We download the audio, separate vocals from the instrumental, and transcribe the lyrics. <span className="font-medium" style={{ color: 'var(--text)' }}>~10 minutes</span>
|
||||
{t('audioProcessingDesc')}
|
||||
</p>
|
||||
<span className="inline-block mt-1.5 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-blue-500/15 text-blue-400">
|
||||
Automatic
|
||||
{t('automatic')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -323,20 +325,20 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
<div className="w-px flex-1 min-h-[20px]" style={{ backgroundColor: 'var(--card-border)' }} />
|
||||
</div>
|
||||
<div className="pb-4 pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>You edit the audio</p>
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>{t('youEditTheAudio')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: 'var(--text-muted)' }}>
|
||||
Trim, cut, or mute sections of the downloaded audio before processing begins.
|
||||
{t('youEditDesc')}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 mt-1.5 flex-wrap">
|
||||
<span className="inline-block text-[10px] px-1.5 py-0.5 rounded-full font-medium" style={{ backgroundColor: 'rgba(255, 122, 204, 0.15)', color: 'var(--brand-pink)' }}>
|
||||
You
|
||||
{t('you')}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 text-[10px]" style={{ color: 'var(--text-muted)' }}>
|
||||
<svg width="12" height="12" viewBox="0 0 16 16" fill="none">
|
||||
<path d="M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v.401a1 1 0 0 1-.373.78L8.707 8.79a1 1 0 0 1-1.414 0L2.373 4.68A1 1 0 0 1 2 3.9V3.5Z" fill="currentColor" opacity="0.7"/>
|
||||
<path d="M2 6.12l4.586 3.59a2 2 0 0 0 2.828 0L14 6.12V12.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5V6.12Z" fill="currentColor" opacity="0.5"/>
|
||||
</svg>
|
||||
Email + chime when ready
|
||||
{t('emailChime')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -354,20 +356,20 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
<div className="w-px flex-1 min-h-[20px]" style={{ backgroundColor: 'var(--card-border)' }} />
|
||||
</div>
|
||||
<div className="pb-4 pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>You review the lyrics & instrumental</p>
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>{t('youReviewLyrics')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: 'var(--text-muted)' }}>
|
||||
Check the lyrics and listen to the instrumental. Fix any errors and approve.
|
||||
{t('youReviewDesc')}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 mt-1.5 flex-wrap">
|
||||
<span className="inline-block text-[10px] px-1.5 py-0.5 rounded-full font-medium" style={{ backgroundColor: 'rgba(255, 122, 204, 0.15)', color: 'var(--brand-pink)' }}>
|
||||
You
|
||||
{t('you')}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 text-[10px]" style={{ color: 'var(--text-muted)' }}>
|
||||
<svg width="12" height="12" viewBox="0 0 16 16" fill="none">
|
||||
<path d="M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v.401a1 1 0 0 1-.373.78L8.707 8.79a1 1 0 0 1-1.414 0L2.373 4.68A1 1 0 0 1 2 3.9V3.5Z" fill="currentColor" opacity="0.7"/>
|
||||
<path d="M2 6.12l4.586 3.59a2 2 0 0 0 2.828 0L14 6.12V12.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5V6.12Z" fill="currentColor" opacity="0.5"/>
|
||||
</svg>
|
||||
Email + chime when ready
|
||||
{t('emailChime')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -384,20 +386,20 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>Video delivered</p>
|
||||
<p className="text-sm font-medium" style={{ color: 'var(--text)' }}>{t('videoDelivered')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: 'var(--text-muted)' }}>
|
||||
After you approve, your karaoke video is rendered and uploaded. <span className="font-medium" style={{ color: 'var(--text)' }}>~10 minutes</span>
|
||||
{t('videoDeliveredDesc')}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 mt-1.5 flex-wrap">
|
||||
<span className="inline-block text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-green-500/15 text-green-400">
|
||||
Automatic
|
||||
{t('automatic')}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 text-[10px]" style={{ color: 'var(--text-muted)' }}>
|
||||
<svg width="12" height="12" viewBox="0 0 16 16" fill="none">
|
||||
<path d="M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v.401a1 1 0 0 1-.373.78L8.707 8.79a1 1 0 0 1-1.414 0L2.373 4.68A1 1 0 0 1 2 3.9V3.5Z" fill="currentColor" opacity="0.7"/>
|
||||
<path d="M2 6.12l4.586 3.59a2 2 0 0 0 2.828 0L14 6.12V12.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5V6.12Z" fill="currentColor" opacity="0.5"/>
|
||||
</svg>
|
||||
Email with link to view
|
||||
{t('emailWithLink')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -405,7 +407,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
</div>
|
||||
|
||||
<p className="text-[10px] text-center" style={{ color: 'var(--text-muted)' }}>
|
||||
Track progress in the <span className="font-medium" style={{ color: 'var(--text)' }}>Recent Jobs</span> list. Keep this tab open to hear the chime.
|
||||
{t('trackProgress')}
|
||||
</p>
|
||||
|
||||
<Button
|
||||
@@ -415,7 +417,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
style={{ borderColor: 'var(--card-border)', color: 'var(--text)' }}
|
||||
>
|
||||
<Music className="w-4 h-4 mr-2" />
|
||||
Create Another
|
||||
{t('createAnother')}
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
@@ -428,13 +430,13 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
<div className="flex items-start gap-2 rounded-lg p-3 border border-amber-500/30 bg-amber-500/10">
|
||||
<AlertTriangle className="w-5 h-5 text-amber-500 shrink-0 mt-0.5" />
|
||||
<div className="text-sm" style={{ color: 'var(--text)' }}>
|
||||
<p>You have no credits remaining. Buy credits to create new karaoke videos.</p>
|
||||
<p>{t('noCreditsWarning')}</p>
|
||||
<button
|
||||
onClick={() => setShowBuyCreditsDialog(true)}
|
||||
className="inline-block mt-1 text-sm font-medium underline"
|
||||
style={{ color: 'var(--brand-pink)' }}
|
||||
>
|
||||
Buy Credits
|
||||
{t('buyCredits')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -442,13 +444,14 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
|
||||
{/* Step indicator */}
|
||||
<div className="flex items-center gap-1" role="navigation" aria-label="Progress">
|
||||
{STEP_LABELS.map((label, i) => {
|
||||
{STEP_LABEL_KEYS.map((key, i) => {
|
||||
const stepNum = (i + 1) as Step
|
||||
const isActive = step === stepNum
|
||||
const isCompleted = step > stepNum
|
||||
const label = t(`stepLabels.${key}`)
|
||||
|
||||
return (
|
||||
<div key={label} className="flex items-center gap-1 flex-1">
|
||||
<div key={key} className="flex items-center gap-1 flex-1">
|
||||
<div className="flex items-center gap-1.5 shrink-0">
|
||||
<div
|
||||
className={`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-semibold shrink-0 transition-colors ${
|
||||
@@ -470,7 +473,7 @@ export function GuidedJobFlow({ onJobCreated }: GuidedJobFlowProps) {
|
||||
{label}
|
||||
</span>
|
||||
</div>
|
||||
{i < STEP_LABELS.length - 1 && (
|
||||
{i < STEP_LABEL_KEYS.length - 1 && (
|
||||
<div
|
||||
className="h-px flex-1 mx-1 hidden sm:block"
|
||||
style={{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useCallback, useRef, useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Upload, X, ImageIcon } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
@@ -23,19 +24,20 @@ function formatFileSize(bytes: number): string {
|
||||
}
|
||||
|
||||
export function ImageUploadField({ label, description, file, onChange, disabled, hidePreview }: ImageUploadFieldProps) {
|
||||
const t = useTranslations('imageUpload')
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
const [dragOver, setDragOver] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
const validate = useCallback((f: File): string | null => {
|
||||
if (!ALLOWED_TYPES.includes(f.type)) {
|
||||
return "Only PNG and JPG images are allowed."
|
||||
return t('onlyPngJpg')
|
||||
}
|
||||
if (f.size > MAX_SIZE_BYTES) {
|
||||
return `File too large (${formatFileSize(f.size)}). Maximum is 10 MB.`
|
||||
return t('fileTooLarge', { size: formatFileSize(f.size) })
|
||||
}
|
||||
return null
|
||||
}, [])
|
||||
}, [t])
|
||||
|
||||
const handleFile = useCallback((f: File) => {
|
||||
const err = validate(f)
|
||||
@@ -126,10 +128,10 @@ export function ImageUploadField({ label, description, file, onChange, disabled,
|
||||
>
|
||||
<Upload className="w-5 h-5" style={{ color: 'var(--text-muted)' }} />
|
||||
<p className="text-xs text-center" style={{ color: 'var(--text-muted)' }}>
|
||||
Drop an image here or <span style={{ color: 'var(--brand-pink)' }}>browse</span>
|
||||
{t('dropOrBrowse')}
|
||||
</p>
|
||||
<p className="text-[10px]" style={{ color: 'var(--text-muted)' }}>
|
||||
PNG or JPG, max 10 MB
|
||||
{t('maxSize')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Job, api } from "@/lib/api"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -15,6 +16,7 @@ interface JobActionsProps {
|
||||
}
|
||||
|
||||
export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
const t = useTranslations('jobActions')
|
||||
const [isRetrying, setIsRetrying] = useState(false)
|
||||
const [isDeleting, setIsDeleting] = useState(false)
|
||||
const { toast } = useToast()
|
||||
@@ -28,8 +30,8 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
try {
|
||||
await api.retryJob(job.job_id)
|
||||
toast({
|
||||
title: "Job retry started",
|
||||
description: "The job is being retried. Refreshing status...",
|
||||
title: t('jobRetryStarted'),
|
||||
description: t('jobRetryStartedDesc'),
|
||||
variant: "default",
|
||||
})
|
||||
onRefresh()
|
||||
@@ -42,7 +44,7 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
"Failed to retry job. Please try again."
|
||||
|
||||
toast({
|
||||
title: "Retry failed",
|
||||
title: t('retryFailed'),
|
||||
description: errorMessage,
|
||||
variant: "destructive",
|
||||
})
|
||||
@@ -52,7 +54,7 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
}
|
||||
|
||||
async function handleDelete() {
|
||||
if (!confirm("Are you sure you want to permanently cancel and delete this job? This cannot be undone.")) return
|
||||
if (!confirm(t('permanentlyCancel'))) return
|
||||
|
||||
// Statuses where the backend does NOT refund credits
|
||||
const noRefundStatuses = ["complete", "prep_complete", "failed", "cancelled"]
|
||||
@@ -65,13 +67,13 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
await fetchUser()
|
||||
const remaining = useAuth.getState().user?.credits ?? 0
|
||||
toast({
|
||||
title: "Credit refunded",
|
||||
description: `1 credit returned to your account. ${remaining} remaining.`,
|
||||
title: t('creditRefunded'),
|
||||
description: t('creditRefundedDesc', { remaining }),
|
||||
})
|
||||
} else {
|
||||
toast({
|
||||
title: "Job deleted",
|
||||
description: "The job has been permanently deleted.",
|
||||
title: t('jobDeleted'),
|
||||
description: t('jobDeletedDesc'),
|
||||
})
|
||||
}
|
||||
onRefresh()
|
||||
@@ -83,7 +85,7 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
"Failed to delete job. Please try again."
|
||||
|
||||
toast({
|
||||
title: "Delete failed",
|
||||
title: t('deleteFailed'),
|
||||
description: errorMessage,
|
||||
variant: "destructive",
|
||||
})
|
||||
@@ -113,7 +115,7 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
) : (
|
||||
<Trash2 className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Delete
|
||||
{t('delete')}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -131,7 +133,7 @@ export function JobActions({ job, onRefresh }: JobActionsProps) {
|
||||
) : (
|
||||
<RotateCcw className="w-3 h-3 mr-1" />
|
||||
)}
|
||||
Retry
|
||||
{t('retry')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Job } from "@/lib/api"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Zap } from "lucide-react"
|
||||
@@ -17,15 +18,21 @@ import { useAuth } from "@/lib/auth"
|
||||
* Displays: "[4/10] Processing..." with colored text and optional progress bar
|
||||
*/
|
||||
function StatusIndicator({ job }: { job: Job }) {
|
||||
const t = useTranslations('jobCard')
|
||||
const tStatus = useTranslations('jobStatus')
|
||||
const { step, total, label, isBlocking, color } = getJobStep(job)
|
||||
const formattedStatus = formatStepIndicator(step, total, label)
|
||||
// Translate status label(s) — may contain " + " for combined parallel status
|
||||
const translatedLabel = label.includes(' + ')
|
||||
? label.split(' + ').map(k => tStatus(k as any)).join(' + ')
|
||||
: tStatus(label as any)
|
||||
const formattedStatus = formatStepIndicator(step, total, translatedLabel)
|
||||
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<span className={color}>{formattedStatus}</span>
|
||||
{isBlocking && (
|
||||
<span className="text-amber-400 text-[10px] font-medium uppercase tracking-wide">
|
||||
Action needed
|
||||
{t('actionNeeded')}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
@@ -76,6 +83,7 @@ interface JobCardProps {
|
||||
}
|
||||
|
||||
export function JobCard({ job, onRefresh, showAdminControls }: JobCardProps) {
|
||||
const t = useTranslations('jobCard')
|
||||
const [showAudioSearch, setShowAudioSearch] = useState(false)
|
||||
const { user } = useAuth()
|
||||
const isAdmin = user?.role === 'admin'
|
||||
@@ -97,9 +105,9 @@ export function JobCard({ job, onRefresh, showAdminControls }: JobCardProps) {
|
||||
return (
|
||||
<div className="flex items-center gap-1 text-xs text-amber-400">
|
||||
<Zap className="w-3 h-3" />
|
||||
Will auto-{job.status === "awaiting_review" || job.status === "in_review" ? "accept" :
|
||||
job.status === "awaiting_instrumental_selection" ? "select" :
|
||||
"select first"}
|
||||
{job.status === "awaiting_review" || job.status === "in_review" ? t('autoAccept') :
|
||||
job.status === "awaiting_instrumental_selection" ? t('autoSelect') :
|
||||
t('willAutoSelectFirst')}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -111,7 +119,7 @@ export function JobCard({ job, onRefresh, showAdminControls }: JobCardProps) {
|
||||
href={`/app/jobs#/${job.job_id}/review`}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-primary-500 hover:bg-primary-600 text-white"
|
||||
>
|
||||
Review Lyrics
|
||||
{t('reviewLyrics')}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
@@ -122,7 +130,7 @@ export function JobCard({ job, onRefresh, showAdminControls }: JobCardProps) {
|
||||
href={`/app/jobs#/${job.job_id}/audio-edit`}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-primary-500 hover:bg-primary-600 text-white"
|
||||
>
|
||||
Edit Audio
|
||||
{t('editAudio')}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
@@ -134,7 +142,7 @@ export function JobCard({ job, onRefresh, showAdminControls }: JobCardProps) {
|
||||
onClick={() => setShowAudioSearch(true)}
|
||||
className="text-xs h-7 px-3 bg-primary-500 hover:bg-primary-600"
|
||||
>
|
||||
Select Audio
|
||||
{t('selectAudio')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -146,7 +154,7 @@ export function JobCard({ job, onRefresh, showAdminControls }: JobCardProps) {
|
||||
href={`/app/jobs#/${job.job_id}/instrumental`}
|
||||
className="inline-flex items-center gap-1 text-xs px-3 py-1.5 rounded bg-primary-500 hover:bg-primary-600 text-white"
|
||||
>
|
||||
Select Instrumental
|
||||
{t('selectInstrumental')}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect, useMemo, useCallback, useRef } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api, ApiError } from "@/lib/api"
|
||||
import type { CatalogArtistResult, CatalogTrackResult, CommunityCheckResponse } from "@/lib/api"
|
||||
import { useAuth } from "@/lib/auth"
|
||||
@@ -20,6 +21,8 @@ interface JobSubmissionProps {
|
||||
}
|
||||
|
||||
export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
const t = useTranslations('jobSubmission')
|
||||
const tFlow = useTranslations('jobFlow')
|
||||
const { user, fetchUser } = useAuth()
|
||||
const { features, isDefault, tenant } = useTenant()
|
||||
const { toast } = useToast()
|
||||
@@ -186,11 +189,11 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.status === 402) {
|
||||
setIsCreditError(true)
|
||||
setError("You're out of credits. Buy more to continue creating karaoke videos.")
|
||||
setError(t('outOfCredits'))
|
||||
} else if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError("Failed to create job")
|
||||
setError(t('failedToCreateJob'))
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
@@ -229,11 +232,11 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.status === 402) {
|
||||
setIsCreditError(true)
|
||||
setError("You're out of credits. Buy more to continue creating karaoke videos.")
|
||||
setError(t('outOfCredits'))
|
||||
} else if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError("Failed to create job")
|
||||
setError(t('failedToCreateJob'))
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
@@ -267,11 +270,11 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError && err.status === 402) {
|
||||
setIsCreditError(true)
|
||||
setError("You're out of credits. Buy more to continue creating karaoke videos.")
|
||||
setError(t('outOfCredits'))
|
||||
} else if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError("Failed to search for audio")
|
||||
setError(t('failedToCreateJob'))
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
@@ -294,13 +297,13 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<div className="flex items-start gap-2 rounded-lg p-3 mb-4 border border-amber-500/30 bg-amber-500/10">
|
||||
<AlertTriangle className="w-5 h-5 text-amber-500 shrink-0 mt-0.5" />
|
||||
<div className="text-sm" style={{ color: 'var(--text)' }}>
|
||||
<p>You have no credits remaining. Buy credits to create new karaoke videos.</p>
|
||||
<p>{tFlow('noCreditsWarning')}</p>
|
||||
<button
|
||||
onClick={() => setShowBuyCreditsDialog(true)}
|
||||
className="inline-block mt-1 text-sm font-medium underline"
|
||||
style={{ color: 'var(--brand-pink)' }}
|
||||
>
|
||||
Buy Credits
|
||||
{tFlow('buyCredits')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -321,7 +324,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
style={{ color: activeTab === 'search' ? 'white' : 'var(--text-muted)' }}
|
||||
>
|
||||
<Music className="w-4 h-4 shrink-0" />
|
||||
<span className="truncate">Search</span>
|
||||
<span className="truncate">{t('search')}</span>
|
||||
</TabsTrigger>
|
||||
)}
|
||||
{availableTabs.includes("upload") && (
|
||||
@@ -331,7 +334,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
style={{ color: activeTab === 'upload' ? 'white' : 'var(--text-muted)' }}
|
||||
>
|
||||
<Upload className="w-4 h-4 shrink-0" />
|
||||
<span className="truncate">Upload</span>
|
||||
<span className="truncate">{t('upload')}</span>
|
||||
</TabsTrigger>
|
||||
)}
|
||||
{availableTabs.includes("url") && (
|
||||
@@ -341,7 +344,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
style={{ color: activeTab === 'url' ? 'white' : 'var(--text-muted)' }}
|
||||
>
|
||||
<Youtube className="w-4 h-4 shrink-0" />
|
||||
<span className="truncate">URL</span>
|
||||
<span className="truncate">{t('url')}</span>
|
||||
</TabsTrigger>
|
||||
)}
|
||||
</TabsList>
|
||||
@@ -351,7 +354,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<TabsContent value="upload" className={availableTabs.length === 1 ? "" : "mt-4"}>
|
||||
<form onSubmit={handleUploadSubmit} className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="audio-file" style={{ color: 'var(--text)' }}>Audio File</Label>
|
||||
<Label htmlFor="audio-file" style={{ color: 'var(--text)' }}>{t('audioFile')}</Label>
|
||||
<div
|
||||
className="relative border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer"
|
||||
style={{
|
||||
@@ -375,8 +378,8 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<p className="font-medium mb-1" style={{ color: 'var(--text)' }}>Click to upload</p>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>MP3, WAV, FLAC, M4A, or OGG</p>
|
||||
<p className="font-medium mb-1" style={{ color: 'var(--text)' }}>{t('clickToUpload')}</p>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>{t('supportedFormats')}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -384,7 +387,7 @@ 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="upload-artist" style={{ color: 'var(--text)' }}>Artist</Label>
|
||||
<Label htmlFor="upload-artist" style={{ color: 'var(--text)' }}>{tFlow('artist')}</Label>
|
||||
<AutocompleteInput
|
||||
id="upload-artist"
|
||||
placeholder="Artist name"
|
||||
@@ -396,7 +399,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="upload-title" style={{ color: 'var(--text)' }}>Title</Label>
|
||||
<Label htmlFor="upload-title" style={{ color: 'var(--text)' }}>{tFlow('title')}</Label>
|
||||
<AutocompleteInput
|
||||
id="upload-title"
|
||||
placeholder="Song title"
|
||||
@@ -409,7 +412,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Tip:</span> Start typing and select from suggestions for correct formatting, or type freely.
|
||||
<span className="text-amber-500 font-medium">Tip:</span> {t('artistTip')}
|
||||
</p>
|
||||
|
||||
{/* Private (no YouTube upload) mode */}
|
||||
@@ -425,10 +428,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="private-upload" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
Private (no YouTube upload)
|
||||
{t('privateNoYoutubeUpload')}
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
Files delivered via Dropbox only. No YouTube or Google Drive upload.
|
||||
{t('filesDropboxOnly')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -451,10 +454,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Creating Job...
|
||||
{t('creatingJob')}
|
||||
</>
|
||||
) : (
|
||||
"Create Karaoke Video"
|
||||
tFlow('createKaraokeVideo')
|
||||
)}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -465,13 +468,13 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
<TabsContent value="url" className={availableTabs.length === 1 ? "" : "mt-4"}>
|
||||
<form onSubmit={handleUrlSubmit} className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="youtube-url" style={{ color: 'var(--text)' }}>YouTube URL</Label>
|
||||
<Label htmlFor="youtube-url" style={{ color: 'var(--text)' }}>{t('youtubeUrlLabel')}</Label>
|
||||
<div className="relative">
|
||||
<Youtube className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4" style={{ color: 'var(--text-muted)' }} />
|
||||
<Input
|
||||
id="youtube-url"
|
||||
type="url"
|
||||
placeholder="https://youtube.com/watch?v=..."
|
||||
placeholder={t('youtubeUrlPlaceholder')}
|
||||
value={youtubeUrl}
|
||||
onChange={(e) => setYoutubeUrl(e.target.value)}
|
||||
className="pl-10"
|
||||
@@ -483,7 +486,7 @@ 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</Label>
|
||||
<Label htmlFor="youtube-artist" style={{ color: 'var(--text)' }}>{tFlow('artist')}</Label>
|
||||
<AutocompleteInput
|
||||
id="youtube-artist"
|
||||
placeholder="Artist name"
|
||||
@@ -495,7 +498,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="youtube-title" style={{ color: 'var(--text)' }}>Title</Label>
|
||||
<Label htmlFor="youtube-title" style={{ color: 'var(--text)' }}>{tFlow('title')}</Label>
|
||||
<AutocompleteInput
|
||||
id="youtube-title"
|
||||
placeholder="Song title"
|
||||
@@ -508,7 +511,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Tip:</span> Start typing and select from suggestions for correct formatting, or type freely.
|
||||
<span className="text-amber-500 font-medium">Tip:</span> {t('artistTip')}
|
||||
</p>
|
||||
|
||||
{/* Private (no YouTube upload) mode */}
|
||||
@@ -524,10 +527,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="private-url" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
Private (no YouTube upload)
|
||||
{t('privateNoYoutubeUpload')}
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
Files delivered via Dropbox only. No YouTube or Google Drive upload.
|
||||
{t('filesDropboxOnly')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -550,10 +553,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Creating Job...
|
||||
{t('creatingJob')}
|
||||
</>
|
||||
) : (
|
||||
"Create Karaoke Video"
|
||||
tFlow('createKaraokeVideo')
|
||||
)}
|
||||
</Button>
|
||||
</form>
|
||||
@@ -565,10 +568,10 @@ 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 Audio Online</Label>
|
||||
<Label style={{ color: 'var(--text)' }}>{t('searchForAudioOnline')}</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>
|
||||
<Label htmlFor="search-artist" className="text-xs" style={{ color: 'var(--text-muted)' }}>{tFlow('artist')}</Label>
|
||||
<AutocompleteInput
|
||||
id="search-artist"
|
||||
data-testid="search-artist-input"
|
||||
@@ -581,7 +584,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="search-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>Title</Label>
|
||||
<Label htmlFor="search-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>{tFlow('title')}</Label>
|
||||
<AutocompleteInput
|
||||
id="search-title"
|
||||
data-testid="search-title-input"
|
||||
@@ -596,7 +599,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
<span className="text-amber-500 font-medium">Tip:</span> Start typing and select from suggestions for correct formatting, or type freely.
|
||||
<span className="text-amber-500 font-medium">Tip:</span> {t('artistTip')}
|
||||
</p>
|
||||
|
||||
{/* Community version check banner */}
|
||||
@@ -621,7 +624,7 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
) : (
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
)}
|
||||
Use different artist/title for title screen
|
||||
{t('useDisplayAs')}
|
||||
</button>
|
||||
{showDisplayAs && (
|
||||
<div className="space-y-2 pl-6">
|
||||
@@ -630,10 +633,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
</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>
|
||||
<Label htmlFor="display-artist" className="text-xs" style={{ color: 'var(--text-muted)' }}>{t('displayArtist')}</Label>
|
||||
<Input
|
||||
id="display-artist"
|
||||
placeholder="e.g., Footloose (Broadway Cast)"
|
||||
placeholder={t('displayArtistPlaceholder')}
|
||||
value={displayArtist}
|
||||
onChange={(e) => setDisplayArtist(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
@@ -641,10 +644,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="display-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>Display Title</Label>
|
||||
<Label htmlFor="display-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>{t('displayTitle')}</Label>
|
||||
<Input
|
||||
id="display-title"
|
||||
placeholder="e.g., I Can't Stand Still"
|
||||
placeholder={t('displayTitlePlaceholder')}
|
||||
value={displayTitle}
|
||||
onChange={(e) => setDisplayTitle(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
@@ -669,10 +672,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
/>
|
||||
<div>
|
||||
<Label htmlFor="private-search" className="cursor-pointer" style={{ color: 'var(--text)' }}>
|
||||
Private (no YouTube upload)
|
||||
{t('privateNoYoutubeUpload')}
|
||||
</Label>
|
||||
<p className="text-xs mt-1" style={{ color: 'var(--text-muted)' }}>
|
||||
Files delivered via Dropbox only. No YouTube or Google Drive upload.
|
||||
{t('filesDropboxOnly')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -695,10 +698,10 @@ export function JobSubmission({ onJobCreated }: JobSubmissionProps) {
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Searching...
|
||||
{t('searching')}
|
||||
</>
|
||||
) : (
|
||||
"Search & Create Job"
|
||||
t('searchCreateJob')
|
||||
)}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useRef, useCallback, useEffect, useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api, adminApi, Job } from "@/lib/api"
|
||||
import { useTenant } from "@/lib/tenant"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -34,6 +35,9 @@ interface OutputLinksProps {
|
||||
}
|
||||
|
||||
export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
const t = useTranslations('outputLinks')
|
||||
const tc = useTranslations('common')
|
||||
const tCard = useTranslations('jobCard')
|
||||
// Use file_urls from job directly - no API call needed
|
||||
const downloadUrls = job.file_urls || null
|
||||
// Use state_data from job directly - no API call needed
|
||||
@@ -207,16 +211,16 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
YouTube
|
||||
{t('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"}
|
||||
title={t('copyYoutubeUrl')}
|
||||
aria-label={copiedUrl === youtubeUrl ? t('youtubeUrlCopied') : t('copyYoutubeUrl')}
|
||||
>
|
||||
{copiedUrl === youtubeUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
|
||||
{copiedUrl === youtubeUrl ? <span className="text-[10px]">{t('copied')}</span> : <Copy className="w-3 h-3" />}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -230,16 +234,16 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<FolderOpen className="w-3 h-3" />
|
||||
Dropbox
|
||||
{t('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"}
|
||||
title={t('copyDropboxUrl')}
|
||||
aria-label={copiedUrl === dropboxUrl ? t('dropboxUrlCopied') : t('copyDropboxUrl')}
|
||||
>
|
||||
{copiedUrl === dropboxUrl ? <span className="text-[10px]">Copied!</span> : <Copy className="w-3 h-3" />}
|
||||
{copiedUrl === dropboxUrl ? <span className="text-[10px]">{t('copied')}</span> : <Copy className="w-3 h-3" />}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -256,7 +260,7 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
4K Video
|
||||
{t('video4k')}
|
||||
</a>
|
||||
)}
|
||||
{downloadUrls?.finals?.lossy_720p_mp4 && (
|
||||
@@ -266,7 +270,7 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
720p Video
|
||||
{t('video720p')}
|
||||
</a>
|
||||
)}
|
||||
{(downloadUrls?.finals?.with_vocals_mp4 || downloadUrls?.videos?.with_vocals) && (
|
||||
@@ -279,7 +283,7 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
With Vocals
|
||||
{t('withVocals')}
|
||||
</a>
|
||||
)}
|
||||
{downloadUrls?.packages?.cdg_zip && (
|
||||
@@ -289,7 +293,7 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
CDG
|
||||
{t('cdg')}
|
||||
</a>
|
||||
)}
|
||||
{downloadUrls?.packages?.txt_zip && (
|
||||
@@ -299,7 +303,7 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Download className="w-3 h-3" />
|
||||
TXT
|
||||
{t('txt')}
|
||||
</a>
|
||||
)}
|
||||
</>
|
||||
@@ -322,8 +326,8 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
<Lock className="w-3 h-3" />
|
||||
)}
|
||||
{isChangingVisibility
|
||||
? (isPrivate ? "Making Public..." : "Making Private...")
|
||||
: (isPrivate ? "Make Public" : "Make Private")
|
||||
? (isPrivate ? t('makingPublic') : t('makingPrivate'))
|
||||
: (isPrivate ? t('makePublic') : t('makePrivate'))
|
||||
}
|
||||
</button>
|
||||
)}
|
||||
@@ -338,19 +342,19 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
title="Send completion email"
|
||||
>
|
||||
<Mail className="w-3 h-3" />
|
||||
Email
|
||||
{t('email')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => { e.stopPropagation(); copyCompletionMessage() }}
|
||||
disabled={isLoadingMessage}
|
||||
className="inline-flex items-center text-xs px-2 py-1.5 rounded-r bg-[#1a1a1a] hover:bg-[#2a2a2a] text-[var(--text)] border border-[var(--card-border)] disabled:opacity-50 transition-colors"
|
||||
title="Copy completion message to clipboard"
|
||||
title={t('copyCompletionMessage')}
|
||||
>
|
||||
{isLoadingMessage ? (
|
||||
<Loader2 className="w-3 h-3 animate-spin" />
|
||||
) : copiedMessage ? (
|
||||
<span className="text-[10px]">Copied!</span>
|
||||
<span className="text-[10px]">{t('copied')}</span>
|
||||
) : (
|
||||
<Copy className="w-3 h-3" />
|
||||
)}
|
||||
@@ -380,36 +384,36 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
title="View job details in admin"
|
||||
>
|
||||
<Settings className="w-3 h-3" />
|
||||
Admin
|
||||
{t('admin')}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!hasOutputs && !isAdmin && !canChangeVisibility && (
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>No outputs available yet</p>
|
||||
<p className="text-xs" style={{ color: 'var(--text-muted)' }}>{tCard('noOutputsAvailable')}</p>
|
||||
)}
|
||||
|
||||
{/* Send Email Dialog */}
|
||||
<Dialog open={showEmailDialog} onOpenChange={setShowEmailDialog}>
|
||||
<DialogContent className="sm:max-w-[425px]" onClick={(e) => e.stopPropagation()}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Send Completion Email</DialogTitle>
|
||||
<DialogTitle>{t('sendCompletionEmail')}</DialogTitle>
|
||||
<DialogDescription>
|
||||
Send the job completion message to an email address. The email will be CC'd to gen@nomadkaraoke.com.
|
||||
{t('sendToEmailDesc')}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="grid gap-4 py-4">
|
||||
<div className="grid grid-cols-4 items-center gap-4">
|
||||
<Label htmlFor="email" className="text-right">
|
||||
Email
|
||||
{t('emailAddress')}
|
||||
</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
value={emailInput}
|
||||
onChange={(e) => setEmailInput(e.target.value)}
|
||||
placeholder="customer@example.com"
|
||||
placeholder={t('emailPlaceholder')}
|
||||
className="col-span-3"
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
@@ -426,7 +430,7 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
onClick={() => setShowEmailDialog(false)}
|
||||
disabled={isSendingEmail}
|
||||
>
|
||||
Cancel
|
||||
{tc('cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@@ -436,12 +440,12 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
{isSendingEmail ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Sending...
|
||||
{t('sending')}
|
||||
</>
|
||||
) : emailSent ? (
|
||||
"Sent!"
|
||||
t('sent')
|
||||
) : (
|
||||
"Send Email"
|
||||
t('sendEmail')
|
||||
)}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
@@ -453,36 +457,36 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
<AlertDialogContent onClick={(e) => e.stopPropagation()}>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
{isPrivate ? "Make This Track Public?" : "Make This Track Private?"}
|
||||
{isPrivate ? t('makePublicTitle') : t('makePrivateTitle')}
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription asChild>
|
||||
<div className="space-y-3">
|
||||
{isPrivate ? (
|
||||
<>
|
||||
<p>This will:</p>
|
||||
<p>{t('thisWill')}</p>
|
||||
<ul className="list-disc pl-5 space-y-1">
|
||||
<li>Remove any custom styling (backgrounds, colors) and reset to the standard Nomad Karaoke theme</li>
|
||||
<li>Regenerate title and end screens</li>
|
||||
<li>Re-render the karaoke video with default branding</li>
|
||||
<li>Publish to YouTube, Google Drive, and Dropbox</li>
|
||||
<li>{t('removeCustomStyling')}</li>
|
||||
<li>{t('regenerateTitleEndScreens')}</li>
|
||||
<li>{t('reRenderWithDefault')}</li>
|
||||
<li>{t('publishToAll')}</li>
|
||||
</ul>
|
||||
<p>This process takes approximately 15-30 minutes. You'll receive an email when it's complete.</p>
|
||||
<p>{t('takes15To30Minutes')}</p>
|
||||
<p className="font-medium" style={{ color: 'var(--text)' }}>
|
||||
Any custom styling you applied will be permanently removed.
|
||||
{t('customStylingRemoved')}
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p>This will:</p>
|
||||
<p>{t('thisWill')}</p>
|
||||
<ul className="list-disc pl-5 space-y-1">
|
||||
<li>Remove the video from YouTube</li>
|
||||
<li>Remove files from Google Drive</li>
|
||||
<li>Move Dropbox files from the public folder to the private folder</li>
|
||||
<li>Assign a new private brand code</li>
|
||||
<li>{t('removeFromYoutube')}</li>
|
||||
<li>{t('removeFromGoogleDrive')}</li>
|
||||
<li>{t('moveDropboxPrivate')}</li>
|
||||
<li>{t('assignPrivateBrand')}</li>
|
||||
</ul>
|
||||
<p>The video content won't change. This usually takes about 1-2 minutes.</p>
|
||||
<p>{t('videoContentWontChange')}</p>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
You can change it back to public later, but that will require re-rendering the video (~15-30 minutes).
|
||||
{t('canChangeBack')}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
@@ -490,9 +494,9 @@ export function OutputLinks({ job, onJobUpdated }: OutputLinksProps) {
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogCancel>{tc('cancel')}</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={handleChangeVisibility}>
|
||||
{isPrivate ? "Make Public" : "Make Private"}
|
||||
{isPrivate ? t('makePublic') : t('makePrivate')}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useRef, useCallback } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api, ApiError } from "@/lib/api"
|
||||
import { useTenant } from "@/lib/tenant"
|
||||
import { CheckCircle2, Upload, Music, Loader2, AlertTriangle } from "lucide-react"
|
||||
@@ -22,6 +23,7 @@ interface TenantJobFlowProps {
|
||||
type SubmitPhase = "idle" | "creating" | "uploading-mixed" | "uploading-instrumental" | "completing" | "done"
|
||||
|
||||
export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
const t = useTranslations('jobFlow')
|
||||
const { branding } = useTenant()
|
||||
|
||||
// Form fields
|
||||
@@ -139,7 +141,7 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
</div>
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold" style={{ color: "var(--text)" }}>
|
||||
Track Submitted
|
||||
{t('trackSubmitted')}
|
||||
</h2>
|
||||
<p className="text-sm mt-1" style={{ color: "var(--text-muted)" }}>
|
||||
<span className="font-medium" style={{ color: "var(--text)" }}>
|
||||
@@ -156,7 +158,7 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
|
||||
{/* Timeline — simplified for tenant (no audio processing step) */}
|
||||
<p className="text-xs font-semibold uppercase tracking-wider" style={{ color: "var(--text-muted)" }}>
|
||||
What happens next
|
||||
{t('whatsHappensNext')}
|
||||
</p>
|
||||
<div className="space-y-0 mt-3">
|
||||
{/* Step 1: Lyrics transcription */}
|
||||
@@ -171,12 +173,12 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
<div className="w-px flex-1 min-h-[20px]" style={{ backgroundColor: "var(--card-border)" }} />
|
||||
</div>
|
||||
<div className="pb-4 pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>Lyrics transcription</p>
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>{t('lyricsTranscription')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: "var(--text-muted)" }}>
|
||||
We transcribe and sync lyrics from your audio. <span className="font-medium" style={{ color: "var(--text)" }}>~5 minutes</span>
|
||||
{t('lyricsTranscriptionDesc')}
|
||||
</p>
|
||||
<span className="inline-block mt-1.5 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-blue-500/15 text-blue-400">
|
||||
Automatic
|
||||
{t('automatic')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,20 +194,20 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
<div className="w-px flex-1 min-h-[20px]" style={{ backgroundColor: "var(--card-border)" }} />
|
||||
</div>
|
||||
<div className="pb-4 pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>Review lyrics</p>
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>{t('reviewLyrics')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: "var(--text-muted)" }}>
|
||||
Check the synced lyrics and fix any errors.
|
||||
{t('reviewLyricsDesc')}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 mt-1.5 flex-wrap">
|
||||
<span className="inline-block text-[10px] px-1.5 py-0.5 rounded-full font-medium" style={{ backgroundColor: "rgba(255, 122, 204, 0.15)", color: "var(--brand-pink)" }}>
|
||||
You
|
||||
{t('you')}
|
||||
</span>
|
||||
<span className="flex items-center gap-1 text-[10px]" style={{ color: "var(--text-muted)" }}>
|
||||
<svg width="12" height="12" viewBox="0 0 16 16" fill="none">
|
||||
<path d="M2 3.5A1.5 1.5 0 0 1 3.5 2h9A1.5 1.5 0 0 1 14 3.5v.401a1 1 0 0 1-.373.78L8.707 8.79a1 1 0 0 1-1.414 0L2.373 4.68A1 1 0 0 1 2 3.9V3.5Z" fill="currentColor" opacity="0.7"/>
|
||||
<path d="M2 6.12l4.586 3.59a2 2 0 0 0 2.828 0L14 6.12V12.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5V6.12Z" fill="currentColor" opacity="0.5"/>
|
||||
</svg>
|
||||
Email when ready
|
||||
{t('emailWhenReady')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -222,19 +224,19 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
</div>
|
||||
</div>
|
||||
<div className="pt-1">
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>Video delivered</p>
|
||||
<p className="text-sm font-medium" style={{ color: "var(--text)" }}>{t('videoDelivered')}</p>
|
||||
<p className="text-xs mt-0.5" style={{ color: "var(--text-muted)" }}>
|
||||
After approval, your karaoke video is rendered and delivered. <span className="font-medium" style={{ color: "var(--text)" }}>~10 minutes</span>
|
||||
{t('afterApproval')}
|
||||
</p>
|
||||
<span className="inline-block mt-1.5 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-green-500/15 text-green-400">
|
||||
Automatic
|
||||
{t('automatic')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="text-[10px] text-center" style={{ color: "var(--text-muted)" }}>
|
||||
Track progress in the <span className="font-medium" style={{ color: "var(--text)" }}>Recent Jobs</span> list.
|
||||
{t('trackProgressTenant')}
|
||||
</p>
|
||||
|
||||
<Button
|
||||
@@ -244,7 +246,7 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
style={{ borderColor: "var(--card-border)", color: "var(--text)" }}
|
||||
>
|
||||
<Music className="w-4 h-4 mr-2" />
|
||||
Submit Another Track
|
||||
{t('submitAnother')}
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
@@ -256,7 +258,7 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
<div className="space-y-4">
|
||||
{/* Artist */}
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="tenant-artist" style={{ color: "var(--text)" }}>Artist</Label>
|
||||
<Label htmlFor="tenant-artist" style={{ color: "var(--text)" }}>{t('artist')}</Label>
|
||||
<Input
|
||||
id="tenant-artist"
|
||||
placeholder="e.g. Adele"
|
||||
@@ -269,7 +271,7 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
|
||||
{/* Title */}
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="tenant-title" style={{ color: "var(--text)" }}>Title</Label>
|
||||
<Label htmlFor="tenant-title" style={{ color: "var(--text)" }}>{t('title')}</Label>
|
||||
<Input
|
||||
id="tenant-title"
|
||||
placeholder="e.g. Someone Like You"
|
||||
@@ -318,10 +320,10 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
<div className="flex items-center gap-2 text-sm" style={{ color: "var(--text-muted)" }}>
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
<span>
|
||||
{phase === "creating" && "Creating job..."}
|
||||
{phase === "uploading-mixed" && "Uploading mixed audio..."}
|
||||
{phase === "uploading-instrumental" && "Uploading instrumental..."}
|
||||
{phase === "completing" && "Finalizing..."}
|
||||
{phase === "creating" && t('creating')}
|
||||
{phase === "uploading-mixed" && t('creating')}
|
||||
{phase === "uploading-instrumental" && t('creating')}
|
||||
{phase === "completing" && t('creating')}
|
||||
</span>
|
||||
</div>
|
||||
{(phase === "uploading-mixed" || phase === "uploading-instrumental") && (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useState, useEffect } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { api } from "@/lib/api"
|
||||
import { useTenant } from "@/lib/tenant"
|
||||
import type { VideoThemeSummary } from "@/lib/video-themes"
|
||||
@@ -17,6 +18,7 @@ interface ThemeSelectorProps {
|
||||
}
|
||||
|
||||
export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps) {
|
||||
const t = useTranslations('themeSelector')
|
||||
const { defaults, isDefault: isDefaultTenant } = useTenant()
|
||||
const [themes, setThemes] = useState<VideoThemeSummary[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -51,7 +53,7 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to load themes:", err)
|
||||
setError("Failed to load themes")
|
||||
setError(t('failedToLoadThemes'))
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -67,7 +69,7 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
<div className="space-y-2">
|
||||
<Label className="flex items-center gap-2" style={{ color: 'var(--text)' }}>
|
||||
<Palette className="w-4 h-4" />
|
||||
Video Theme
|
||||
{t('videoTheme')}
|
||||
</Label>
|
||||
<Skeleton className="h-10 w-full" style={{ backgroundColor: 'var(--secondary)' }} />
|
||||
</div>
|
||||
@@ -79,11 +81,11 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
<div className="space-y-2">
|
||||
<Label className="flex items-center gap-2" style={{ color: 'var(--text)' }}>
|
||||
<Palette className="w-4 h-4" />
|
||||
Video Theme
|
||||
{t('videoTheme')}
|
||||
</Label>
|
||||
<div className="flex items-center gap-2 text-sm text-amber-400 bg-amber-500/10 rounded p-2">
|
||||
<AlertCircle className="w-4 h-4" />
|
||||
{error || "No themes available"}
|
||||
{error || t('noThemesAvailable')}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -95,7 +97,7 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
<div className="space-y-2">
|
||||
<Label className="flex items-center gap-2" style={{ color: 'var(--text)' }}>
|
||||
<Palette className="w-4 h-4" />
|
||||
Video Theme
|
||||
{t('videoTheme')}
|
||||
</Label>
|
||||
<div
|
||||
className="flex items-center gap-2 px-3 py-2 rounded-md border"
|
||||
@@ -134,7 +136,7 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
id="theme-select"
|
||||
style={{ backgroundColor: 'var(--secondary)', borderColor: 'var(--card-border)', color: 'var(--text)' }}
|
||||
>
|
||||
<SelectValue placeholder="Select a theme..." />
|
||||
<SelectValue placeholder={t('selectATheme')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent style={{ backgroundColor: 'var(--card)', borderColor: 'var(--card-border)' }}>
|
||||
{themes.map((theme) => (
|
||||
@@ -146,7 +148,7 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
<div className="flex items-center gap-2">
|
||||
<span>{theme.name}</span>
|
||||
{theme.is_default && (
|
||||
<span className="text-xs text-amber-400">(Default)</span>
|
||||
<span className="text-xs text-amber-400">{t('default')}</span>
|
||||
)}
|
||||
</div>
|
||||
</SelectItem>
|
||||
@@ -166,9 +168,9 @@ export function ThemeSelector({ value, onChange, disabled }: ThemeSelectorProps)
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
{showPreview ? (
|
||||
<><EyeOff className="w-4 h-4 mr-1.5" />Hide preview</>
|
||||
<><EyeOff className="w-4 h-4 mr-1.5" />{t('hidePreview')}</>
|
||||
) : (
|
||||
<><Eye className="w-4 h-4 mr-1.5" />Show preview</>
|
||||
<><Eye className="w-4 h-4 mr-1.5" />{t('showPreview')}</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useRef, useEffect, useCallback } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
|
||||
interface TitleCardPreviewProps {
|
||||
artist: string
|
||||
@@ -123,6 +124,7 @@ function drawTextBlock(
|
||||
}
|
||||
|
||||
export function TitleCardPreview({ artist, title, customBackgroundUrl, backgroundColor, titleColor, artistColor }: TitleCardPreviewProps) {
|
||||
const t = useTranslations('titleCardPreview')
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null)
|
||||
|
||||
const effectiveTitleColor = titleColor || TITLE_COLOR
|
||||
@@ -172,8 +174,8 @@ export function TitleCardPreview({ artist, title, customBackgroundUrl, backgroun
|
||||
}
|
||||
|
||||
// Apply uppercase transform (matching style_params.json title_text_transform/artist_text_transform)
|
||||
const titleText = (title || "Song Title").toUpperCase()
|
||||
const artistText = (artist || "Artist").toUpperCase()
|
||||
const titleText = (title || t('songTitle')).toUpperCase()
|
||||
const artistText = (artist || t('artist')).toUpperCase()
|
||||
|
||||
// Draw title
|
||||
drawTextBlock(
|
||||
@@ -192,7 +194,7 @@ export function TitleCardPreview({ artist, title, customBackgroundUrl, backgroun
|
||||
artist ? effectiveArtistColor : "rgba(255,223,107,0.25)",
|
||||
fontFamily,
|
||||
)
|
||||
}, [artist, title, customBackgroundUrl, backgroundColor, effectiveTitleColor, effectiveArtistColor])
|
||||
}, [artist, title, customBackgroundUrl, backgroundColor, effectiveTitleColor, effectiveArtistColor, t])
|
||||
|
||||
useEffect(() => {
|
||||
draw()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect, useMemo, useRef, useState } from "react"
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Label } from "@/components/ui/label"
|
||||
@@ -212,6 +213,8 @@ export function CustomizeStep({
|
||||
isSubmitting,
|
||||
disabled,
|
||||
}: CustomizeStepProps) {
|
||||
const t = useTranslations('jobFlow')
|
||||
const tc = useTranslations('common')
|
||||
const previewArtist = displayArtist.trim() || artist
|
||||
const previewTitle = displayTitle.trim() || title
|
||||
|
||||
@@ -293,10 +296,10 @@ export function CustomizeStep({
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold" style={{ color: 'var(--text)' }}>
|
||||
Customize & Create
|
||||
{t('stepLabels.customizeCreate')}
|
||||
</h2>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
Confirm the artist and title for your title card.
|
||||
{t('confirmArtistTitle')}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
@@ -307,7 +310,7 @@ export function CustomizeStep({
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-1" />
|
||||
Back
|
||||
{tc('back')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -323,14 +326,14 @@ export function CustomizeStep({
|
||||
<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
|
||||
{t('titleCardArtist')}
|
||||
{!displayArtist.trim() && artist.trim() && (
|
||||
<span className="ml-1 opacity-50">(same as above)</span>
|
||||
<span className="ml-1 opacity-50">{t('sameAsAbove')}</span>
|
||||
)}
|
||||
</Label>
|
||||
<Input
|
||||
id="guided-display-artist"
|
||||
placeholder={artist || "Artist on title card"}
|
||||
placeholder={artist || t('artistOnTitleCard')}
|
||||
value={displayArtist}
|
||||
onChange={(e) => onDisplayArtistChange(e.target.value)}
|
||||
disabled={disabled || isSubmitting}
|
||||
@@ -339,14 +342,14 @@ export function CustomizeStep({
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<Label htmlFor="guided-display-title" className="text-xs" style={{ color: 'var(--text-muted)' }}>
|
||||
Title Card Title
|
||||
{t('titleCardTitle')}
|
||||
{!displayTitle.trim() && title.trim() && (
|
||||
<span className="ml-1 opacity-50">(same as above)</span>
|
||||
<span className="ml-1 opacity-50">{t('sameAsAbove')}</span>
|
||||
)}
|
||||
</Label>
|
||||
<Input
|
||||
id="guided-display-title"
|
||||
placeholder={title || "Title on title card"}
|
||||
placeholder={title || t('titleOnTitleCard')}
|
||||
value={displayTitle}
|
||||
onChange={(e) => onDisplayTitleChange(e.target.value)}
|
||||
disabled={disabled || isSubmitting}
|
||||
@@ -355,7 +358,7 @@ export function CustomizeStep({
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-[10px]" style={{ color: 'var(--text-muted)' }}>
|
||||
These default to your search values. Override for soundtracks, covers, or alternate formatting.
|
||||
{t('defaultsToSearchValues')}
|
||||
</p>
|
||||
|
||||
<Button
|
||||
@@ -366,10 +369,10 @@ export function CustomizeStep({
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Creating...
|
||||
{t('creating')}
|
||||
</>
|
||||
) : (
|
||||
"Create Karaoke Video"
|
||||
t('createKaraokeVideo')
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -382,10 +385,10 @@ export function CustomizeStep({
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold" style={{ color: 'var(--text)' }}>
|
||||
Customize & Create
|
||||
{t('stepLabels.customizeCreate')}
|
||||
</h2>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
Customize your private video's appearance.
|
||||
{t('confirmArtistTitle')}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
@@ -396,7 +399,7 @@ export function CustomizeStep({
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-1" />
|
||||
Back
|
||||
{tc('back')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -411,7 +414,7 @@ export function CustomizeStep({
|
||||
</Label>
|
||||
<Input
|
||||
id="guided-display-artist"
|
||||
placeholder={artist || "Artist on title card"}
|
||||
placeholder={artist || t('artistOnTitleCard')}
|
||||
value={displayArtist}
|
||||
onChange={(e) => onDisplayArtistChange(e.target.value)}
|
||||
disabled={disabled || isSubmitting}
|
||||
@@ -427,7 +430,7 @@ export function CustomizeStep({
|
||||
</Label>
|
||||
<Input
|
||||
id="guided-display-title"
|
||||
placeholder={title || "Title on title card"}
|
||||
placeholder={title || t('titleOnTitleCard')}
|
||||
value={displayTitle}
|
||||
onChange={(e) => onDisplayTitleChange(e.target.value)}
|
||||
disabled={disabled || isSubmitting}
|
||||
@@ -447,7 +450,7 @@ export function CustomizeStep({
|
||||
<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
|
||||
{t('customVideoStyle')}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
@@ -457,7 +460,7 @@ export function CustomizeStep({
|
||||
<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
|
||||
{t('titleCard')}
|
||||
</Label>
|
||||
<BgModeToggle
|
||||
mode={introBgMode}
|
||||
@@ -523,7 +526,7 @@ export function CustomizeStep({
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<ColorPickerField
|
||||
id="artist-color"
|
||||
label="Artist Color"
|
||||
label={t('artistColor')}
|
||||
value={colorOverrides.artist_color}
|
||||
defaultColor="#ffdf6b"
|
||||
onChange={(val) => onColorOverridesChange({ ...colorOverrides, artist_color: val })}
|
||||
@@ -531,7 +534,7 @@ export function CustomizeStep({
|
||||
/>
|
||||
<ColorPickerField
|
||||
id="title-color"
|
||||
label="Title Color"
|
||||
label={t('titleColor')}
|
||||
value={colorOverrides.title_color}
|
||||
defaultColor="#ffffff"
|
||||
onChange={(val) => onColorOverridesChange({ ...colorOverrides, title_color: val })}
|
||||
@@ -544,7 +547,7 @@ export function CustomizeStep({
|
||||
<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
|
||||
{t('karaokeVideo')}
|
||||
</Label>
|
||||
<BgModeToggle
|
||||
mode={karaokeBgMode}
|
||||
@@ -608,7 +611,7 @@ export function CustomizeStep({
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<ColorPickerField
|
||||
id="sung-lyrics-color"
|
||||
label="Highlight Color"
|
||||
label={t('highlightColor')}
|
||||
value={colorOverrides.sung_lyrics_color}
|
||||
defaultColor="#7070F7"
|
||||
onChange={(val) => onColorOverridesChange({ ...colorOverrides, sung_lyrics_color: val })}
|
||||
@@ -616,7 +619,7 @@ export function CustomizeStep({
|
||||
/>
|
||||
<ColorPickerField
|
||||
id="unsung-lyrics-color"
|
||||
label="Lyrics Color"
|
||||
label={t('lyricsColor')}
|
||||
value={colorOverrides.unsung_lyrics_color}
|
||||
defaultColor="#ffffff"
|
||||
onChange={(val) => onColorOverridesChange({ ...colorOverrides, unsung_lyrics_color: val })}
|
||||
@@ -627,7 +630,7 @@ export function CustomizeStep({
|
||||
</div>
|
||||
|
||||
<p className="text-[10px]" style={{ color: 'var(--text-muted)' }}>
|
||||
Leave colors blank to use default Nomad theme. Previews are approximate — final rendering may differ slightly.
|
||||
{t('leaveColorsBlank')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { Label } from "@/components/ui/label"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -22,6 +23,8 @@ export function SongInfoStep({
|
||||
onNext,
|
||||
disabled,
|
||||
}: SongInfoStepProps) {
|
||||
const t = useTranslations('jobFlow')
|
||||
const tc = useTranslations('common')
|
||||
const canProceed = artist.trim() && title.trim()
|
||||
|
||||
function handleSubmit(e: React.FormEvent) {
|
||||
@@ -35,29 +38,29 @@ export function SongInfoStep({
|
||||
<div className="flex items-center gap-3 text-xs flex-wrap" style={{ color: 'var(--text-muted)' }}>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Search className="w-3.5 h-3.5" style={{ color: 'var(--brand-pink)' }} />
|
||||
<span>We find the best audio</span>
|
||||
<span>{t('weFindBestAudio')}</span>
|
||||
</div>
|
||||
<span className="opacity-40">or</span>
|
||||
<span className="opacity-40">{tc('or')}</span>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Upload className="w-3.5 h-3.5 text-amber-400" />
|
||||
<span>upload a file</span>
|
||||
<span>{t('uploadAFile')}</span>
|
||||
</div>
|
||||
<span className="opacity-40">/</span>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Youtube className="w-3.5 h-3.5 text-red-400" />
|
||||
<span>YouTube URL</span>
|
||||
<span>{t('youtubeUrl')}</span>
|
||||
</div>
|
||||
<span className="opacity-50">(on next page)</span>
|
||||
<span className="opacity-50">{t('onNextPage')}</span>
|
||||
</div>
|
||||
|
||||
{/* Search artist/title */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="guided-artist" style={{ color: 'var(--text)' }}>Artist</Label>
|
||||
<Label htmlFor="guided-artist" style={{ color: 'var(--text)' }}>{t('artist')}</Label>
|
||||
<Input
|
||||
id="guided-artist"
|
||||
data-testid="guided-artist-input"
|
||||
placeholder="e.g. Queen"
|
||||
placeholder={t('artistPlaceholder')}
|
||||
value={artist}
|
||||
onChange={(e) => onArtistChange(e.target.value)}
|
||||
disabled={disabled}
|
||||
@@ -66,11 +69,11 @@ export function SongInfoStep({
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="guided-title" style={{ color: 'var(--text)' }}>Title</Label>
|
||||
<Label htmlFor="guided-title" style={{ color: 'var(--text)' }}>{t('title')}</Label>
|
||||
<Input
|
||||
id="guided-title"
|
||||
data-testid="guided-title-input"
|
||||
placeholder="e.g. Bohemian Rhapsody"
|
||||
placeholder={t('titlePlaceholder')}
|
||||
value={title}
|
||||
onChange={(e) => onTitleChange(e.target.value)}
|
||||
disabled={disabled}
|
||||
@@ -85,10 +88,8 @@ export function SongInfoStep({
|
||||
style={{ backgroundColor: 'var(--secondary)', color: 'var(--text-muted)' }}
|
||||
>
|
||||
<Lightbulb className="w-4 h-4 shrink-0 mt-0.5 text-amber-400" />
|
||||
<p>
|
||||
Looking for a specific version (live, cover, remix)? Include those details in the title - e.g. "Bohemian Rhapsody - Live at Wembley".
|
||||
<br className="mt-1" />
|
||||
If we can't find the right audio, you can provide a YouTube URL or upload a file on the next page.
|
||||
<p style={{ whiteSpace: 'pre-line' }}>
|
||||
{t('tipCallout')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -99,7 +100,7 @@ export function SongInfoStep({
|
||||
>
|
||||
<Pencil className="w-4 h-4 shrink-0 mt-0.5 text-purple-400" />
|
||||
<p>
|
||||
Making a video with custom lyrics? Start with the artist/title of the original song here - you can change the title screen and lyrics later.
|
||||
{t('customLyricsNote')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -110,7 +111,7 @@ export function SongInfoStep({
|
||||
>
|
||||
<Upload className="w-4 h-4 shrink-0 mt-0.5 text-blue-400" />
|
||||
<p>
|
||||
Have an unreleased song or your own audio file? Enter the artist and title here anyway — you can upload your file on step 2, and mark it private on step 3 if you're not ready to publish it.
|
||||
{t('unreleasedNote')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -119,7 +120,7 @@ export function SongInfoStep({
|
||||
disabled={!canProceed || 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)]"
|
||||
>
|
||||
Choose Audio
|
||||
{t('stepLabels.chooseAudio')}
|
||||
<ArrowRight className="w-4 h-4 ml-2" />
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { ArrowLeft, ArrowRight, Globe, Lock, ExternalLink, Sparkles } from "lucide-react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
@@ -18,15 +19,17 @@ export function VisibilityStep({
|
||||
onBack,
|
||||
disabled,
|
||||
}: VisibilityStepProps) {
|
||||
const t = useTranslations('jobFlow')
|
||||
const tc = useTranslations('common')
|
||||
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?
|
||||
{t('howShouldVideoBeShared')}
|
||||
</h2>
|
||||
<p className="text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
Choose how your finished karaoke video will be delivered.
|
||||
{t('chooseHowVideoDelivered')}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
@@ -37,7 +40,7 @@ export function VisibilityStep({
|
||||
style={{ color: 'var(--text-muted)' }}
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-1" />
|
||||
Back
|
||||
{tc('back')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +59,7 @@ export function VisibilityStep({
|
||||
>
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<Globe className="w-5 h-5" style={{ color: !isPrivate ? 'var(--brand-pink)' : 'var(--text-muted)' }} />
|
||||
<span className="font-semibold" style={{ color: 'var(--text)' }}>Publish & Share</span>
|
||||
<span className="font-semibold" style={{ color: 'var(--text)' }}>{t('publishShare')}</span>
|
||||
<ArrowRight className="w-4 h-4" style={{ color: 'var(--text-muted)' }} />
|
||||
</div>
|
||||
</button>
|
||||
@@ -74,20 +77,20 @@ export function VisibilityStep({
|
||||
>
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<Lock className="w-5 h-5" style={{ color: isPrivate ? 'var(--brand-pink)' : 'var(--text-muted)' }} />
|
||||
<span className="font-semibold" style={{ color: 'var(--text)' }}>Keep Private</span>
|
||||
<span className="font-semibold" style={{ color: 'var(--text)' }}>{t('keepPrivate')}</span>
|
||||
<ArrowRight className="w-4 h-4" style={{ color: 'var(--text-muted)' }} />
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p className="text-xs text-center" style={{ color: 'var(--text-muted)' }}>
|
||||
You can change the visibility anytime after the video is produced.
|
||||
{t('changeVisibilityAnytime')}
|
||||
</p>
|
||||
|
||||
{/* Divider */}
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex-1 h-px" style={{ backgroundColor: 'var(--card-border)' }} />
|
||||
<span className="text-xs" style={{ color: 'var(--text-muted)' }}>What's the difference?</span>
|
||||
<span className="text-xs" style={{ color: 'var(--text-muted)' }}>{t('whatsDifference')}</span>
|
||||
<div className="flex-1 h-px" style={{ backgroundColor: 'var(--card-border)' }} />
|
||||
</div>
|
||||
|
||||
@@ -119,49 +122,31 @@ export function VisibilityStep({
|
||||
<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
|
||||
{t('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
|
||||
{t('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>
|
||||
<p>{t('videoSharedWithWorld')}</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>
|
||||
{" "}— the easiest way for you (and anyone else) to sing this song anytime
|
||||
</span>
|
||||
<span>{t('uploadedToYoutube')}</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 — your song will be available to sing at bars and venues around the world
|
||||
</span>
|
||||
<span>{t('sharedWithVenues')}</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 — all stems, highest quality formats, ready to download
|
||||
</span>
|
||||
<span>{t('sourceFilesDelivered')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -169,7 +154,7 @@ export function VisibilityStep({
|
||||
className="rounded-md p-2.5 mt-1 text-xs"
|
||||
style={{ backgroundColor: 'rgba(255,122,204,0.08)', color: 'var(--text)' }}
|
||||
>
|
||||
By publishing, you're helping other fans of this song discover and enjoy it at karaoke nights everywhere. Share the joy!
|
||||
{t('publishingHelpFans')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -204,37 +189,29 @@ export function VisibilityStep({
|
||||
<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
|
||||
{t('private')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 text-sm" style={{ color: 'var(--text-muted)' }}>
|
||||
<p>Your karaoke video stays just with you:</p>
|
||||
<p>{t('videoStaysWithYou')}</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]">•</span>
|
||||
<span>
|
||||
<strong style={{ color: 'var(--text)' }}>Delivered via Dropbox only</strong> — no YouTube upload, no Google Drive sharing. Download and use however you see fit.
|
||||
</span>
|
||||
<span>{t('deliveredViaDropboxOnly')}</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]">•</span>
|
||||
<span>
|
||||
<strong style={{ color: 'var(--text)' }}>Venue use is up to you</strong> — if you want to perform this track at a venue, you'll need to provide the files to the host yourself.
|
||||
</span>
|
||||
<span>{t('venueUseUpToYou')}</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]">•</span>
|
||||
<span>
|
||||
<strong style={{ color: 'var(--text)' }}>YouTube self-upload</strong> — you can upload to your own channel, but monetization is unlikely as song copyrights are typically held by record labels.
|
||||
</span>
|
||||
<span>{t('youtubeUploadOwn')}</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]">•</span>
|
||||
<span>
|
||||
<strong style={{ color: 'var(--text)' }}>Custom styling available</strong> — choose your own background images, colors, and text styles on the next step.
|
||||
</span>
|
||||
<span>{t('customStylingAvailable')}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useMemo } from 'react'
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
@@ -30,6 +31,7 @@ export default function AgenticCorrectionMetrics({
|
||||
onCategoryClick,
|
||||
onConfidenceFilterClick,
|
||||
}: AgenticCorrectionMetricsProps) {
|
||||
const t = useTranslations('lyricsReview.agenticMetrics')
|
||||
const metrics = useMemo(() => {
|
||||
// Filter only agentic corrections
|
||||
const agenticCorrections = corrections.filter((c) => c.handler === 'AgenticCorrector')
|
||||
@@ -109,15 +111,15 @@ export default function AgenticCorrectionMetrics({
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<Card className="p-2 h-full flex flex-col">
|
||||
<span className="text-xs text-muted-foreground mb-1">Agentic AI Corrections</span>
|
||||
<span className="text-xs text-muted-foreground mb-1">{t('title')}</span>
|
||||
|
||||
{/* Overall stats */}
|
||||
<div className="mb-2">
|
||||
<p className="text-xs mb-1">
|
||||
Total: <strong>{metrics.totalCorrections}</strong>
|
||||
{t('total')} <strong>{metrics.totalCorrections}</strong>
|
||||
</p>
|
||||
<p className="text-xs mb-1">
|
||||
Avg Confidence: <strong>{(metrics.avgConfidence * 100).toFixed(0)}%</strong>
|
||||
{t('avgConfidence')} <strong>{(metrics.avgConfidence * 100).toFixed(0)}%</strong>
|
||||
</p>
|
||||
|
||||
{/* Quick filters */}
|
||||
@@ -127,20 +129,20 @@ export default function AgenticCorrectionMetrics({
|
||||
className="text-[0.65rem] h-5 cursor-pointer hover:bg-muted/30"
|
||||
onClick={() => onConfidenceFilterClick?.('low')}
|
||||
>
|
||||
Low (<60%): {metrics.lowConfidenceCount}
|
||||
{t('low')} {metrics.lowConfidenceCount}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="text-[0.65rem] h-5 cursor-pointer hover:bg-muted/30 text-green-600"
|
||||
onClick={() => onConfidenceFilterClick?.('high')}
|
||||
>
|
||||
High (≥80%): {metrics.highConfidenceCount}
|
||||
{t('high')} {metrics.highConfidenceCount}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Category breakdown */}
|
||||
<span className="text-xs text-muted-foreground mb-1">By Category</span>
|
||||
<span className="text-xs text-muted-foreground mb-1">{t('byCategory')}</span>
|
||||
<div className="flex-1 overflow-auto">
|
||||
{metrics.categories.map((metric) => (
|
||||
<Tooltip key={metric.category}>
|
||||
@@ -174,7 +176,7 @@ export default function AgenticCorrectionMetrics({
|
||||
</Tooltip>
|
||||
))}
|
||||
{metrics.categories.length === 0 && (
|
||||
<p className="text-xs text-muted-foreground italic">No agentic corrections</p>
|
||||
<p className="text-xs text-muted-foreground italic">{t('noCorrections')}</p>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -74,6 +75,7 @@ export default function CorrectionDetailCard({
|
||||
onEdit,
|
||||
onAccept,
|
||||
}: CorrectionDetailCardProps) {
|
||||
const t = useTranslations('lyricsReview.correctionDetail')
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 640
|
||||
|
||||
return (
|
||||
@@ -81,7 +83,7 @@ export default function CorrectionDetailCard({
|
||||
<DialogContent className={cn('max-w-md', isMobile && 'max-h-[85vh]')}>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex justify-between items-center">
|
||||
<span className="text-lg font-semibold">Correction Details</span>
|
||||
<span className="text-lg font-semibold">{t('title')}</span>
|
||||
<Button variant="ghost" size="icon" onClick={onClose} className="h-8 w-8">
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -91,7 +93,7 @@ export default function CorrectionDetailCard({
|
||||
<div className="space-y-4">
|
||||
{/* Original -> Corrected */}
|
||||
<div>
|
||||
<span className="text-xs text-muted-foreground mb-1 block">Change</span>
|
||||
<span className="text-xs text-muted-foreground mb-1 block">{t('change')}</span>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex-1 px-3 py-2 bg-red-100 dark:bg-red-900/30 rounded text-center line-through">
|
||||
<span className="font-medium">{originalWord}</span>
|
||||
@@ -106,7 +108,7 @@ export default function CorrectionDetailCard({
|
||||
{/* Category */}
|
||||
{category && (
|
||||
<div>
|
||||
<span className="text-xs text-muted-foreground mb-1 block">Category</span>
|
||||
<span className="text-xs text-muted-foreground mb-1 block">{t('category')}</span>
|
||||
<Badge variant="outline" className="text-sm">
|
||||
{getCategoryIcon(category)} {formatCategory(category)}
|
||||
</Badge>
|
||||
@@ -116,7 +118,7 @@ export default function CorrectionDetailCard({
|
||||
{/* Confidence */}
|
||||
<div>
|
||||
<div className="flex justify-between mb-1">
|
||||
<span className="text-xs text-muted-foreground">Confidence</span>
|
||||
<span className="text-xs text-muted-foreground">{t('confidence')}</span>
|
||||
<span className="text-xs font-semibold">{(confidence * 100).toFixed(0)}%</span>
|
||||
</div>
|
||||
<Progress value={confidence * 100} className="h-2" />
|
||||
@@ -124,17 +126,17 @@ export default function CorrectionDetailCard({
|
||||
|
||||
{/* Reasoning */}
|
||||
<div>
|
||||
<span className="text-xs text-muted-foreground mb-1 block">Reasoning</span>
|
||||
<span className="text-xs text-muted-foreground mb-1 block">{t('reasoning')}</span>
|
||||
<div className="p-3 bg-muted rounded border text-sm leading-relaxed">{reason}</div>
|
||||
</div>
|
||||
|
||||
{/* Metadata */}
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Badge variant="outline" className="text-xs">
|
||||
Handler: {handler}
|
||||
{t('handler', { handler })}
|
||||
</Badge>
|
||||
<Badge variant="outline" className="text-xs">
|
||||
Source: {source}
|
||||
{t('source', { source })}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
@@ -148,7 +150,7 @@ export default function CorrectionDetailCard({
|
||||
}}
|
||||
className={cn('text-destructive', isMobile && 'w-full h-11')}
|
||||
>
|
||||
Revert to Original
|
||||
{t('revertToOriginal')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -158,7 +160,7 @@ export default function CorrectionDetailCard({
|
||||
}}
|
||||
className={cn(isMobile && 'w-full h-11')}
|
||||
>
|
||||
Edit Correction
|
||||
{t('editCorrection')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
@@ -167,7 +169,7 @@ export default function CorrectionDetailCard({
|
||||
}}
|
||||
className={cn('bg-green-600 hover:bg-green-700', isMobile && 'w-full h-11')}
|
||||
>
|
||||
Mark as Correct
|
||||
{t('markAsCorrect')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { COLORS } from '@/lib/lyrics-review/constants'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -87,6 +88,7 @@ export default function CorrectionMetrics({
|
||||
totalWords = 0,
|
||||
onMetricClick,
|
||||
}: CorrectionMetricsProps) {
|
||||
const t = useTranslations('lyricsReview.guidance')
|
||||
// Calculate percentages based on word counts
|
||||
const anchorPercentage = totalWords > 0 ? Math.round((anchorWordCount / totalWords) * 100) : 0
|
||||
const uncorrectedWordCount = uncorrectedGaps?.reduce((sum, gap) => sum + gap.length, 0) ?? 0
|
||||
@@ -102,12 +104,12 @@ export default function CorrectionMetrics({
|
||||
<div className="flex-1 h-full">
|
||||
<Metric
|
||||
color={COLORS.anchor}
|
||||
label="Anchor Sequences"
|
||||
label={t('anchorSequences')}
|
||||
value={`${anchorCount ?? '-'} (${anchorPercentage}%)`}
|
||||
description="Matched sections between transcription and reference"
|
||||
description={t('anchorSequencesDesc')}
|
||||
details={[
|
||||
{ label: 'Words in Anchors', value: anchorWordCount },
|
||||
{ label: 'Multi-source Matches', value: multiSourceAnchors },
|
||||
{ label: t('wordsInAnchors'), value: anchorWordCount },
|
||||
{ label: t('multiSourceMatches'), value: multiSourceAnchors },
|
||||
]}
|
||||
onClick={onMetricClick?.anchor}
|
||||
/>
|
||||
@@ -115,12 +117,12 @@ export default function CorrectionMetrics({
|
||||
<div className="flex-1 h-full">
|
||||
<Metric
|
||||
color={COLORS.corrected}
|
||||
label="Corrected Gaps"
|
||||
label={t('correctedGaps')}
|
||||
value={`${correctedGapCount} (${correctedPercentage}%)`}
|
||||
description="Successfully corrected sections"
|
||||
description={t('correctedGapsDesc')}
|
||||
details={[
|
||||
{ label: 'Words Replaced', value: replacedCount },
|
||||
{ label: 'Words Added / Deleted', value: `+${addedCount} / -${deletedCount}` },
|
||||
{ label: t('wordsReplaced'), value: replacedCount },
|
||||
{ label: t('wordsAddedDeleted'), value: `+${addedCount} / -${deletedCount}` },
|
||||
]}
|
||||
onClick={onMetricClick?.corrected}
|
||||
/>
|
||||
@@ -128,12 +130,12 @@ export default function CorrectionMetrics({
|
||||
<div className="flex-1 h-full">
|
||||
<Metric
|
||||
color={COLORS.uncorrectedGap}
|
||||
label="Uncorrected Gaps"
|
||||
label={t('uncorrectedGaps')}
|
||||
value={`${uncorrectedGapCount} (${uncorrectedPercentage}%)`}
|
||||
description="Sections that may need manual review"
|
||||
description={t('uncorrectedGapsDesc')}
|
||||
details={[
|
||||
{ label: 'Words Uncorrected', value: uncorrectedWordCount },
|
||||
{ label: 'Number of Gaps', value: uncorrectedGaps.length },
|
||||
{ label: t('wordsUncorrected'), value: uncorrectedWordCount },
|
||||
{ label: t('numberOfGaps'), value: uncorrectedGaps.length },
|
||||
]}
|
||||
onClick={onMetricClick?.uncorrected}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Trash2, RotateCcw, History } from 'lucide-react'
|
||||
import { LyricsSegment } from '@/lib/lyrics-review/types'
|
||||
@@ -26,6 +27,7 @@ export default function EditActionBar({
|
||||
originalTranscribedSegment,
|
||||
isGlobal = false,
|
||||
}: EditActionBarProps) {
|
||||
const t = useTranslations('lyricsReview.editActionBar')
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 640
|
||||
|
||||
return (
|
||||
@@ -43,12 +45,12 @@ export default function EditActionBar({
|
||||
>
|
||||
<Button variant="outline" size={isMobile ? 'sm' : 'default'} onClick={onReset}>
|
||||
<RotateCcw className="h-4 w-4 mr-1" />
|
||||
Reset
|
||||
{t('reset')}
|
||||
</Button>
|
||||
{originalTranscribedSegment && (
|
||||
<Button variant="outline" size={isMobile ? 'sm' : 'default'} onClick={onRevertToOriginal}>
|
||||
<History className="h-4 w-4 mr-1" />
|
||||
Un-Correct
|
||||
{t('unCorrect')}
|
||||
</Button>
|
||||
)}
|
||||
{!isGlobal && onDelete && (
|
||||
@@ -59,7 +61,7 @@ export default function EditActionBar({
|
||||
className="text-destructive hover:text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4 mr-1" />
|
||||
Delete Segment
|
||||
{t('deleteSegment')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -67,14 +69,14 @@ export default function EditActionBar({
|
||||
className={cn('flex gap-2', isMobile ? 'justify-center ml-0' : 'justify-end ml-auto')}
|
||||
>
|
||||
<Button variant="outline" size={isMobile ? 'sm' : 'default'} onClick={onClose}>
|
||||
Cancel
|
||||
{t('cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
size={isMobile ? 'sm' : 'default'}
|
||||
onClick={onSave}
|
||||
disabled={!editedSegment || editedSegment.words.length === 0}
|
||||
>
|
||||
Save
|
||||
{t('save')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,45 +1,31 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useEffect, useRef, useCallback } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { X } from 'lucide-react'
|
||||
import type { EditLogEntry, EditFeedbackReason } from '@/lib/lyrics-review/types'
|
||||
|
||||
const REASONS_BY_OP: Record<string, { label: string; reason: EditFeedbackReason }[]> = {
|
||||
const REASONS_BY_OP: Record<string, { key: string; reason: EditFeedbackReason }[]> = {
|
||||
word_change: [
|
||||
{ label: 'Mis-heard word', reason: 'misheard_word' },
|
||||
{ label: 'Wrong lyrics', reason: 'wrong_lyrics' },
|
||||
{ label: 'Spelling/punctuation', reason: 'spelling_punctuation' },
|
||||
{ label: 'Other', reason: 'other' },
|
||||
{ key: 'misheardWord', reason: 'misheard_word' },
|
||||
{ key: 'wrongLyrics', reason: 'wrong_lyrics' },
|
||||
{ key: 'spellingPunctuation', reason: 'spelling_punctuation' },
|
||||
{ key: 'other', reason: 'other' },
|
||||
],
|
||||
word_delete: [
|
||||
{ label: 'Phantom word', reason: 'phantom_word' },
|
||||
{ label: 'Duplicate', reason: 'duplicate_word' },
|
||||
{ label: 'Mis-heard word', reason: 'misheard_word' },
|
||||
{ label: 'Other', reason: 'other' },
|
||||
{ key: 'phantomWord', reason: 'phantom_word' },
|
||||
{ key: 'duplicate', reason: 'duplicate_word' },
|
||||
{ key: 'misheardWord', reason: 'misheard_word' },
|
||||
{ key: 'other', reason: 'other' },
|
||||
],
|
||||
word_add: [
|
||||
{ label: 'Missing word', reason: 'missing_word' },
|
||||
{ label: 'Split word', reason: 'split_word' },
|
||||
{ label: 'Other', reason: 'other' },
|
||||
{ key: 'missingWord', reason: 'missing_word' },
|
||||
{ key: 'splitWord', reason: 'split_word' },
|
||||
{ key: 'other', reason: 'other' },
|
||||
],
|
||||
}
|
||||
|
||||
function getQuestionText(entry: EditLogEntry): string {
|
||||
const before = entry.text_before.trim()
|
||||
const after = entry.text_after.trim()
|
||||
switch (entry.operation) {
|
||||
case 'word_change':
|
||||
return `Changed "${before}" → "${after}", why?`
|
||||
case 'word_delete':
|
||||
return `Removed "${before}", why?`
|
||||
case 'word_add':
|
||||
return `Added "${after}", why?`
|
||||
default:
|
||||
return `Edit made, why?`
|
||||
}
|
||||
}
|
||||
|
||||
interface EditFeedbackBarProps {
|
||||
entry: EditLogEntry | null
|
||||
visible: boolean
|
||||
@@ -53,6 +39,7 @@ export default function EditFeedbackBar({
|
||||
onFeedback,
|
||||
onDismiss,
|
||||
}: EditFeedbackBarProps) {
|
||||
const t = useTranslations('lyricsReview.editFeedback')
|
||||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const entryIdRef = useRef<string | null>(null)
|
||||
const hoveredRef = useRef(false)
|
||||
@@ -123,7 +110,13 @@ export default function EditFeedbackBar({
|
||||
>
|
||||
<div className="bg-muted/95 backdrop-blur-sm border-t border-b px-4 py-2 flex items-center gap-3 w-full max-w-4xl">
|
||||
<span className="text-sm text-muted-foreground shrink-0 truncate max-w-[280px]">
|
||||
{getQuestionText(entry)}
|
||||
{entry.operation === 'word_change'
|
||||
? t('changed', { before: entry.text_before.trim(), after: entry.text_after.trim() })
|
||||
: entry.operation === 'word_delete'
|
||||
? t('removed', { before: entry.text_before.trim() })
|
||||
: entry.operation === 'word_add'
|
||||
? t('added', { after: entry.text_after.trim() })
|
||||
: t('editMade')}
|
||||
</span>
|
||||
<div className="flex items-center gap-1.5 flex-wrap">
|
||||
{reasons.map((r) => (
|
||||
@@ -138,7 +131,7 @@ export default function EditFeedbackBar({
|
||||
onDismiss()
|
||||
}}
|
||||
>
|
||||
{r.label}
|
||||
{t(r.key)}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, memo, useMemo } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -43,6 +44,7 @@ const WordRow = memo(function WordRow({
|
||||
onTabNavigation: (currentIndex: number) => void
|
||||
isMobile: boolean
|
||||
}) {
|
||||
const t = useTranslations('lyricsReview.editWordList')
|
||||
const handleKeyDown = (e: React.KeyboardEvent) => {
|
||||
if (e.key === 'Tab' && !e.shiftKey) {
|
||||
e.preventDefault()
|
||||
@@ -58,7 +60,7 @@ const WordRow = memo(function WordRow({
|
||||
<div className={`flex gap-2 items-end ${isMobile ? '' : 'flex-1'}`}>
|
||||
<div className="flex-1">
|
||||
<Label htmlFor={`word-text-${index}`} className="text-xs text-muted-foreground mb-1">
|
||||
Word {index}
|
||||
{t('wordLabel', { index })}
|
||||
</Label>
|
||||
<Input
|
||||
id={`word-text-${index}`}
|
||||
@@ -75,7 +77,7 @@ const WordRow = memo(function WordRow({
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => onSplitWord(index)}
|
||||
title="Split Word"
|
||||
title={t('splitWord')}
|
||||
className="h-8 w-8 text-primary"
|
||||
>
|
||||
<Split className="h-4 w-4" />
|
||||
@@ -85,7 +87,7 @@ const WordRow = memo(function WordRow({
|
||||
size="icon"
|
||||
onClick={() => onRemoveWord(index)}
|
||||
disabled={wordsLength <= 1}
|
||||
title="Remove Word"
|
||||
title={t('removeWord')}
|
||||
className="h-8 w-8 text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
@@ -101,13 +103,13 @@ const WordRow = memo(function WordRow({
|
||||
<TimeInput
|
||||
value={word.start_time ?? null}
|
||||
onChange={(val) => onWordUpdate(index, { start_time: val ?? undefined })}
|
||||
label="Start"
|
||||
label={t('start')}
|
||||
widthClass={isMobile ? 'w-20' : 'w-24'}
|
||||
/>
|
||||
<TimeInput
|
||||
value={word.end_time ?? null}
|
||||
onChange={(val) => onWordUpdate(index, { end_time: val ?? undefined })}
|
||||
label="End"
|
||||
label={t('end')}
|
||||
widthClass={isMobile ? 'w-20' : 'w-24'}
|
||||
/>
|
||||
{/* Action buttons on desktop only */}
|
||||
@@ -117,7 +119,7 @@ const WordRow = memo(function WordRow({
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => onSplitWord(index)}
|
||||
title="Split Word"
|
||||
title={t('splitWord')}
|
||||
className="h-8 w-8 text-primary"
|
||||
>
|
||||
<Split className="h-4 w-4" />
|
||||
@@ -127,7 +129,7 @@ const WordRow = memo(function WordRow({
|
||||
size="icon"
|
||||
onClick={() => onRemoveWord(index)}
|
||||
disabled={wordsLength <= 1}
|
||||
title="Remove Word"
|
||||
title={t('removeWord')}
|
||||
className="h-8 w-8 text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
@@ -222,6 +224,7 @@ export default function EditWordList({
|
||||
onMergeSegment,
|
||||
isGlobal = false,
|
||||
}: EditWordListProps) {
|
||||
const t = useTranslations('lyricsReview.editWordList')
|
||||
// Simple mobile detection
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 640
|
||||
|
||||
@@ -327,10 +330,10 @@ export default function EditWordList({
|
||||
onClick={() => setPage((p) => Math.max(1, p - 1))}
|
||||
disabled={page === 1}
|
||||
>
|
||||
Previous
|
||||
{t('previous')}
|
||||
</Button>
|
||||
<span className="text-sm">
|
||||
Page {page} of {pageCount}
|
||||
{t('pageCount', { current: page, total: pageCount })}
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -338,10 +341,10 @@ export default function EditWordList({
|
||||
onClick={() => setPage((p) => Math.min(pageCount, p + 1))}
|
||||
disabled={page === pageCount}
|
||||
>
|
||||
Next
|
||||
{t('next')}
|
||||
</Button>
|
||||
<span className="text-sm text-muted-foreground ml-2">
|
||||
Words {startIndex + 1}-{endIndex} of {words.length}
|
||||
{t('wordsRange', { start: startIndex + 1, end: endIndex, total: words.length })}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
@@ -358,12 +361,12 @@ export default function EditWordList({
|
||||
handleReplaceAllWords()
|
||||
}
|
||||
}}
|
||||
placeholder="Replace all words"
|
||||
placeholder={t('replaceAllWords')}
|
||||
className="flex-grow"
|
||||
/>
|
||||
<Button onClick={handleReplaceAllWords} size="sm" className="whitespace-nowrap">
|
||||
<Wand2 className="h-4 w-4 mr-1" />
|
||||
Replace All
|
||||
{t('replaceAll')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Tooltip,
|
||||
@@ -21,6 +22,7 @@ export default function GapNavigator({
|
||||
onPrevGap,
|
||||
onNextGap,
|
||||
}: GapNavigatorProps) {
|
||||
const t = useTranslations('lyricsReview.gapNavigator')
|
||||
if (totalGaps === 0) return null
|
||||
|
||||
const displayIndex = currentGapIndex !== null ? currentGapIndex + 1 : 0
|
||||
@@ -40,10 +42,10 @@ export default function GapNavigator({
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Previous gap (P)</TooltipContent>
|
||||
<TooltipContent>{t('previousGap')}</TooltipContent>
|
||||
</Tooltip>
|
||||
<span className="text-xs text-muted-foreground whitespace-nowrap">
|
||||
Gap {displayIndex} of {totalGaps}
|
||||
{t('gapCount', { current: displayIndex, total: totalGaps })}
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -58,7 +60,7 @@ export default function GapNavigator({
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Next gap (N)</TooltipContent>
|
||||
<TooltipContent>{t('nextGap')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState } from 'react'
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
@@ -38,6 +39,7 @@ export default function GuidancePanel({
|
||||
statsVisible,
|
||||
onStatsToggle,
|
||||
}: GuidancePanelProps) {
|
||||
const t = useTranslations('lyricsReview.guidance')
|
||||
const [guidanceDismissed, setGuidanceDismissed] = useState(() => {
|
||||
if (typeof window === 'undefined') return false
|
||||
return localStorage.getItem('lyricsReviewGuidanceDismissed') === 'true'
|
||||
@@ -126,21 +128,21 @@ export default function GuidancePanel({
|
||||
onClick={onMetricClick.anchor}
|
||||
>
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-blue-500/60 inline-block" />
|
||||
<span className="text-muted-foreground">Matched</span>
|
||||
<span className="text-muted-foreground">{t('matched')}</span>
|
||||
</button>
|
||||
<button
|
||||
className="flex items-center gap-1.5 hover:opacity-80 transition-opacity"
|
||||
onClick={onMetricClick.uncorrected}
|
||||
>
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-orange-500/60 inline-block" />
|
||||
<span className="text-muted-foreground">Gaps (needs review)</span>
|
||||
<span className="text-muted-foreground">{t('gapsNeedsReview')}</span>
|
||||
</button>
|
||||
<button
|
||||
className="flex items-center gap-1.5 hover:opacity-80 transition-opacity"
|
||||
onClick={onMetricClick.corrected}
|
||||
>
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-green-500/60 inline-block" />
|
||||
<span className="text-muted-foreground">Corrected</span>
|
||||
<span className="text-muted-foreground">{t('corrected')}</span>
|
||||
</button>
|
||||
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
@@ -149,7 +151,7 @@ export default function GuidancePanel({
|
||||
className="text-amber-500 hover:text-amber-400 transition-colors text-xs"
|
||||
onClick={handleShowTips}
|
||||
>
|
||||
Show tips
|
||||
{t('showTips')}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
@@ -161,7 +163,7 @@ export default function GuidancePanel({
|
||||
)}
|
||||
onClick={onStatsToggle}
|
||||
>
|
||||
{statsVisible ? 'Hide Stats' : 'Stats'}
|
||||
{statsVisible ? t('hideStats') : t('stats')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -172,16 +174,16 @@ export default function GuidancePanel({
|
||||
<Lightbulb className="h-4 w-4 text-amber-500 shrink-0 mt-0.5" />
|
||||
<div className="text-xs text-muted-foreground flex-1 leading-relaxed space-y-1.5">
|
||||
{totalGaps === 0 && Object.keys(data.reference_lyrics).length === 0 ? (
|
||||
<p>No reference lyrics were found for this track. You can still review the transcription and click any word to edit. Use the <strong>Reference Lyrics</strong> panel on the right to search for lyrics with a different artist/title.</p>
|
||||
<p>{t('noReferenceFound')}</p>
|
||||
) : totalGaps === 0 ? (
|
||||
<p>All lyrics matched the reference — no corrections needed. You can still click any word to edit.</p>
|
||||
<p>{t('allMatched')}</p>
|
||||
) : (
|
||||
<>
|
||||
<p>The <strong>Synced Lyrics</strong> on the left are what will appear in the karaoke video.</p>
|
||||
<p>The orange highlighted words are <strong>gaps</strong> — sections that couldn't be matched to the reference lyrics and may contain errors (e.g. mis-heard words which sound similar).</p>
|
||||
<p>Use <kbd className="px-1 py-0.5 rounded bg-muted text-[0.65rem] font-mono">N</kbd> and <kbd className="px-1 py-0.5 rounded bg-muted text-[0.65rem] font-mono">P</kbd> to jump between gaps. For each one, click play beside the line and compare what you hear with the reference lyrics on the right, then click a word to edit or delete it.</p>
|
||||
<p>Watch out for phantom words like "and" at the start or end of lines — the transcription often adds these.</p>
|
||||
<p>Try the <strong>Timeline</strong> view to spot any unusually long words (10+ seconds), which usually indicate a timing problem.</p>
|
||||
<p>{t('syncedLyricsOnLeft')}</p>
|
||||
<p>{t('orangeHighlightedWords')}</p>
|
||||
<p>{t('useNAndP')}</p>
|
||||
<p>{t('watchOutForPhantomWords')}</p>
|
||||
<p>{t('tryTimelineView')}</p>
|
||||
</>
|
||||
)}
|
||||
<a
|
||||
@@ -191,7 +193,7 @@ export default function GuidancePanel({
|
||||
className="inline-flex items-center gap-1 text-amber-500 hover:text-amber-400 transition-colors mt-1"
|
||||
>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
Watch full tutorial
|
||||
{t('watchFullTutorial')}
|
||||
</a>
|
||||
</div>
|
||||
<button
|
||||
@@ -209,7 +211,7 @@ export default function GuidancePanel({
|
||||
<div className={cn('flex gap-2 overflow-hidden', isMobile ? 'flex-col' : 'flex-row', isMobile ? 'h-auto' : 'h-[140px]')}>
|
||||
{/* Handler panel */}
|
||||
<Card className={cn('p-2', isMobile ? 'w-full' : 'w-[280px] min-w-[280px]')}>
|
||||
<h4 className="text-xs text-muted-foreground mb-1">Correction Handlers</h4>
|
||||
<h4 className="text-xs text-muted-foreground mb-1">{t('correctionHandlers')}</h4>
|
||||
<div className="flex-1 overflow-auto flex flex-col">
|
||||
{availableHandlers.map((handler: { id: string; name: string; description: string }) => (
|
||||
<div key={handler.id} className="mb-1">
|
||||
@@ -247,21 +249,21 @@ export default function GuidancePanel({
|
||||
>
|
||||
<div className="flex items-center gap-1 mb-0.5">
|
||||
<div className="w-3 h-3 rounded bg-blue-500/25 shrink-0" />
|
||||
<span className="text-xs text-muted-foreground truncate">Anchor Sequences</span>
|
||||
<span className="text-xs text-muted-foreground truncate">{t('anchorSequences')}</span>
|
||||
</div>
|
||||
<span className="text-lg font-semibold leading-tight">
|
||||
{data.metadata.anchor_sequences_count ?? '-'} ({anchorPercentage}%)
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground leading-tight">
|
||||
Matched sections between transcription and reference
|
||||
{t('anchorSequencesDesc')}
|
||||
</span>
|
||||
<div className="mt-auto space-y-0 text-[10px]">
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Words in Anchors</span>
|
||||
<span className="text-muted-foreground">{t('wordsInAnchors')}</span>
|
||||
<span>{anchorWordCount}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Multi-source Matches</span>
|
||||
<span className="text-muted-foreground">{t('multiSourceMatches')}</span>
|
||||
<span>{multiSourceAnchors}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -273,21 +275,21 @@ export default function GuidancePanel({
|
||||
>
|
||||
<div className="flex items-center gap-1 mb-0.5">
|
||||
<div className="w-3 h-3 rounded bg-green-500/25 shrink-0" />
|
||||
<span className="text-xs text-muted-foreground truncate">Corrected Gaps</span>
|
||||
<span className="text-xs text-muted-foreground truncate">{t('correctedGaps')}</span>
|
||||
</div>
|
||||
<span className="text-lg font-semibold text-green-500 leading-tight">
|
||||
{correctedGapCount} ({correctedPercentage}%)
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground leading-tight">
|
||||
Successfully corrected sections
|
||||
{t('correctedGapsDesc')}
|
||||
</span>
|
||||
<div className="mt-auto space-y-0 text-[10px]">
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Words Replaced</span>
|
||||
<span className="text-muted-foreground">{t('wordsReplaced')}</span>
|
||||
<span>{replacedCount}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Words Added / Deleted</span>
|
||||
<span className="text-muted-foreground">{t('wordsAddedDeleted')}</span>
|
||||
<span>+{addedCount} / -{deletedCount}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -299,21 +301,21 @@ export default function GuidancePanel({
|
||||
>
|
||||
<div className="flex items-center gap-1 mb-0.5">
|
||||
<div className="w-3 h-3 rounded bg-orange-500/25 shrink-0" />
|
||||
<span className="text-xs text-muted-foreground truncate">Uncorrected Gaps</span>
|
||||
<span className="text-xs text-muted-foreground truncate">{t('uncorrectedGaps')}</span>
|
||||
</div>
|
||||
<span className="text-lg font-semibold text-amber-500 leading-tight">
|
||||
{uncorrectedGapCount} ({uncorrectedPercentage}%)
|
||||
</span>
|
||||
<span className="text-[10px] text-muted-foreground leading-tight">
|
||||
Sections that may need manual review
|
||||
{t('uncorrectedGapsDesc')}
|
||||
</span>
|
||||
<div className="mt-auto space-y-0 text-[10px]">
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Words Uncorrected</span>
|
||||
<span className="text-muted-foreground">{t('wordsUncorrected')}</span>
|
||||
<span>{uncorrectedWordCount}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-muted-foreground">Number of Gaps</span>
|
||||
<span className="text-muted-foreground">{t('numberOfGaps')}</span>
|
||||
<span>{uncorrectedGaps.length}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Card } from '@/components/ui/card'
|
||||
@@ -96,6 +97,7 @@ export default function Header({
|
||||
onAcceptHighConfidenceCorrections,
|
||||
onRevertAllCorrections,
|
||||
}: HeaderProps) {
|
||||
const t = useTranslations('lyricsReview.header')
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768
|
||||
|
||||
// Check if agentic mode is active
|
||||
@@ -111,7 +113,7 @@ export default function Header({
|
||||
{isReadOnly && (
|
||||
<div className="flex items-center gap-1 text-muted-foreground text-sm mb-2">
|
||||
<Lock className="h-4 w-4" />
|
||||
<span>View Only Mode</span>
|
||||
<span>{t('viewOnlyMode')}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -127,20 +129,20 @@ export default function Header({
|
||||
onClick={() => onReviewModeToggle(!reviewMode)}
|
||||
>
|
||||
<Eye className="h-3 w-3 mr-1" />
|
||||
{reviewMode ? 'Review Mode' : 'Review Off'}
|
||||
{reviewMode ? t('reviewMode') : t('reviewOff')}
|
||||
</Badge>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
{reviewMode
|
||||
? 'Hide inline correction actions'
|
||||
: 'Show inline actions on all corrections for quick review'}
|
||||
? t('hideInlineActions')
|
||||
: t('showInlineActions')}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{isReadOnly && (
|
||||
<Button variant="outline" size="sm" onClick={onFileLoad} className={cn(isMobile && 'w-full')}>
|
||||
<Upload className="h-4 w-4 mr-1" />
|
||||
Load File
|
||||
{t('loadFile')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -163,7 +165,7 @@ export default function Header({
|
||||
<Card className="p-2 mb-2 bg-accent/50">
|
||||
<div className={cn('flex gap-2', isMobile ? 'flex-col' : 'flex-row items-center justify-between')}>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
Batch Actions ({data.corrections.length} corrections)
|
||||
{t('batchActions', { count: data.corrections.length })}
|
||||
</span>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
{onAcceptHighConfidenceCorrections && (
|
||||
@@ -173,7 +175,7 @@ export default function Header({
|
||||
className="bg-green-600 hover:bg-green-700 text-xs h-7"
|
||||
>
|
||||
<CheckCircle2 className="h-3 w-3 mr-1" />
|
||||
Accept High Confidence ({data.corrections.filter((c) => c.confidence >= 0.8).length})
|
||||
{t('acceptHighConfidence', { count: data.corrections.filter((c) => c.confidence >= 0.8).length })}
|
||||
</Button>
|
||||
)}
|
||||
{onAcceptAllCorrections && (
|
||||
@@ -184,7 +186,7 @@ export default function Header({
|
||||
className="text-xs h-7"
|
||||
>
|
||||
<CheckCircle2 className="h-3 w-3 mr-1" />
|
||||
Accept All
|
||||
{t('acceptAll')}
|
||||
</Button>
|
||||
)}
|
||||
{onRevertAllCorrections && (
|
||||
@@ -195,7 +197,7 @@ export default function Header({
|
||||
className="text-destructive text-xs h-7"
|
||||
>
|
||||
<XCircle className="h-3 w-3 mr-1" />
|
||||
Revert All
|
||||
{t('revertAll')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -219,10 +221,10 @@ export default function Header({
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="outline" size="sm" onClick={onResetCorrections} className="h-8 text-xs text-amber-500 border-amber-500/50 hover:border-amber-500 hover:bg-amber-500/10">
|
||||
<Undo2 className="h-3.5 w-3.5 mr-1" />
|
||||
Undo All
|
||||
{t('undoAll')}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">Reset all changes back to the original AI-corrected lyrics</TooltipContent>
|
||||
<TooltipContent className="max-w-xs">{t('resetAllChanges')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
@@ -240,7 +242,7 @@ export default function Header({
|
||||
<Undo2 className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Undo</TooltipContent>
|
||||
<TooltipContent>{t('undo')}</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -254,7 +256,7 @@ export default function Header({
|
||||
<Redo2 className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Redo</TooltipContent>
|
||||
<TooltipContent>{t('redo')}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
)}
|
||||
@@ -264,10 +266,10 @@ export default function Header({
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="outline" size="sm" onClick={onFindReplace} className="h-8 text-xs">
|
||||
<Search className="h-3.5 w-3.5 mr-1" />
|
||||
Find/Replace
|
||||
{t('findReplace')}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">Search for text across all lyrics and replace it. Useful for a word that appears multiple times.</TooltipContent>
|
||||
<TooltipContent className="max-w-xs">{t('findReplaceDesc')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
@@ -276,10 +278,10 @@ export default function Header({
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="outline" size="sm" onClick={onEditAll} className="h-8 text-xs">
|
||||
<Edit className="h-3.5 w-3.5 mr-1" />
|
||||
Edit All
|
||||
{t('editAll')}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">View and edit all lyrics as plain text. Useful when many lines need changing.</TooltipContent>
|
||||
<TooltipContent className="max-w-xs">{t('editAllDesc')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
@@ -294,17 +296,17 @@ export default function Header({
|
||||
className={cn('h-8 text-xs', timingOffsetMs !== 0 && 'border-purple-500 text-purple-500')}
|
||||
>
|
||||
<Timer className="h-3.5 w-3.5 mr-1" />
|
||||
Timing Offset
|
||||
{t('timingOffset')}
|
||||
</Button>
|
||||
{timingOffsetMs !== 0 && (
|
||||
<span className="ml-1 text-xs font-bold text-purple-500">
|
||||
{timingOffsetMs > 0 ? '+' : ''}
|
||||
{timingOffsetMs}ms
|
||||
{t('timingOffsetValue', { ms: timingOffsetMs })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">Shift all word timings forward or backward. Use if lyrics appear slightly early or late in the preview.</TooltipContent>
|
||||
<TooltipContent className="max-w-xs">{t('timingOffsetDesc')}</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect, useCallback, useMemo, useRef, memo } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -110,6 +111,7 @@ export default function LyricsAnalyzer({
|
||||
jobId,
|
||||
hasExistingInstrumental = false,
|
||||
}: LyricsAnalyzerProps) {
|
||||
const t = useTranslations('lyricsReview')
|
||||
const router = useRouter()
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
|
||||
import {
|
||||
Tooltip,
|
||||
@@ -16,10 +17,11 @@ interface ModeSelectorProps {
|
||||
}
|
||||
|
||||
export default function ModeSelector({ effectiveMode, onChange }: ModeSelectorProps) {
|
||||
const t = useTranslations('lyricsReview.modeSelector')
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<div className="flex items-center gap-1.5 h-8">
|
||||
<span className="text-[0.75rem] text-muted-foreground">Mode:</span>
|
||||
<span className="text-[0.75rem] text-muted-foreground">{t('mode')}</span>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
value={effectiveMode}
|
||||
@@ -33,11 +35,11 @@ export default function ModeSelector({ effectiveMode, onChange }: ModeSelectorPr
|
||||
className="h-8 px-2.5 text-[0.75rem] !flex-none aria-checked:font-semibold aria-checked:bg-blue-600 aria-checked:text-white dark:aria-checked:bg-blue-500"
|
||||
>
|
||||
<Pencil className="h-3.5 w-3.5 mr-1" />
|
||||
Edit
|
||||
{t('edit')}
|
||||
</ToggleGroupItem>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">
|
||||
<p>Click any word to edit that lyrics line. Default mode for correcting misheard words.</p>
|
||||
<p>{t('editDesc')}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
@@ -48,11 +50,11 @@ export default function ModeSelector({ effectiveMode, onChange }: ModeSelectorPr
|
||||
className="h-8 px-2.5 text-[0.75rem] !flex-none aria-checked:font-semibold aria-checked:bg-blue-600 aria-checked:text-white dark:aria-checked:bg-blue-500"
|
||||
>
|
||||
<Highlighter className="h-3.5 w-3.5 mr-1" />
|
||||
Highlight
|
||||
{t('highlight')}
|
||||
</ToggleGroupItem>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">
|
||||
<p>Click any word to see where it matches in the reference lyrics. Shortcut: hold SHIFT.</p>
|
||||
<p>{t('highlightDesc')}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
@@ -63,11 +65,11 @@ export default function ModeSelector({ effectiveMode, onChange }: ModeSelectorPr
|
||||
className="h-8 px-2.5 text-[0.75rem] !flex-none aria-checked:font-semibold aria-checked:bg-blue-600 aria-checked:text-white dark:aria-checked:bg-blue-500"
|
||||
>
|
||||
<Trash2 className="h-3.5 w-3.5 mr-1" />
|
||||
Delete
|
||||
{t('delete')}
|
||||
</ToggleGroupItem>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs">
|
||||
<p>Click any word to instantly delete it. Great for removing phantom words like "And" during instrumental sections. Shortcut: hold CTRL.</p>
|
||||
<p>{t('deleteDesc')}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</ToggleGroup>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect, RefObject } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert'
|
||||
@@ -31,6 +32,7 @@ export default function PreviewVideoSection({
|
||||
videoRef,
|
||||
timingOffsetMs = 0,
|
||||
}: PreviewVideoSectionProps) {
|
||||
const t = useTranslations('lyricsReview.previewVideo')
|
||||
const [previewState, setPreviewState] = useState<{
|
||||
status: 'loading' | 'warming_up' | 'ready' | 'error'
|
||||
videoUrl?: string
|
||||
@@ -99,7 +101,7 @@ export default function PreviewVideoSection({
|
||||
{previewState.status === 'loading' && (
|
||||
<div className="flex items-center gap-3 p-4">
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
<span>Generating preview video...</span>
|
||||
<span>{t('generating')}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -107,7 +109,7 @@ export default function PreviewVideoSection({
|
||||
<div className="flex flex-col items-center justify-center p-8 text-center">
|
||||
<div className="h-8 w-8 animate-spin rounded-full border-4 border-gray-200 border-t-blue-500 mb-4" />
|
||||
<p className="text-sm text-gray-600">
|
||||
Starting encoding worker... This usually takes about a minute.
|
||||
{t('startingEncoder')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -136,7 +138,7 @@ export default function PreviewVideoSection({
|
||||
src={previewState.videoUrl}
|
||||
className="block w-full h-auto"
|
||||
>
|
||||
Your browser does not support the video tag.
|
||||
{t('unsupportedBrowser')}
|
||||
</video>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
import { Info } from 'lucide-react'
|
||||
@@ -20,6 +21,7 @@ export default function ReferenceEmptyState({
|
||||
onAdd,
|
||||
onSearch,
|
||||
}: ReferenceEmptyStateProps) {
|
||||
const t = useTranslations('lyricsReview.referenceEmpty')
|
||||
// onClose is a no-op here — it's inline, not a modal
|
||||
const handleClose = () => {}
|
||||
|
||||
@@ -28,18 +30,17 @@ export default function ReferenceEmptyState({
|
||||
<Alert>
|
||||
<Info className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
No reference lyrics were found for this song. Search all configured lyrics providers or
|
||||
paste lyrics manually to enable gap correction.
|
||||
{t('noReferenceFound')}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<Tabs defaultValue="search">
|
||||
<TabsList className="w-full">
|
||||
<TabsTrigger value="search" className="flex-1">
|
||||
Search
|
||||
{t('search')}
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="paste" className="flex-1">
|
||||
Paste
|
||||
{t('paste')}
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useMemo } from 'react'
|
||||
import { Card, CardContent } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -30,6 +31,7 @@ export default function ReferenceView({
|
||||
defaultArtist = '',
|
||||
defaultTitle = '',
|
||||
}: ReferenceViewProps) {
|
||||
const t = useTranslations('lyricsReview.reference')
|
||||
const availableSources = useMemo(() => Object.keys(referenceSources), [referenceSources])
|
||||
|
||||
const effectiveCurrentSource = useMemo(
|
||||
@@ -166,13 +168,13 @@ export default function ReferenceView({
|
||||
<CardContent className="p-0">
|
||||
<div className="flex justify-between items-center mb-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="text-sm font-semibold">Reference Lyrics</h3>
|
||||
<h3 className="text-sm font-semibold">{t('title')}</h3>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-5 w-5 min-h-0 min-w-0 p-0.5"
|
||||
onClick={copyAllReferenceText}
|
||||
title="Copy all reference lyrics"
|
||||
title={t('copyAll')}
|
||||
>
|
||||
<Copy className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -54,13 +55,14 @@ function TriggerBadge({ trigger }: { trigger: string }) {
|
||||
}
|
||||
|
||||
function EditPreview({ session }: { session: ReviewSession }) {
|
||||
const t = useTranslations('lyricsReview.sessionRestore')
|
||||
const { summary } = session
|
||||
const changedWords = summary?.changed_words || []
|
||||
|
||||
if (changedWords.length === 0) {
|
||||
return (
|
||||
<div className="text-sm text-muted-foreground italic p-4">
|
||||
No word-level changes recorded in this session.
|
||||
{t('noWordChanges')}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -98,6 +100,7 @@ export default function SessionRestoreDialog({
|
||||
currentAudioDuration,
|
||||
isLoading = false,
|
||||
}: SessionRestoreDialogProps) {
|
||||
const t = useTranslations('lyricsReview.sessionRestore')
|
||||
const [selectedSessionId, setSelectedSessionId] = useState<string | null>(null)
|
||||
const [isRestoring, setIsRestoring] = useState(false)
|
||||
const [searchMode, setSearchMode] = useState<'this-job' | 'all-jobs'>('this-job')
|
||||
@@ -221,7 +224,7 @@ export default function SessionRestoreDialog({
|
||||
<Dialog open={open && !durationWarning} onOpenChange={(o) => !o && onClose()}>
|
||||
<DialogContent className="max-w-3xl max-h-[80vh] flex flex-col">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Saved Review Sessions</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{/* Tab switcher */}
|
||||
@@ -231,14 +234,14 @@ export default function SessionRestoreDialog({
|
||||
size="sm"
|
||||
onClick={() => setSearchMode('this-job')}
|
||||
>
|
||||
This Job ({sessions.length})
|
||||
{t('thisJob', { count: sessions.length })}
|
||||
</Button>
|
||||
<Button
|
||||
variant={searchMode === 'all-jobs' ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
onClick={() => setSearchMode('all-jobs')}
|
||||
>
|
||||
All Jobs
|
||||
{t('allJobs')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -246,7 +249,7 @@ export default function SessionRestoreDialog({
|
||||
{searchMode === 'all-jobs' && (
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
placeholder="Search by artist, title, or job ID..."
|
||||
placeholder={t('searchPlaceholder')}
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleSearch()}
|
||||
@@ -263,7 +266,7 @@ export default function SessionRestoreDialog({
|
||||
</div>
|
||||
) : displayedSessions.length === 0 ? (
|
||||
<div className="text-center py-12 text-muted-foreground">
|
||||
{searchMode === 'all-jobs' ? 'Search for sessions across all jobs' : 'No saved sessions found'}
|
||||
{searchMode === 'all-jobs' ? t('searchAcrossAllJobs') : t('noSessions')}
|
||||
</div>
|
||||
) : (
|
||||
/* Split pane: session list (left) + preview (right) */
|
||||
@@ -302,7 +305,7 @@ export default function SessionRestoreDialog({
|
||||
<EditPreview session={selectedSession} />
|
||||
) : (
|
||||
<div className="text-sm text-muted-foreground p-4 italic">
|
||||
Select a session to preview changes
|
||||
{t('selectToPreview')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -311,14 +314,14 @@ export default function SessionRestoreDialog({
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={onClose}>
|
||||
Start Fresh
|
||||
{t('startFresh')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleRestore}
|
||||
disabled={!selectedSession || isRestoring}
|
||||
>
|
||||
{isRestoring && <Loader2 className="h-4 w-4 animate-spin mr-2" />}
|
||||
Restore Selected
|
||||
{t('restoreSelected')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
@@ -330,20 +333,20 @@ export default function SessionRestoreDialog({
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<AlertTriangle className="h-5 w-5 text-yellow-500" />
|
||||
Duration Mismatch
|
||||
{t('durationMismatchTitle')}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
{durationWarning && (
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
The selected session is from a track with a different duration:
|
||||
{t('durationMismatchDesc')}
|
||||
</p>
|
||||
<div className="bg-muted rounded-md p-3 text-sm space-y-1">
|
||||
<div>This job: <strong>{formatDuration(durationWarning.current)}</strong> ({Math.round(durationWarning.current)}s)</div>
|
||||
<div>Source session: <strong>{formatDuration(durationWarning.source)}</strong> ({Math.round(durationWarning.source)}s)</div>
|
||||
<div>{t('thisJobDuration')} <strong>{formatDuration(durationWarning.current)}</strong> ({Math.round(durationWarning.current)}s)</div>
|
||||
<div>{t('sourceSessionDuration')} <strong>{formatDuration(durationWarning.source)}</strong> ({Math.round(durationWarning.source)}s)</div>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Timing alignment may not match. Word timestamps from the source session will be preserved as-is.
|
||||
{t('timingMayNotMatch')}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -353,7 +356,7 @@ export default function SessionRestoreDialog({
|
||||
</Button>
|
||||
<Button onClick={doRestore} disabled={isRestoring}>
|
||||
{isRestoring && <Loader2 className="h-4 w-4 animate-spin mr-2" />}
|
||||
Restore Anyway
|
||||
{t('restoreAnyway')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState } from 'react'
|
||||
import { Card, CardContent } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -33,6 +34,7 @@ export default function TranscriptionView({
|
||||
advancedMode = false,
|
||||
onAdvancedModeToggle,
|
||||
}: TranscriptionViewProps) {
|
||||
const t = useTranslations('lyricsReview.transcription')
|
||||
const [selectedSegmentIndex, setSelectedSegmentIndex] = useState<number | null>(null)
|
||||
const [viewMode, setViewMode] = useState<'text' | 'duration'>('text')
|
||||
|
||||
@@ -48,13 +50,13 @@ export default function TranscriptionView({
|
||||
<CardContent className="p-0">
|
||||
<div className="flex justify-between items-center mb-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="text-sm font-semibold">Synced Lyrics</h3>
|
||||
<h3 className="text-sm font-semibold">{t('syncedLyrics')}</h3>
|
||||
<Badge
|
||||
variant={advancedMode ? 'default' : 'outline'}
|
||||
className="cursor-pointer hover:opacity-80 transition-opacity text-[0.65rem] h-5 px-1.5"
|
||||
onClick={() => onAdvancedModeToggle?.(!advancedMode)}
|
||||
>
|
||||
{advancedMode ? 'Advanced' : 'Simple'}
|
||||
{advancedMode ? t('advanced') : t('simple')}
|
||||
</Badge>
|
||||
</div>
|
||||
<ToggleGroup
|
||||
@@ -65,7 +67,7 @@ export default function TranscriptionView({
|
||||
>
|
||||
<ToggleGroupItem value="text" aria-label="text view" className="h-7 px-2.5 text-[0.75rem]">
|
||||
<Type className="h-3.5 w-3.5 mr-1" />
|
||||
Text
|
||||
{t('text')}
|
||||
</ToggleGroupItem>
|
||||
<ToggleGroupItem
|
||||
value="duration"
|
||||
@@ -73,7 +75,7 @@ export default function TranscriptionView({
|
||||
className="h-7 px-2.5 text-[0.75rem]"
|
||||
>
|
||||
<Clock className="h-3.5 w-3.5 mr-1.5" />
|
||||
Timeline
|
||||
{t('timeline')}
|
||||
</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</div>
|
||||
@@ -160,7 +162,7 @@ export default function TranscriptionView({
|
||||
size="icon"
|
||||
className="h-[18px] w-[18px] min-h-0 min-w-0 p-[1px] text-destructive hover:text-destructive"
|
||||
onClick={() => handleDeleteSegment(segmentIndex)}
|
||||
title="Delete segment"
|
||||
title={t('deleteSegment')}
|
||||
>
|
||||
<Trash2 className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
@@ -171,7 +173,7 @@ export default function TranscriptionView({
|
||||
size="icon"
|
||||
className="h-[18px] w-[18px] min-h-0 min-w-0 p-[1px]"
|
||||
onClick={() => onPlaySegment?.(segment.start_time!)}
|
||||
title="Play segment"
|
||||
title={t('playSegment')}
|
||||
>
|
||||
<Play className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -36,6 +37,8 @@ export default function AIFeedbackModal({
|
||||
onSubmit,
|
||||
suggestion,
|
||||
}: AIFeedbackModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.aiFeedback')
|
||||
const tc = useTranslations('common')
|
||||
const [reviewerAction, setAction] = useState('ACCEPT')
|
||||
const [finalText, setFinalText] = useState('')
|
||||
const [reasonCategory, setReason] = useState('AI_CORRECT')
|
||||
@@ -62,7 +65,7 @@ export default function AIFeedbackModal({
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="max-w-md" ref={contentRef}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>AI Suggestion</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4">
|
||||
@@ -79,54 +82,54 @@ export default function AIFeedbackModal({
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="action">Action</Label>
|
||||
<Label htmlFor="action">{t('action')}</Label>
|
||||
<Select value={reviewerAction} onValueChange={setAction}>
|
||||
<SelectTrigger id="action">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ACCEPT">Accept</SelectItem>
|
||||
<SelectItem value="REJECT">Reject</SelectItem>
|
||||
<SelectItem value="MODIFY">Modify</SelectItem>
|
||||
<SelectItem value="ACCEPT">{t('accept')}</SelectItem>
|
||||
<SelectItem value="REJECT">{t('reject')}</SelectItem>
|
||||
<SelectItem value="MODIFY">{t('modify')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{reviewerAction === 'MODIFY' && (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="finalText">Final Text</Label>
|
||||
<Label htmlFor="finalText">{t('finalText')}</Label>
|
||||
<Input
|
||||
id="finalText"
|
||||
value={finalText}
|
||||
onChange={(e) => setFinalText(e.target.value)}
|
||||
placeholder="Enter the modified text..."
|
||||
placeholder={t('finalTextPlaceholder')}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="reason">Reason</Label>
|
||||
<Label htmlFor="reason">{t('reason')}</Label>
|
||||
<Select value={reasonCategory} onValueChange={setReason}>
|
||||
<SelectTrigger id="reason">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="AI_CORRECT">AI_CORRECT</SelectItem>
|
||||
<SelectItem value="AI_INCORRECT">AI_INCORRECT</SelectItem>
|
||||
<SelectItem value="AI_SUBOPTIMAL">AI_SUBOPTIMAL</SelectItem>
|
||||
<SelectItem value="CONTEXT_NEEDED">CONTEXT_NEEDED</SelectItem>
|
||||
<SelectItem value="SUBJECTIVE_PREFERENCE">SUBJECTIVE_PREFERENCE</SelectItem>
|
||||
<SelectItem value="AI_CORRECT">{t('aiCorrect')}</SelectItem>
|
||||
<SelectItem value="AI_INCORRECT">{t('aiIncorrect')}</SelectItem>
|
||||
<SelectItem value="AI_SUBOPTIMAL">{t('aiSuboptimal')}</SelectItem>
|
||||
<SelectItem value="CONTEXT_NEEDED">{t('contextNeeded')}</SelectItem>
|
||||
<SelectItem value="SUBJECTIVE_PREFERENCE">{t('subjectivePreference')}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="details">Details</Label>
|
||||
<Label htmlFor="details">{t('details')}</Label>
|
||||
<Textarea
|
||||
id="details"
|
||||
value={reasonDetail}
|
||||
onChange={(e) => setDetail(e.target.value)}
|
||||
placeholder="Additional details..."
|
||||
placeholder={t('detailsPlaceholder')}
|
||||
rows={3}
|
||||
/>
|
||||
</div>
|
||||
@@ -134,9 +137,9 @@ export default function AIFeedbackModal({
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={onClose}>
|
||||
Cancel
|
||||
{tc('cancel')}
|
||||
</Button>
|
||||
<Button onClick={handleSubmit}>Submit</Button>
|
||||
<Button onClick={handleSubmit}>{t('submit')}</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
|
||||
@@ -24,6 +25,7 @@ export default function AddLyricsModal({
|
||||
defaultArtist,
|
||||
defaultTitle,
|
||||
}: AddLyricsModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.addLyrics')
|
||||
const [activeTab, setActiveTab] = useState('search')
|
||||
|
||||
const handleClose = () => {
|
||||
@@ -35,16 +37,16 @@ export default function AddLyricsModal({
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && handleClose()}>
|
||||
<DialogContent className="max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Add Reference Lyrics</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab}>
|
||||
<TabsList className="w-full">
|
||||
<TabsTrigger value="search" className="flex-1">
|
||||
Search
|
||||
{t('search')}
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="paste" className="flex-1">
|
||||
Paste
|
||||
{t('paste')}
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -40,62 +41,18 @@ interface CorrectionAnnotationModalProps {
|
||||
gapId?: string
|
||||
}
|
||||
|
||||
const ANNOTATION_TYPES: { value: CorrectionAnnotationType; label: string; description: string }[] = [
|
||||
{
|
||||
value: 'SOUND_ALIKE',
|
||||
label: 'Sound-Alike Error',
|
||||
description: 'Homophones or similar-sounding words (e.g., "out" vs "now")',
|
||||
},
|
||||
{
|
||||
value: 'BACKGROUND_VOCALS',
|
||||
label: 'Background Vocals',
|
||||
description: 'Backing vocals that should be removed from karaoke',
|
||||
},
|
||||
{
|
||||
value: 'EXTRA_WORDS',
|
||||
label: 'Extra Filler Words',
|
||||
description: 'Transcription added words like "And", "But", "Well"',
|
||||
},
|
||||
{
|
||||
value: 'PUNCTUATION_ONLY',
|
||||
label: 'Punctuation/Style Only',
|
||||
description: 'Only punctuation or capitalization differences',
|
||||
},
|
||||
{
|
||||
value: 'REPEATED_SECTION',
|
||||
label: 'Repeated Section',
|
||||
description: 'Chorus or verse repetition not in condensed references',
|
||||
},
|
||||
{
|
||||
value: 'COMPLEX_MULTI_ERROR',
|
||||
label: 'Complex Multi-Error',
|
||||
description: 'Multiple different error types in one section',
|
||||
},
|
||||
{
|
||||
value: 'AMBIGUOUS',
|
||||
label: 'Ambiguous',
|
||||
description: 'Unclear without listening to audio',
|
||||
},
|
||||
{
|
||||
value: 'NO_ERROR',
|
||||
label: 'No Error',
|
||||
description: 'Transcription matches at least one reference source',
|
||||
},
|
||||
{
|
||||
value: 'MANUAL_EDIT',
|
||||
label: 'Manual Edit',
|
||||
description: 'Human-initiated correction not from detected gap',
|
||||
},
|
||||
const ANNOTATION_TYPE_KEYS: { value: CorrectionAnnotationType; labelKey: string; descKey: string }[] = [
|
||||
{ value: 'SOUND_ALIKE', labelKey: 'soundAlike', descKey: 'soundAlikeDesc' },
|
||||
{ value: 'BACKGROUND_VOCALS', labelKey: 'backgroundVocals', descKey: 'backgroundVocalsDesc' },
|
||||
{ value: 'EXTRA_WORDS', labelKey: 'extraFiller', descKey: 'extraFillerDesc' },
|
||||
{ value: 'PUNCTUATION_ONLY', labelKey: 'punctuation', descKey: 'punctuationDesc' },
|
||||
{ value: 'REPEATED_SECTION', labelKey: 'repeatedSection', descKey: 'repeatedSectionDesc' },
|
||||
{ value: 'COMPLEX_MULTI_ERROR', labelKey: 'complexMultiError', descKey: 'complexMultiErrorDesc' },
|
||||
{ value: 'AMBIGUOUS', labelKey: 'ambiguous', descKey: 'ambiguousDesc' },
|
||||
{ value: 'NO_ERROR', labelKey: 'noError', descKey: 'noErrorDesc' },
|
||||
{ value: 'MANUAL_EDIT', labelKey: 'manualEdit', descKey: 'manualEditDesc' },
|
||||
]
|
||||
|
||||
const CONFIDENCE_LABELS: Record<number, string> = {
|
||||
1: '1 - Very Uncertain',
|
||||
2: '2 - Somewhat Uncertain',
|
||||
3: '3 - Neutral',
|
||||
4: '4 - Fairly Confident',
|
||||
5: '5 - Very Confident',
|
||||
}
|
||||
|
||||
export default function CorrectionAnnotationModal({
|
||||
open,
|
||||
onClose,
|
||||
@@ -112,6 +69,9 @@ export default function CorrectionAnnotationModal({
|
||||
sessionId,
|
||||
gapId,
|
||||
}: CorrectionAnnotationModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.correctionAnnotation')
|
||||
const tTypes = useTranslations('lyricsReview.modals.correctionAnnotation.types')
|
||||
const tConf = useTranslations('lyricsReview.modals.correctionAnnotation.confidenceLevels')
|
||||
const [annotationType, setAnnotationType] = useState<CorrectionAnnotationType>('MANUAL_EDIT')
|
||||
const [actionTaken, setActionTaken] = useState<CorrectionAction>('REPLACE')
|
||||
const [confidence, setConfidence] = useState(3)
|
||||
@@ -190,26 +150,26 @@ export default function CorrectionAnnotationModal({
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && handleClose()}>
|
||||
<DialogContent className="max-w-2xl max-h-[90vh] overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Annotate Your Correction</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Help improve the AI by explaining your correction
|
||||
{t('description')}
|
||||
</p>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6">
|
||||
{/* Show what changed */}
|
||||
<div className="bg-muted p-4 rounded-lg">
|
||||
<h4 className="text-sm font-medium mb-2">Your Correction:</h4>
|
||||
<h4 className="text-sm font-medium mb-2">{t('yourCorrection')}</h4>
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex-1">
|
||||
<span className="text-xs text-destructive">Original:</span>
|
||||
<span className="text-xs text-destructive">{t('original')}</span>
|
||||
<p className="font-mono text-sm line-through text-destructive">
|
||||
{originalText || '(empty)'}
|
||||
</p>
|
||||
</div>
|
||||
<span className="text-lg">→</span>
|
||||
<div className="flex-1">
|
||||
<span className="text-xs text-green-500">Corrected:</span>
|
||||
<span className="text-xs text-green-500">{t('corrected')}</span>
|
||||
<p className="font-mono text-sm font-bold text-green-500">
|
||||
{correctedText || '(empty)'}
|
||||
</p>
|
||||
@@ -221,19 +181,19 @@ export default function CorrectionAnnotationModal({
|
||||
{agenticProposal && (
|
||||
<Alert variant={agenticAgreed ? 'default' : 'default'}>
|
||||
<AlertDescription>
|
||||
<h4 className="font-medium mb-2">AI Suggestion:</h4>
|
||||
<h4 className="font-medium mb-2">{t('aiSuggestion')}</h4>
|
||||
<p className="text-sm">
|
||||
Category: <strong>{agenticProposal.gap_category}</strong>
|
||||
{t('category')} <strong>{agenticProposal.gap_category}</strong>
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
Action: <strong>{agenticProposal.action}</strong>
|
||||
{t('action')} <strong>{agenticProposal.action}</strong>
|
||||
{agenticProposal.replacement_text && ` → "${agenticProposal.replacement_text}"`}
|
||||
</p>
|
||||
<p className="text-sm">Reason: {agenticProposal.reason}</p>
|
||||
<p className="text-sm">{t('reason')} {agenticProposal.reason}</p>
|
||||
<p className="text-sm mt-2">
|
||||
{agenticAgreed
|
||||
? '✓ Your correction matches the AI suggestion'
|
||||
: '✗ Your correction differs from the AI suggestion'}
|
||||
? `✓ ${t('matchesAI')}`
|
||||
: `✗ ${t('differsFromAI')}`}
|
||||
</p>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
@@ -242,7 +202,7 @@ export default function CorrectionAnnotationModal({
|
||||
{/* Reference sources */}
|
||||
{referenceSources.length > 0 && (
|
||||
<div>
|
||||
<h4 className="text-sm font-medium mb-2">Reference Sources Consulted:</h4>
|
||||
<h4 className="text-sm font-medium mb-2">{t('referenceSources')}</h4>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{referenceSources.map((source) => (
|
||||
<Badge key={source} variant="secondary">
|
||||
@@ -255,17 +215,17 @@ export default function CorrectionAnnotationModal({
|
||||
|
||||
{/* Annotation type */}
|
||||
<div className="space-y-2">
|
||||
<Label>Correction Type *</Label>
|
||||
<Label>{t('correctionType')}</Label>
|
||||
<Select value={annotationType} onValueChange={(v) => setAnnotationType(v as CorrectionAnnotationType)}>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select correction type" />
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{ANNOTATION_TYPES.map((type) => (
|
||||
{ANNOTATION_TYPE_KEYS.map((type) => (
|
||||
<SelectItem key={type.value} value={type.value}>
|
||||
<div>
|
||||
<p className="font-medium">{type.label}</p>
|
||||
<p className="text-xs text-muted-foreground">{type.description}</p>
|
||||
<p className="font-medium">{tTypes(type.labelKey)}</p>
|
||||
<p className="text-xs text-muted-foreground">{tTypes(type.descKey)}</p>
|
||||
</div>
|
||||
</SelectItem>
|
||||
))}
|
||||
@@ -275,7 +235,7 @@ export default function CorrectionAnnotationModal({
|
||||
|
||||
{/* Confidence slider */}
|
||||
<div className="space-y-2">
|
||||
<Label>Confidence in Your Correction *</Label>
|
||||
<Label>{t('confidence')}</Label>
|
||||
<Slider
|
||||
value={[confidence]}
|
||||
min={1}
|
||||
@@ -283,12 +243,12 @@ export default function CorrectionAnnotationModal({
|
||||
step={1}
|
||||
onValueChange={([v]) => setConfidence(v)}
|
||||
/>
|
||||
<p className="text-sm text-muted-foreground">{CONFIDENCE_LABELS[confidence]}</p>
|
||||
<p className="text-sm text-muted-foreground">{tConf(String(confidence))}</p>
|
||||
</div>
|
||||
|
||||
{/* Reasoning text area */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="reasoning">Reasoning *</Label>
|
||||
<Label htmlFor="reasoning">{t('reasoning')}</Label>
|
||||
<Textarea
|
||||
id="reasoning"
|
||||
value={reasoning}
|
||||
@@ -296,21 +256,21 @@ export default function CorrectionAnnotationModal({
|
||||
setReasoning(e.target.value)
|
||||
setError('')
|
||||
}}
|
||||
placeholder="Explain why this correction is needed (minimum 10 characters)..."
|
||||
placeholder={t('reasoningPlaceholder')}
|
||||
rows={4}
|
||||
className={error ? 'border-destructive' : ''}
|
||||
/>
|
||||
<p className={`text-sm ${error ? 'text-destructive' : 'text-muted-foreground'}`}>
|
||||
{error || `${reasoning.length}/10 minimum characters`}
|
||||
{error || t('minChars', { count: reasoning.length })}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={handleSkipAndClose}>
|
||||
Skip
|
||||
{t('skip')}
|
||||
</Button>
|
||||
<Button onClick={handleSave}>Save & Continue</Button>
|
||||
<Button onClick={handleSave}>{t('saveAndContinue')}</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -49,6 +50,8 @@ export default function EditModal({
|
||||
isGlobal = false,
|
||||
isLoading = false,
|
||||
}: EditModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.editAll')
|
||||
const tActions = useTranslations('lyricsReview.editActionBar')
|
||||
const [editedSegment, setEditedSegment] = useState<LyricsSegment | null>(segment)
|
||||
const [isPlaying, setIsPlaying] = useState(false)
|
||||
const currentTimeRef = useRef(currentTime)
|
||||
@@ -358,7 +361,7 @@ export default function EditModal({
|
||||
<DialogContent className="max-w-[960px] max-h-[90vh] overflow-hidden flex flex-col" onKeyDown={handleKeyDown}>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
Edit {isGlobal ? 'All Words' : `Segment ${segmentIndex}`}
|
||||
{isGlobal ? t('title') : t('editSegment', { index: segmentIndex ?? 0 })}
|
||||
{segment && segment.start_time !== null && onPlaySegment && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -376,7 +379,7 @@ export default function EditModal({
|
||||
<div className="flex flex-col items-center justify-center flex-1 py-12">
|
||||
<Loader2 className="h-12 w-12 animate-spin text-primary" />
|
||||
<p className="mt-4 text-lg font-semibold">
|
||||
Loading {isGlobal ? 'all words' : 'segment'}...
|
||||
{isGlobal ? t('loadingAll') : t('loadingSegment')}
|
||||
</p>
|
||||
</div>
|
||||
) : editedSegment ? (
|
||||
@@ -421,7 +424,7 @@ export default function EditModal({
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex items-center justify-center flex-1">
|
||||
<p className="text-lg">No segment data available</p>
|
||||
<p className="text-lg">{t('noData')}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -434,27 +437,27 @@ export default function EditModal({
|
||||
className="text-orange-600 border-orange-600 hover:bg-orange-50 dark:text-orange-400 dark:border-orange-400 dark:hover:bg-orange-950"
|
||||
>
|
||||
<RotateCcw className="h-4 w-4 mr-1" />
|
||||
Reset
|
||||
{tActions('reset')}
|
||||
</Button>
|
||||
{originalTranscribedSegment && (
|
||||
<Button variant="outline" size="sm" onClick={handleRevertToOriginal}>
|
||||
<History className="h-4 w-4 mr-1" />
|
||||
Un-Correct
|
||||
{t('unCorrect')}
|
||||
</Button>
|
||||
)}
|
||||
{!isGlobal && onDelete && (
|
||||
<Button variant="destructive" size="sm" onClick={handleDelete}>
|
||||
<Trash2 className="h-4 w-4 mr-1" />
|
||||
Delete Segment
|
||||
{tActions('deleteSegment')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-2 ml-auto">
|
||||
<Button variant="outline" onClick={handleClose}>
|
||||
Cancel
|
||||
{tActions('cancel')}
|
||||
</Button>
|
||||
<Button onClick={handleSave} disabled={isLoading || !editedSegment || editedSegment.words.length === 0}>
|
||||
Save
|
||||
{tActions('save')}
|
||||
</Button>
|
||||
</div>
|
||||
</DialogFooter>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -37,6 +38,7 @@ export default function FindReplaceModal({
|
||||
onReplace,
|
||||
data,
|
||||
}: FindReplaceModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.findReplace')
|
||||
const [findText, setFindText] = useState('')
|
||||
const [replaceText, setReplaceText] = useState('')
|
||||
const [caseSensitive, setCaseSensitive] = useState(false)
|
||||
@@ -124,17 +126,17 @@ export default function FindReplaceModal({
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="max-w-2xl" onKeyDown={handleKeyDown}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Find and Replace</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="find">Find</Label>
|
||||
<Label htmlFor="find">{t('find')}</Label>
|
||||
<Input
|
||||
id="find"
|
||||
value={findText}
|
||||
onChange={(e) => setFindText(e.target.value)}
|
||||
placeholder="Text to find..."
|
||||
placeholder={t('findPlaceholder')}
|
||||
autoFocus
|
||||
className={regexError ? 'border-destructive' : ''}
|
||||
/>
|
||||
@@ -142,12 +144,12 @@ export default function FindReplaceModal({
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="replace">Replace with</Label>
|
||||
<Label htmlFor="replace">{t('replaceWith')}</Label>
|
||||
<Input
|
||||
id="replace"
|
||||
value={replaceText}
|
||||
onChange={(e) => setReplaceText(e.target.value)}
|
||||
placeholder="Replacement text..."
|
||||
placeholder={t('replacePlaceholder')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -158,11 +160,11 @@ export default function FindReplaceModal({
|
||||
checked={caseSensitive}
|
||||
onCheckedChange={setCaseSensitive}
|
||||
/>
|
||||
<Label htmlFor="caseSensitive">Case sensitive</Label>
|
||||
<Label htmlFor="caseSensitive">{t('caseSensitive')}</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<Switch id="useRegex" checked={useRegex} onCheckedChange={setUseRegex} />
|
||||
<Label htmlFor="useRegex">Use regex</Label>
|
||||
<Label htmlFor="useRegex">{t('useRegex')}</Label>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<Switch
|
||||
@@ -170,13 +172,13 @@ export default function FindReplaceModal({
|
||||
checked={fullTextMode}
|
||||
onCheckedChange={setFullTextMode}
|
||||
/>
|
||||
<Label htmlFor="fullTextMode">Full text mode</Label>
|
||||
<Label htmlFor="fullTextMode">{t('fullTextMode')}</Label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<h4 className="font-medium">Preview</h4>
|
||||
<h4 className="font-medium">{t('preview')}</h4>
|
||||
{isSearching && <Loader2 className="h-4 w-4 animate-spin" />}
|
||||
</div>
|
||||
|
||||
@@ -184,21 +186,21 @@ export default function FindReplaceModal({
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
Some replacements will result in empty words, which will be removed.
|
||||
{t('emptyWordsWarning')}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{!isSearching && findText && matchPreviews.length === 0 && !regexError && (
|
||||
<Alert>
|
||||
<AlertDescription>No matches found</AlertDescription>
|
||||
<AlertDescription>{t('noMatches')}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{!isSearching && matchPreviews.length > 0 && (
|
||||
<>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{matchPreviews.length} {matchPreviews.length === 1 ? 'match' : 'matches'} found
|
||||
{t('matchesFound', { count: matchPreviews.length })}
|
||||
</p>
|
||||
<ScrollArea className="h-48 border rounded-md p-2">
|
||||
<div className="space-y-2">
|
||||
@@ -238,7 +240,7 @@ export default function FindReplaceModal({
|
||||
onClick={handleReplace}
|
||||
disabled={!findText || !!regexError || matchPreviews.length === 0}
|
||||
>
|
||||
Replace All ({matchPreviews.length})
|
||||
{t('replaceAll', { count: matchPreviews.length })}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { RefreshCw, ClipboardPaste, TextCursorInput, X } from 'lucide-react'
|
||||
@@ -22,12 +23,13 @@ export default function ModeSelectionModal({
|
||||
onSelectReplaceSegments,
|
||||
hasExistingLyrics,
|
||||
}: ModeSelectionModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.modeSelection')
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center justify-between">
|
||||
<span>Edit All Lyrics</span>
|
||||
<span>{t('title')}</span>
|
||||
<Button variant="ghost" size="icon" onClick={onClose} className="h-8 w-8">
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -35,7 +37,7 @@ export default function ModeSelectionModal({
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm text-muted-foreground">Choose how you want to edit the lyrics:</p>
|
||||
<p className="text-sm text-muted-foreground">{t('chooseMethod')}</p>
|
||||
|
||||
<div className="flex flex-col gap-3">
|
||||
{/* Re-sync Existing option - only show if there are existing lyrics */}
|
||||
@@ -50,12 +52,11 @@ export default function ModeSelectionModal({
|
||||
<div className="flex items-start gap-3">
|
||||
<RefreshCw className="h-10 w-10 text-primary mt-0.5" />
|
||||
<div className="flex-1">
|
||||
<h3 className="text-lg font-semibold text-primary">Re-sync Existing Lyrics</h3>
|
||||
<h3 className="text-lg font-semibold text-primary">{t('resyncTitle')}</h3>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
Keep the current lyrics text and fix timing issues. Use this when lyrics are
|
||||
correct but timing has drifted, especially in the second half of the song.
|
||||
{t('resyncDesc')}
|
||||
</p>
|
||||
<p className="text-xs text-green-500 mt-2">Recommended for fixing timing drift</p>
|
||||
<p className="text-xs text-green-500 mt-2">{t('resyncRecommended')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,12 +74,11 @@ export default function ModeSelectionModal({
|
||||
<div className="flex items-start gap-3">
|
||||
<TextCursorInput className="h-10 w-10 text-muted-foreground mt-0.5" />
|
||||
<div className="flex-1">
|
||||
<h3 className="text-lg font-semibold">Replace Segment Lyrics</h3>
|
||||
<h3 className="text-lg font-semibold">{t('replaceSegmentTitle')}</h3>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
Edit or paste new lyrics for each line. Timing is preserved — only the words
|
||||
change. Best for custom lyrics, translations, or fixing multiple lines at once.
|
||||
{t('replaceSegmentDesc')}
|
||||
</p>
|
||||
<p className="text-xs text-green-500 mt-2">Recommended for custom lyrics</p>
|
||||
<p className="text-xs text-green-500 mt-2">{t('replaceSegmentRecommended')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,13 +95,12 @@ export default function ModeSelectionModal({
|
||||
<div className="flex items-start gap-3">
|
||||
<ClipboardPaste className="h-10 w-10 text-muted-foreground mt-0.5" />
|
||||
<div className="flex-1">
|
||||
<h3 className="text-lg font-semibold">Replace All Lyrics</h3>
|
||||
<h3 className="text-lg font-semibold">{t('replaceAllTitle')}</h3>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
Paste completely new lyrics from clipboard and manually sync timing for all
|
||||
words from scratch.
|
||||
{t('replaceAllDesc')}
|
||||
</p>
|
||||
<p className="text-xs text-yellow-500 mt-2">
|
||||
All existing timing data will be lost
|
||||
{t('replaceAllWarning')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -18,6 +19,7 @@ export default function PasteLyricsTab({
|
||||
onClose,
|
||||
disabled = false,
|
||||
}: PasteLyricsTabProps) {
|
||||
const t = useTranslations('lyricsReview.modals.pasteLyrics')
|
||||
const [source, setSource] = useState('')
|
||||
const [lyrics, setLyrics] = useState('')
|
||||
const [isAdding, setIsAdding] = useState(false)
|
||||
@@ -53,23 +55,23 @@ export default function PasteLyricsTab({
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="paste-source">Source Name</Label>
|
||||
<Label htmlFor="paste-source">{t('sourceName')}</Label>
|
||||
<Input
|
||||
id="paste-source"
|
||||
value={source}
|
||||
onChange={(e) => setSource(e.target.value)}
|
||||
placeholder="e.g., manual, genius, azlyrics..."
|
||||
placeholder={t('sourceNamePlaceholder')}
|
||||
disabled={isAdding || disabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="paste-lyrics">Lyrics</Label>
|
||||
<Label htmlFor="paste-lyrics">{t('lyrics')}</Label>
|
||||
<Textarea
|
||||
id="paste-lyrics"
|
||||
value={lyrics}
|
||||
onChange={(e) => setLyrics(e.target.value)}
|
||||
placeholder="Paste lyrics here..."
|
||||
placeholder={t('lyricsPlaceholder')}
|
||||
rows={10}
|
||||
disabled={isAdding || disabled}
|
||||
className="font-mono text-sm"
|
||||
@@ -89,10 +91,10 @@ export default function PasteLyricsTab({
|
||||
{isAdding ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
Adding...
|
||||
{t('adding')}
|
||||
</>
|
||||
) : (
|
||||
'Add Lyrics'
|
||||
t('addLyrics')
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -40,6 +41,7 @@ export default function ReplaceAllLyricsModal({
|
||||
setModalSpacebarHandler,
|
||||
existingSegments = [],
|
||||
}: ReplaceAllLyricsModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.replaceAllLyrics')
|
||||
const [mode, setMode] = useState<ModalMode>('selection')
|
||||
const [inputText, setInputText] = useState('')
|
||||
const [newSegments, setNewSegments] = useState<LyricsSegment[]>([])
|
||||
@@ -220,7 +222,7 @@ export default function ReplaceAllLyricsModal({
|
||||
<Button variant="ghost" size="icon" onClick={handleBackToSelection} className="h-8 w-8">
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<span className="flex-1">Replace All Lyrics</span>
|
||||
<span className="flex-1">{t('replaceAll')}</span>
|
||||
<Button variant="ghost" size="icon" onClick={handleClose} className="h-8 w-8">
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -229,26 +231,26 @@ export default function ReplaceAllLyricsModal({
|
||||
|
||||
<div className="flex-1 overflow-hidden flex flex-col gap-4">
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold">Paste your new lyrics below:</h3>
|
||||
<h3 className="text-lg font-semibold">{t('pastePrompt')}</h3>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
Each line will become a separate segment. Words will be separated by spaces.
|
||||
{t('eachLineNote')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Button variant="outline" size="sm" onClick={handlePasteFromClipboard}>
|
||||
<ClipboardPaste className="h-4 w-4 mr-2" />
|
||||
Paste from Clipboard
|
||||
{t('pasteFromClipboard')}
|
||||
</Button>
|
||||
<span className="text-sm text-muted-foreground font-medium">
|
||||
{parseInfo.lines} lines, {parseInfo.words} words
|
||||
{t('lineWordCount', { lines: parseInfo.lines, words: parseInfo.words })}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<Textarea
|
||||
value={inputText}
|
||||
onChange={(e) => setInputText(e.target.value)}
|
||||
placeholder={`Paste your lyrics here...\nEach line will become a segment\nWords will be separated by spaces`}
|
||||
placeholder={t('placeholder')}
|
||||
className="flex-1 resize-none font-mono text-sm min-h-[300px]"
|
||||
/>
|
||||
</div>
|
||||
@@ -259,7 +261,7 @@ export default function ReplaceAllLyricsModal({
|
||||
</Button>
|
||||
<Button onClick={processLyrics} disabled={!inputText.trim()}>
|
||||
<Sparkles className="h-4 w-4 mr-2" />
|
||||
Continue to Sync
|
||||
{t('continueToSync')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
@@ -273,7 +275,7 @@ export default function ReplaceAllLyricsModal({
|
||||
<Button variant="ghost" size="icon" onClick={handleBackToSelection} className="h-8 w-8">
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<span className="flex-1">Replace Segment Lyrics</span>
|
||||
<span className="flex-1">{t('replaceSegment')}</span>
|
||||
<Button variant="ghost" size="icon" onClick={handleClose} className="h-8 w-8">
|
||||
<X className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -284,17 +286,14 @@ export default function ReplaceAllLyricsModal({
|
||||
<div className="flex items-start gap-2 p-3 rounded-md bg-muted/50 text-sm text-muted-foreground">
|
||||
<Info className="h-4 w-4 mt-0.5 shrink-0" />
|
||||
<p>
|
||||
Edit lyrics line by line. Each line corresponds to a timed segment.
|
||||
The number of lines must stay the same (currently: {replaceSegmentsInfo.expectedLineCount} lines).
|
||||
Changed lines will get new word timing estimated from the segment duration.
|
||||
Unchanged lines are left as-is.
|
||||
{t('editLineByLine', { count: replaceSegmentsInfo.expectedLineCount })}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<Button variant="outline" size="sm" onClick={handlePasteFromClipboard}>
|
||||
<ClipboardPaste className="h-4 w-4 mr-2" />
|
||||
Paste from Clipboard
|
||||
{t('pasteFromClipboard')}
|
||||
</Button>
|
||||
<span className={`text-sm font-medium ${replaceSegmentsInfo.lineDiff === 0 ? 'text-green-500' : 'text-destructive'}`}>
|
||||
{replaceSegmentsInfo.lineDiff === 0 ? (
|
||||
@@ -322,10 +321,9 @@ export default function ReplaceAllLyricsModal({
|
||||
<div className="flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-sm text-destructive">
|
||||
<AlertTriangle className="h-4 w-4 mt-0.5 shrink-0" />
|
||||
<p>
|
||||
You have {Math.abs(replaceSegmentsInfo.lineDiff)} too{' '}
|
||||
{replaceSegmentsInfo.lineDiff > 0 ? 'many' : 'few'} lines (expected{' '}
|
||||
{replaceSegmentsInfo.expectedLineCount}, got {replaceSegmentsInfo.currentLineCount}).
|
||||
Each line maps to a timed segment, so the count must match exactly.
|
||||
{replaceSegmentsInfo.lineDiff > 0
|
||||
? t('tooManyLines', { diff: Math.abs(replaceSegmentsInfo.lineDiff), expected: replaceSegmentsInfo.expectedLineCount, actual: replaceSegmentsInfo.currentLineCount })
|
||||
: t('tooFewLines', { diff: Math.abs(replaceSegmentsInfo.lineDiff), expected: replaceSegmentsInfo.expectedLineCount, actual: replaceSegmentsInfo.currentLineCount })}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -354,7 +352,7 @@ export default function ReplaceAllLyricsModal({
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
</Button>
|
||||
<span className="flex-1">
|
||||
{newSegments.length > 0 ? 'Sync New Lyrics' : 'Re-sync Existing Lyrics'}
|
||||
{newSegments.length > 0 ? t('syncNewLyrics') : t('resyncExisting')}
|
||||
</span>
|
||||
<Button variant="ghost" size="icon" onClick={handleClose} className="h-8 w-8">
|
||||
<X className="h-4 w-4" />
|
||||
@@ -374,13 +372,13 @@ export default function ReplaceAllLyricsModal({
|
||||
/>
|
||||
) : (
|
||||
<div className="flex flex-col items-center justify-center h-full gap-4">
|
||||
<h3 className="text-lg font-semibold text-muted-foreground">No lyrics to sync</h3>
|
||||
<h3 className="text-lg font-semibold text-muted-foreground">{t('noLyricsToSync')}</h3>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Go back and paste new lyrics, or close this modal.
|
||||
{t('goBackAndPaste')}
|
||||
</p>
|
||||
<Button variant="outline" onClick={handleBackToSelection}>
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Back to Selection
|
||||
{t('backToSelection')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { CorrectionData } from '@/lib/lyrics-review/types'
|
||||
@@ -34,6 +35,7 @@ export default function ReviewChangesModal({
|
||||
apiClient = null,
|
||||
timingOffsetMs = 0,
|
||||
}: ReviewChangesModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.reviewChanges')
|
||||
const corrections = data.corrections || []
|
||||
const totalSegments = data.corrected_segments?.length || 0
|
||||
const hasNoLyrics = totalSegments === 0
|
||||
@@ -50,7 +52,7 @@ export default function ReviewChangesModal({
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="max-w-4xl max-h-[90vh] overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Preview Video (With Vocals)</DialogTitle>
|
||||
<DialogTitle>{t('previewWithVocals')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{/* Video Preview Section */}
|
||||
@@ -66,14 +68,12 @@ export default function ReviewChangesModal({
|
||||
<div className="flex items-start gap-3 rounded-lg border border-yellow-500/50 bg-yellow-500/10 p-4">
|
||||
<AlertTriangle className="h-5 w-5 text-yellow-500 mt-0.5 shrink-0" />
|
||||
<div className="text-sm space-y-2">
|
||||
<p className="font-medium text-yellow-500">No lyrics detected</p>
|
||||
<p className="font-medium text-yellow-500">{t('noLyricsTitle')}</p>
|
||||
<p className="text-muted-foreground">
|
||||
No lyrics were found in the audio. This usually happens when the input audio has no vocals
|
||||
(e.g. a karaoke track or instrumental).
|
||||
{t('noLyricsDesc')}
|
||||
</p>
|
||||
<p className="text-muted-foreground">
|
||||
You can go back and paste lyrics manually using <strong>Replace All</strong>,
|
||||
or cancel this job and try again with an audio file that contains vocals.
|
||||
{t('noLyricsHint')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,11 +83,11 @@ export default function ReviewChangesModal({
|
||||
{!hasNoLyrics && (
|
||||
<div className="text-sm text-muted-foreground space-y-1">
|
||||
{hasManualCorrections ? (
|
||||
<p>Manual corrections detected. Review the preview to ensure the lyrics are synchronized correctly.</p>
|
||||
<p>{t('manualCorrectionsDetected')}</p>
|
||||
) : (
|
||||
<p>No manual corrections detected. If everything looks good in the preview, proceed to select your instrumental.</p>
|
||||
<p>{t('noManualCorrections')}</p>
|
||||
)}
|
||||
<p>Total segments: {totalSegments}</p>
|
||||
<p>{t('totalSegments', { count: totalSegments })}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -104,11 +104,11 @@ export default function ReviewChangesModal({
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
Saving...
|
||||
{t('saving')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
Proceed to Instrumental Review
|
||||
{t('proceedToInstrumental')}
|
||||
<ArrowRight className="h-4 w-4 ml-2" />
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -24,6 +25,7 @@ export default function SearchLyricsTab({
|
||||
onClose,
|
||||
disabled = false,
|
||||
}: SearchLyricsTabProps) {
|
||||
const t = useTranslations('lyricsReview.modals.searchLyrics')
|
||||
const [artist, setArtist] = useState(defaultArtist)
|
||||
const [title, setTitle] = useState(defaultTitle)
|
||||
const [isSearching, setIsSearching] = useState(false)
|
||||
@@ -78,30 +80,29 @@ export default function SearchLyricsTab({
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="search-artist">Artist</Label>
|
||||
<Label htmlFor="search-artist">{t('artist')}</Label>
|
||||
<Input
|
||||
id="search-artist"
|
||||
value={artist}
|
||||
onChange={(e) => setArtist(e.target.value)}
|
||||
placeholder="Artist name"
|
||||
placeholder={t('artistPlaceholder')}
|
||||
disabled={isSearching || disabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="search-title">Title</Label>
|
||||
<Label htmlFor="search-title">{t('title')}</Label>
|
||||
<Input
|
||||
id="search-title"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="Song title"
|
||||
placeholder={t('titlePlaceholder')}
|
||||
disabled={isSearching || disabled}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Searches all configured lyrics providers (Genius, AZLyrics, etc.) and adds any
|
||||
results that are a close match to this song.
|
||||
{t('searchDesc')}
|
||||
</p>
|
||||
|
||||
{error && (
|
||||
@@ -114,20 +115,20 @@ export default function SearchLyricsTab({
|
||||
<div className="space-y-3">
|
||||
<Alert>
|
||||
<AlertDescription>
|
||||
{searchResult.message || 'No matching lyrics found across all providers.'}
|
||||
{searchResult.message || t('noMatches')}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
{notFoundSources.length > 0 && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Not found: {notFoundSources.join(', ')}
|
||||
{t('notFound', { sources: notFoundSources.join(', ') })}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{rejectedEntries.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm font-medium">
|
||||
Low-confidence results — select any to force-add:
|
||||
{t('lowConfidence')}
|
||||
</p>
|
||||
{rejectedEntries.map(([source, info]: [string, RejectedSource]) => (
|
||||
<div
|
||||
@@ -151,8 +152,7 @@ export default function SearchLyricsTab({
|
||||
“{info.track_name}” by {info.artist_names}
|
||||
</p>
|
||||
<p className="text-muted-foreground">
|
||||
Match: {info.matched_words}/{info.total_words} words (
|
||||
{Math.round(info.relevance * 100)}% relevance)
|
||||
{t('matched', { matched: info.matched_words, total: info.total_words, relevance: Math.round(info.relevance * 100) })}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -173,10 +173,10 @@ export default function SearchLyricsTab({
|
||||
{isSearching ? (
|
||||
<>
|
||||
<Spinner className="mr-2 h-4 w-4" />
|
||||
Searching...
|
||||
{t('searching')}
|
||||
</>
|
||||
) : (
|
||||
'Search Again'
|
||||
t('searchAgain')
|
||||
)}
|
||||
</Button>
|
||||
{rejectedEntries.length > 0 && (
|
||||
@@ -190,7 +190,7 @@ export default function SearchLyricsTab({
|
||||
Adding...
|
||||
</>
|
||||
) : (
|
||||
`Add Selected (${selectedForce.size})`
|
||||
t('addSelected', { count: selectedForce.size })
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
@@ -203,10 +203,10 @@ export default function SearchLyricsTab({
|
||||
{isSearching ? (
|
||||
<>
|
||||
<Spinner className="mr-2 h-4 w-4" />
|
||||
Searching...
|
||||
{t('searching')}
|
||||
</>
|
||||
) : (
|
||||
'Search All Providers'
|
||||
t('searchAll')
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -21,13 +22,14 @@ export default function SegmentDetailsModal({
|
||||
segment,
|
||||
segmentIndex,
|
||||
}: SegmentDetailsModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.segmentDetails')
|
||||
if (!segment || segmentIndex === null) return null
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Segment {segmentIndex} Details</DialogTitle>
|
||||
<DialogTitle>{t('title', { index: segmentIndex })}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<pre className="m-0 font-mono text-sm whitespace-pre-wrap break-words overflow-auto max-h-[60vh] bg-muted p-4 rounded">
|
||||
{JSON.stringify(segment, null, 2)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState } from 'react'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -20,6 +21,7 @@ export default function TimingOffsetModal({
|
||||
currentOffset,
|
||||
onApply,
|
||||
}: TimingOffsetModalProps) {
|
||||
const t = useTranslations('lyricsReview.modals.timingOffset')
|
||||
const [offset, setOffset] = useState(currentOffset)
|
||||
|
||||
const handleApply = () => {
|
||||
@@ -35,12 +37,12 @@ export default function TimingOffsetModal({
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Adjust Timing Offset</DialogTitle>
|
||||
<DialogTitle>{t('title')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
<Label>Offset (milliseconds)</Label>
|
||||
<Label>{t('offsetLabel')}</Label>
|
||||
<div className="flex gap-4 items-center">
|
||||
<Slider
|
||||
value={[offset]}
|
||||
@@ -58,21 +60,21 @@ export default function TimingOffsetModal({
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Positive values shift lyrics later, negative values shift them earlier.
|
||||
{t('offsetDesc')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="bg-muted p-3 rounded space-y-1">
|
||||
<p className="text-sm">
|
||||
<span className="text-muted-foreground">Current offset:</span>{' '}
|
||||
<span className="text-muted-foreground">{t('currentOffset')}</span>{' '}
|
||||
<span className="font-mono">{currentOffset}ms</span>
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="text-muted-foreground">New offset:</span>{' '}
|
||||
<span className="text-muted-foreground">{t('newOffset')}</span>{' '}
|
||||
<span className="font-mono font-medium">{offset}ms</span>
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="text-muted-foreground">Change:</span>{' '}
|
||||
<span className="text-muted-foreground">{t('change')}</span>{' '}
|
||||
<span className="font-mono">{offset - currentOffset}ms</span>
|
||||
</p>
|
||||
</div>
|
||||
@@ -80,7 +82,7 @@ export default function TimingOffsetModal({
|
||||
|
||||
<DialogFooter className="flex gap-2 sm:justify-between">
|
||||
<Button variant="outline" onClick={handleReset}>
|
||||
Reset to 0
|
||||
{t('resetTo0')}
|
||||
</Button>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" onClick={onClose}>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useState, useCallback, useEffect, useRef, useMemo, memo } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Slider } from '@/components/ui/slider'
|
||||
@@ -59,6 +60,7 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
onCancel,
|
||||
setModalSpacebarHandler,
|
||||
}: LyricsSynchronizerProps) {
|
||||
const t = useTranslations('lyricsReview.synchronizer')
|
||||
const isDarkMode = typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 640
|
||||
|
||||
@@ -738,36 +740,36 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
if (isManualSyncing) {
|
||||
if (isSpacebarPressed) {
|
||||
return {
|
||||
primary: '⏱️ Holding... release when word ends',
|
||||
secondary: 'Release spacebar when the word finishes',
|
||||
primary: t('holdingRelease'),
|
||||
secondary: t('releaseSpacebar'),
|
||||
}
|
||||
}
|
||||
if (stats.remaining === 0) {
|
||||
return {
|
||||
primary: '✅ All words synced!',
|
||||
secondary: 'Click "Stop Sync" then "Apply" to save',
|
||||
primary: t('allWordsSynced'),
|
||||
secondary: t('clickStopSync'),
|
||||
}
|
||||
}
|
||||
return {
|
||||
primary: '👆 Press SPACEBAR when you hear each word',
|
||||
secondary: 'Tap for short words, hold for longer words',
|
||||
primary: t('pressSpacebar'),
|
||||
secondary: t('tapForShort'),
|
||||
}
|
||||
}
|
||||
if (stats.synced === 0) {
|
||||
return {
|
||||
primary: 'Click "Start Sync" to begin timing words',
|
||||
secondary: "Audio will play and you'll tap spacebar for each word",
|
||||
primary: t('clickStartSync'),
|
||||
secondary: t('audioWillPlay'),
|
||||
}
|
||||
}
|
||||
if (stats.remaining > 0) {
|
||||
return {
|
||||
primary: `${stats.remaining} words remaining to sync`,
|
||||
secondary: 'Click "Start Sync" to continue, or "Unsync from Cursor" to re-sync from a point',
|
||||
primary: t('wordsRemaining', { remaining: stats.remaining }),
|
||||
secondary: t('clickStartContinue'),
|
||||
}
|
||||
}
|
||||
return {
|
||||
primary: '✅ All words synced!',
|
||||
secondary: 'Click "Apply" to save changes, or make adjustments first',
|
||||
primary: t('allWordsSynced'),
|
||||
secondary: t('allSyncedApply'),
|
||||
}
|
||||
}, [isManualSyncing, isSpacebarPressed, stats.synced, stats.remaining])
|
||||
|
||||
@@ -778,8 +780,8 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
{/* Stats bar */}
|
||||
<div className="flex justify-end items-center h-6">
|
||||
<span className="text-sm text-muted-foreground">
|
||||
{stats.synced} / {stats.total} words synced
|
||||
{stats.remaining > 0 && ` (${stats.remaining} remaining)`}
|
||||
{t('wordsSynced', { synced: stats.synced, total: stats.total })}
|
||||
{stats.remaining > 0 && ` ${t('remaining', { remaining: stats.remaining })}`}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -889,20 +891,20 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
<Dialog open={showEditLyricsModal} onOpenChange={setShowEditLyricsModal}>
|
||||
<DialogContent className="max-w-2xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Edit Lyrics</DialogTitle>
|
||||
<DialogTitle>{t('controls.editLyrics')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<Alert variant="destructive">
|
||||
<AlertTriangle className="h-4 w-4" />
|
||||
<AlertDescription>
|
||||
Editing lyrics will reset all timing data. You will need to re-sync the entire song.
|
||||
{t('editingResetsWarning')}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<Textarea
|
||||
value={editLyricsText}
|
||||
onChange={(e) => setEditLyricsText(e.target.value)}
|
||||
placeholder="Enter lyrics, one line per segment..."
|
||||
placeholder={t('lyricsPlaceholder')}
|
||||
rows={15}
|
||||
className="font-mono"
|
||||
/>
|
||||
@@ -912,7 +914,7 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
Cancel
|
||||
</Button>
|
||||
<Button variant="destructive" onClick={handleSaveEditedLyrics}>
|
||||
Save & Reset Timing
|
||||
{t('saveAndResetTiming')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
@@ -922,11 +924,11 @@ const LyricsSynchronizer = memo(function LyricsSynchronizer({
|
||||
<Dialog open={showEditWordModal} onOpenChange={setShowEditWordModal}>
|
||||
<DialogContent className="max-w-sm">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Edit Word</DialogTitle>
|
||||
<DialogTitle>{t('editWord')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Edit the word text. Enter multiple words separated by spaces to split.
|
||||
{t('editWordDesc')}
|
||||
</p>
|
||||
|
||||
<Input
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { memo } from 'react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
@@ -69,6 +70,7 @@ const SyncControls = memo(function SyncControls({
|
||||
onTapEnd,
|
||||
isTapping = false,
|
||||
}: SyncControlsProps) {
|
||||
const t = useTranslations('lyricsReview.synchronizer.controls')
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{/* Row 1: Playback & Sync Mode Controls */}
|
||||
@@ -76,11 +78,11 @@ const SyncControls = memo(function SyncControls({
|
||||
{/* Playback controls */}
|
||||
<Button variant="outline" size="sm" onClick={onPlay} disabled={isPlaying}>
|
||||
<Play className="h-4 w-4 mr-1" />
|
||||
Play
|
||||
{t('play')}
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" onClick={onStop} disabled={!isPlaying}>
|
||||
<Square className="h-4 w-4 mr-1" />
|
||||
Stop
|
||||
{t('stop')}
|
||||
</Button>
|
||||
|
||||
{!isMobile && <Separator orientation="vertical" className="h-6" />}
|
||||
@@ -90,7 +92,7 @@ const SyncControls = memo(function SyncControls({
|
||||
<>
|
||||
<Button variant="destructive" size="sm" onClick={onStartSync}>
|
||||
<Square className="h-4 w-4 mr-1" />
|
||||
Stop Sync
|
||||
{t('stopSync')}
|
||||
</Button>
|
||||
<Button
|
||||
variant={isPaused ? 'default' : 'outline'}
|
||||
@@ -99,7 +101,7 @@ const SyncControls = memo(function SyncControls({
|
||||
className={isPaused ? 'bg-green-600 hover:bg-green-700' : ''}
|
||||
>
|
||||
{isPaused ? <Play className="h-4 w-4 mr-1" /> : <Pause className="h-4 w-4 mr-1" />}
|
||||
{isPaused ? 'Resume' : 'Pause'}
|
||||
{isPaused ? t('resume') : t('pause')}
|
||||
</Button>
|
||||
{/* TAP button for mobile - no spacebar on mobile */}
|
||||
{isMobile && !isPaused && onTapStart && onTapEnd && (
|
||||
@@ -119,14 +121,14 @@ const SyncControls = memo(function SyncControls({
|
||||
className={isTapping ? 'bg-yellow-500' : 'bg-green-600'}
|
||||
>
|
||||
<Pointer className="h-4 w-4 mr-1" />
|
||||
{isTapping ? 'Release' : 'TAP'}
|
||||
{isTapping ? t('release') : t('tap')}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Button size="sm" onClick={onStartSync}>
|
||||
<PlayCircle className="h-4 w-4 mr-1" />
|
||||
Start Sync
|
||||
{t('startSync')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -140,7 +142,7 @@ const SyncControls = memo(function SyncControls({
|
||||
disabled={isManualSyncing && !isPaused}
|
||||
>
|
||||
<Trash2 className="h-4 w-4 mr-1" />
|
||||
Clear Sync
|
||||
{t('clearSync')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
@@ -150,7 +152,7 @@ const SyncControls = memo(function SyncControls({
|
||||
disabled={isManualSyncing && !isPaused}
|
||||
>
|
||||
<FileEdit className="h-4 w-4 mr-1" />
|
||||
Edit Lyrics
|
||||
{t('editLyrics')}
|
||||
</Button>
|
||||
|
||||
{!isMobile && <Separator orientation="vertical" className="h-6" />}
|
||||
@@ -162,7 +164,7 @@ const SyncControls = memo(function SyncControls({
|
||||
disabled={!canUnsyncFromCursor || (isManualSyncing && !isPaused)}
|
||||
>
|
||||
<CircleSlash className="h-4 w-4 mr-1" />
|
||||
Unsync from Cursor
|
||||
{t('unsyncFromCursor')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
@@ -172,7 +174,7 @@ const SyncControls = memo(function SyncControls({
|
||||
disabled={!hasSelectedWords || selectedWordCount !== 1}
|
||||
>
|
||||
<Edit3 className="h-4 w-4 mr-1" />
|
||||
Edit Word
|
||||
{t('editWord')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
@@ -183,7 +185,9 @@ const SyncControls = memo(function SyncControls({
|
||||
className="text-destructive hover:text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4 mr-1" />
|
||||
Delete{hasSelectedWords && selectedWordCount > 0 ? ` (${selectedWordCount})` : ''}
|
||||
{hasSelectedWords && selectedWordCount > 0
|
||||
? t('deleteCount', { count: selectedWordCount })
|
||||
: t('deleteCount', { count: selectedWordCount }).split(' (')[0]}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { memo, useMemo } from 'react'
|
||||
import { Word } from '@/lib/lyrics-review/types'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -17,6 +18,7 @@ const UpcomingWordsBar = memo(function UpcomingWordsBar({
|
||||
isManualSyncing,
|
||||
maxWordsToShow = 20,
|
||||
}: UpcomingWordsBarProps) {
|
||||
const t = useTranslations('lyricsReview.synchronizer')
|
||||
// Get upcoming unsynced words
|
||||
const upcomingWords = useMemo(() => {
|
||||
if (!isManualSyncing || syncWordIndex < 0) return []
|
||||
@@ -55,7 +57,7 @@ const UpcomingWordsBar = memo(function UpcomingWordsBar({
|
||||
|
||||
{totalRemaining > maxWordsToShow && (
|
||||
<span className="text-xs text-muted-foreground ml-2">
|
||||
+{totalRemaining - maxWordsToShow} more
|
||||
{t('upcomingMore', { count: totalRemaining - maxWordsToShow })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -4,12 +4,14 @@ import { useState } from 'react';
|
||||
import { Bell, X, Smartphone, Share } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { usePushNotifications } from '@/hooks/use-push-notifications';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
/**
|
||||
* Soft-ask banner prompting users to enable push notifications.
|
||||
* Shows different UI for iOS (Add to Home Screen instructions) vs other browsers.
|
||||
*/
|
||||
export function PushNotificationPrompt() {
|
||||
const t = useTranslations('push');
|
||||
const {
|
||||
isLoading,
|
||||
isPushEnabled,
|
||||
@@ -37,26 +39,26 @@ export function PushNotificationPrompt() {
|
||||
<div className="flex items-start gap-3">
|
||||
<Smartphone className="h-5 w-5 mt-0.5 flex-shrink-0" />
|
||||
<div className="flex-1">
|
||||
<p className="font-medium mb-1">Get notifications on your iPhone</p>
|
||||
<p className="font-medium mb-1">{t('iosTitle')}</p>
|
||||
<p className="text-sm text-[var(--text-muted)] mb-3">
|
||||
To receive push notifications on iOS, install this app to your home screen:
|
||||
{t('iosInstructions')}
|
||||
</p>
|
||||
<ol className="text-sm text-[var(--text-muted)] space-y-2 mb-3">
|
||||
<li className="flex items-center gap-2">
|
||||
<span className="bg-blue-500/20 rounded-full w-5 h-5 flex items-center justify-center text-xs">1</span>
|
||||
<span>Tap the <Share className="inline h-4 w-4" /> Share button in Safari</span>
|
||||
<span>{t('iosStep1')}</span>
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<span className="bg-blue-500/20 rounded-full w-5 h-5 flex items-center justify-center text-xs">2</span>
|
||||
<span>Scroll down and tap "Add to Home Screen"</span>
|
||||
<span>{t('iosStep2')}</span>
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<span className="bg-blue-500/20 rounded-full w-5 h-5 flex items-center justify-center text-xs">3</span>
|
||||
<span>Open the app from your home screen</span>
|
||||
<span>{t('iosStep3')}</span>
|
||||
</li>
|
||||
</ol>
|
||||
<p className="text-xs text-[var(--text-muted)]">
|
||||
iOS requires apps to be installed for push notifications to work.
|
||||
{t('iosNote')}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
@@ -99,9 +101,9 @@ export function PushNotificationPrompt() {
|
||||
<div className="flex items-start gap-3">
|
||||
<Bell className="h-5 w-5 mt-0.5 flex-shrink-0" />
|
||||
<div className="flex-1">
|
||||
<p className="font-medium mb-1">Get notified when your video is ready</p>
|
||||
<p className="font-medium mb-1">{t('promptTitle')}</p>
|
||||
<p className="text-sm text-[var(--text-muted)] mb-3">
|
||||
We'll send you a notification when your karaoke video needs attention or is ready to download.
|
||||
{t('promptDescription')}
|
||||
</p>
|
||||
{error && (
|
||||
<p className="text-sm text-red-400 mb-3">{error}</p>
|
||||
@@ -113,7 +115,7 @@ export function PushNotificationPrompt() {
|
||||
disabled={isSubscribing}
|
||||
className="bg-purple-600 hover:bg-purple-700 text-white"
|
||||
>
|
||||
{isSubscribing ? 'Enabling...' : 'Enable Notifications'}
|
||||
{isSubscribing ? t('enabling') : t('enable')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -121,7 +123,7 @@ export function PushNotificationPrompt() {
|
||||
onClick={handleDismiss}
|
||||
className="text-[var(--text-muted)] hover:text-[var(--text)]"
|
||||
>
|
||||
Not now
|
||||
{t('notNow')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@@ -129,7 +131,7 @@ export function PushNotificationPrompt() {
|
||||
onClick={handleNeverAsk}
|
||||
className="text-[var(--text-muted)] hover:text-[var(--text)] text-xs"
|
||||
>
|
||||
Don't ask again
|
||||
{t('dontAskAgain')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -149,6 +151,7 @@ export function PushNotificationPrompt() {
|
||||
* Compact version of the prompt for use in menus/settings.
|
||||
*/
|
||||
export function PushNotificationToggle() {
|
||||
const t = useTranslations('push');
|
||||
const {
|
||||
isLoading,
|
||||
isPushEnabled,
|
||||
@@ -184,9 +187,9 @@ export function PushNotificationToggle() {
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<div className="flex items-center gap-2 text-[var(--text-muted)]">
|
||||
<Bell className="h-4 w-4" />
|
||||
<span>Push Notifications</span>
|
||||
<span>{t('settingsTitle')}</span>
|
||||
</div>
|
||||
<span className="text-xs text-[var(--text-muted)]">Blocked in browser</span>
|
||||
<span className="text-xs text-[var(--text-muted)]">{t('blockedInBrowser')}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -195,7 +198,7 @@ export function PushNotificationToggle() {
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Bell className="h-4 w-4 text-[var(--text-muted)]" />
|
||||
<span className="text-sm">Push Notifications</span>
|
||||
<span className="text-sm">{t('settingsTitle')}</span>
|
||||
</div>
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -204,7 +207,7 @@ export function PushNotificationToggle() {
|
||||
disabled={isProcessing}
|
||||
className="h-7 text-xs"
|
||||
>
|
||||
{isProcessing ? '...' : isSubscribed ? 'Disable' : 'Enable'}
|
||||
{isProcessing ? '...' : isSubscribed ? t('disableOnDevice') : t('enableNotifications')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -5,12 +5,15 @@ import { Bell, Smartphone, Monitor, Trash2, RefreshCw, Check, X } from 'lucide-r
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { usePushNotifications } from '@/hooks/use-push-notifications';
|
||||
import { api, PushSubscriptionInfo } from '@/lib/api';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
/**
|
||||
* Full settings panel for managing push notification subscriptions.
|
||||
* Shows list of subscribed devices and allows enabling/disabling.
|
||||
*/
|
||||
export function PushSettings() {
|
||||
const t = useTranslations('push');
|
||||
const tCommon = useTranslations('common');
|
||||
const {
|
||||
isLoading: hookLoading,
|
||||
isPushEnabled,
|
||||
@@ -119,7 +122,7 @@ export function PushSettings() {
|
||||
if (hookLoading) {
|
||||
return (
|
||||
<div className="p-4 text-center text-[var(--text-muted)]">
|
||||
Loading...
|
||||
{tCommon('loading')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -129,7 +132,7 @@ export function PushSettings() {
|
||||
<div className="p-4 bg-[var(--card)] rounded-lg border border-[var(--card-border)]">
|
||||
<div className="flex items-center gap-2 text-[var(--text-muted)]">
|
||||
<Bell className="h-5 w-5" />
|
||||
<span>Push notifications are not available on this server.</span>
|
||||
<span>{t('notAvailable')}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -142,28 +145,28 @@ export function PushSettings() {
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<Bell className="h-5 w-5" />
|
||||
<h3 className="font-medium">Push Notifications</h3>
|
||||
<h3 className="font-medium">{t('settingsTitle')}</h3>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{isSubscribed ? (
|
||||
<span className="flex items-center gap-1 text-sm text-green-400">
|
||||
<Check className="h-4 w-4" />
|
||||
Enabled
|
||||
{t('enabled')}
|
||||
</span>
|
||||
) : permission === 'denied' ? (
|
||||
<span className="flex items-center gap-1 text-sm text-red-400">
|
||||
<X className="h-4 w-4" />
|
||||
Blocked
|
||||
{t('blockedInBrowser')}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-sm text-[var(--text-muted)]">Disabled</span>
|
||||
<span className="text-sm text-[var(--text-muted)]">{t('disabled')}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{permission === 'denied' ? (
|
||||
<div className="text-sm text-[var(--text-muted)] mb-4">
|
||||
Notifications are blocked in your browser. To enable them, you'll need to allow notifications in your browser settings.
|
||||
{t('blockedDescription')}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex gap-2">
|
||||
@@ -174,7 +177,7 @@ export function PushSettings() {
|
||||
onClick={handleDisable}
|
||||
disabled={isProcessing}
|
||||
>
|
||||
{isProcessing ? 'Processing...' : 'Disable on this device'}
|
||||
{isProcessing ? tCommon('processing') : t('disableOnDevice')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
@@ -182,7 +185,7 @@ export function PushSettings() {
|
||||
onClick={handleEnable}
|
||||
disabled={isProcessing}
|
||||
>
|
||||
{isProcessing ? 'Processing...' : 'Enable notifications'}
|
||||
{isProcessing ? tCommon('processing') : t('enableNotifications')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -196,24 +199,24 @@ export function PushSettings() {
|
||||
{/* Subscriptions List */}
|
||||
<div className="p-4 bg-[var(--card)] rounded-lg border border-[var(--card-border)]">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h3 className="font-medium">Subscribed Devices</h3>
|
||||
<h3 className="font-medium">{t('subscribedDevices')}</h3>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={loadSubscriptions}
|
||||
disabled={isLoadingList}
|
||||
className="h-8 w-8 p-0"
|
||||
title="Refresh"
|
||||
title={t('refresh')}
|
||||
>
|
||||
<RefreshCw className={`h-4 w-4 ${isLoadingList ? 'animate-spin' : ''}`} />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{isLoadingList ? (
|
||||
<div className="text-sm text-[var(--text-muted)]">Loading...</div>
|
||||
<div className="text-sm text-[var(--text-muted)]">{tCommon('loading')}</div>
|
||||
) : subscriptions.length === 0 ? (
|
||||
<div className="text-sm text-[var(--text-muted)]">
|
||||
No devices are subscribed to push notifications.
|
||||
{t('noDevicesSubscribed')}
|
||||
</div>
|
||||
) : (
|
||||
<ul className="space-y-2">
|
||||
@@ -226,11 +229,11 @@ export function PushSettings() {
|
||||
{getDeviceIcon(sub.device_name)}
|
||||
<div>
|
||||
<div className="text-sm font-medium">
|
||||
{sub.device_name || `Device ${index + 1}`}
|
||||
{sub.device_name || t('deviceLabel', { index: index + 1 })}
|
||||
</div>
|
||||
<div className="text-xs text-[var(--text-muted)]">
|
||||
Added {formatDate(sub.created_at)}
|
||||
{sub.last_used_at && ` • Last used ${formatDate(sub.last_used_at)}`}
|
||||
{t('addedDate', { date: formatDate(sub.created_at) })}
|
||||
{sub.last_used_at && ` • ${t('lastUsedDate', { date: formatDate(sub.last_used_at) })}`}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -239,7 +242,7 @@ export function PushSettings() {
|
||||
size="sm"
|
||||
onClick={() => handleRemoveSubscription(sub.endpoint)}
|
||||
className="h-8 w-8 p-0 text-[var(--text-muted)] hover:text-red-400"
|
||||
title="Remove this device"
|
||||
title={t('removeDevice')}
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</Button>
|
||||
@@ -249,7 +252,7 @@ export function PushSettings() {
|
||||
)}
|
||||
|
||||
<p className="text-xs text-[var(--text-muted)] mt-4">
|
||||
You can have up to 5 devices subscribed. Adding more will remove the oldest subscription.
|
||||
{t('maxDevicesNote')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { JobStatus } from "@/lib/types"
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
interface StatusBadgeProps {
|
||||
status: JobStatus
|
||||
@@ -7,6 +8,7 @@ interface StatusBadgeProps {
|
||||
}
|
||||
|
||||
export function StatusBadge({ status, size = "md" }: StatusBadgeProps) {
|
||||
const t = useTranslations('status')
|
||||
const getStatusColor = () => {
|
||||
switch (status) {
|
||||
case "queued":
|
||||
@@ -28,17 +30,17 @@ export function StatusBadge({ status, size = "md" }: StatusBadgeProps) {
|
||||
const getStatusLabel = () => {
|
||||
switch (status) {
|
||||
case "queued":
|
||||
return "Queued"
|
||||
return t('queued')
|
||||
case "processing":
|
||||
return "Processing"
|
||||
return t('processing')
|
||||
case "awaiting_review":
|
||||
return "Awaiting Review"
|
||||
return t('awaitingReview')
|
||||
case "awaiting_instrumental":
|
||||
return "Select Instrumental"
|
||||
return t('selectInstrumental')
|
||||
case "completed":
|
||||
return "Completed"
|
||||
return t('completed')
|
||||
case "failed":
|
||||
return "Failed"
|
||||
return t('failed')
|
||||
default:
|
||||
return status
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { api, SystemStatus, ServiceStatus } from "@/lib/api";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
interface SystemStatusModalProps {
|
||||
open: boolean;
|
||||
@@ -51,6 +52,7 @@ function ServiceCard({
|
||||
service: ServiceStatus;
|
||||
children?: React.ReactNode;
|
||||
}) {
|
||||
const t = useTranslations('status');
|
||||
const isOk = service.status === "ok";
|
||||
return (
|
||||
<div
|
||||
@@ -66,7 +68,7 @@ function ServiceCard({
|
||||
<span className="font-medium text-sm">{name}</span>
|
||||
</div>
|
||||
<span className="text-xs opacity-60">
|
||||
{isOk ? "Healthy" : "Offline"}
|
||||
{isOk ? t('healthy') : t('offline')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +78,7 @@ function ServiceCard({
|
||||
|
||||
{service.deployed_at && (
|
||||
<div className="text-xs opacity-50 mt-0.5">
|
||||
Deployed {formatRelativeTime(service.deployed_at)}
|
||||
{t('deployed', { time: formatRelativeTime(service.deployed_at) })}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -105,6 +107,7 @@ function ServiceCard({
|
||||
}
|
||||
|
||||
function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["admin_details"]> }) {
|
||||
const t = useTranslations('status');
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
return (
|
||||
@@ -114,9 +117,9 @@ function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["adm
|
||||
className="text-xs text-amber-500 hover:text-amber-400 flex items-center gap-1"
|
||||
>
|
||||
<span>{expanded ? "\u25BE" : "\u25B8"}</span>
|
||||
Blue-Green Deployment
|
||||
{t('blueGreenDeployment')}
|
||||
{details.deploy_in_progress && (
|
||||
<span className="text-amber-400 animate-pulse ml-1">\u26A0 deploying...</span>
|
||||
<span className="text-amber-400 animate-pulse ml-1">{'\u26A0'} {t('deploying')}</span>
|
||||
)}
|
||||
</button>
|
||||
|
||||
@@ -131,7 +134,7 @@ function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["adm
|
||||
}}
|
||||
>
|
||||
<div className="text-green-500 text-[10px] font-semibold uppercase tracking-wider">
|
||||
Primary
|
||||
{t('primary')}
|
||||
</div>
|
||||
<div className="mt-1 font-mono">{details.primary_vm}</div>
|
||||
<div className="opacity-60">v{details.primary_version}</div>
|
||||
@@ -151,7 +154,7 @@ function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["adm
|
||||
}}
|
||||
>
|
||||
<div className="text-[10px] font-semibold uppercase tracking-wider opacity-50">
|
||||
Secondary (stopped)
|
||||
{t('secondaryStopped')}
|
||||
</div>
|
||||
<div className="mt-1 font-mono">{details.secondary_vm}</div>
|
||||
{details.secondary_version && (
|
||||
@@ -162,10 +165,10 @@ function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["adm
|
||||
{/* Metadata row */}
|
||||
<div className="col-span-2 text-[10px] opacity-40 mt-1">
|
||||
{details.last_swap_at && (
|
||||
<span>Last swap: {formatRelativeTime(details.last_swap_at)}</span>
|
||||
<span>{t('lastSwap', { time: formatRelativeTime(details.last_swap_at) })}</span>
|
||||
)}
|
||||
{details.active_jobs != null && details.active_jobs > 0 && (
|
||||
<span className="ml-3">Active jobs: {details.active_jobs}</span>
|
||||
<span className="ml-3">{t('activeJobs', { count: details.active_jobs })}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -175,6 +178,8 @@ function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["adm
|
||||
}
|
||||
|
||||
export function SystemStatusModal({ open, onClose }: SystemStatusModalProps) {
|
||||
const t = useTranslations('status');
|
||||
const tCommon = useTranslations('common');
|
||||
const [status, setStatus] = useState<SystemStatus | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -213,11 +218,11 @@ export function SystemStatusModal({ open, onClose }: SystemStatusModalProps) {
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="sm:max-w-lg" style={{ backgroundColor: "var(--card-bg)", borderColor: "var(--card-border)" }}>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground">System Status</DialogTitle>
|
||||
<DialogTitle className="text-foreground">{t('systemStatus')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{loading && (
|
||||
<div className="py-8 text-center text-sm opacity-60">Loading...</div>
|
||||
<div className="py-8 text-center text-sm opacity-60">{tCommon('loading')}</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
@@ -226,16 +231,16 @@ export function SystemStatusModal({ open, onClose }: SystemStatusModalProps) {
|
||||
|
||||
{services && !loading && (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 mt-2">
|
||||
<ServiceCard name="Frontend" service={frontendService} />
|
||||
<ServiceCard name="Backend" service={services.backend} />
|
||||
<ServiceCard name="Encoder" service={services.encoder}>
|
||||
<ServiceCard name={t('frontend')} service={frontendService} />
|
||||
<ServiceCard name={t('backend')} service={services.backend} />
|
||||
<ServiceCard name={t('encoder')} service={services.encoder}>
|
||||
{services.encoder.admin_details &&
|
||||
services.encoder.admin_details.primary_vm && (
|
||||
<BlueGreenSection details={services.encoder.admin_details} />
|
||||
)}
|
||||
</ServiceCard>
|
||||
<ServiceCard name="Flacfetch" service={services.flacfetch} />
|
||||
<ServiceCard name="Separator" service={services.separator} />
|
||||
<ServiceCard name={t('flacfetch')} service={services.flacfetch} />
|
||||
<ServiceCard name={t('separator')} service={services.separator} />
|
||||
</div>
|
||||
)}
|
||||
</DialogContent>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { getRequestConfig } from 'next-intl/server';
|
||||
import { hasLocale } from 'next-intl';
|
||||
import { routing } from './routing';
|
||||
|
||||
export default getRequestConfig(async ({ requestLocale }) => {
|
||||
const requested = await requestLocale;
|
||||
const locale = hasLocale(routing.locales, requested)
|
||||
? requested
|
||||
: routing.defaultLocale;
|
||||
|
||||
return {
|
||||
locale,
|
||||
messages: (await import(`../messages/${locale}.json`)).default
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineRouting } from 'next-intl/routing';
|
||||
import { createNavigation } from 'next-intl/navigation';
|
||||
|
||||
export const routing = defineRouting({
|
||||
locales: ['en', 'es', 'de'],
|
||||
defaultLocale: 'en'
|
||||
});
|
||||
|
||||
export const { Link, redirect, usePathname, useRouter } =
|
||||
createNavigation(routing);
|
||||
@@ -20,6 +20,10 @@ const customJestConfig = {
|
||||
'/node_modules/',
|
||||
'/e2e/', // E2E tests run via Playwright, not Jest
|
||||
],
|
||||
// Allow Jest to transform ESM packages (next-intl uses ESM exports)
|
||||
transformIgnorePatterns: [
|
||||
'/node_modules/(?!(next-intl|use-intl)/)',
|
||||
],
|
||||
collectCoverageFrom: [
|
||||
'components/**/*.{js,jsx,ts,tsx}',
|
||||
'lib/**/*.{js,jsx,ts,tsx}',
|
||||
|
||||
@@ -1,6 +1,41 @@
|
||||
// Learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom'
|
||||
|
||||
// Mock next-intl — loads actual English strings so tests see real text
|
||||
const enMessages = require('./messages/en.json')
|
||||
|
||||
function getNestedValue(obj, dottedKey) {
|
||||
return dottedKey.split('.').reduce((o, k) => (o && typeof o === 'object' ? o[k] : undefined), obj)
|
||||
}
|
||||
|
||||
jest.mock('next-intl', () => ({
|
||||
useTranslations: (namespace) => {
|
||||
const messages = namespace
|
||||
? getNestedValue(enMessages, namespace) || {}
|
||||
: enMessages
|
||||
const t = (key, params) => {
|
||||
const value = getNestedValue(messages, key)
|
||||
if (typeof value !== 'string') return key
|
||||
if (params) {
|
||||
return value.replace(/\{(\w+)(?:,\s*plural,\s*one\s*\{([^}]*)\}\s*other\s*\{([^}]*)\})?\}/g,
|
||||
(match, name, one, other) => {
|
||||
if (one !== undefined && other !== undefined) {
|
||||
return params[name] === 1 ? one : other
|
||||
}
|
||||
return params[name] !== undefined ? String(params[name]) : match
|
||||
})
|
||||
}
|
||||
return value
|
||||
}
|
||||
t.rich = (key, params) => t(key, params)
|
||||
t.raw = (key) => getNestedValue(messages, key) || key
|
||||
return t
|
||||
},
|
||||
useLocale: () => 'en',
|
||||
useMessages: () => enMessages,
|
||||
NextIntlClientProvider: ({ children }) => children,
|
||||
}))
|
||||
|
||||
// Mock window.matchMedia
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
|
||||
+9
-1
@@ -38,8 +38,16 @@ export function clearAccessToken() {
|
||||
}
|
||||
}
|
||||
|
||||
function getLocaleFromPath(): string {
|
||||
if (typeof window === 'undefined') return 'en';
|
||||
const match = window.location.pathname.match(/^\/(en|es|de)\//);
|
||||
return match ? match[1] : 'en';
|
||||
}
|
||||
|
||||
function getAuthHeaders(): HeadersInit {
|
||||
const headers: HeadersInit = {};
|
||||
const headers: HeadersInit = {
|
||||
'Accept-Language': getLocaleFromPath(),
|
||||
};
|
||||
const token = getAccessToken();
|
||||
if (token) {
|
||||
headers['Authorization'] = `Bearer ${token}`;
|
||||
|
||||
+41
-40
@@ -10,6 +10,7 @@ import type { Job } from "./api";
|
||||
export interface JobStep {
|
||||
step: number;
|
||||
total: number;
|
||||
/** Translation key(s) from the "jobStatus" namespace. May contain " + " for combined parallel status labels. */
|
||||
label: string;
|
||||
isBlocking: boolean;
|
||||
color: string;
|
||||
@@ -35,59 +36,59 @@ const STATUS_CONFIG: Record<
|
||||
{ step: number; label: string; isBlocking: boolean; color: string }
|
||||
> = {
|
||||
// Step 1: Setup
|
||||
pending: { step: 1, label: "Setting up", isBlocking: false, color: "text-muted-foreground" },
|
||||
pending: { step: 1, label: "settingUp", isBlocking: false, color: "text-muted-foreground" },
|
||||
|
||||
// Step 2: Audio Search (optional path)
|
||||
searching_audio: { step: 2, label: "Searching for audio", isBlocking: false, color: "text-blue-400" },
|
||||
awaiting_audio_selection: { step: 2, label: "Select audio source", isBlocking: true, color: "text-amber-400" },
|
||||
searching_audio: { step: 2, label: "searchingForAudio", isBlocking: false, color: "text-blue-400" },
|
||||
awaiting_audio_selection: { step: 2, label: "selectAudioSource", isBlocking: true, color: "text-amber-400" },
|
||||
|
||||
// Step 3: Download
|
||||
downloading_audio: { step: 3, label: "Downloading audio", isBlocking: false, color: "text-blue-400" },
|
||||
downloading: { step: 3, label: "Downloading", isBlocking: false, color: "text-blue-400" },
|
||||
downloading_audio: { step: 3, label: "downloadingAudio", isBlocking: false, color: "text-blue-400" },
|
||||
downloading: { step: 3, label: "downloading", isBlocking: false, color: "text-blue-400" },
|
||||
|
||||
// Step 3.5: Audio Editing (optional, BLOCKING)
|
||||
awaiting_audio_edit: { step: 3, label: "Edit audio", isBlocking: true, color: "text-amber-400" },
|
||||
in_audio_edit: { step: 3, label: "Editing audio", isBlocking: true, color: "text-blue-400" },
|
||||
audio_edit_complete: { step: 3, label: "Audio edited", isBlocking: false, color: "text-teal-400" },
|
||||
awaiting_audio_edit: { step: 3, label: "editAudio", isBlocking: true, color: "text-amber-400" },
|
||||
in_audio_edit: { step: 3, label: "editingAudio", isBlocking: true, color: "text-blue-400" },
|
||||
audio_edit_complete: { step: 3, label: "audioEdited", isBlocking: false, color: "text-teal-400" },
|
||||
|
||||
// Step 4: Parallel Processing (Audio + Lyrics)
|
||||
separating_stage1: { step: 4, label: "Separating audio (1/2)", isBlocking: false, color: "text-purple-400" },
|
||||
separating_stage2: { step: 4, label: "Separating audio (2/2)", isBlocking: false, color: "text-purple-400" },
|
||||
audio_complete: { step: 4, label: "Audio ready, processing lyrics", isBlocking: false, color: "text-purple-400" },
|
||||
transcribing: { step: 4, label: "Transcribing lyrics", isBlocking: false, color: "text-blue-400" },
|
||||
correcting: { step: 4, label: "Correcting lyrics", isBlocking: false, color: "text-blue-400" },
|
||||
lyrics_complete: { step: 4, label: "Lyrics ready, processing audio", isBlocking: false, color: "text-teal-400" },
|
||||
separating_stage1: { step: 4, label: "separatingAudio1", isBlocking: false, color: "text-purple-400" },
|
||||
separating_stage2: { step: 4, label: "separatingAudio2", isBlocking: false, color: "text-purple-400" },
|
||||
audio_complete: { step: 4, label: "audioReadyProcessingLyrics", isBlocking: false, color: "text-purple-400" },
|
||||
transcribing: { step: 4, label: "transcribingLyrics", isBlocking: false, color: "text-blue-400" },
|
||||
correcting: { step: 4, label: "correctingLyrics", isBlocking: false, color: "text-blue-400" },
|
||||
lyrics_complete: { step: 4, label: "lyricsReadyProcessingAudio", isBlocking: false, color: "text-teal-400" },
|
||||
|
||||
// Step 5: Screen Generation
|
||||
generating_screens: { step: 5, label: "Generating screens", isBlocking: false, color: "text-cyan-400" },
|
||||
applying_padding: { step: 5, label: "Syncing countdown", isBlocking: false, color: "text-cyan-400" },
|
||||
generating_screens: { step: 5, label: "generatingScreens", isBlocking: false, color: "text-cyan-400" },
|
||||
applying_padding: { step: 5, label: "syncingCountdown", isBlocking: false, color: "text-cyan-400" },
|
||||
|
||||
// Step 6: Review (BLOCKING - requires user action)
|
||||
awaiting_review: { step: 6, label: "Review lyrics", isBlocking: true, color: "text-amber-400" },
|
||||
in_review: { step: 6, label: "In review", isBlocking: true, color: "text-blue-400" },
|
||||
awaiting_review: { step: 6, label: "reviewLyrics", isBlocking: true, color: "text-amber-400" },
|
||||
in_review: { step: 6, label: "inReview", isBlocking: true, color: "text-blue-400" },
|
||||
|
||||
// Step 7: Video Rendering
|
||||
review_complete: { step: 7, label: "Starting render", isBlocking: false, color: "text-teal-400" },
|
||||
rendering_video: { step: 7, label: "Rendering video", isBlocking: false, color: "text-indigo-400" },
|
||||
review_complete: { step: 7, label: "startingRender", isBlocking: false, color: "text-teal-400" },
|
||||
rendering_video: { step: 7, label: "renderingVideo", isBlocking: false, color: "text-indigo-400" },
|
||||
|
||||
// Step 8: Instrumental Selection (BLOCKING - requires user action)
|
||||
awaiting_instrumental_selection: { step: 8, label: "Select instrumental", isBlocking: true, color: "text-amber-400" },
|
||||
awaiting_instrumental_selection: { step: 8, label: "selectInstrumental", isBlocking: true, color: "text-amber-400" },
|
||||
|
||||
// Step 9: Final Encoding
|
||||
instrumental_selected: { step: 9, label: "Starting final encode", isBlocking: false, color: "text-pink-400" },
|
||||
generating_video: { step: 9, label: "Generating final video", isBlocking: false, color: "text-violet-400" },
|
||||
encoding: { step: 9, label: "Encoding video", isBlocking: false, color: "text-violet-400" },
|
||||
packaging: { step: 9, label: "Packaging files", isBlocking: false, color: "text-violet-400" },
|
||||
instrumental_selected: { step: 9, label: "startingFinalEncode", isBlocking: false, color: "text-pink-400" },
|
||||
generating_video: { step: 9, label: "generatingFinalVideo", isBlocking: false, color: "text-violet-400" },
|
||||
encoding: { step: 9, label: "encodingVideo", isBlocking: false, color: "text-violet-400" },
|
||||
packaging: { step: 9, label: "packagingFiles", isBlocking: false, color: "text-violet-400" },
|
||||
|
||||
// Step 10: Distribution / Complete
|
||||
uploading: { step: 10, label: "Uploading", isBlocking: false, color: "text-green-400" },
|
||||
notifying: { step: 10, label: "Sending notifications", isBlocking: false, color: "text-green-400" },
|
||||
complete: { step: 10, label: "Complete", isBlocking: false, color: "text-green-400" },
|
||||
prep_complete: { step: 10, label: "Prep complete", isBlocking: false, color: "text-green-400" },
|
||||
uploading: { step: 10, label: "uploading", isBlocking: false, color: "text-green-400" },
|
||||
notifying: { step: 10, label: "sendingNotifications", isBlocking: false, color: "text-green-400" },
|
||||
complete: { step: 10, label: "complete", isBlocking: false, color: "text-green-400" },
|
||||
prep_complete: { step: 10, label: "prepComplete", isBlocking: false, color: "text-green-400" },
|
||||
|
||||
// Terminal states (no step progression)
|
||||
failed: { step: 0, label: "Failed", isBlocking: false, color: "text-red-400" },
|
||||
cancelled: { step: 0, label: "Cancelled", isBlocking: false, color: "text-muted-foreground" },
|
||||
failed: { step: 0, label: "failed", isBlocking: false, color: "text-red-400" },
|
||||
cancelled: { step: 0, label: "cancelled", isBlocking: false, color: "text-muted-foreground" },
|
||||
};
|
||||
|
||||
const TOTAL_STEPS = 10;
|
||||
@@ -184,7 +185,7 @@ function getParallelProcessingLabel(job: Job, defaultLabel: string): string {
|
||||
const lyricsDone = lyricsStage === "lyrics_complete" || job.state_data?.lyrics_complete;
|
||||
|
||||
if (audioDone && lyricsDone) {
|
||||
return "Processing complete";
|
||||
return "processingComplete";
|
||||
}
|
||||
|
||||
// Show what's still running
|
||||
@@ -207,26 +208,26 @@ function getParallelProcessingLabel(job: Job, defaultLabel: string): string {
|
||||
function getShortAudioStatus(stage: string): string {
|
||||
switch (stage) {
|
||||
case "separating_stage1":
|
||||
return "Audio 1/2";
|
||||
return "audio1of2";
|
||||
case "separating_stage2":
|
||||
return "Audio 2/2";
|
||||
return "audio2of2";
|
||||
case "audio_complete":
|
||||
return "Audio done";
|
||||
return "audioDone";
|
||||
default:
|
||||
return "Audio";
|
||||
return "audio";
|
||||
}
|
||||
}
|
||||
|
||||
function getShortLyricsStatus(stage: string): string {
|
||||
switch (stage) {
|
||||
case "transcribing":
|
||||
return "Transcribing";
|
||||
return "transcribing";
|
||||
case "correcting":
|
||||
return "Correcting";
|
||||
return "correcting";
|
||||
case "lyrics_complete":
|
||||
return "Lyrics done";
|
||||
return "lyricsDone";
|
||||
default:
|
||||
return "Lyrics";
|
||||
return "lyrics";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,10 @@
|
||||
import createNextIntlPlugin from 'next-intl/plugin';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const withNextIntl = createNextIntlPlugin('./i18n/request.ts');
|
||||
|
||||
// Read version from root pyproject.toml (single source of truth)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const pyprojectPath = path.join(__dirname, '..', 'pyproject.toml');
|
||||
@@ -71,4 +74,4 @@ const nextConfig = {
|
||||
},
|
||||
}
|
||||
|
||||
export default nextConfig
|
||||
export default withNextIntl(nextConfig)
|
||||
Generated
+730
-5
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.85.7",
|
||||
"version": "0.85.9",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.85.7",
|
||||
"version": "0.85.9",
|
||||
"dependencies": {
|
||||
"@fingerprintjs/fingerprintjs": "^5.1.0",
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
@@ -49,6 +49,7 @@
|
||||
"input-otp": "1.4.1",
|
||||
"lucide-react": "^0.454.0",
|
||||
"next": "16.0.7",
|
||||
"next-intl": "^4.9.0",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "19.2.0",
|
||||
"react-day-picker": "9.8.0",
|
||||
@@ -903,6 +904,57 @@
|
||||
"integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@formatjs/bigdecimal": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/bigdecimal/-/bigdecimal-0.2.0.tgz",
|
||||
"integrity": "sha512-GeaxHZbUoYvHL9tC5eltHLs+1zU70aPw0s7LwqgktIzF5oMhNY4o4deEtusJMsq7WFJF3Ye2zQEzdG8beVk73w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@formatjs/ecma402-abstract": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-3.2.0.tgz",
|
||||
"integrity": "sha512-dHnqHgBo6GXYGRsepaE1wmsC2etaivOWd5VaJstZd+HI2zR3DCUjbDVZRtoPGkkXZmyHvBwrdEUuqfvzhF/DtQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/bigdecimal": "0.2.0",
|
||||
"@formatjs/fast-memoize": "3.1.1",
|
||||
"@formatjs/intl-localematcher": "0.8.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@formatjs/fast-memoize": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-3.1.1.tgz",
|
||||
"integrity": "sha512-CbNbf+tlJn1baRnPkNePnBqTLxGliG6DDgNa/UtV66abwIjwsliPMOt0172tzxABYzSuxZBZfcp//qI8AvBWPg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@formatjs/icu-messageformat-parser": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-3.5.3.tgz",
|
||||
"integrity": "sha512-HJWZ9S6JWey6iY5+YXE3Kd0ofWU1sC2KTTp56e1168g/xxWvVvr8k9G4fexIgwYV9wbtjY7kGYK5FjoWB3B2OQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/ecma402-abstract": "3.2.0",
|
||||
"@formatjs/icu-skeleton-parser": "2.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@formatjs/icu-skeleton-parser": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-2.1.3.tgz",
|
||||
"integrity": "sha512-9mFp8TJ166ZM2pcjKwsBWXrDnOJGT7vMEScVgLygUODPOsE8S6f/FHoacvrlHK1B4dYZk8vSCNruyPU64AfgJQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/ecma402-abstract": "3.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@formatjs/intl-localematcher": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.8.2.tgz",
|
||||
"integrity": "sha512-q05KMYGJLyqFNFtIb8NhWLF5X3aK/k0wYt7dnRFuy6aLQL+vUwQ1cg5cO4qawEiINybeCPXAWlprY2mSBjSXAQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/fast-memoize": "3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@hookform/resolvers": {
|
||||
"version": "3.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.10.0.tgz",
|
||||
@@ -2032,6 +2084,313 @@
|
||||
"node": ">=12.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz",
|
||||
"integrity": "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.3",
|
||||
"is-glob": "^4.0.3",
|
||||
"node-addon-api": "^7.0.0",
|
||||
"picomatch": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@parcel/watcher-android-arm64": "2.5.6",
|
||||
"@parcel/watcher-darwin-arm64": "2.5.6",
|
||||
"@parcel/watcher-darwin-x64": "2.5.6",
|
||||
"@parcel/watcher-freebsd-x64": "2.5.6",
|
||||
"@parcel/watcher-linux-arm-glibc": "2.5.6",
|
||||
"@parcel/watcher-linux-arm-musl": "2.5.6",
|
||||
"@parcel/watcher-linux-arm64-glibc": "2.5.6",
|
||||
"@parcel/watcher-linux-arm64-musl": "2.5.6",
|
||||
"@parcel/watcher-linux-x64-glibc": "2.5.6",
|
||||
"@parcel/watcher-linux-x64-musl": "2.5.6",
|
||||
"@parcel/watcher-win32-arm64": "2.5.6",
|
||||
"@parcel/watcher-win32-ia32": "2.5.6",
|
||||
"@parcel/watcher-win32-x64": "2.5.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-android-arm64": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.6.tgz",
|
||||
"integrity": "sha512-YQxSS34tPF/6ZG7r/Ih9xy+kP/WwediEUsqmtf0cuCV5TPPKw/PQHRhueUo6JdeFJaqV3pyjm0GdYjZotbRt/A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-darwin-arm64": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.6.tgz",
|
||||
"integrity": "sha512-Z2ZdrnwyXvvvdtRHLmM4knydIdU9adO3D4n/0cVipF3rRiwP+3/sfzpAwA/qKFL6i1ModaabkU7IbpeMBgiVEA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-darwin-x64": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.6.tgz",
|
||||
"integrity": "sha512-HgvOf3W9dhithcwOWX9uDZyn1lW9R+7tPZ4sug+NGrGIo4Rk1hAXLEbcH1TQSqxts0NYXXlOWqVpvS1SFS4fRg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-freebsd-x64": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.6.tgz",
|
||||
"integrity": "sha512-vJVi8yd/qzJxEKHkeemh7w3YAn6RJCtYlE4HPMoVnCpIXEzSrxErBW5SJBgKLbXU3WdIpkjBTeUNtyBVn8TRng==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-linux-arm-glibc": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.6.tgz",
|
||||
"integrity": "sha512-9JiYfB6h6BgV50CCfasfLf/uvOcJskMSwcdH1PHH9rvS1IrNy8zad6IUVPVUfmXr+u+Km9IxcfMLzgdOudz9EQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-linux-arm-musl": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.6.tgz",
|
||||
"integrity": "sha512-Ve3gUCG57nuUUSyjBq/MAM0CzArtuIOxsBdQ+ftz6ho8n7s1i9E1Nmk/xmP323r2YL0SONs1EuwqBp2u1k5fxg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-linux-arm64-glibc": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.6.tgz",
|
||||
"integrity": "sha512-f2g/DT3NhGPdBmMWYoxixqYr3v/UXcmLOYy16Bx0TM20Tchduwr4EaCbmxh1321TABqPGDpS8D/ggOTaljijOA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-linux-arm64-musl": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.6.tgz",
|
||||
"integrity": "sha512-qb6naMDGlbCwdhLj6hgoVKJl2odL34z2sqkC7Z6kzir8b5W65WYDpLB6R06KabvZdgoHI/zxke4b3zR0wAbDTA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-linux-x64-glibc": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.6.tgz",
|
||||
"integrity": "sha512-kbT5wvNQlx7NaGjzPFu8nVIW1rWqV780O7ZtkjuWaPUgpv2NMFpjYERVi0UYj1msZNyCzGlaCWEtzc+exjMGbQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-linux-x64-musl": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.6.tgz",
|
||||
"integrity": "sha512-1JRFeC+h7RdXwldHzTsmdtYR/Ku8SylLgTU/reMuqdVD7CtLwf0VR1FqeprZ0eHQkO0vqsbvFLXUmYm/uNKJBg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-win32-arm64": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.6.tgz",
|
||||
"integrity": "sha512-3ukyebjc6eGlw9yRt678DxVF7rjXatWiHvTXqphZLvo7aC5NdEgFufVwjFfY51ijYEWpXbqF5jtrK275z52D4Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-win32-ia32": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.6.tgz",
|
||||
"integrity": "sha512-k35yLp1ZMwwee3Ez/pxBi5cf4AoBKYXj00CZ80jUz5h8prpiaQsiRPKQMxoLstNuqe2vR4RNPEAEcjEFzhEz/g==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher-win32-x64": {
|
||||
"version": "2.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.6.tgz",
|
||||
"integrity": "sha512-hbQlYcCq5dlAX9Qx+kFb0FHue6vbjlf0FrNzSKdYK2APUf7tGfGxQCk2ihEREmbR6ZMc0MVAD5RIX/41gpUzTw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/@parcel/watcher/node_modules/picomatch": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
|
||||
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.57.0",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.57.0.tgz",
|
||||
@@ -3378,6 +3737,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@schummar/icu-type-parser": {
|
||||
"version": "1.21.5",
|
||||
"resolved": "https://registry.npmjs.org/@schummar/icu-type-parser/-/icu-type-parser-1.21.5.tgz",
|
||||
"integrity": "sha512-bXHSaW5jRTmke9Vd0h5P7BtWZG9Znqb8gSDxZnxaGSJnGwPLDPfS+3g0BKzeWqzgZPsIVZkM7m2tbo18cm5HBw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@sinclair/typebox": {
|
||||
"version": "0.27.8",
|
||||
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
||||
@@ -3405,6 +3770,204 @@
|
||||
"@sinonjs/commons": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-arm64": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.21.tgz",
|
||||
"integrity": "sha512-SA8SFg9dp0qKRH8goWsax6bptFE2EdmPf2YRAQW9WoHGf3XKM1bX0nd5UdwxmC5hXsBUZAYf7xSciCler6/oyA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-x64": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.15.21.tgz",
|
||||
"integrity": "sha512-//fOVntgowz9+V90lVsNCtyyrtbHp3jWH6Rch7MXHXbcvbLmbCTmssl5DeedUWLLGiAAW1wksBdqdGYOTjaNLw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm-gnueabihf": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.15.21.tgz",
|
||||
"integrity": "sha512-meNI4Sh6h9h8DvIfEc0l5URabYMSuNvyisLmG6vnoYAS43s8ON3NJR8sDHvdP7NJTrLe0q/x2XCn6yL/BeHcZg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-gnu": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.15.21.tgz",
|
||||
"integrity": "sha512-QrXlNQnHeXqU2EzLlnsPoWEh8/GtNJLvfMiPsDhk+ht6Xv8+vhvZ5YZ/BokNWSIZiWPKLAqR0M7T92YF5tmD3g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-musl": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.15.21.tgz",
|
||||
"integrity": "sha512-8/yGCMO333ultDaMQivE5CjO6oXDPeeg1IV4sphojPkb0Pv0i6zvcRIkgp60xDB+UxLr6VgHgt+BBgqS959E9g==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-ppc64-gnu": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.15.21.tgz",
|
||||
"integrity": "sha512-ucW0HzPx0s1dgRvcvuLSPSA/2Kk/VYTv9st8qe1Kc22Gu0Q0rH9+6TcBTmMuNIp0Xs4BPr1uBttmbO1wEGI49Q==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-s390x-gnu": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.15.21.tgz",
|
||||
"integrity": "sha512-ulTnOGc5I7YRObE/9NreAhQg94QkiR5qNhhcUZ1iFAYjzg/JGAi1ch+s/Ixe61pMIr8bfVrF0NOaB0f8wjaAfA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-gnu": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.15.21.tgz",
|
||||
"integrity": "sha512-D0RokxtM+cPvSqJIKR6uja4hbD+scI9ezo95mBhfSyLUs9wnPPl26sLp1ZPR/EXRdYm3F3S6RUtVi+8QXhT24Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-musl": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.15.21.tgz",
|
||||
"integrity": "sha512-nER8u7VeRfmU6fMDzl1NQAbbB/G7O2avmvCOwIul1uGkZ2/acbPH+DCL9h5+0yd/coNcxMBTL6NGepIew+7C2w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-arm64-msvc": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.15.21.tgz",
|
||||
"integrity": "sha512-+/AgNBnjYugUA8C0Do4YzymgvnGbztv7j8HKSQLvR/DQgZPoXQ2B3PqB2mTtGh/X5DhlJWiqnunN35JUgWcAeQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-ia32-msvc": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.15.21.tgz",
|
||||
"integrity": "sha512-IkSZj8PX/N4HcaFhMQtzmkV8YSnuNoJ0E6OvMwFiOfejPhiKXvl7CdDsn1f4/emYEIDO3fpgZW9DTaCRMDxaDA==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-x64-msvc": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.21.tgz",
|
||||
"integrity": "sha512-zUyWso7OOENB6e1N1hNuNn8vbvLsTdKQ5WKLgt/JcBNfJhKy/6jmBmqI3GXk/MyvQKd5SLvP7A0F36p7TeDqvw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/counter": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",
|
||||
"integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.15",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
|
||||
@@ -3414,6 +3977,15 @@
|
||||
"tslib": "^2.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/types": {
|
||||
"version": "0.1.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.26.tgz",
|
||||
"integrity": "sha512-lyMwd7WGgG79RS7EERZV3T8wMdmPq3xwyg+1nmAM64kIhx5yl+juO2PYIHb7vTiPgPCj8LYjsNV2T5wiQHUEaw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/node": {
|
||||
"version": "4.1.17",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.17.tgz",
|
||||
@@ -6112,7 +6684,6 @@
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -7719,6 +8290,21 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/icu-minify": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/icu-minify/-/icu-minify-4.9.0.tgz",
|
||||
"integrity": "sha512-9ev7MqkN29jcIelUAqJRfNCxzGOEkBJPnr+scYATMp2bfpU4Bm1eIwYU0/o5xRy8BBnSWMUjK58WTB3132P0bg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/amannn"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/icu-messageformat-parser": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ignore": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
||||
@@ -7859,6 +8445,17 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/intl-messageformat": {
|
||||
"version": "11.2.0",
|
||||
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-11.2.0.tgz",
|
||||
"integrity": "sha512-IhghAA8n4KSlXuWKzYsWyWb82JoYTzShfyvdSF85oJPnNOjvv4kAo7S7Jtkm3/vJ53C7dQNRO+Gpnj3iWgTjBQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@formatjs/ecma402-abstract": "3.2.0",
|
||||
"@formatjs/fast-memoize": "3.1.1",
|
||||
"@formatjs/icu-messageformat-parser": "3.5.3"
|
||||
}
|
||||
},
|
||||
"node_modules/is-array-buffer": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
|
||||
@@ -8015,7 +8612,6 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@@ -8081,7 +8677,6 @@
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-extglob": "^2.1.1"
|
||||
@@ -10016,6 +10611,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
|
||||
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/next": {
|
||||
"version": "16.0.7",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-16.0.7.tgz",
|
||||
@@ -10068,6 +10672,94 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/next-intl": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/next-intl/-/next-intl-4.9.0.tgz",
|
||||
"integrity": "sha512-MMNAjewHUw9Ke93E5/Yzhf8lqesesaXJTPlrK3FwECgn4EXG9m7Tuzy4rnDes0ogjDhQIa/Ksj/qmFnHJAOluw==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/amannn"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/intl-localematcher": "^0.8.1",
|
||||
"@parcel/watcher": "^2.4.1",
|
||||
"@swc/core": "^1.15.2",
|
||||
"icu-minify": "^4.9.0",
|
||||
"negotiator": "^1.0.0",
|
||||
"next-intl-swc-plugin-extractor": "^4.9.0",
|
||||
"po-parser": "^2.1.1",
|
||||
"use-intl": "^4.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/next-intl-swc-plugin-extractor": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/next-intl-swc-plugin-extractor/-/next-intl-swc-plugin-extractor-4.9.0.tgz",
|
||||
"integrity": "sha512-CAu6Qy6XiCenKsvzyCPm2cZFkGfcvhJi8N93TCnOowmzD4Br3ked7QdROusRRp4MQ1iG9u+KCLgVcM9CLDUOIQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/next-intl/node_modules/@swc/core": {
|
||||
"version": "1.15.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.15.21.tgz",
|
||||
"integrity": "sha512-fkk7NJcBscrR3/F8jiqlMptRHP650NxqDnspBMrRe5d8xOoCy9MLL5kOBLFXjFLfMo3KQQHhk+/jUULOMlR1uQ==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@swc/counter": "^0.1.3",
|
||||
"@swc/types": "^0.1.25"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/swc"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@swc/core-darwin-arm64": "1.15.21",
|
||||
"@swc/core-darwin-x64": "1.15.21",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.15.21",
|
||||
"@swc/core-linux-arm64-gnu": "1.15.21",
|
||||
"@swc/core-linux-arm64-musl": "1.15.21",
|
||||
"@swc/core-linux-ppc64-gnu": "1.15.21",
|
||||
"@swc/core-linux-s390x-gnu": "1.15.21",
|
||||
"@swc/core-linux-x64-gnu": "1.15.21",
|
||||
"@swc/core-linux-x64-musl": "1.15.21",
|
||||
"@swc/core-win32-arm64-msvc": "1.15.21",
|
||||
"@swc/core-win32-ia32-msvc": "1.15.21",
|
||||
"@swc/core-win32-x64-msvc": "1.15.21"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/helpers": ">=0.5.17"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/helpers": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/next-intl/node_modules/@swc/helpers": {
|
||||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.21.tgz",
|
||||
"integrity": "sha512-jI/VAmtdjB/RnI8GTnokyX7Ug8c+g+ffD6QRLa6XQewtnGyukKkKSk3wLTM3b5cjt1jNh9x0jfVlagdN2gDKQg==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/next-themes": {
|
||||
"version": "0.4.6",
|
||||
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz",
|
||||
@@ -10106,6 +10798,12 @@
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/node-addon-api": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
|
||||
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-int64": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
||||
@@ -10568,6 +11266,12 @@
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/po-parser": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/po-parser/-/po-parser-2.1.1.tgz",
|
||||
"integrity": "sha512-ECF4zHLbUItpUgE3OTtLKlPjeBN+fKEczj2zYjDfCGOzicNs0GK3Vg2IoAYwx7LH/XYw43fZQP6xnZ4TkNxSLQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/possible-typed-array-names": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
||||
@@ -12352,6 +13056,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/use-intl": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/use-intl/-/use-intl-4.9.0.tgz",
|
||||
"integrity": "sha512-GehJvP7gu8SvmaDHNDNrRHt2TCNSZt4l1cGJMpUX77TGeZPAQKVQokAVvoYkeTT1UWPtv9RJ6N16UJNButzrgg==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/amannn"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@formatjs/fast-memoize": "^3.1.0",
|
||||
"@schummar/icu-type-parser": "1.21.5",
|
||||
"icu-minify": "^4.9.0",
|
||||
"intl-messageformat": "^11.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/use-sidecar": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.3.tgz",
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
"input-otp": "1.4.1",
|
||||
"lucide-react": "^0.454.0",
|
||||
"next": "16.0.7",
|
||||
"next-intl": "^4.9.0",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "19.2.0",
|
||||
"react-day-picker": "9.8.0",
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_meta": {
|
||||
"description": "Translation glossary for Nomad Karaoke Generator. Terms listed here should be translated consistently across all projects.",
|
||||
"usage": "Terms with null values should NOT be translated (keep original). Terms with string values should use the specified translation."
|
||||
},
|
||||
"terms": {
|
||||
"Nomad Karaoke": { "es": null, "de": null },
|
||||
"Generator": { "es": null, "de": null },
|
||||
"YouTube": { "es": null, "de": null },
|
||||
"Dropbox": { "es": null, "de": null },
|
||||
"Google Drive": { "es": null, "de": null },
|
||||
"Stripe": { "es": null, "de": null },
|
||||
"CDG": { "es": null, "de": null },
|
||||
"MP3": { "es": null, "de": null },
|
||||
"MP4": { "es": null, "de": null },
|
||||
"FLAC": { "es": null, "de": null },
|
||||
"WAV": { "es": null, "de": null },
|
||||
"OGG": { "es": null, "de": null },
|
||||
"4K": { "es": null, "de": null },
|
||||
"720p": { "es": null, "de": null },
|
||||
"stem separation": { "es": "separación de pistas", "de": "Stem-Trennung" },
|
||||
"vocal separation": { "es": "separación vocal", "de": "Gesangstrennung" },
|
||||
"backing vocals": { "es": "coros", "de": "Hintergrundgesang" },
|
||||
"lead vocals": { "es": "voz principal", "de": "Hauptgesang" },
|
||||
"karaoke video": { "es": "video de karaoke", "de": "Karaoke-Video" },
|
||||
"instrumental": { "es": "instrumental", "de": "Instrumental" },
|
||||
"instrumental track": { "es": "pista instrumental", "de": "Instrumentalspur" },
|
||||
"clean instrumental": { "es": "instrumental limpio", "de": "reines Instrumental" },
|
||||
"title card": { "es": "tarjeta de título", "de": "Titelkarte" },
|
||||
"title screen": { "es": "pantalla de título", "de": "Titelbildschirm" },
|
||||
"end screen": { "es": "pantalla final", "de": "Endbildschirm" },
|
||||
"lyrics review": { "es": "revisión de letras", "de": "Textüberprüfung" },
|
||||
"lyrics sync": { "es": "sincronización de letras", "de": "Textsynchronisation" },
|
||||
"synced lyrics": { "es": "letras sincronizadas", "de": "synchronisierter Text" },
|
||||
"reference lyrics": { "es": "letras de referencia", "de": "Referenztext" },
|
||||
"transcription": { "es": "transcripción", "de": "Transkription" },
|
||||
"gap": { "es": "hueco", "de": "Lücke" },
|
||||
"correction": { "es": "corrección", "de": "Korrektur" },
|
||||
"phantom word": { "es": "palabra fantasma", "de": "Phantomwort" },
|
||||
"misheard word": { "es": "palabra mal escuchada", "de": "falsch erkanntes Wort" },
|
||||
"waveform": { "es": "forma de onda", "de": "Wellenform" },
|
||||
"mute region": { "es": "región silenciada", "de": "stummgeschalteter Bereich" },
|
||||
"timing offset": { "es": "desplazamiento de tiempo", "de": "Zeitversatz" },
|
||||
"credit": { "es": "crédito", "de": "Guthaben" },
|
||||
"credits": { "es": "créditos", "de": "Guthaben" },
|
||||
"magic link": { "es": "enlace mágico", "de": "magischer Link" },
|
||||
"sign-in link": { "es": "enlace de inicio de sesión", "de": "Anmeldelink" },
|
||||
"karaoke machine": { "es": "máquina de karaoke", "de": "Karaoke-Maschine" },
|
||||
"sing along": { "es": "cantar junto", "de": "mitsingen" },
|
||||
"audio stems": { "es": "pistas de audio", "de": "Audio-Stems" },
|
||||
"lossless": { "es": "sin pérdida", "de": "verlustfrei" },
|
||||
"push notification": { "es": "notificación push", "de": "Push-Benachrichtigung" },
|
||||
"encoding": { "es": "codificación", "de": "Kodierung" },
|
||||
"rendering": { "es": "renderizado", "de": "Rendern" },
|
||||
"separation": { "es": "separación", "de": "Trennung" },
|
||||
"audio separation": { "es": "separación de audio", "de": "Audiotrennung" },
|
||||
"job": { "es": "trabajo", "de": "Auftrag" },
|
||||
"anchor sequence": { "es": "secuencia de anclaje", "de": "Ankersequenz" },
|
||||
"segment": { "es": "segmento", "de": "Segment" },
|
||||
"countdown": { "es": "cuenta regresiva", "de": "Countdown" },
|
||||
"vinyl rip": { "es": "copia de vinilo", "de": "Vinyl-Rip" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
LLM Translation Pipeline for Nomad Karaoke i18n.
|
||||
|
||||
Two-pass translation using Gemini via Vertex AI:
|
||||
1. Translate English JSON to target language
|
||||
2. Review and polish translations for fluency
|
||||
|
||||
Usage:
|
||||
python scripts/translate.py --messages-dir ./messages --target es de
|
||||
python scripts/translate.py --messages-dir ../karaoke-decide-i18n/frontend/messages --target es
|
||||
python scripts/translate.py --messages-dir ./messages --target es --skip-review
|
||||
|
||||
Requires:
|
||||
- google-genai SDK (pip install google-genai)
|
||||
- GCP Application Default Credentials (gcloud auth application-default login)
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from google import genai
|
||||
from google.genai import types
|
||||
|
||||
MODEL = "gemini-3.1-pro-preview"
|
||||
PROJECT = "nomadkaraoke"
|
||||
LOCATION = "global"
|
||||
|
||||
|
||||
def load_glossary(script_dir: Path) -> dict:
|
||||
glossary_path = script_dir / "glossary.json"
|
||||
if glossary_path.exists():
|
||||
with open(glossary_path) as f:
|
||||
return json.load(f)
|
||||
return {"terms": {}}
|
||||
|
||||
|
||||
def build_glossary_instructions(glossary: dict, target_locale: str) -> str:
|
||||
lines = []
|
||||
for term, translations in glossary["terms"].items():
|
||||
if target_locale in translations:
|
||||
val = translations[target_locale]
|
||||
if val is None:
|
||||
lines.append(f'- "{term}" → DO NOT translate, keep as "{term}"')
|
||||
else:
|
||||
lines.append(f'- "{term}" → "{val}"')
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def translate_pass(
|
||||
client: genai.Client,
|
||||
english_json: str,
|
||||
target_locale: str,
|
||||
glossary_instructions: str,
|
||||
) -> str:
|
||||
"""Pass 1: Translate English to target language."""
|
||||
|
||||
locale_names = {"es": "Spanish", "de": "German"}
|
||||
target_name = locale_names.get(target_locale, target_locale)
|
||||
|
||||
response = client.models.generate_content(
|
||||
model=MODEL,
|
||||
contents=f"""Translate the following JSON message file from English to {target_name}.
|
||||
|
||||
## Context
|
||||
This is for Nomad Karaoke (nomadkaraoke.com), a karaoke platform with two products:
|
||||
- "Decide": a song discovery app that helps users find karaoke songs to sing
|
||||
- "Generator": a karaoke video creation tool that generates professional karaoke videos from any song
|
||||
|
||||
The strings are used in the website UI, including navigation, headings, descriptions, policy pages, and a tipping page.
|
||||
|
||||
## Rules
|
||||
1. Preserve ALL JSON keys exactly as they are — only translate the string values
|
||||
2. Preserve all placeholders like {{year}}, {{count}} etc. exactly as they appear
|
||||
3. Preserve all URLs, email addresses, phone numbers, and physical addresses exactly
|
||||
4. Preserve all currency amounts ($5, $10, etc.) in their original format
|
||||
5. Use informal "{"tú" if target_locale == "es" else "du"}" form when addressing the user
|
||||
|
||||
## Glossary — follow these translations exactly:
|
||||
{glossary_instructions}
|
||||
|
||||
## JSON to translate:
|
||||
```json
|
||||
{english_json}
|
||||
```
|
||||
|
||||
Return ONLY the translated JSON, no explanation or markdown code fences.""",
|
||||
config=types.GenerateContentConfig(
|
||||
thinking_config=types.ThinkingConfig(thinking_level="medium"),
|
||||
temperature=0.3,
|
||||
),
|
||||
)
|
||||
|
||||
return response.text
|
||||
|
||||
|
||||
def review_pass(
|
||||
client: genai.Client,
|
||||
english_json: str,
|
||||
translated_json: str,
|
||||
target_locale: str,
|
||||
glossary_instructions: str,
|
||||
) -> str:
|
||||
"""Pass 2: Review and polish translations."""
|
||||
|
||||
locale_names = {"es": "Spanish", "de": "German"}
|
||||
target_name = locale_names.get(target_locale, target_locale)
|
||||
|
||||
response = client.models.generate_content(
|
||||
model=MODEL,
|
||||
contents=f"""Review and polish this {target_name} translation of a UI message file for Nomad Karaoke (a karaoke video generation platform).
|
||||
|
||||
## Your task
|
||||
1. Read the original English and the {target_name} translation side by side
|
||||
2. Check every string for:
|
||||
- Naturalness: Would a native {target_name} speaker find this awkward or unnatural?
|
||||
- Accuracy: Does the translation convey the same meaning as the English?
|
||||
- Consistency: Are the same terms translated the same way throughout?
|
||||
- Tone: The tone should be friendly, approachable, and professional — like a small business talking to customers
|
||||
- Form of address: Should use informal "{"tú" if target_locale == "es" else "du"}" form
|
||||
3. Fix any issues you find
|
||||
4. Ensure all JSON keys, placeholders, URLs, emails, phone numbers, and addresses are preserved exactly
|
||||
|
||||
## Glossary — these translations are mandatory:
|
||||
{glossary_instructions}
|
||||
|
||||
## Original English:
|
||||
```json
|
||||
{english_json}
|
||||
```
|
||||
|
||||
## {target_name} translation to review:
|
||||
```json
|
||||
{translated_json}
|
||||
```
|
||||
|
||||
Return ONLY the improved JSON, no explanation or markdown code fences.""",
|
||||
config=types.GenerateContentConfig(
|
||||
thinking_config=types.ThinkingConfig(thinking_level="medium"),
|
||||
temperature=0.3,
|
||||
),
|
||||
)
|
||||
|
||||
return response.text
|
||||
|
||||
|
||||
def clean_json_response(text: str) -> str:
|
||||
"""Strip markdown code fences if the model included them."""
|
||||
text = text.strip()
|
||||
if text.startswith("```"):
|
||||
lines = text.split("\n")
|
||||
lines = [line for line in lines if not line.strip().startswith("```")]
|
||||
text = "\n".join(lines)
|
||||
return text
|
||||
|
||||
|
||||
def count_keys(obj: dict, prefix: str = "") -> int:
|
||||
"""Count leaf keys in nested dict."""
|
||||
count = 0
|
||||
for key, value in obj.items():
|
||||
if isinstance(value, dict):
|
||||
count += count_keys(value, f"{prefix}{key}.")
|
||||
else:
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Translate i18n message files using Gemini via Vertex AI")
|
||||
parser.add_argument(
|
||||
"--messages-dir",
|
||||
type=Path,
|
||||
required=True,
|
||||
help="Path to messages directory containing en.json",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--target",
|
||||
nargs="+",
|
||||
required=True,
|
||||
help="Target locale codes (e.g., es de)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--skip-review",
|
||||
action="store_true",
|
||||
help="Skip the review pass (faster, lower quality)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Validate
|
||||
en_path = args.messages_dir / "en.json"
|
||||
if not en_path.exists():
|
||||
print(f"Error: {en_path} not found")
|
||||
sys.exit(1)
|
||||
|
||||
# Load English source
|
||||
with open(en_path) as f:
|
||||
english_json = f.read()
|
||||
|
||||
# Validate it's valid JSON
|
||||
json.loads(english_json)
|
||||
|
||||
script_dir = Path(__file__).parent
|
||||
glossary = load_glossary(script_dir)
|
||||
|
||||
# Initialize Vertex AI client using Application Default Credentials
|
||||
client = genai.Client(
|
||||
vertexai=True,
|
||||
project=PROJECT,
|
||||
location=LOCATION,
|
||||
)
|
||||
|
||||
print(f"Using model: {MODEL}")
|
||||
print(f"Project: {PROJECT}, Location: {LOCATION}")
|
||||
|
||||
for locale in args.target:
|
||||
print(f"\n{'='*60}")
|
||||
print(f"Translating to: {locale}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
glossary_instructions = build_glossary_instructions(glossary, locale)
|
||||
|
||||
# Pass 1: Translate
|
||||
print("Pass 1: Translating...")
|
||||
translated = translate_pass(client, english_json, locale, glossary_instructions)
|
||||
translated = clean_json_response(translated)
|
||||
|
||||
# Validate JSON
|
||||
try:
|
||||
json.loads(translated)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Warning: Pass 1 produced invalid JSON: {e}")
|
||||
print("Saving raw output for inspection...")
|
||||
out_path = args.messages_dir / f"{locale}.raw.json"
|
||||
with open(out_path, "w") as f:
|
||||
f.write(translated)
|
||||
print(f"Saved to {out_path}")
|
||||
continue
|
||||
|
||||
if not args.skip_review:
|
||||
# Pass 2: Review
|
||||
print("Pass 2: Reviewing and polishing...")
|
||||
reviewed = review_pass(client, english_json, translated, locale, glossary_instructions)
|
||||
reviewed = clean_json_response(reviewed)
|
||||
|
||||
try:
|
||||
parsed = json.loads(reviewed)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Warning: Pass 2 produced invalid JSON: {e}")
|
||||
print("Using Pass 1 output instead.")
|
||||
parsed = json.loads(translated)
|
||||
else:
|
||||
parsed = json.loads(translated)
|
||||
|
||||
# Write output
|
||||
out_path = args.messages_dir / f"{locale}.json"
|
||||
with open(out_path, "w", encoding="utf-8") as f:
|
||||
json.dump(parsed, f, ensure_ascii=False, indent=2)
|
||||
f.write("\n")
|
||||
|
||||
print(f"Saved: {out_path}")
|
||||
|
||||
# Quick stats
|
||||
en_keys = count_keys(json.loads(english_json))
|
||||
tr_keys = count_keys(parsed)
|
||||
pct = (tr_keys / en_keys * 100) if en_keys else 0
|
||||
print(f"Keys: {tr_keys}/{en_keys} ({pct:.0f}%)")
|
||||
|
||||
print("\nDone!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user