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
e119c4d4
Commit
e119c4d4
authored
Jan 25, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more stats fixes
parent
8e7271f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
33 deletions
+50
-33
useClientRect.tsx
lib/hooks/useClientRect.tsx
+1
-3
AddressCoinBalanceChart.tsx
ui/address/coinBalance/AddressCoinBalanceChart.tsx
+1
-0
ChartWidget.tsx
ui/shared/chart/ChartWidget.tsx
+47
-29
ChartWidgetGraph.tsx
ui/shared/chart/ChartWidgetGraph.tsx
+1
-1
No files found.
lib/hooks/useClientRect.tsx
View file @
e119c4d4
...
@@ -2,8 +2,6 @@ import _debounce from 'lodash/debounce';
...
@@ -2,8 +2,6 @@ import _debounce from 'lodash/debounce';
import
type
{
LegacyRef
}
from
'
react
'
;
import
type
{
LegacyRef
}
from
'
react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
useUpdateEffect
from
'
lib/hooks/useUpdateEffect
'
;
export
default
function
useClientRect
<
E
extends
Element
>
():
[
DOMRect
|
null
,
LegacyRef
<
E
>
|
undefined
]
{
export
default
function
useClientRect
<
E
extends
Element
>
():
[
DOMRect
|
null
,
LegacyRef
<
E
>
|
undefined
]
{
const
[
rect
,
setRect
]
=
React
.
useState
<
DOMRect
|
null
>
(
null
);
const
[
rect
,
setRect
]
=
React
.
useState
<
DOMRect
|
null
>
(
null
);
const
nodeRef
=
React
.
useRef
<
E
>
();
const
nodeRef
=
React
.
useRef
<
E
>
();
...
@@ -15,7 +13,7 @@ export default function useClientRect<E extends Element>(): [ DOMRect | null, Le
...
@@ -15,7 +13,7 @@ export default function useClientRect<E extends Element>(): [ DOMRect | null, Le
nodeRef
.
current
=
node
;
nodeRef
.
current
=
node
;
},
[]);
},
[]);
useUpdat
eEffect
(()
=>
{
React
.
us
eEffect
(()
=>
{
const
content
=
window
.
document
.
querySelector
(
'
main
'
);
const
content
=
window
.
document
.
querySelector
(
'
main
'
);
if
(
!
content
)
{
if
(
!
content
)
{
return
;
return
;
...
...
ui/address/coinBalance/AddressCoinBalanceChart.tsx
View file @
e119c4d4
...
@@ -25,6 +25,7 @@ const AddressCoinBalanceChart = ({ addressHash }: Props) => {
...
@@ -25,6 +25,7 @@ const AddressCoinBalanceChart = ({ addressHash }: Props) => {
title=
"Balances"
title=
"Balances"
items=
{
items
}
items=
{
items
}
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
chartHeight=
"250px"
/>
/>
);
);
};
};
...
...
ui/shared/chart/ChartWidget.tsx
View file @
e119c4d4
import
{
import
{
Box
,
Box
,
Center
,
Flex
,
Flex
,
Grid
,
Grid
,
Icon
,
Icon
,
...
@@ -111,6 +112,49 @@ const ChartWidget = ({ items, title, description, isLoading, chartHeight, isErro
...
@@ -111,6 +112,49 @@ const ChartWidget = ({ items, title, description, isLoading, chartHeight, isErro
return
<
ChartWidgetSkeleton
hasDescription=
{
Boolean
(
description
)
}
/>;
return
<
ChartWidgetSkeleton
hasDescription=
{
Boolean
(
description
)
}
/>;
}
}
const
hasItems
=
items
&&
items
.
length
>
2
;
const
content
=
(()
=>
{
if
(
isError
)
{
return
(
<
Flex
alignItems=
"center"
justifyContent=
"center"
flexGrow=
{
1
}
py=
{
4
}
>
<
Text
variant=
"secondary"
fontSize=
"sm"
textAlign=
"center"
>
{
`The data didn${ apos }t load. Please, `
}
<
Link
href=
{
window
.
document
.
location
.
href
}
>
try to reload the page.
</
Link
>
</
Text
>
</
Flex
>
);
}
if
(
!
hasItems
)
{
return
(
<
Center
flexGrow=
{
1
}
>
<
Text
variant=
"secondary"
fontSize=
"sm"
>
No data
</
Text
>
</
Center
>
);
}
return
(
<
Box
h=
{
chartHeight
||
'
auto
'
}
maxW=
"100%"
>
<
ChartWidgetGraph
items=
{
items
}
onZoom=
{
handleZoom
}
isZoomResetInitial=
{
isZoomResetInitial
}
title=
{
title
}
/>
</
Box
>
);
})();
return
(
return
(
<>
<>
<
Box
<
Box
...
@@ -167,7 +211,7 @@ const ChartWidget = ({ items, title, description, isLoading, chartHeight, isErro
...
@@ -167,7 +211,7 @@ const ChartWidget = ({ items, title, description, isLoading, chartHeight, isErro
/>
/>
</
Tooltip
>
</
Tooltip
>
{
!
isError
&&
(
{
hasItems
&&
(
<
Menu
>
<
Menu
>
<
MenuButton
<
MenuButton
gridColumn=
{
3
}
gridColumn=
{
3
}
...
@@ -216,36 +260,10 @@ const ChartWidget = ({ items, title, description, isLoading, chartHeight, isErro
...
@@ -216,36 +260,10 @@ const ChartWidget = ({ items, title, description, isLoading, chartHeight, isErro
)
}
)
}
</
Grid
>
</
Grid
>
{
items
?
(
{
content
}
<
Box
h=
{
chartHeight
||
'
auto
'
}
maxW=
"100%"
>
<
ChartWidgetGraph
margin=
{
{
bottom
:
20
}
}
items=
{
items
}
onZoom=
{
handleZoom
}
isZoomResetInitial=
{
isZoomResetInitial
}
title=
{
title
}
/>
</
Box
>
)
:
(
<
Flex
alignItems=
"center"
justifyContent=
"center"
flexGrow=
{
1
}
py=
{
4
}
>
<
Text
variant=
"secondary"
fontSize=
"sm"
textAlign=
"center"
>
{
`The data didn${ apos }t load. Please, `
}
<
Link
href=
{
window
.
document
.
location
.
href
}
>
try to reload the page.
</
Link
>
</
Text
>
</
Flex
>
)
}
</
Box
>
</
Box
>
{
i
tems
&&
(
{
hasI
tems
&&
(
<
FullscreenChartModal
<
FullscreenChartModal
isOpen=
{
isFullscreen
}
isOpen=
{
isFullscreen
}
items=
{
items
}
items=
{
items
}
...
...
ui/shared/chart/ChartWidgetGraph.tsx
View file @
e119c4d4
...
@@ -23,7 +23,7 @@ interface Props {
...
@@ -23,7 +23,7 @@ interface Props {
items
:
Array
<
TimeChartItem
>
;
items
:
Array
<
TimeChartItem
>
;
onZoom
:
()
=>
void
;
onZoom
:
()
=>
void
;
isZoomResetInitial
:
boolean
;
isZoomResetInitial
:
boolean
;
margin
:
ChartMargin
;
margin
?
:
ChartMargin
;
}
}
const
MAX_SHOW_ITEMS
=
100
;
const
MAX_SHOW_ITEMS
=
100
;
...
...
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