Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scheduler-react-sample
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linh Nguyen
scheduler-react-sample
Commits
993a0033
Commit
993a0033
authored
Jun 20, 2020
by
Linh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last version
parent
bbddebd9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
49 deletions
+20
-49
src/App.js
src/App.js
+1
-2
src/HOC/withLoading.js
src/HOC/withLoading.js
+0
-8
src/HOC/withUVs.js
src/HOC/withUVs.js
+1
-1
src/components/Scheduler/Scheduler.js
src/components/Scheduler/Scheduler.js
+6
-35
src/components/User/ButtonWithModal.js
src/components/User/ButtonWithModal.js
+2
-2
src/components/User/LoginInput.js
src/components/User/LoginInput.js
+10
-1
No files found.
src/App.js
View file @
993a0033
...
...
@@ -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
,
...
...
src/HOC/withLoading.js
deleted
100644 → 0
View file @
bbddebd9
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
src/HOC/withUVs.js
View file @
993a0033
...
...
@@ -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
}
...
...
src/components/Scheduler/Scheduler.js
View file @
993a0033
...
...
@@ -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
)
...
...
src/components/User/ButtonWithModal.js
View file @
993a0033
...
...
@@ -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
>
Co
mfirmer
à
supprimer
<
/Modal.Body
>
<
Modal
.
Body
>
Co
nfirm
to
delete
<
/Modal.Body
>
<
Modal
.
Footer
>
<
Button
variant
=
"
secondary
"
onClick
=
{
handleClose
}
>
Annuler
Cancle
<
/Button
>
<
Button
variant
=
"
primary
"
...
...
src/components/User/LoginInput.js
View file @
993a0033
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment