From 268e912c127c7f796b7ab2e5e3dfedb1726fcda2 Mon Sep 17 00:00:00 2001 From: Endrit Date: Wed, 16 Mar 2022 21:39:58 +0100 Subject: [PATCH] disable camera publish option --- public/ui-config.json.example | 1 + .../camera/views/checkout/CameraWidgetCheckoutView.tsx | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/public/ui-config.json.example b/public/ui-config.json.example index 3410db79..61210521 100644 --- a/public/ui-config.json.example +++ b/public/ui-config.json.example @@ -11,6 +11,7 @@ "widget.dimmer.colorwheel": false, "avatar.wardrobe.max.slots": 10, "user.badges.max.slots": 5, + "camera.publish.disabled": false, "hc.disabled": false, "hotelview": { "widgets": { diff --git a/src/components/camera/views/checkout/CameraWidgetCheckoutView.tsx b/src/components/camera/views/checkout/CameraWidgetCheckoutView.tsx index bbde7e98..fd460c9c 100644 --- a/src/components/camera/views/checkout/CameraWidgetCheckoutView.tsx +++ b/src/components/camera/views/checkout/CameraWidgetCheckoutView.tsx @@ -1,5 +1,5 @@ import { CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraStorageUrlMessageEvent, PublishPhotoMessageComposer, PurchasePhotoMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useEffect, useState } from 'react'; +import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { GetConfiguration, GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api'; import { Button, Column, Flex, LayoutCurrencyIcon, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { InventoryEvent } from '../../../../events'; @@ -23,6 +23,8 @@ export const CameraWidgetCheckoutView: FC = props const [ isWaiting, setIsWaiting ] = useState(false); const [ publishCooldown, setPublishCooldown ] = useState(0); + const publishDisabled = useMemo(() => GetConfiguration('camera.publish.disabled', false), []); + const onCameraPurchaseOKMessageEvent = useCallback((event: CameraPurchaseOKMessageEvent) => { BatchUpdates(() => @@ -105,7 +107,7 @@ export const CameraWidgetCheckoutView: FC = props } - + { LocalizeText('camera.purchase.header') } @@ -133,6 +135,7 @@ export const CameraWidgetCheckoutView: FC = props + { !publishDisabled && @@ -158,7 +161,7 @@ export const CameraWidgetCheckoutView: FC = props { LocalizeText('camera.publish.button.text') } } - + } { LocalizeText('camera.warning.disclaimer') }