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
39943b5f
Commit
39943b5f
authored
3 years ago
by
Aymeric Chaumont
Browse files
Options
Downloads
Patches
Plain Diff
update front graph component for time-dependance
parent
e81b8ff8
Branches
Branches containing commit
No related tags found
2 merge requests
!29
Time dependence
,
!28
improve front
Pipeline
#43934
passed with warnings
3 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/src/components/Graph.js
+12
-26
12 additions, 26 deletions
frontend/src/components/Graph.js
frontend/src/components/index.js
+1
-1
1 addition, 1 deletion
frontend/src/components/index.js
frontend/src/views/Restaurant.js
+3
-2
3 additions, 2 deletions
frontend/src/views/Restaurant.js
with
16 additions
and
29 deletions
frontend/src/components/Graph.js
+
12
−
26
View file @
39943b5f
...
...
@@ -11,33 +11,19 @@ import {
}
from
"
recharts
"
;
import
"
../styles/Graph.css
"
;
export
default
function
DailyGraph
({
place
})
{
const
[
day
,
min_time_hour
,
min_time_mn
,
max_time_hour
,
max_time_mn
,
interval
]
=
[
3
,
12
,
0
,
12
,
40
,
300
,
];
const
url
=
process
.
env
.
REACT_APP_BASE_URL_BACK
+
"
/
"
+
place
+
"
/stats/
"
+
day
+
"
/
"
+
min_time_hour
+
"
/
"
+
min_time_mn
+
"
/
"
+
max_time_hour
+
"
/
"
+
max_time_mn
+
"
/
"
+
interval
;
const
[
data
,
setData
]
=
React
.
useState
([]);
export
default
function
Graph
({
place
,
type
})
{
const
[
data
,
setData
]
=
React
.
useState
(
null
);
React
.
useEffect
(()
=>
{
axios
.
get
(
url
).
then
((
response
)
=>
{
axios
.
get
(
`
${
process
.
env
.
REACT_APP_BASE_URL_BACK
}
/
${
encodeURIComponent
(
place
)}
/
${
encodeURIComponent
(
type
,
)}
_graph`
,
)
.
then
((
response
)
=>
{
setData
(
response
.
data
);
});
},
[
url
]);
},
[]);
if
(
!
data
)
return
null
;
const
CustomTooltip
=
({
active
,
payload
})
=>
{
...
...
This diff is collapsed.
Click to expand it.
frontend/src/components/index.js
+
1
−
1
View file @
39943b5f
...
...
@@ -2,5 +2,5 @@ export { default as Header } from "./Header";
export
{
default
as
Footer
}
from
"
./Footer
"
;
export
{
default
as
Timetable
}
from
"
./Timetable
"
;
export
{
default
as
WaitingTime
}
from
"
./WaitingTime
"
;
export
{
default
as
Daily
Graph
}
from
"
./Graph
"
;
export
{
default
as
Graph
}
from
"
./Graph
"
;
export
{
default
as
Comments
}
from
"
./Comments
"
;
This diff is collapsed.
Click to expand it.
frontend/src/views/Restaurant.js
+
3
−
2
View file @
39943b5f
import
React
from
"
react
"
;
import
{
Daily
Graph
,
WaitingTime
,
Comments
}
from
"
../components
"
;
import
{
Graph
,
WaitingTime
,
Comments
}
from
"
../components
"
;
import
"
../styles/restaurant.css
"
;
...
...
@@ -12,9 +12,10 @@ export default function RestaurantPage({ selection }) {
<
Comments
place
=
{
selection
.
name
}
infos
/>
<
div
className
=
"
restaurant-container
"
id
=
"
restaurant-main-page
"
>
<
WaitingTime
place
=
{
selection
.
name
}
/
>
<
Daily
Graph
place
=
{
selection
.
name
}
/
>
<
Graph
place
=
{
selection
.
name
}
type
=
"
current
"
/>
<
/div
>
<
Comments
place
=
{
selection
.
name
}
/
>
{
/*<Graph place={selection.name} type="avg" />*/
}
<
/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