From edb13ae716c1801c8f842ae64cf95c8c9ad8d69f Mon Sep 17 00:00:00 2001 From: ajnart Date: Fri, 10 Feb 2023 13:20:38 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20=20WIP=20on=20dynamic=20imports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/modules/video-stream.json | 4 ++-- src/widgets/video/VideoStreamTile.tsx | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/public/locales/en/modules/video-stream.json b/public/locales/en/modules/video-stream.json index 3b84c3574..a35c740a3 100644 --- a/public/locales/en/modules/video-stream.json +++ b/public/locales/en/modules/video-stream.json @@ -4,8 +4,8 @@ "description": "Embed a video stream or video from a camera or a website", "settings": { "title": "Settings for video stream widget", - "cameraFeedUrl": { - "label": "Camera feed url" + "FeedUrl": { + "label": "Feed url" }, "autoPlay": { "label": "Auto play" diff --git a/src/widgets/video/VideoStreamTile.tsx b/src/widgets/video/VideoStreamTile.tsx index 028809f99..7db8a2c80 100644 --- a/src/widgets/video/VideoStreamTile.tsx +++ b/src/widgets/video/VideoStreamTile.tsx @@ -1,15 +1,17 @@ import { Center, Group, Stack, Title } from '@mantine/core'; import { IconDeviceCctv, IconHeartBroken } from '@tabler/icons'; import { useTranslation } from 'next-i18next'; +import dynamic from 'next/dynamic'; import { defineWidget } from '../helper'; import { IWidget } from '../widgets'; -import VideoFeed from './VideoFeed'; + +const VideoFeed = dynamic(() => import('./VideoFeed'), { ssr: false }); const definition = defineWidget({ id: 'video-stream', icon: IconDeviceCctv, options: { - cameraFeedUrl: { + FeedUrl: { type: 'text', defaultValue: '', }, @@ -43,7 +45,7 @@ interface VideoStreamWidgetProps { function VideoStreamWidget({ widget }: VideoStreamWidgetProps) { const { t } = useTranslation('modules/video-stream'); - if (!widget.properties.cameraFeedUrl) { + if (!widget.properties.FeedUrl) { return (
@@ -56,7 +58,7 @@ function VideoStreamWidget({ widget }: VideoStreamWidgetProps) { return (