Compare commits
No commits in common. "e201fe0135cd18e2bcff238ce18d05b47b2c0a1d" and "743b65f917fde792763614222cf66fe01fd3680d" have entirely different histories.
e201fe0135
...
743b65f917
3 changed files with 108 additions and 193 deletions
|
|
@ -2280,117 +2280,12 @@ export default function App() {
|
||||||
Добавить ролик
|
Добавить ролик
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
<section
|
|
||||||
className={`local-video-upload rounded-md border border-dashed p-3 transition-colors ${
|
|
||||||
localVideoDragActive ? "border-primary bg-primary/5" : "border-border bg-background"
|
|
||||||
}`}
|
|
||||||
onDragEnter={(event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
if (localVideoUpload?.status !== "uploading") setLocalVideoDragActive(true)
|
|
||||||
}}
|
|
||||||
onDragOver={(event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
event.dataTransfer.dropEffect = "copy"
|
|
||||||
if (localVideoUpload?.status !== "uploading") setLocalVideoDragActive(true)
|
|
||||||
}}
|
|
||||||
onDragLeave={(event) => {
|
|
||||||
if (event.currentTarget.contains(event.relatedTarget as Node)) return
|
|
||||||
setLocalVideoDragActive(false)
|
|
||||||
}}
|
|
||||||
onDrop={(event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
setLocalVideoDragActive(false)
|
|
||||||
if (localVideoUpload?.status === "uploading") return
|
|
||||||
selectLocalVideo(event.dataTransfer.files?.[0])
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
ref={localVideoInputRef}
|
|
||||||
className="hidden"
|
|
||||||
type="file"
|
|
||||||
accept="video/mp4,video/webm,video/quicktime,video/x-matroska,.mp4,.webm,.mov,.mkv"
|
|
||||||
onChange={(event) => {
|
|
||||||
const file = event.currentTarget.files?.[0]
|
|
||||||
event.currentTarget.value = ""
|
|
||||||
selectLocalVideo(file)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<div className="flex flex-wrap items-center gap-3">
|
|
||||||
<span className="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground">
|
|
||||||
<Upload className="size-4" />
|
|
||||||
</span>
|
|
||||||
<div className="min-w-0 flex-1">
|
|
||||||
<p className="text-sm font-semibold">Загрузить видео с компьютера</p>
|
|
||||||
<p className="mt-0.5 text-xs text-muted-foreground">MP4, WebM, MOV или MKV. Перетащите файл сюда или выберите его.</p>
|
|
||||||
</div>
|
|
||||||
<Button size="sm" variant="outline" disabled={localVideoUpload?.status === "uploading"} onClick={() => localVideoInputRef.current?.click()}>
|
|
||||||
<Upload data-icon="inline-start" />
|
|
||||||
Выбрать файл
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
{localVideoUpload ? (
|
|
||||||
<div className="mt-3 border-t pt-3" aria-live="polite">
|
|
||||||
<div className="flex items-start justify-between gap-3">
|
|
||||||
<div className="min-w-0">
|
|
||||||
<p className="truncate text-sm font-medium" title={localVideoUpload.name}>{localVideoUpload.name}</p>
|
|
||||||
<p className={`mt-0.5 text-xs ${localVideoUpload.status === "error" ? "text-destructive" : "text-muted-foreground"}`}>
|
|
||||||
{localVideoUpload.status === "uploading"
|
|
||||||
? `Загружено ${formatFileSize(localVideoUpload.loaded)} из ${formatFileSize(localVideoUpload.total)}`
|
|
||||||
: localVideoUpload.status === "complete"
|
|
||||||
? `Загружено ${formatFileSize(localVideoUpload.total)}. Файл готов к обработке.`
|
|
||||||
: localVideoUpload.status === "cancelled"
|
|
||||||
? "Загрузка отменена."
|
|
||||||
: localVideoUpload.errorMessage || "Не удалось загрузить файл."}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{localVideoUpload.status === "uploading" ? (
|
|
||||||
<Button size="icon" variant="outline" title="Отменить загрузку" aria-label="Отменить загрузку" onClick={cancelLocalVideoUpload}>
|
|
||||||
<X className="size-4" />
|
|
||||||
</Button>
|
|
||||||
) : (
|
|
||||||
<Button size="icon" variant="ghost" title="Скрыть статус" aria-label="Скрыть статус" onClick={() => setLocalVideoUpload(null)}>
|
|
||||||
<X className="size-4" />
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="mt-2 flex items-center gap-3">
|
|
||||||
<div className="h-1.5 flex-1 overflow-hidden rounded-full bg-muted">
|
|
||||||
<div
|
|
||||||
className={localVideoUpload.status === "error" ? "h-full rounded-full bg-destructive transition-all" : "h-full rounded-full bg-primary transition-all"}
|
|
||||||
style={{ width: `${localVideoUpload.status === "complete" ? 100 : localUploadPercent}%` }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<span className="w-10 text-right text-xs tabular-nums text-muted-foreground">
|
|
||||||
{localVideoUpload.status === "uploading" ? `${localUploadPercent}%` : localVideoUpload.status === "complete" ? "100%" : ""}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{activeView === "settings" ? (
|
{activeView === "settings" ? (
|
||||||
<SettingsPanel onBack={() => setActiveView("dashboard")} onSaved={handleSettingsSaved} />
|
<SettingsPanel onBack={() => setActiveView("dashboard")} onSaved={handleSettingsSaved} />
|
||||||
) : <>
|
) : <>
|
||||||
<section className={`video-storage-strip rounded-md border bg-background p-3 ${videoStorageLow ? "border-amber-300 bg-amber-50/60" : "border-border"}`} aria-live="polite">
|
|
||||||
<div className="flex items-center justify-between gap-2">
|
|
||||||
<p className="text-xs font-semibold uppercase tracking-wide text-muted-foreground">Видео на диске</p>
|
|
||||||
{videoStorage ? <span className="text-xs tabular-nums text-muted-foreground">{videoStoragePercent}%</span> : null}
|
|
||||||
</div>
|
|
||||||
{videoStorage ? (
|
|
||||||
<>
|
|
||||||
<div className="mt-3 h-1.5 overflow-hidden rounded-full bg-muted">
|
|
||||||
<div className={`h-full rounded-full transition-all ${videoStorageLow ? "bg-amber-500" : "bg-primary"}`} style={{ width: `${videoStoragePercent}%` }} />
|
|
||||||
</div>
|
|
||||||
<p className={`mt-2 text-xs leading-5 ${videoStorageLow ? "text-amber-800" : "text-muted-foreground"}`}>
|
|
||||||
Свободно {formatFileSize(videoStorage.freeBytes)} из {formatFileSize(videoStorage.totalBytes)}
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<p className="mt-3 text-xs leading-5 text-muted-foreground">Данные о диске недоступны.</p>
|
|
||||||
)}
|
|
||||||
</section>
|
|
||||||
<section className="workspace-grid grid gap-5 xl:grid-cols-2">
|
<section className="workspace-grid grid gap-5 xl:grid-cols-2">
|
||||||
<Card className="work-column min-w-0">
|
<Card className="work-column min-w-0">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
|
|
@ -2402,6 +2297,114 @@ export default function App() {
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="work-list flex max-h-[72vh] flex-col gap-2 overflow-y-auto">
|
<CardContent className="work-list flex max-h-[72vh] flex-col gap-2 overflow-y-auto">
|
||||||
|
<div className="grid gap-2 xl:grid-cols-[minmax(0,1fr)_13rem]">
|
||||||
|
<section
|
||||||
|
className={`local-video-upload rounded-md border border-dashed p-3 transition-colors ${
|
||||||
|
localVideoDragActive ? "border-primary bg-primary/5" : "border-border bg-background"
|
||||||
|
}`}
|
||||||
|
onDragEnter={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
if (localVideoUpload?.status !== "uploading") setLocalVideoDragActive(true)
|
||||||
|
}}
|
||||||
|
onDragOver={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.dataTransfer.dropEffect = "copy"
|
||||||
|
if (localVideoUpload?.status !== "uploading") setLocalVideoDragActive(true)
|
||||||
|
}}
|
||||||
|
onDragLeave={(event) => {
|
||||||
|
if (event.currentTarget.contains(event.relatedTarget as Node)) return
|
||||||
|
setLocalVideoDragActive(false)
|
||||||
|
}}
|
||||||
|
onDrop={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
setLocalVideoDragActive(false)
|
||||||
|
if (localVideoUpload?.status === "uploading") return
|
||||||
|
selectLocalVideo(event.dataTransfer.files?.[0])
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
ref={localVideoInputRef}
|
||||||
|
className="hidden"
|
||||||
|
type="file"
|
||||||
|
accept="video/mp4,video/webm,video/quicktime,video/x-matroska,.mp4,.webm,.mov,.mkv"
|
||||||
|
onChange={(event) => {
|
||||||
|
const file = event.currentTarget.files?.[0]
|
||||||
|
event.currentTarget.value = ""
|
||||||
|
selectLocalVideo(file)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div className="flex flex-wrap items-center gap-3">
|
||||||
|
<span className="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground">
|
||||||
|
<Upload className="size-4" />
|
||||||
|
</span>
|
||||||
|
<div className="min-w-0 flex-1">
|
||||||
|
<p className="text-sm font-semibold">Загрузить видео с компьютера</p>
|
||||||
|
<p className="mt-0.5 text-xs text-muted-foreground">MP4, WebM, MOV или MKV. Перетащите файл сюда или выберите его.</p>
|
||||||
|
</div>
|
||||||
|
<Button size="sm" variant="outline" disabled={localVideoUpload?.status === "uploading"} onClick={() => localVideoInputRef.current?.click()}>
|
||||||
|
<Upload data-icon="inline-start" />
|
||||||
|
Выбрать файл
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{localVideoUpload ? (
|
||||||
|
<div className="mt-3 border-t pt-3" aria-live="polite">
|
||||||
|
<div className="flex items-start justify-between gap-3">
|
||||||
|
<div className="min-w-0">
|
||||||
|
<p className="truncate text-sm font-medium" title={localVideoUpload.name}>{localVideoUpload.name}</p>
|
||||||
|
<p className={`mt-0.5 text-xs ${localVideoUpload.status === "error" ? "text-destructive" : "text-muted-foreground"}`}>
|
||||||
|
{localVideoUpload.status === "uploading"
|
||||||
|
? `Загружено ${formatFileSize(localVideoUpload.loaded)} из ${formatFileSize(localVideoUpload.total)}`
|
||||||
|
: localVideoUpload.status === "complete"
|
||||||
|
? `Загружено ${formatFileSize(localVideoUpload.total)}. Файл готов к обработке.`
|
||||||
|
: localVideoUpload.status === "cancelled"
|
||||||
|
? "Загрузка отменена."
|
||||||
|
: localVideoUpload.errorMessage || "Не удалось загрузить файл."}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{localVideoUpload.status === "uploading" ? (
|
||||||
|
<Button size="icon" variant="outline" title="Отменить загрузку" aria-label="Отменить загрузку" onClick={cancelLocalVideoUpload}>
|
||||||
|
<X className="size-4" />
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Button size="icon" variant="ghost" title="Скрыть статус" aria-label="Скрыть статус" onClick={() => setLocalVideoUpload(null)}>
|
||||||
|
<X className="size-4" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<div className="mt-2 flex items-center gap-3">
|
||||||
|
<div className="h-1.5 flex-1 overflow-hidden rounded-full bg-muted">
|
||||||
|
<div
|
||||||
|
className={localVideoUpload.status === "error" ? "h-full rounded-full bg-destructive transition-all" : "h-full rounded-full bg-primary transition-all"}
|
||||||
|
style={{ width: `${localVideoUpload.status === "complete" ? 100 : localUploadPercent}%` }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span className="w-10 text-right text-xs tabular-nums text-muted-foreground">
|
||||||
|
{localVideoUpload.status === "uploading" ? `${localUploadPercent}%` : localVideoUpload.status === "complete" ? "100%" : ""}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section className={`rounded-md border bg-background p-3 ${videoStorageLow ? "border-amber-300 bg-amber-50/60" : "border-border"}`} aria-live="polite">
|
||||||
|
<div className="flex items-center justify-between gap-2">
|
||||||
|
<p className="text-xs font-semibold uppercase tracking-wide text-muted-foreground">Видео на диске</p>
|
||||||
|
{videoStorage ? <span className="text-xs tabular-nums text-muted-foreground">{videoStoragePercent}%</span> : null}
|
||||||
|
</div>
|
||||||
|
{videoStorage ? (
|
||||||
|
<>
|
||||||
|
<div className="mt-3 h-1.5 overflow-hidden rounded-full bg-muted">
|
||||||
|
<div className={`h-full rounded-full transition-all ${videoStorageLow ? "bg-amber-500" : "bg-primary"}`} style={{ width: `${videoStoragePercent}%` }} />
|
||||||
|
</div>
|
||||||
|
<p className={`mt-2 text-xs leading-5 ${videoStorageLow ? "text-amber-800" : "text-muted-foreground"}`}>
|
||||||
|
Свободно {formatFileSize(videoStorage.freeBytes)} из {formatFileSize(videoStorage.totalBytes)}
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<p className="mt-3 text-xs leading-5 text-muted-foreground">Данные о диске недоступны.</p>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
{productionVideos.length > 0 ? (
|
{productionVideos.length > 0 ? (
|
||||||
productionVideos.map((video) => {
|
productionVideos.map((video) => {
|
||||||
const draftArticles = video.articles?.filter((article) => article.status !== "published") ?? []
|
const draftArticles = video.articles?.filter((article) => article.status !== "published") ?? []
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
# Dashboard Video Upload Layout Implementation Plan
|
|
||||||
|
|
||||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
||||||
|
|
||||||
**Goal:** Place local-file upload next to URL import and place disk capacity across the dashboard above the work columns.
|
|
||||||
|
|
||||||
**Architecture:** Move existing JSX sections without changing their state, handlers or API calls. The existing `.command-row` owns the two methods of adding a video; a new full-width storage section sits directly before `workspace-grid`.
|
|
||||||
|
|
||||||
**Tech Stack:** React 19, TypeScript, Tailwind CSS, Vite.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Task 1: Recompose the dashboard regions
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Modify: `admin/src/App.tsx:2267-2406`
|
|
||||||
|
|
||||||
- [ ] **Step 1: Capture the existing placement**
|
|
||||||
|
|
||||||
At desktop width, confirm that URL import is above the workspace while local upload and disk capacity are nested in the scrollable «Ролики» card.
|
|
||||||
|
|
||||||
- [ ] **Step 2: Move the existing local upload section to `command-row`**
|
|
||||||
|
|
||||||
Move the complete `<section className="local-video-upload …">` with its hidden input, refs, drag events, upload state and progress UI to be the second child of `.command-row`, immediately after the URL import `<form>`. Do not change `uploadLocalVideo`, `selectLocalVideo`, `cancelLocalVideoUpload`, or their state.
|
|
||||||
|
|
||||||
- [ ] **Step 3: Make disk capacity a full-width dashboard region**
|
|
||||||
|
|
||||||
Move the existing `Видео на диске` `<section>` out of `CardContent.work-list` and render it immediately after `.command-row` and before `<section className="workspace-grid …">`. Preserve `videoStorage`, `videoStorageLow`, the progress percentage, aria-live and all warning styles.
|
|
||||||
|
|
||||||
- [ ] **Step 4: Remove the obsolete nested two-column wrapper**
|
|
||||||
|
|
||||||
Delete the inner `grid gap-2 xl:grid-cols-[minmax(0,1fr)_13rem]` that previously coupled local upload and storage inside the video list. Keep video cards as direct list children so scrolling only affects the list.
|
|
||||||
|
|
||||||
- [ ] **Step 5: Build and check responsive order**
|
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run build --prefix admin
|
|
||||||
```
|
|
||||||
|
|
||||||
Expected: TypeScript and Vite build successfully. Inspect 390 px and desktop: mobile order is URL, local file, disk capacity, videos, drafts; at `lg` width URL and local file are side by side; capacity spans the workspace width.
|
|
||||||
|
|
||||||
- [ ] **Step 6: Run detector and commit**
|
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
node /Users/dima/.agents/skills/impeccable/scripts/detect.mjs --json --scope layout admin/src/App.tsx
|
|
||||||
git diff --check
|
|
||||||
```
|
|
||||||
|
|
||||||
Expected: detector findings are `[]` and diff check has no output.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git add admin/src/App.tsx
|
|
||||||
git commit -m "fix: reorganize video upload dashboard"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Plan review
|
|
||||||
|
|
||||||
- The plan covers exact requested placement and keeps all data/API behavior unchanged.
|
|
||||||
- It does not add components, CSS, routes, state or dependencies because the current `lg:grid-cols-2` command row already provides the intended responsive behavior.
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
# Раскладка загрузки видео на панели
|
|
||||||
|
|
||||||
## Цель
|
|
||||||
|
|
||||||
Сделать два способа добавления ролика одной понятной группой: ссылка слева, локальный файл справа. Показатель места на диске должен быть общим ресурсом и занимать всю ширину перед рабочими колонками.
|
|
||||||
|
|
||||||
## Структура
|
|
||||||
|
|
||||||
1. В верхней строке панели находятся две равные области: существующая форма «Добавить ролик» по ссылке и существующая область «Загрузить видео с компьютера».
|
|
||||||
2. Ниже размещается существующая полоса «Видео на диске» на всю доступную ширину.
|
|
||||||
3. Затем остаются существующие колонки «Ролики» и «Черновики».
|
|
||||||
4. На экранах уже, чем `lg`, порядок в DOM и на экране линейный: ссылка, локальный файл, место на диске, ролики, черновики.
|
|
||||||
|
|
||||||
## Сохранение поведения
|
|
||||||
|
|
||||||
- Не меняются маршруты, состояние загрузки, drag-and-drop, отмена, прогресс, предупреждение о малом свободном месте и обновление индикатора после загрузки.
|
|
||||||
- Не меняется импорт ролика по URL и рабочие карточки роликов/черновиков.
|
|
||||||
- Локальная зона загрузки сохраняет доступный file input и кнопку выбора файла.
|
|
||||||
|
|
||||||
## Проверка
|
|
||||||
|
|
||||||
1. На desktop оба способа загрузки видны рядом, а индикатор диска расположен под ними и над колонками.
|
|
||||||
2. На 320, 375, 390 и 430 px блоки становятся одной вертикальной последовательностью без горизонтальной прокрутки.
|
|
||||||
3. Выбор файла, перетаскивание, отмена и отображение прогресса продолжают работать; после успешной загрузки обновляется место на диске.
|
|
||||||
4. Импорт ссылки сохраняет прежний сценарий и состояние кнопки.
|
|
||||||
Loading…
Reference in a new issue