Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Block Explorer UI
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
Block Explorer UI
Commits
624b462e
Commit
624b462e
authored
1 month ago
by
Lukas
Committed by
mcfarhat
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
Create new card for hive price chart
parent
2db3adad
No related branches found
No related tags found
1 merge request
!599
Lbudginas/#493 hive price chart
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/home/HeadBlockHiveChartCard.tsx
+67
-0
67 additions, 0 deletions
components/home/HeadBlockHiveChartCard.tsx
with
67 additions
and
0 deletions
components/home/HeadBlockHiveChartCard.tsx
0 → 100644
+
67
−
0
View file @
624b462e
import
{
ArrowDown
,
ArrowUp
}
from
"
lucide-react
"
;
import
{
Loader2
}
from
"
lucide-react
"
;
import
MarketHistoryChart
from
"
./MarketHistoryChart
"
;
import
moment
from
"
moment
"
;
import
useMarketHistory
from
"
@/hooks/common/useMarketHistory
"
;
interface
HeadBlockPropertyCardProps
{
header
:
string
;
isParamsHidden
:
boolean
;
handleHideParams
:
()
=>
void
;
isLoading
:
boolean
;
}
const
MARKET_HISTORY_INTERVAL
=
86400
;
// 1 day
const
CURRENT_TIME
=
moment
().
format
(
"
YYYY-MM-DDTHH:mm:ss
"
);
const
MARKET_HISTORY_TIME_PERIOD
=
moment
()
.
subtract
(
30
,
"
days
"
)
.
format
(
"
YYYY-MM-DDTHH:mm:ss
"
);
const
HeadBlockHiveChartCard
:
React
.
FC
<
HeadBlockPropertyCardProps
>
=
({
header
,
isParamsHidden
,
handleHideParams
,
isLoading
,
})
=>
{
const
{
marketHistory
,
isMarketHistoryLoading
}
=
useMarketHistory
(
MARKET_HISTORY_INTERVAL
,
MARKET_HISTORY_TIME_PERIOD
,
CURRENT_TIME
);
return
(
<
div
className
=
"bg-theme py-1 rounded-[6px] data-box-chart"
data-testid
=
"expandable-list"
style
=
{
{
overflowX
:
"
auto
"
,
width
:
"
100%
"
}
}
>
<
div
onClick
=
{
handleHideParams
}
className
=
"h-full w-full flex items-center justify-between py-1 cursor-pointer px-1"
>
<
div
className
=
"text-lg"
>
{
header
}
</
div
>
<
div
>
{
isParamsHidden
?
<
ArrowDown
/>
:
<
ArrowUp
/>
}
</
div
>
</
div
>
{
isLoading
&&
!
isParamsHidden
?
(
<
div
className
=
"flex justify-center w-full"
>
<
Loader2
className
=
"animate-spin mt-1 text-white h-8 w-8"
/>
</
div
>
)
:
(
<
div
hidden
=
{
isParamsHidden
}
data-testid
=
"content-expandable-list"
>
<
div
>
<
MarketHistoryChart
data
=
{
marketHistory
}
isLoading
=
{
isMarketHistoryLoading
}
/>
</
div
>
</
div
>
)
}
</
div
>
);
};
export
default
HeadBlockHiveChartCard
;
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