Skip to content

Commit f0fb4f8

Browse files
committed
chore: code refactoring
1 parent 5b591cf commit f0fb4f8

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

src/components/charts/ChartGroupCard.tsx

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,43 +31,10 @@ export const ChartGroupCard = ({ chartGroup }: ChartGroupCardProps) => {
3131

3232
const GROUP_EDIT_LINK = getChartGroupURL(chartGroup.id)
3333

34-
const renderCardInfo = () => (
35-
<div className="flexbox-col flex-grow-1 dc__gap-8">
36-
<div className="flexbox-col dc__gap-2">
37-
<div className="flex left">
38-
<InteractiveCellText
39-
text={chartGroup.name}
40-
rootClassName="fw-6 chart-grid-item__title cn-9"
41-
fontSize={14}
42-
/>
43-
<div className="chart-name__arrow dc__no-shrink flex">
44-
<Icon name="ic-caret-down-small" color="B500" rotateBy={270} />
45-
</div>
46-
</div>
47-
</div>
48-
49-
<span className={`fw-4 fs-13 lh-1-5 ${getDescriptionTruncate({})}`}>
50-
{chartGroup.description || 'No description'}
51-
</span>
52-
</div>
53-
)
54-
5534
const handleClick = () => {
5635
handleAnalyticsEvent({ category: 'Chart Store', action: 'CS_CHART_GROUP_CARD_CLICKED' })
5736
}
5837

59-
const renderFooter = () => (
60-
<div className="flex left dc__content-space dc__border-top-n1 px-20 py-16 dc__gap-6">
61-
<div className="flex">
62-
{getAlphabetIcon(chartGroup.createdBy)}
63-
<InteractiveCellText text={chartGroup.createdBy} rootClassName="cn-7 lh-1-5" fontSize={12} />
64-
</div>
65-
<span className="lh-20 dc__truncate m-0 dc__align-item-left cn-7 lh-1-5 dc__mxw-120 fs-12">
66-
{chartGroup.chartGroupEntries?.length || 0} charts
67-
</span>
68-
</div>
69-
)
70-
7138
return (
7239
<Link
7340
key={chartGroup.id}
@@ -94,10 +61,35 @@ export const ChartGroupCard = ({ chartGroup }: ChartGroupCardProps) => {
9461
</div>
9562
)}
9663
</div>
97-
{renderCardInfo()}
64+
<div className="flexbox-col flex-grow-1 dc__gap-8">
65+
<div className="flexbox-col dc__gap-2">
66+
<div className="flex left">
67+
<InteractiveCellText
68+
text={chartGroup.name}
69+
rootClassName="fw-6 chart-grid-item__title cn-9"
70+
fontSize={14}
71+
/>
72+
<div className="chart-name__arrow dc__no-shrink flex">
73+
<Icon name="ic-caret-down-small" color="B500" rotateBy={270} />
74+
</div>
75+
</div>
76+
</div>
77+
78+
<span className={`fw-4 fs-13 lh-1-5 ${getDescriptionTruncate({})}`}>
79+
{chartGroup.description || 'No description'}
80+
</span>
81+
</div>
9882
</div>
9983

100-
{renderFooter()}
84+
<div className="flex left dc__content-space dc__border-top-n1 px-20 py-16 dc__gap-6">
85+
<div className="flex">
86+
{getAlphabetIcon(chartGroup.createdBy)}
87+
<InteractiveCellText text={chartGroup.createdBy} rootClassName="cn-7 lh-1-5" fontSize={12} />
88+
</div>
89+
<span className="lh-20 dc__truncate m-0 dc__align-item-left cn-7 lh-1-5 dc__mxw-120 fs-12">
90+
{chartGroup.chartGroupEntries?.length || 0} charts
91+
</span>
92+
</div>
10193
</Link>
10294
)
10395
}

src/components/charts/list/DiscoverCharts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const DiscoverChartList = ({ isSuperAdmin }: { isSuperAdmin: boolean }) => {
119119

120120
const chartStoreRef = useRef<HTMLDivElement>(null)
121121

122-
const { open, overlayProps, popoverProps, triggerProps, scrollableRef, closePopover } = usePopover({
122+
const { open, overlayProps, popoverProps, triggerProps, closePopover } = usePopover({
123123
id: 'profile-menu',
124124
alignment: 'end',
125125
width: 250,

0 commit comments

Comments
 (0)