From be53a5dce8452167ac17fa15e2e295a513a59694 Mon Sep 17 00:00:00 2001
From: Ilya Y <75578537+ilya-bkv@users.noreply.github.com>
Date: Sat, 10 Jun 2023 17:10:05 +0300
Subject: [PATCH] Feature/video upload (#107)
* Add Video Player and Video Uploader
* Remove old video component
---
public/locales/en/translation.json | 8 +-
public/locales/ru/translation.json | 8 +-
src/components/Article/FullArticle.tsx | 23 +--
.../Article/VideoPlayer.module.scss | 12 --
src/components/Article/VideoPlayer.tsx | 25 ----
.../BubbleMenu/BlockquoteBubbleMenu.tsx | 6 +-
.../Editor/BubbleMenu/FigureBubbleMenu.tsx | 10 +-
.../Editor/BubbleMenu/IncutBubbleMenu.tsx | 12 +-
src/components/Editor/Editor.tsx | 1 -
.../VideoUploader/VideoUploader.module.scss | 89 ++++++++++++
.../Editor/VideoUploader/VideoUploader.tsx | 133 ++++++++++++++++++
src/components/Editor/VideoUploader/index.ts | 1 +
src/components/Views/Edit.module.scss | 1 +
src/components/Views/Edit.tsx | 48 ++++++-
.../VideoPlayer/VideoPlayer.module.scss | 39 +++++
.../_shared/VideoPlayer/VideoPlayer.tsx | 79 +++++++++++
src/components/_shared/VideoPlayer/index.ts | 1 +
src/context/editor.tsx | 11 +-
src/graphql/query/drafts-load.ts | 1 +
src/graphql/types.gen.ts | 2 +
src/pages/create.page.tsx | 16 ++-
src/pages/edit.page.tsx | 10 +-
src/styles/Create.module.scss | 2 +-
src/utils/apiClient.ts | 2 +-
24 files changed, 450 insertions(+), 90 deletions(-)
delete mode 100644 src/components/Article/VideoPlayer.module.scss
delete mode 100644 src/components/Article/VideoPlayer.tsx
create mode 100644 src/components/Editor/VideoUploader/VideoUploader.module.scss
create mode 100644 src/components/Editor/VideoUploader/VideoUploader.tsx
create mode 100644 src/components/Editor/VideoUploader/index.ts
create mode 100644 src/components/_shared/VideoPlayer/VideoPlayer.module.scss
create mode 100644 src/components/_shared/VideoPlayer/VideoPlayer.tsx
create mode 100644 src/components/_shared/VideoPlayer/index.ts
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index e22e6509..fa02a723 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -132,6 +132,7 @@
"Just start typing...": "Just start typing...",
"Knowledge base": "Knowledge base",
"Last rev.": "Посл. изм.",
+ "Let's log in": "Let's log in",
"Link sent, check your email": "Link sent, check your email",
"Lists": "Lists",
"Literature": "Literature",
@@ -231,6 +232,7 @@
"Thank you": "Thank you",
"This comment has not yet been rated": "This comment has not yet been rated",
"This email is already taken. If it's you": "This email is already taken. If it's you",
+ "This functionality is currently not available, we would like to work on this issue. Use the download link.": "This functionality is currently not available, we would like to work on this issue. Use the download link.",
"This post has not been rated yet": "This post has not been rated yet",
"To leave a comment please": "To leave a comment please",
"To write a comment, you must": "To write a comment, you must",
@@ -250,9 +252,11 @@
"Unfollow the topic": "Unfollow the topic",
"Unnamed draft": "Unnamed draft",
"Upload": "Upload",
+ "Upload video": "Upload video",
"Username": "Username",
"Userpic": "Userpic",
"Video": "Video",
+ "Video format not supported": "Video format not supported",
"Views": "Views",
"We are convinced that one voice is good, but many is better": "We are convinced that one voice is good, but many is better",
"We can't find you, check email or": "We can't find you, check email or",
@@ -321,5 +325,7 @@
"user already exist": "user already exists",
"video": "video",
"view": "view",
- "zine": "zine"
+ "zine": "zine",
+ "Insert video link": "Insert video link",
+ "Looks like you forgot to upload the video": "Looks like you forgot to upload the video"
}
diff --git a/public/locales/ru/translation.json b/public/locales/ru/translation.json
index 0ca4310f..e045f9b2 100644
--- a/public/locales/ru/translation.json
+++ b/public/locales/ru/translation.json
@@ -139,6 +139,7 @@
"Karma": "Карма",
"Knowledge base": "База знаний",
"Last rev.": "Посл. изм.",
+ "Let's log in": "Давайте авторизуемся",
"Link sent, check your email": "Ссылка отправлена, проверьте почту",
"Lists": "Списки",
"Literature": "Литература",
@@ -244,6 +245,7 @@
"Thank you": "Благодарности",
"This comment has not yet been rated": "Этот комментарий еще пока никто не оценил",
"This email is already taken. If it's you": "Такой email уже зарегистрирован. Если это вы",
+ "This functionality is currently not available, we would like to work on this issue. Use the download link.": "В данный момент этот функционал не доступен, бы работаем над этой проблемой. Воспользуйтесь загрузкой по ссылке.",
"This post has not been rated yet": "Эту публикацию еще пока никто не оценил",
"To leave a comment please": "Чтобы оставить комментарий, необходимо",
"To write a comment, you must": "Чтобы написать комментарий, необходимо",
@@ -263,9 +265,11 @@
"Unfollow the topic": "Отписаться от темы",
"Unnamed draft": "Unnamed draft",
"Upload": "Загрузить",
+ "Upload video": "Загрузить видео",
"Username": "Имя пользователя",
"Userpic": "Аватар",
"Video": "Видео",
+ "Video format not supported": "Тип видео не поддерживается",
"Views": "Просмотры",
"We are convinced that one voice is good, but many is better": "Мы убеждены, один голос хорошо, а много — лучше",
"We can't find you, check email or": "Не можем вас найти, проверьте адрес электронной почты или",
@@ -343,5 +347,7 @@
"user already exist": "пользователь уже существует",
"video": "видео",
"view": "просмотр",
- "zine": "журнал"
+ "zine": "журнал",
+ "Insert video link": "Вставить ссылку на видео",
+ "Looks like you forgot to upload the video": "Похоже, что вы забыли загрузить видео"
}
diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx
index ad14135a..9638124b 100644
--- a/src/components/Article/FullArticle.tsx
+++ b/src/components/Article/FullArticle.tsx
@@ -10,7 +10,7 @@ import { ShoutRatingControl } from './ShoutRatingControl'
import { clsx } from 'clsx'
import { CommentsTree } from './CommentsTree'
import { useSession } from '../../context/session'
-import VideoPlayer from './VideoPlayer'
+import { VideoPlayer } from '../_shared/VideoPlayer'
import Slider from '../_shared/Slider'
import { getPagePath } from '@nanostores/router'
import { router, useRouter } from '../../stores/router'
@@ -29,7 +29,6 @@ interface ArticleProps {
interface MediaItem {
url?: string
- pic?: string
title?: string
body?: string
}
@@ -40,17 +39,12 @@ const MediaView = (props: { media: MediaItem; kind: Shout['layout'] }) => {
return (
<>
{t('Cannot show this media type')}}>
-
-