mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 04:16:24 -05:00
Creating WROLModeMessage to warn users why functionality is disabled.
This commit is contained in:
parent
491db17fac
commit
ae9737e52b
4 changed files with 42 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue