Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ecolyo
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
Ecolyo
Commits
a117ab4d
Commit
a117ab4d
authored
4 years ago
by
Yoan VALLET
Browse files
Options
Downloads
Patches
Plain Diff
feat: lead user to the right date & timestep
parent
4ad9a50b
No related branches found
No related tags found
1 merge request
!325
feat: lead user to the right date & timestep
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Analysis/MonthlyAnalysis.tsx
+1
-0
1 addition, 0 deletions
src/components/Analysis/MonthlyAnalysis.tsx
src/components/PerformanceIndicator/FluidPerformanceIndicator.tsx
+57
-46
57 additions, 46 deletions
...onents/PerformanceIndicator/FluidPerformanceIndicator.tsx
with
58 additions
and
46 deletions
src/components/Analysis/MonthlyAnalysis.tsx
+
1
−
0
View file @
a117ab4d
...
@@ -155,6 +155,7 @@ const MonthlyAnalysis: React.FC = () => {
...
@@ -155,6 +155,7 @@ const MonthlyAnalysis: React.FC = () => {
performanceIndicator
=
{
performanceIndicator
=
{
performanceIndicators
[
fluid
.
fluidTypeId
]
performanceIndicators
[
fluid
.
fluidTypeId
]
}
}
date
=
{
analysisDate
.
minus
({
month
:
1
}).
startOf
(
'
month
'
)
}
/>
/>
)
:
null
)
:
null
})
}
})
}
...
...
This diff is collapsed.
Click to expand it.
src/components/PerformanceIndicator/FluidPerformanceIndicator.tsx
+
57
−
46
View file @
a117ab4d
import
React
from
'
react
'
import
React
,
{
useCallback
}
from
'
react
'
import
{
NavLink
}
from
'
react-router-dom
'
import
'
./fluidPerformanceIndicator.scss
'
import
{
useHistory
}
from
'
react-router-dom
'
import
{
useI18n
}
from
'
cozy-ui/transpiled/react/I18n
'
import
{
useI18n
}
from
'
cozy-ui/transpiled/react/I18n
'
import
{
useDispatch
}
from
'
react-redux
'
import
{
DateTime
}
from
'
luxon
'
import
{
FluidType
}
from
'
enum/fluid.enum
'
import
{
FluidType
}
from
'
enum/fluid.enum
'
import
{
PerformanceIndicator
}
from
'
models
'
import
{
PerformanceIndicator
}
from
'
models
'
...
@@ -11,17 +14,23 @@ import StyledCard from 'components/CommonKit/Card/StyledCard'
...
@@ -11,17 +14,23 @@ import StyledCard from 'components/CommonKit/Card/StyledCard'
import
StyledIcon
from
'
components/CommonKit/Icon/StyledIcon
'
import
StyledIcon
from
'
components/CommonKit/Icon/StyledIcon
'
import
BlackArrowIcon
from
'
assets/icons/ico/black-arrow.svg
'
import
BlackArrowIcon
from
'
assets/icons/ico/black-arrow.svg
'
import
ConverterService
from
'
services/converter.service
'
import
ConverterService
from
'
services/converter.service
'
import
'
./fluidPerformanceIndicator.scss
'
import
{
setCurrentTimeStep
,
setSelectedDate
}
from
'
store/chart/chart.actions
'
import
{
TimeStep
}
from
'
enum/timeStep.enum
'
interface
FluidPerformanceIndicatorProps
{
interface
FluidPerformanceIndicatorProps
{
performanceIndicator
:
PerformanceIndicator
performanceIndicator
:
PerformanceIndicator
fluidType
:
FluidType
fluidType
:
FluidType
date
:
DateTime
}
}
const
FluidPerformanceIndicator
:
React
.
FC
<
FluidPerformanceIndicatorProps
>
=
({
const
FluidPerformanceIndicator
:
React
.
FC
<
FluidPerformanceIndicatorProps
>
=
({
performanceIndicator
,
performanceIndicator
,
fluidType
,
fluidType
,
date
,
}:
FluidPerformanceIndicatorProps
)
=>
{
}:
FluidPerformanceIndicatorProps
)
=>
{
const
{
t
}
=
useI18n
()
const
{
t
}
=
useI18n
()
const
history
=
useHistory
()
const
dispatch
=
useDispatch
()
const
iconType
=
getPicto
(
fluidType
)
const
iconType
=
getPicto
(
fluidType
)
const
converterService
=
new
ConverterService
()
const
converterService
=
new
ConverterService
()
...
@@ -30,54 +39,56 @@ const FluidPerformanceIndicator: React.FC<FluidPerformanceIndicatorProps> = ({
...
@@ -30,54 +39,56 @@ const FluidPerformanceIndicator: React.FC<FluidPerformanceIndicatorProps> = ({
displayedValue
=
formatNumberValues
(
performanceIndicator
.
value
).
toString
()
displayedValue
=
formatNumberValues
(
performanceIndicator
.
value
).
toString
()
else
displayedValue
=
'
-----
'
else
displayedValue
=
'
-----
'
return
(
const
handleClick
=
useCallback
(()
=>
{
<
NavLink
dispatch
(
setCurrentTimeStep
(
TimeStep
.
DAY
))
tabIndex
=
{
-
1
}
dispatch
(
setSelectedDate
(
date
))
className
=
"fpi-link"
history
.
push
(
to
=
{
`/consumption/
${
t
(
`/consumption/
${
t
(
'
FLUID.
'
+
FluidType
[
fluidType
]
+
'
.NAME
'
'
FLUID.
'
+
FluidType
[
fluidType
]
+
'
.NAME
'
).
toLowerCase
()}
`
}
).
toLowerCase
()}
`
>
)
<
StyledCard
fluidType
=
{
fluidType
}
>
},
[
t
,
dispatch
,
history
,
date
,
fluidType
])
<
div
className
=
"fpi"
>
<
div
className
=
"fpi-left"
>
return
(
<
div
className
=
"fpi-title card-title-on"
>
<
StyledCard
onClick
=
{
handleClick
}
fluidType
=
{
fluidType
}
>
{
t
(
'
FLUID.
'
+
FluidType
[
fluidType
]
+
'
.LABEL
'
)
}
<
div
className
=
"fpi"
>
</
div
>
<
div
className
=
"fpi-left"
>
<
div
className
=
"fpi-content"
>
<
div
className
=
"fpi-title card-title-on"
>
<
StyledIcon
{
t
(
'
FLUID.
'
+
FluidType
[
fluidType
]
+
'
.LABEL
'
)
}
className
=
"fpi-content-icon"
</
div
>
icon
=
{
iconType
}
<
div
className
=
"fpi-content"
>
size
=
{
50
}
<
StyledIcon
/>
className
=
"fpi-content-icon"
<
div
className
=
"fpi-content-perf"
>
icon
=
{
iconType
}
<
div
className
=
"fpi-content-perf-result card-result"
>
size
=
{
50
}
<
span
>
{
displayedValue
}
</
span
>
/>
<
span
className
=
"card-indicator"
>
<
div
className
=
"fpi-content-perf"
>
{
t
(
'
FLUID.
'
+
FluidType
[
fluidType
]
+
'
.UNIT
'
)
}
<
div
className
=
"fpi-content-perf-result card-result"
>
</
span
>
<
span
>
{
displayedValue
}
</
span
>
<
span
<
span
className
=
"card-indicator"
>
className
=
{
`
${
FluidType
[
fluidType
]
+
'
-color euro-value
'
}
`
}
{
t
(
'
FLUID.
'
+
FluidType
[
fluidType
]
+
'
.UNIT
'
)
}
>
</
span
>
{
performanceIndicator
&&
<
span
performanceIndicator
.
value
&&
className
=
{
`
${
FluidType
[
fluidType
]
+
'
-color euro-value
'
}
`
}
`
${
formatNumberValues
(
>
converterService
.
LoadToEuro
(
{
performanceIndicator
&&
performanceIndicator
.
value
,
performanceIndicator
.
value
&&
fluidType
`
${
formatNumberValues
(
)
converterService
.
LoadToEuro
(
)}
€`
}
performanceIndicator
.
value
,
</
span
>
fluidType
</
div
>
)
)}
€`
}
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className
=
"fpi-right"
>
<
StyledIcon
icon
=
{
BlackArrowIcon
}
size
=
{
18
}
/>
</
div
>
</
div
>
</
div
>
</
StyledCard
>
<
div
className
=
"fpi-right"
>
</
NavLink
>
<
StyledIcon
icon
=
{
BlackArrowIcon
}
size
=
{
18
}
/>
</
div
>
</
div
>
</
StyledCard
>
)
)
}
}
...
...
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