Complete stabilization pass bringing all 3 stacks to green: Frontend (apps/web/): - Fix TypeScript nullability in useSeason.ts, useTimeOfDay.ts hooks - Disable no-undef in ESLint config (TypeScript handles it; JSX misidentified) - Rename 306 story imports from @storybook/react to @storybook/react-vite - Fix conditional hook call in useMediaQuery.ts useIsTablet - Move useQuery to top of LoginPage.tsx component - Remove useless try/catch in GearFormModal.tsx - Fix stale closure in ResetPasswordPage.tsx handleChange - Make Storybook decorators (withRouter, withQueryClient, withToast, withAudio) no-ops since global StorybookDecorator already provides these — prevents nested Router / duplicate provider crashes in vitest-browser - Fix nested MemoryRouter in 3 page stories (TrackDetail, PlaylistDetail, UserProfile) - Update i18n initialization in test setup (await init before changeLanguage) - Update ~30 test assertions from English to French to match i18n translations - Update test assertions to match SUMI V3 design changes (shadow vs border) - Fix remaining story type errors (PlayerError, PlaylistBatchActions, TrackFilters, VirtualizedChatMessages) Backend (veza-backend-api/): - Fix response_test.go RespondWithAppError signature (2 args, not 3) - Fix TestErrorContractAuthEndpoints expected error codes (ErrCodeUnauthorized vs ErrCodeInvalidCredentials) - Fix TestTrackHandler_GetTrackLikes_Success missing auth middleware setup - Fix TestPlaybackAnalyticsService_GetTrackStats k-anonymity threshold (needs 5 unique users, not 1) - Replace NOW() PostgreSQL function with time.Now() parameter in marketplace service for SQLite test compatibility - Add missing AutoMigrate entries in marketplace_test.go (ProductImage, ProductPreview, ProductLicense, ProductReview) Results: - Frontend TypeCheck: 617 errors -> 0 errors - Frontend ESLint: 349 errors -> 0 errors - Frontend Vitest: 196 failing tests -> 1 skipped (3396/3397 passing) - Backend go vet: 1 error -> 0 errors - Backend tests: 5 failing -> all 13 packages passing - Rust: 150/150 tests passing (unchanged) - Storybook audit: 0 errors across 1244 stories Triage report: docs/TRIAGE_REPORT.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
104 lines
3.4 KiB
TypeScript
104 lines
3.4 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { Dialog } from '../../ui/dialog';
|
|
import { Input } from '../../ui/input';
|
|
import { Lock, Globe } from 'lucide-react';
|
|
import { useToast } from '../../../components/feedback/ToastProvider';
|
|
import { useTranslation } from '@/hooks/useTranslation';
|
|
|
|
interface SaveQueueAsPlaylistModalProps {
|
|
open: boolean;
|
|
onClose: () => void;
|
|
onSave: (name: string, isPublic: boolean) => void | Promise<void>;
|
|
}
|
|
|
|
export const SaveQueueAsPlaylistModal: React.FC<
|
|
SaveQueueAsPlaylistModalProps
|
|
> = ({ open, onClose, onSave }) => {
|
|
const { addToast } = useToast();
|
|
const { t } = useTranslation();
|
|
const [name, setName] = useState('');
|
|
const [isPublic, setIsPublic] = useState(false);
|
|
const [saving, setSaving] = useState(false);
|
|
|
|
const handleSubmit = async () => {
|
|
if (!name) {
|
|
addToast(t('queue.saveAsPlaylist.nameRequired'), 'error');
|
|
return;
|
|
}
|
|
setSaving(true);
|
|
try {
|
|
await onSave(name, isPublic);
|
|
onClose();
|
|
} catch (err) {
|
|
addToast(
|
|
err instanceof Error
|
|
? err.message
|
|
: t('queue.saveAsPlaylist.saveFailed'),
|
|
'error',
|
|
);
|
|
} finally {
|
|
setSaving(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Dialog
|
|
open={open}
|
|
onClose={onClose}
|
|
title={t('queue.saveAsPlaylist.title')}
|
|
onConfirm={handleSubmit}
|
|
confirmLabel={saving ? t('common.loading') : t('queue.saveAsPlaylist.save')}
|
|
onCancel={onClose}
|
|
showCancel
|
|
cancelLabel={t('queue.saveAsPlaylist.cancel')}
|
|
>
|
|
<div className="space-y-4">
|
|
<Input
|
|
id="queue-playlist-name"
|
|
label={t('queue.saveAsPlaylist.nameLabel')}
|
|
value={name}
|
|
onChange={(e) => setName(e.target.value)}
|
|
autoFocus
|
|
placeholder={t('queue.saveAsPlaylist.namePlaceholder')}
|
|
/>
|
|
|
|
<button
|
|
type="button"
|
|
role="switch"
|
|
aria-checked={isPublic}
|
|
aria-label={t('queue.saveAsPlaylist.toggleVisibility')}
|
|
className="flex w-full items-center justify-between p-4 bg-card rounded shadow-[0_0_8px_rgba(26,26,30,0.05)] cursor-pointer hover:shadow-[0_0_12px_rgba(26,26,30,0.1)]"
|
|
onClick={() => setIsPublic(!isPublic)}
|
|
>
|
|
<div className="flex items-center gap-4">
|
|
{isPublic ? (
|
|
<Globe className="w-5 h-5 text-muted-foreground" />
|
|
) : (
|
|
<Lock className="w-5 h-5 text-warning" />
|
|
)}
|
|
<div className="text-left">
|
|
<div className="text-sm font-bold text-foreground">
|
|
{isPublic
|
|
? t('queue.saveAsPlaylist.publicPlaylist')
|
|
: t('queue.saveAsPlaylist.privatePlaylist')}
|
|
</div>
|
|
<div className="text-xs text-muted-foreground">
|
|
{isPublic
|
|
? t('queue.saveAsPlaylist.publicDescription')
|
|
: t('queue.saveAsPlaylist.privateDescription')}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div
|
|
aria-hidden="true"
|
|
className={`w-10 h-5 rounded-full relative transition-colors ${isPublic ? 'bg-primary' : 'bg-muted'}`}
|
|
>
|
|
<div
|
|
className={`absolute top-1 w-3 h-3 bg-white rounded-full transition-all ${isPublic ? 'left-6' : 'left-1'}`}
|
|
></div>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
</Dialog>
|
|
);
|
|
};
|