removed notification + new react structure
This commit is contained in:
15
react/admin-panel/config-overrides.js
Normal file
15
react/admin-panel/config-overrides.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const {
|
||||
override,
|
||||
removeModuleScopePlugin,
|
||||
babelInclude,
|
||||
} = require('customize-cra');
|
||||
|
||||
module.exports = override(
|
||||
removeModuleScopePlugin(),
|
||||
babelInclude([
|
||||
path.resolve(path.join(__dirname, 'src')),
|
||||
fs.realpathSync(path.join(__dirname, '../shared')),
|
||||
]),
|
||||
);
|
||||
26
react/admin-panel/package.json
Normal file
26
react/admin-panel/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "admin-panel",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"shared": "link:../shared"
|
||||
},
|
||||
"scripts": {
|
||||
"debug": "react-app-rewired start"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"description": "",
|
||||
"devDependencies": {},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
react/admin-panel/public/css
Symbolic link
1
react/admin-panel/public/css
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../css/
|
||||
1
react/admin-panel/public/fonts
Symbolic link
1
react/admin-panel/public/fonts
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../fonts
|
||||
9
react/admin-panel/public/index.html
Normal file
9
react/admin-panel/public/index.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/fontawesome.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="admin-panel"></div>
|
||||
</body>
|
||||
</html>
|
||||
93
react/admin-panel/src/index.jsx
Normal file
93
react/admin-panel/src/index.jsx
Normal file
@@ -0,0 +1,93 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './res/adminlte.min.css';
|
||||
import './res/index.css';
|
||||
import API from "shared/api";
|
||||
import Icon from "shared/elements/icon";
|
||||
|
||||
class AdminDashboard extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.api = new API();
|
||||
this.state = {
|
||||
loaded: false,
|
||||
dialog: { onClose: () => this.hideDialog() },
|
||||
notifications: [ ],
|
||||
contactRequests: [ ]
|
||||
};
|
||||
}
|
||||
|
||||
onUpdate() {
|
||||
}
|
||||
|
||||
showDialog(message, title, options=["Close"], onOption = null) {
|
||||
const props = { show: true, message: message, title: title, options: options, onOption: onOption };
|
||||
this.setState({ ...this.state, dialog: { ...this.state.dialog, ...props } });
|
||||
}
|
||||
|
||||
hideDialog() {
|
||||
this.setState({ ...this.state, dialog: { ...this.state.dialog, show: false } });
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.api.fetchUser().then(Success => {
|
||||
if (!Success) {
|
||||
document.location = "/admin";
|
||||
} else {
|
||||
this.fetchNotifications();
|
||||
this.fetchContactRequests();
|
||||
setInterval(this.onUpdate.bind(this), 60*1000);
|
||||
this.setState({...this.state, loaded: true});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
if (!this.state.loaded) {
|
||||
return <b>Loading… <Icon icon={"spinner"}/></b>
|
||||
}
|
||||
|
||||
this.controlObj = {
|
||||
showDialog: this.showDialog.bind(this),
|
||||
api: this.api
|
||||
};
|
||||
|
||||
return <b>test</b>
|
||||
/*return <Router>
|
||||
<Header {...this.controlObj} notifications={this.state.notifications} />
|
||||
<Sidebar {...this.controlObj} notifications={this.state.notifications} contactRequests={this.state.contactRequests}/>
|
||||
<div className={"content-wrapper p-2"}>
|
||||
<section className={"content"}>
|
||||
<Switch>
|
||||
<Route path={"/admin/dashboard"}><Overview {...this.controlObj} notifications={this.state.notifications} /></Route>
|
||||
<Route exact={true} path={"/admin/users"}><UserOverview {...this.controlObj} /></Route>
|
||||
<Route path={"/admin/user/add"}><CreateUser {...this.controlObj} /></Route>
|
||||
<Route path={"/admin/user/edit/:userId"} render={(props) => {
|
||||
let newProps = {...props, ...this.controlObj};
|
||||
return <EditUser {...newProps} />
|
||||
}}/>
|
||||
<Route path={"/admin/user/permissions"}><PermissionSettings {...this.controlObj}/></Route>
|
||||
<Route path={"/admin/group/add"}><CreateGroup {...this.controlObj} /></Route>
|
||||
<Route exact={true} path={"/admin/contact/"}><ContactRequestOverview {...this.controlObj} /></Route>
|
||||
<Route path={"/admin/visitors"}><Visitors {...this.controlObj} /></Route>
|
||||
<Route path={"/admin/logs"}><Logs {...this.controlObj} notifications={this.state.notifications} /></Route>
|
||||
<Route path={"/admin/settings"}><Settings {...this.controlObj} /></Route>
|
||||
<Route path={"/admin/pages"}><PageOverview {...this.controlObj} /></Route>
|
||||
<Route path={"/admin/help"}><HelpPage {...this.controlObj} /></Route>
|
||||
<Route path={"*"}><View404 /></Route>
|
||||
</Switch>
|
||||
<Dialog {...this.state.dialog}/>
|
||||
</section>
|
||||
</div>
|
||||
<Footer />
|
||||
</Router>
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<AdminDashboard />,
|
||||
document.getElementById('admin-panel')
|
||||
);
|
||||
12
react/admin-panel/src/res/adminlte.min.css
vendored
Normal file
12
react/admin-panel/src/res/adminlte.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6
react/admin-panel/src/res/index.css
Normal file
6
react/admin-panel/src/res/index.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.page-link { color: #222629; }
|
||||
.page-link:hover { color: black; }
|
||||
|
||||
.ReactCollapse--collapse {
|
||||
transition: height 500ms;
|
||||
}
|
||||
1
react/admin-panel/src/res/select2.min.css
vendored
Normal file
1
react/admin-panel/src/res/select2.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user