Commit 993a0033 authored by Linh Nguyen's avatar Linh Nguyen

last version

parent bbddebd9
......@@ -16,13 +16,12 @@ class App extends Component {
super(props)
const storage = new LocalStorageManager()
storage.set("logins", ["nguyetra", "lyujiawe"])
storage.set("logins", ["lyujiawe"])
let logins = storage.logins()
this.state = {
currentTimeFormatState: true,
messages: [],
error: null,
isLoaded: false,
logins: logins,
......
import React from 'react';
function WithLoading(WrappedComponent) {
return ({ isLoading, ...props }) => {
if (!isLoading) return (<WrappedComponent {...props} />);
return (<p>Be Hold, fetching data may take some time :)</p>);
}
}
export default WithLoading;
\ No newline at end of file
......@@ -88,7 +88,7 @@ const extractUvDateInfo = (uvs) => {
{
start_date: day + " " + uv.begin,
end_date: day + " " + uv.end,
text: uv.uv,
text: uv.type + " " + uv.uv,
id: uvInAllTerm.length + 1,
login: uv.login
}
......
......@@ -32,7 +32,9 @@ const changeColorForEachStudent = (events, logins) => {
const changeColorForEachClass = (events, classes) => {
events.map(event => {
event.color = toColorName(classes.indexOf(event.text))
let className = []
className = event.text.split(" ")
event.color = toColorName(classes.indexOf(className[1]))
event.text = event.text + "\n" + event.login
scheduler.updateEvent(event.id)
})
......@@ -42,35 +44,6 @@ const changeColor = isByStudent => (events, logins, classes) => isByStudent ? ch
export default class Scheduler extends Component {
initSchedulerEvents() {
if (scheduler._$initialized) {
return;
}
const onDataUpdated = this.props.onDataUpdated;
scheduler.attachEvent('onEventAdded', (id, ev) => {
if (onDataUpdated) {
onDataUpdated('create', ev, id);
}
});
scheduler.attachEvent('onEventChanged', (id, ev) => {
if (onDataUpdated) {
onDataUpdated('update', ev, id);
}
});
scheduler.attachEvent('onEventDeleted', (id, ev) => {
if (onDataUpdated) {
onDataUpdated('delete', ev, id);
}
});
scheduler._$initialized = true;
}
componentDidMount() {
scheduler.skin = 'material';
scheduler.config.header = [
......@@ -87,13 +60,11 @@ export default class Scheduler extends Component {
scheduler.config.hour_date = '%g:%i %A';
scheduler.xy.scale_width = 60;
this.initSchedulerEvents();
const { events, logins, isByStudent, classes } = this.props;
scheduler.init(this.schedulerContainer, new Date(2020, 5, 10));
scheduler.init(this.schedulerContainer, new Date());
scheduler.clearAll();
scheduler.parse(events);
console.log(this.props.isByStudent)
changeColor(isByStudent)(events, logins, classes)
}
......@@ -103,7 +74,7 @@ export default class Scheduler extends Component {
componentDidUpdate() {
const { events, logins, classes, isByStudent } = this.props
scheduler.init(this.schedulerContainer, new Date(2020, 5, 10));
scheduler.init(this.schedulerContainer, new Date());
scheduler.clearAll();
scheduler.parse(events);
changeColor(isByStudent)(events, logins, classes)
......
......@@ -27,10 +27,10 @@ export default (props) => {
<Modal.Header closeButton>
<Modal.Title>Do you want to delete this user?</Modal.Title>
</Modal.Header>
<Modal.Body>Comfirmer à supprimer</Modal.Body>
<Modal.Body>Confirm to delete</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={handleClose}>
Annuler
Cancle
</Button>
<Button
variant="primary"
......
......@@ -2,6 +2,11 @@ import React from 'react';
export const LoginInput = (props) => {
let inputValue;
function validateForm(login) {
return login.length > 0;
}
return (
<>
<form>
......@@ -20,7 +25,11 @@ export const LoginInput = (props) => {
className="btn btn-primary btn-sm"
onClick={(e) => {
e.preventDefault();
props.handleClick(inputValue.value)
if (validateForm(inputValue.value)){
props.handleClick(inputValue.value)
} else {
alert("Login empty")
}
}}
>
Add
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment