Creating WROLModeMessage to warn users why functionality is disabled.

This commit is contained in:
Roland 2022-01-12 09:38:21 -07:00
parent 491db17fac
commit ae9737e52b
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
4 changed files with 42 additions and 4 deletions

View file

@ -1,8 +1,10 @@
import React, {useState} from "react";
import React, {useEffect, useState} from "react";
import {Card, Container, Form, Icon, Image, Input, Pagination, Progress} from 'semantic-ui-react';
import {Link} from "react-router-dom";
import Button from "semantic-ui-react/dist/commonjs/elements/Button";
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
import {getConfig} from "../api";
export const API_URI = `http://${window.location.host}/api`;
export const VIDEOS_API = `${API_URI}/videos`;
@ -583,3 +585,26 @@ export function MoreButton(props) {
</Grid>
)
}
export const useWROLMode = () => {
const [enabled, setEnabled] = useState(false);
const fetchStatus = async () => {
let config = await getConfig();
setEnabled(config['wrol_mode']);
}
useEffect(() => {
fetchStatus();
}, []);
return enabled;
}
export function WROLModeMessage({content}) {
let enabled = useWROLMode();
if (enabled) {
return <Message icon='lock' header='WROL Mode Enabled' content={content}/>
}
return null;
}