Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ViaResto-website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aymeric Chaumont
ViaResto-website
Commits
00d9b2c9
Commit
00d9b2c9
authored
Jul 8, 2022
by
Aymeric Chaumont
Browse files
Options
Downloads
Patches
Plain Diff
udpated waiting time component to be time-dependent
parent
a71c9c50
No related branches found
No related tags found
2 merge requests
!29
Time dependence
,
!28
improve front
Pipeline
#43879
passed
Jul 8, 2022
Stage: build
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/components/Comments.js
+18
-4
18 additions, 4 deletions
frontend/src/components/Comments.js
frontend/src/components/WaitingTime.js
+14
-10
14 additions, 10 deletions
frontend/src/components/WaitingTime.js
with
32 additions
and
14 deletions
frontend/src/components/Comments.js
+
18
−
4
View file @
00d9b2c9
...
@@ -11,14 +11,28 @@ export default function Comments({ place }) {
...
@@ -11,14 +11,28 @@ export default function Comments({ place }) {
setComments
(
res
.
data
);
setComments
(
res
.
data
);
})
})
.
catch
((
e
)
=>
console
.
log
(
e
));
.
catch
((
e
)
=>
console
.
log
(
e
));
});
}
,
[]
);
return
(
return
(
<
div
style
=
{{
width
:
"
25%
"
,
overflowY
:
"
scroll
"
}}
>
<
div
style
=
{{
width
:
"
25%
"
,
overflowY
:
"
scroll
"
}}
>
{
comments
.
map
((
comment
,
index
)
=>
(
{
comments
.
map
((
comment
,
index
)
=>
(
<
div
key
=
{
index
}
style
=
{{
display
:
"
flex
"
,
flexDirection
:
"
column
"
,
border
:
"
solid black 1px
"
,
borderRadius
:
"
0.5rem
"
,
margin
:
"
1rem
"
,
padding
:
"
0.5rem
"
}}
>
<
div
key
=
{
index
}
style
=
{{
display
:
"
flex
"
,
flexDirection
:
"
column
"
,
border
:
"
solid black 1px
"
,
borderRadius
:
"
0.5rem
"
,
margin
:
"
1rem
"
,
padding
:
"
0.5rem
"
,
}}
>
<
div
style
=
{{
marginBottom
:
"
0.5rem
"
,
textAlign
:
"
left
"
}}
>
{
comment
.
comment
}
<
/div
>
<
div
style
=
{{
marginBottom
:
"
0.5rem
"
,
textAlign
:
"
left
"
}}
>
{
comment
.
comment
}
<
/div
>
<
div
style
=
{{
fontSize
:
"
0.7rem
"
,
alignSelf
:
"
flex-start
"
,
marginLeft
:
"
0.2rem
"
}}
>
{
comment
.
date
.
split
(
"
T
"
).
reduce
((
date
,
hours
)
=>
`À
${
hours
.
substring
(
0
,
5
)}
le
${
date
}
`
)}
<
/div
>
<
div
style
=
{{
fontSize
:
"
0.7rem
"
,
alignSelf
:
"
flex-start
"
,
marginLeft
:
"
0.2rem
"
}}
>
{
comment
.
date
.
split
(
"
T
"
)
.
reduce
((
date
,
hours
)
=>
`À
${
hours
.
substring
(
0
,
5
)}
le
${
date
}
`
)}
<
/div
>
<
/div
>
<
/div
>
))}
))}
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/WaitingTime.js
+
14
−
10
View file @
00d9b2c9
...
@@ -5,26 +5,30 @@ import "../styles/WaitingTime.css";
...
@@ -5,26 +5,30 @@ import "../styles/WaitingTime.css";
export
default
function
WaitingTime
({
place
})
{
export
default
function
WaitingTime
({
place
})
{
const
url
=
process
.
env
.
REACT_APP_BASE_URL_BACK
+
"
/
"
+
place
+
"
/waiting_time
"
;
const
url
=
process
.
env
.
REACT_APP_BASE_URL_BACK
+
"
/
"
+
place
+
"
/waiting_time
"
;
const
[
post
,
setPost
]
=
React
.
useState
(
null
);
const
[
post
,
setPost
]
=
React
.
useState
(
[
null
,
null
]
);
React
.
useEffect
(()
=>
{
React
.
useEffect
(()
=>
{
axios
.
get
(
url
).
then
((
response
)
=>
{
axios
.
get
(
url
).
then
((
res
)
=>
{
if
(
response
.
data
<
60
)
{
setPost
(
res
.
data
);
setPost
(
0
);
}
else
{
setPost
(
Math
.
round
(
response
.
data
/
60
));
}
});
});
},
[
url
]);
},
[
url
]);
return
(
return
(
<
div
className
=
"
parent
"
>
<
div
className
=
"
parent
"
>
{
post
?
(
{
post
[
1
]
?
(
<
div
className
=
"
waiting-time
"
>
Le
RU
ouvre
aujourd
&
apos
;
hui
à
{
"
"
}
<
b
>
{
String
(
post
[
0
]).
padStart
(
2
,
"
0
"
)}
h
{
String
(
post
[
1
]).
padStart
(
2
,
"
0
"
)}
<
/b
>
.
<
/div
>
)
:
post
[
0
]
?
(
<
div
className
=
"
waiting-time
"
>
<
div
className
=
"
waiting-time
"
>
T
emps
d
&
apos
;
attente
estimé
à
<
b
>
{
post
}
minutes
<
/b>
.
Le
t
emps
d
&
apos
;
attente
est
estimé
à
<
b
>
{
post
[
0
]
}
minutes
.
<
/b
>
<
/div
>
<
/div
>
)
:
(
)
:
(
<
div
>
Pas
de
données
..
.
<
/div
>
<
div
className
=
"
waiting-time
"
>
Le
RU
est
fermé
pour
aujourd
&
apos
;
hui
.
<
/div
>
)}
)}
<
/div
>
<
/div
>
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment