Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
f382970c
Commit
f382970c
authored
Jan 08, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tooltip on stats page
parent
2099d37d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
ChartsWidgetsList.tsx
ui/stats/ChartsWidgetsList.tsx
+18
-2
No files found.
ui/stats/ChartsWidgetsList.tsx
View file @
f382970c
import
type
{
TooltipProps
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Grid
,
Heading
,
List
,
ListItem
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Box
,
Grid
,
Heading
,
List
,
ListItem
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
React
,
{
useCallback
,
useState
}
from
'
react
'
;
import
type
{
StatsChartsSection
}
from
'
types/api/stats
'
;
import
type
{
HomeStats
,
StatsChartsSection
}
from
'
types/api/stats
'
;
import
type
{
StatsIntervalIds
}
from
'
types/client/stats
'
;
import
type
{
StatsIntervalIds
}
from
'
types/client/stats
'
;
import
{
getResourceKey
}
from
'
lib/api/useApiQuery
'
;
import
{
apos
}
from
'
lib/html-entities
'
;
import
{
apos
}
from
'
lib/html-entities
'
;
import
EmptySearchResult
from
'
ui/shared/EmptySearchResult
'
;
import
EmptySearchResult
from
'
ui/shared/EmptySearchResult
'
;
import
GasInfoTooltipContent
from
'
ui/shared/GasInfoTooltipContent/GasInfoTooltipContent
'
;
import
Hint
from
'
ui/shared/Hint
'
;
import
ChartsLoadingErrorAlert
from
'
./ChartsLoadingErrorAlert
'
;
import
ChartsLoadingErrorAlert
from
'
./ChartsLoadingErrorAlert
'
;
import
ChartWidgetContainer
from
'
./ChartWidgetContainer
'
;
import
ChartWidgetContainer
from
'
./ChartWidgetContainer
'
;
const
GAS_TOOLTIP_PROPS
:
Partial
<
TooltipProps
>
=
{
borderRadius
:
'
md
'
,
hasArrow
:
false
,
padding
:
0
,
};
type
Props
=
{
type
Props
=
{
filterQuery
:
string
;
filterQuery
:
string
;
isError
:
boolean
;
isError
:
boolean
;
...
@@ -23,6 +34,9 @@ const ChartsWidgetsList = ({ filterQuery, isError, isPlaceholderData, charts, in
...
@@ -23,6 +34,9 @@ const ChartsWidgetsList = ({ filterQuery, isError, isPlaceholderData, charts, in
const
isAnyChartDisplayed
=
charts
?.
some
((
section
)
=>
section
.
charts
.
length
>
0
);
const
isAnyChartDisplayed
=
charts
?.
some
((
section
)
=>
section
.
charts
.
length
>
0
);
const
isEmptyChartList
=
Boolean
(
filterQuery
)
&&
!
isAnyChartDisplayed
;
const
isEmptyChartList
=
Boolean
(
filterQuery
)
&&
!
isAnyChartDisplayed
;
const
queryClient
=
useQueryClient
();
const
homeStatsData
=
queryClient
.
getQueryData
<
HomeStats
>
(
getResourceKey
(
'
homepage_stats
'
));
const
handleChartLoadingError
=
useCallback
(
const
handleChartLoadingError
=
useCallback
(
()
=>
setIsSomeChartLoadingError
(
true
),
()
=>
setIsSomeChartLoadingError
(
true
),
[
setIsSomeChartLoadingError
]);
[
setIsSomeChartLoadingError
]);
...
@@ -51,10 +65,12 @@ const ChartsWidgetsList = ({ filterQuery, isError, isPlaceholderData, charts, in
...
@@ -51,10 +65,12 @@ const ChartsWidgetsList = ({ filterQuery, isError, isPlaceholderData, charts, in
marginBottom
:
0
,
marginBottom
:
0
,
}
}
}
}
>
>
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
mb=
{
4
}
display=
"inline-
block"
>
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
mb=
{
4
}
display=
"inline-
flex"
alignItems=
"center"
columnGap=
{
2
}
>
<
Heading
size=
"md"
>
<
Heading
size=
"md"
>
{
section
.
title
}
{
section
.
title
}
</
Heading
>
</
Heading
>
{
section
.
id
===
'
gas
'
&&
homeStatsData
&&
homeStatsData
.
gas_prices
&&
<
Hint
label=
{
<
GasInfoTooltipContent
data=
{
homeStatsData
}
/>
}
tooltipProps=
{
GAS_TOOLTIP_PROPS
}
/>
}
</
Skeleton
>
</
Skeleton
>
<
Grid
<
Grid
...
...
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