Skip to content

Commit

Permalink
fix: fixed some hydration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BLuEScioN committed Jan 23, 2025
1 parent b9c2dec commit 123ae37
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/app/search/filters/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function AddressFilter({
open={open}
onOpenChange={e => setOpen(e.open)}
>
<PopoverTrigger>
<PopoverTrigger asChild>
<Button
variant="secondary"
fontSize={'sm'}
Expand Down
2 changes: 1 addition & 1 deletion src/app/search/filters/Date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function DateFilter({ defaultStartTime, defaultEndTime }: DateFilterProps
open={open}
onOpenChange={e => setOpen(e.open)}
>
<PopoverTrigger>
<PopoverTrigger asChild>
<Button
variant={'secondary'}
fontSize={'sm'}
Expand Down
72 changes: 44 additions & 28 deletions src/app/transactions/MempoolFeePieChart.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SkeletonCircle } from '@/components/ui/skeleton';
import { ClientOnly, Flex } from '@chakra-ui/react';
import { Cell, Pie, PieChart } from 'recharts';

const pieChartWidth = 215;
Expand Down Expand Up @@ -95,33 +97,47 @@ export function MempoolFeePieChart({
});

return (
<PieChart width={pieChartWidth} height={pieChartHeight}>
<Pie
paddingAngle={3}
startAngle={0}
data={pieData}
dataKey="value"
nameKey="name"
cx="50%"
cy="50%"
labelLine={false}
label={props =>
renderCustomizedLabel({
...props,
})
}
innerRadius={60}
outerRadius={67}
>
{pieData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={getTxTypePieChartColor(entry.name)} stroke="none" />
))}
</Pie>
{renderCenterCustomizedLabel({
label: `${totalTxCount} tx`,
cx: pieChartWidth / 2,
cy: pieChartHeight / 2,
})}
</PieChart>
<ClientOnly
fallback={
<Flex
justifyContent="center"
alignItems="center"
width={pieChartWidth}
height={pieChartHeight}
>
<SkeletonCircle width={134} height={134} />
</Flex>
}
>
<PieChart width={pieChartWidth} height={pieChartHeight} id="mempool-fee-pie-chart">
<Pie
paddingAngle={3}
startAngle={0}
data={pieData}
dataKey="value"
nameKey="name"
cx="50%"
cy="50%"
labelLine={false}
label={props =>
renderCustomizedLabel({
...props,
})
}
innerRadius={60}
outerRadius={67}
>
{pieData &&
pieData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={getTxTypePieChartColor(entry.name)} stroke="none" />
))}
</Pie>
{renderCenterCustomizedLabel({
label: `${totalTxCount} tx`,
cx: pieChartWidth / 2,
cy: pieChartHeight / 2,
})}
</PieChart>
</ClientOnly>
);
}
2 changes: 1 addition & 1 deletion src/app/transactions/MempoolFeeStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export function MempoolFeeStats({ tokenPrice }: { tokenPrice: TokenPrice }) {
const bg = getTxTypePieChartColor(key);

return (
<Flex gap={0.5} alignItems={'center'} justifyContent={'center'}>
<Flex gap={0.5} alignItems={'center'} justifyContent={'center'} key={key}>
<Box h={2.5} w={2.5} borderRadius="50%" mr={2} backgroundColor={bg} />
<Icon
h={3.5}
Expand Down

0 comments on commit 123ae37

Please # to comment.