From 06cf7050a995a646cd2211416ce2509be0f9dd6c Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Wed, 26 Feb 2025 16:48:54 +0700 Subject: [PATCH] play video in embed instead of new window on desktops --- package.json | 1 + .../components/CommentVideoFrame/index.tsx | 28 +++++++++ .../CommentVideoFrame/styles.module.scss | 8 +++ .../components/CommentEmbedBlock/index.tsx | 57 +++++++++++++---- .../CommentEmbedBlock/styles.module.scss | 49 ++++++++++++++- src/containers/node/NodeComments/index.tsx | 61 ++++++++++--------- src/utils/providers/VideoPlayerProvider.tsx | 17 ++++++ yarn.lock | 7 +++ 8 files changed, 184 insertions(+), 44 deletions(-) create mode 100644 src/containers/node/NodeComments/components/Comment/components/CommentContent/components/CommentEmbedBlock/components/CommentVideoFrame/index.tsx create mode 100644 src/containers/node/NodeComments/components/Comment/components/CommentContent/components/CommentEmbedBlock/components/CommentVideoFrame/styles.module.scss create mode 100644 src/utils/providers/VideoPlayerProvider.tsx diff --git a/package.json b/package.json index ca720cff..43e726e8 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "react-lazyload": "^3.2.0", "react-masonry-css": "^1.0.16", "react-popper": "^2.2.3", + "react-resize-detector": "^12.0.2", "react-router": "^5.1.2", "react-router-dom": "^5.1.2", "react-sticky-box": "^1.0.2", diff --git a/src/containers/node/NodeComments/components/Comment/components/CommentContent/components/CommentEmbedBlock/components/CommentVideoFrame/index.tsx b/src/containers/node/NodeComments/components/Comment/components/CommentContent/components/CommentEmbedBlock/components/CommentVideoFrame/index.tsx new file mode 100644 index 00000000..686e6dd1 --- /dev/null +++ b/src/containers/node/NodeComments/components/Comment/components/CommentContent/components/CommentEmbedBlock/components/CommentVideoFrame/index.tsx @@ -0,0 +1,28 @@ +import classNames from 'classnames'; +import { useResizeDetector } from 'react-resize-detector'; + +import styles from './styles.module.scss'; + +interface Props { + id: string; + title: string; + className?: string; +} + +export const CommentVideoFrame = ({ id, title, className }: Props) => { + const { ref, width = 0, height = 0 } = useResizeDetector(); + + return ( +
+