import React from 'react'; import {Container} from "semantic-ui-react"; import {getStatus, saveSettings} from "../../api"; import {PageContainer, TabLinks, Toggle} from "../Common"; import {Route, Routes} from "react-router-dom"; import {ThemeContext} from "../../contexts/contexts"; import {Header, Loader, Segment} from "../Theme"; import {DownloadsPage} from "./Downloads"; import {Settings} from "./Settings"; import {Status} from "./Status"; class WROLMode extends React.Component { constructor(props) { super(props); this.state = { WROLMode: false, } } async componentDidMount() { try { const {wrol_mode} = await getStatus(); this.setState({ready: true, WROLMode: wrol_mode}); } catch (e) { console.error(e); } } toggleWROLMode = async (checked) => { // Handle WROL Mode toggling by itself so that other settings are not modified. let config = { wrol_mode: checked, } await saveSettings(config); this.setState({disabled: !this.state.WROLMode, WROLMode: checked}); } render() { if (this.state.ready === false) { return } return {({t}) =>
WROL Mode
Enable read-only mode. No content can be deleted or modified. Enable this when the SHTF and you want to prevent any potential loss of data.

Note: User settings and tags can still be modified.

}
} } export default function AdminRoute() { const links = [ {text: 'Downloads', to: '/admin', key: 'admin', end: true}, {text: 'Settings', to: '/admin/settings', key: 'settings'}, {text: 'Status', to: '/admin/status', key: 'status'}, {text: 'WROL Mode', to: '/admin/wrol', key: 'wrol'}, ]; return }/> }/> }/> }/> }