Enhance UploadToShowDialog: add 'apply to all' functionality for batch show assignment, improve UI layout for better user experience, and update translations for new options.
This commit is contained in:
@@ -46,6 +46,10 @@ export function UploadToShowDialog({ files, onClose }: { files: File[]; onClose:
|
||||
const assignment = (name: string): string =>
|
||||
name in overrides ? overrides[name] : (matchedByName.get(name) ?? '')
|
||||
|
||||
/** Проставить одно шоу (или «в библиотеку») всем файлам разом. */
|
||||
const applyToAll = (showId: string) =>
|
||||
setOverrides(Object.fromEntries(files.map((f) => [f.name, showId])))
|
||||
|
||||
// Предпросмотр: что распарсим для каждого файла при текущих настройках, в порядке добавления.
|
||||
const previews = useMemo(() => {
|
||||
const opts = {
|
||||
@@ -104,11 +108,26 @@ export function UploadToShowDialog({ files, onClose }: { files: File[]; onClose:
|
||||
)}
|
||||
</p>
|
||||
|
||||
<div className="flex items-center justify-between text-sm">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-sm">
|
||||
<span className="font-medium">{t('admin.media.toShowPreview')}</span>
|
||||
<span className="text-muted-foreground">
|
||||
{t('admin.media.toShowMatched', { matched: matchedCount, total: files.length })}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-muted-foreground">
|
||||
{t('admin.media.toShowMatched', { matched: matchedCount, total: files.length })}
|
||||
</span>
|
||||
<Select value="" onValueChange={(v) => applyToAll(v === LIBRARY_VALUE ? '' : v)}>
|
||||
<SelectTrigger className="h-8 w-52">
|
||||
<SelectValue placeholder={t('admin.media.applyToAll')} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={LIBRARY_VALUE}>{t('admin.media.toShowLibrary')}</SelectItem>
|
||||
{shows?.map((s) => (
|
||||
<SelectItem key={s.id} value={s.id}>
|
||||
{s.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
<ul className="crt-panel max-h-72 divide-y divide-border overflow-y-auto rounded-md text-sm">
|
||||
{previews.map((p) => {
|
||||
|
||||
Reference in New Issue
Block a user