From e201fe0135cd18e2bcff238ce18d05b47b2c0a1d Mon Sep 17 00:00:00 2001 From: nstarikov Date: Sat, 15 Aug 2026 14:08:35 +0300 Subject: [PATCH] fix: reorganize video upload dashboard --- dzen-assistant/admin/src/App.tsx | 213 +++++++++++++++---------------- 1 file changed, 105 insertions(+), 108 deletions(-) diff --git a/dzen-assistant/admin/src/App.tsx b/dzen-assistant/admin/src/App.tsx index 1de4e79..d334733 100644 --- a/dzen-assistant/admin/src/App.tsx +++ b/dzen-assistant/admin/src/App.tsx @@ -2280,12 +2280,117 @@ export default function App() { Добавить ролик +
{ + 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]) + }} + > + { + const file = event.currentTarget.files?.[0] + event.currentTarget.value = "" + selectLocalVideo(file) + }} + /> +
+ + + +
+

Загрузить видео с компьютера

+

MP4, WebM, MOV или MKV. Перетащите файл сюда или выберите его.

+
+ +
+ {localVideoUpload ? ( +
+
+
+

{localVideoUpload.name}

+

+ {localVideoUpload.status === "uploading" + ? `Загружено ${formatFileSize(localVideoUpload.loaded)} из ${formatFileSize(localVideoUpload.total)}` + : localVideoUpload.status === "complete" + ? `Загружено ${formatFileSize(localVideoUpload.total)}. Файл готов к обработке.` + : localVideoUpload.status === "cancelled" + ? "Загрузка отменена." + : localVideoUpload.errorMessage || "Не удалось загрузить файл."} +

+
+ {localVideoUpload.status === "uploading" ? ( + + ) : ( + + )} +
+
+
+
+
+ + {localVideoUpload.status === "uploading" ? `${localUploadPercent}%` : localVideoUpload.status === "complete" ? "100%" : ""} + +
+
+ ) : null} +
) : null} {activeView === "settings" ? ( setActiveView("dashboard")} onSaved={handleSettingsSaved} /> ) : <> +
+
+

Видео на диске

+ {videoStorage ? {videoStoragePercent}% : null} +
+ {videoStorage ? ( + <> +
+
+
+

+ Свободно {formatFileSize(videoStorage.freeBytes)} из {formatFileSize(videoStorage.totalBytes)} +

+ + ) : ( +

Данные о диске недоступны.

+ )} +
@@ -2297,114 +2402,6 @@ export default function App() { -
-
{ - 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]) - }} - > - { - const file = event.currentTarget.files?.[0] - event.currentTarget.value = "" - selectLocalVideo(file) - }} - /> -
- - - -
-

Загрузить видео с компьютера

-

MP4, WebM, MOV или MKV. Перетащите файл сюда или выберите его.

-
- -
- {localVideoUpload ? ( -
-
-
-

{localVideoUpload.name}

-

- {localVideoUpload.status === "uploading" - ? `Загружено ${formatFileSize(localVideoUpload.loaded)} из ${formatFileSize(localVideoUpload.total)}` - : localVideoUpload.status === "complete" - ? `Загружено ${formatFileSize(localVideoUpload.total)}. Файл готов к обработке.` - : localVideoUpload.status === "cancelled" - ? "Загрузка отменена." - : localVideoUpload.errorMessage || "Не удалось загрузить файл."} -

-
- {localVideoUpload.status === "uploading" ? ( - - ) : ( - - )} -
-
-
-
-
- - {localVideoUpload.status === "uploading" ? `${localUploadPercent}%` : localVideoUpload.status === "complete" ? "100%" : ""} - -
-
- ) : null} -
- -
-
-

Видео на диске

- {videoStorage ? {videoStoragePercent}% : null} -
- {videoStorage ? ( - <> -
-
-
-

- Свободно {formatFileSize(videoStorage.freeBytes)} из {formatFileSize(videoStorage.totalBytes)} -

- - ) : ( -

Данные о диске недоступны.

- )} -
-
{productionVideos.length > 0 ? ( productionVideos.map((video) => { const draftArticles = video.articles?.filter((article) => article.status !== "published") ?? []