import axios from "axios";
import React from "react";
import ReactDOM from "react-dom";
import { config } from "../config";
import { addLocalFiles, list } from "../libs/api_share";
import { login, logout } from "../libs/api_auth";
import { FilePane } from "../components/composite/file_pane";
import { InfoBar } from "../components/composite/info_bar";
import { Log } from "../components/composite/log";
function getWidth() {
if (window.innerWidth >= window.innerHeight) {
return `${Math.floor(
(window.innerWidth * 0.95) / config.rootSize / config.colWidth
) * config.colWidth}rem`;
}
return "auto";
}
const styleLogContainer = {
paddingTop: "1rem",
textAlign: "center",
height: "2rem",
overflowX: "hidden" // TODO: should no hidden
};
const styleLogContent = {
color: "#333",
fontSize: "0.875rem",
opacity: 0.6,
backgroundColor: "#fff",
borderRadius: "1rem",
whiteSpace: "nowrap"
};
class AdminPanel extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
isLogin: false,
filterName: "",
serverAddr: `${window.location.protocol}//${window.location.hostname}:${
window.location.port
}`,
width: getWidth()
};
this.log = {
ok: msg => console.log(msg),
warning: msg => console.log(msg),
info: msg => console.log(msg),
error: msg => console.log(msg),
start: msg => console.log(msg),
end: msg => console.log(msg)
};
this.logComponent =