diff --git a/public/settings.json b/public/settings.json index 2aa2f605..fe8cd3d6 100644 --- a/public/settings.json +++ b/public/settings.json @@ -13,5 +13,9 @@ "apiUrl": "https://hermes.api.dev.k8s.nerds.sh/graphql", "sources": [ "k9Ljm6DdzCI" - ] + ], + "features": { + "login": false, + "livestream": false + } } diff --git a/src/cameras/content.jsx b/src/cameras/content.jsx index ec82e614..fb59237e 100644 --- a/src/cameras/content.jsx +++ b/src/cameras/content.jsx @@ -1,17 +1,16 @@ import React from 'react' -import YouTube from 'react-youtube' -import * as Material from '@material-ui/core' +import { Box, Grid } from '@material-ui/core' import { Map } from 'cameras/map' -import { settings } from 'settings' -import { useStyles } from 'cameras/style' +import { Livestream } from 'cameras/livestream' +import { useLivestreamPadding } from 'cameras/hooks/use-livestream-padding' -export const Content = () => - +export const Content = () => + - - - - - + + + + + diff --git a/src/cameras/hooks/use-livestream-padding.js b/src/cameras/hooks/use-livestream-padding.js new file mode 100644 index 00000000..d1b20a60 --- /dev/null +++ b/src/cameras/hooks/use-livestream-padding.js @@ -0,0 +1,7 @@ +import { useSettings } from 'settings/hooks/use-settings' + +export const useLivestreamPadding = () => { + const appear = useSettings().features.livestream + + return appear ? { style: { paddingBottom: '2%' } } : { style: { paddingBottom: '3.8%' } } +} diff --git a/src/cameras/index.jsx b/src/cameras/index.jsx index 41458a38..23859a8f 100644 --- a/src/cameras/index.jsx +++ b/src/cameras/index.jsx @@ -1,14 +1,14 @@ import React from 'react' -import * as Material from '@material-ui/core' +import { Grid } from '@material-ui/core' import { Content } from 'cameras/content' import { useDefaultContext, Context } from 'cameras/context' import { Sidebar } from 'cameras/sidebar' export const Cameras = () => - + - + diff --git a/src/cameras/livestream/hooks/use-livestream-props.js b/src/cameras/livestream/hooks/use-livestream-props.js new file mode 100644 index 00000000..b4e2f1c5 --- /dev/null +++ b/src/cameras/livestream/hooks/use-livestream-props.js @@ -0,0 +1,7 @@ +import { useStyles } from 'cameras/style' +import { useSettings } from 'settings/hooks/use-settings' + +export const useLivestreamProps = () => ({ + classes: useStyles(), + hidden: !useSettings().features.livestream, +}) diff --git a/src/cameras/livestream/index.jsx b/src/cameras/livestream/index.jsx new file mode 100644 index 00000000..28717e15 --- /dev/null +++ b/src/cameras/livestream/index.jsx @@ -0,0 +1,10 @@ +import React from 'react' +import { Grid } from '@material-ui/core' +import YouTube from 'react-youtube' + +import { settings } from 'settings' +import { useLivestreamProps } from 'cameras/livestream/hooks/use-livestream-props' + +export const Livestream = () => + + diff --git a/src/cameras/sidebar/index.jsx b/src/cameras/sidebar/index.jsx index c63647f5..5da5f0ae 100644 --- a/src/cameras/sidebar/index.jsx +++ b/src/cameras/sidebar/index.jsx @@ -1,10 +1,10 @@ import React from 'react' -import * as Material from '@material-ui/core' +import { Grid } from '@material-ui/core' import { Header } from 'cameras/sidebar/header' import { Ids } from 'cameras/sidebar/ids' -export const Sidebar = () => +export const Sidebar = () =>
- + diff --git a/src/login/hooks/use-menu-props.js b/src/login/hooks/use-menu-props.js new file mode 100644 index 00000000..85268174 --- /dev/null +++ b/src/login/hooks/use-menu-props.js @@ -0,0 +1,6 @@ +import { useSettings } from 'settings/hooks/use-settings' + +export const useMenuProps = () => ({ + px: 3, + hidden: !useSettings().features.login, +}) diff --git a/src/login/menu.jsx b/src/login/menu.jsx index 384b8c4f..5517e1a2 100644 --- a/src/login/menu.jsx +++ b/src/login/menu.jsx @@ -3,11 +3,12 @@ import { Box } from '@material-ui/core' import { useContext } from 'login/context' import { Button } from 'login/login-button' +import { useMenuProps } from 'login/hooks/use-menu-props' export const Menu = () => { const { user } = useContext() - return + return