Merge branch 'dev' into 'dev'

disable camera publish option

See merge request nitro/nitro-react!11
This commit is contained in:
Bill 2022-03-16 22:36:44 +00:00
commit 9a90abe1fc
2 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@
"widget.dimmer.colorwheel": false, "widget.dimmer.colorwheel": false,
"avatar.wardrobe.max.slots": 10, "avatar.wardrobe.max.slots": 10,
"user.badges.max.slots": 5, "user.badges.max.slots": 5,
"camera.publish.disabled": false,
"hc.disabled": false, "hc.disabled": false,
"hotelview": { "hotelview": {
"widgets": { "widgets": {

View File

@ -1,5 +1,5 @@
import { CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraStorageUrlMessageEvent, PublishPhotoMessageComposer, PurchasePhotoMessageComposer } from '@nitrots/nitro-renderer'; 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 { GetConfiguration, GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, LayoutCurrencyIcon, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common'; import { Button, Column, Flex, LayoutCurrencyIcon, LayoutImage, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
import { InventoryEvent } from '../../../../events'; import { InventoryEvent } from '../../../../events';
@ -23,6 +23,8 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
const [ isWaiting, setIsWaiting ] = useState(false); const [ isWaiting, setIsWaiting ] = useState(false);
const [ publishCooldown, setPublishCooldown ] = useState(0); const [ publishCooldown, setPublishCooldown ] = useState(0);
const publishDisabled = useMemo(() => GetConfiguration<boolean>('camera.publish.disabled', false), []);
const onCameraPurchaseOKMessageEvent = useCallback((event: CameraPurchaseOKMessageEvent) => const onCameraPurchaseOKMessageEvent = useCallback((event: CameraPurchaseOKMessageEvent) =>
{ {
BatchUpdates(() => BatchUpdates(() =>
@ -105,7 +107,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
</Flex> } </Flex> }
</Flex> </Flex>
<Flex justifyContent="between" alignItems="center" className="bg-muted rounded p-2"> <Flex justifyContent="between" alignItems="center" className="bg-muted rounded p-2">
<Column gap={ 1 }> <Column size={ publishDisabled ? 10 : 6 } gap={ 1 }>
<Text bold> <Text bold>
{ LocalizeText('camera.purchase.header') } { LocalizeText('camera.purchase.header') }
</Text> </Text>
@ -133,6 +135,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
<Button variant="success" disabled={ isWaiting } onClick={ event => processAction('buy') }>{ LocalizeText(!picturesBought ? 'buy' : 'camera.buy.another.button.text') }</Button> <Button variant="success" disabled={ isWaiting } onClick={ event => processAction('buy') }>{ LocalizeText(!picturesBought ? 'buy' : 'camera.buy.another.button.text') }</Button>
</Flex> </Flex>
</Flex> </Flex>
{ !publishDisabled &&
<Flex justifyContent="between" alignItems="center" className="bg-muted rounded p-2"> <Flex justifyContent="between" alignItems="center" className="bg-muted rounded p-2">
<Column gap={ 1 }> <Column gap={ 1 }>
<Text bold> <Text bold>
@ -158,7 +161,7 @@ export const CameraWidgetCheckoutView: FC<CameraWidgetCheckoutViewProps> = props
{ LocalizeText('camera.publish.button.text') } { LocalizeText('camera.publish.button.text') }
</Button> </Button>
</Flex> } </Flex> }
</Flex> </Flex> }
<Text center>{ LocalizeText('camera.warning.disclaimer') }</Text> <Text center>{ LocalizeText('camera.warning.disclaimer') }</Text>
<Flex justifyContent="end"> <Flex justifyContent="end">
<Button onClick={ event => processAction('cancel') }>{ LocalizeText('generic.cancel') }</Button> <Button onClick={ event => processAction('cancel') }>{ LocalizeText('generic.cancel') }</Button>