Skip to content

Commit 593dcc3

Browse files
committed
chore: chart group created by integration
1 parent 4333e95 commit 593dcc3

File tree

6 files changed

+36
-21
lines changed

6 files changed

+36
-21
lines changed

src/components/charts/ChartGroupCard.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { Link } from 'react-router-dom'
1818

19-
import { handleAnalyticsEvent, Icon } from '@devtron-labs/devtron-fe-common-lib'
19+
import { getAlphabetIcon, handleAnalyticsEvent, Icon } from '@devtron-labs/devtron-fe-common-lib'
2020

2121
import { InteractiveCellText } from '@Components/common/helpers/InteractiveCellText/InteractiveCellText'
2222

@@ -27,6 +27,7 @@ import { getChartGroupSubgroup, getDescriptionTruncate } from './charts.util'
2727

2828
export const ChartGroupCard = ({ chartGroup }: ChartGroupCardProps) => {
2929
const chartGroupEntries = getChartGroupSubgroup(chartGroup.chartGroupEntries)
30+
3031
const GROUP_EDIT_LINK = getChartGroupURL(chartGroup.id)
3132

3233
const renderCardInfo = () => (
@@ -56,9 +57,9 @@ export const ChartGroupCard = ({ chartGroup }: ChartGroupCardProps) => {
5657

5758
const renderFooter = () => (
5859
<div className="flex left dc__content-space dc__border-top-n1 px-20 py-16 dc__gap-6">
59-
<div className="flex dc__gap-6">
60-
<Icon name="ic-folder-color" size={18} color={null} />
61-
<InteractiveCellText text="" rootClassName="cn-7 lh-1-5" fontSize={12} />
60+
<div className="flex">
61+
{getAlphabetIcon(chartGroup.createdBy)}
62+
<InteractiveCellText text={chartGroup.createdBy} rootClassName="cn-7 lh-1-5" fontSize={12} />
6263
</div>
6364
<span className="lh-20 dc__truncate m-0 dc__align-item-left cn-7 lh-1-5 dc__mxw-120 fs-12">
6465
{chartGroup.chartGroupEntries?.length || 0} charts
@@ -75,7 +76,15 @@ export const ChartGroupCard = ({ chartGroup }: ChartGroupCardProps) => {
7576
>
7677
<div className="flexbox-col h-166 dc__gap-12 px-20 pt-20 pb-16">
7778
<div className="flexbox">
78-
{chartGroupEntries?.map((chart) => <ChartIcon icon={chart.chartMetaData.icon} key={chart.id} />)}
79+
{chartGroupEntries?.length ? (
80+
chartGroupEntries.map((chart) => (
81+
<ChartIcon icon={chart.chartMetaData.icon} key={chart.id} isChartGroupCard />
82+
))
83+
) : (
84+
<div className="dc__border-dashed bg__secondary br-8 p-8 dc__w-fit-content h-50">
85+
<Icon name="ic-folder-color" size={32} color={null} />
86+
</div>
87+
)}
7988
</div>
8089
{renderCardInfo()}
8190
</div>

src/components/charts/ChartIcon.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ import { ImageWithFallback } from '@devtron-labs/devtron-fe-common-lib'
22

33
import { ReactComponent as Helm } from '../../assets/icons/ic-default-chart.svg'
44

5-
const ChartIcon = ({ icon }: { icon: string }) => {
6-
const chartIconClass = 'dc__chart-grid-item__icon chart-icon-dim br-4 dc__no-shrink'
5+
const ChartIcon = ({ icon, isChartGroupCard }: { icon: string; isChartGroupCard?: boolean }) => {
6+
const chartIconClass = `dc__chart-grid-item__icon icon-dim-32 ${isChartGroupCard ? 'chart-group-card__icon' : 'chart-icon-dim'} br-4 dc__no-shrink`
77

88
return (
9-
<div className="icon-wrapper">
9+
<div
10+
className={`${isChartGroupCard ? 'chart-group-card__icon-wrapper' : 'chart-card__icon-wrapper'} border__secondary-translucent bg__secondary br-8 p-8 dc__w-fit-content h-50`}
11+
>
1012
<ImageWithFallback
1113
imageProps={{
1214
height: 32,
1315
width: 32,
1416
src: icon,
1517
alt: 'chart',
16-
className: 'dc__chart-grid-item__icon chart-icon-dim br-4 dc__no-shrink',
18+
className: chartIconClass,
1719
}}
1820
fallbackImage={<Helm className={chartIconClass} />}
1921
/>

src/components/charts/charts.scss

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,8 @@
2222
background-color: var(--B50);
2323
}
2424

25-
.icon-wrapper {
26-
border: 1px solid var(--border-secondary-translucent);
27-
background-color: var(--bg-secondary);
28-
border-radius: 8px;
29-
padding: 8px;
30-
width: fit-content;
31-
height: 50px;
32-
}
3325

3426
.chart-icon-dim {
35-
width: 32px;
36-
height: 32px;
3727
transition: transform 0.17s ease-out;
3828
}
3929
}
@@ -54,7 +44,7 @@
5444
color: var(--B500);
5545
}
5646

57-
.icon-wrapper {
47+
.chart-card__icon-wrapper {
5848
border: 1px solid transparent;
5949
background-color: transparent;
6050
}
@@ -67,6 +57,10 @@
6757
transform: translateX(30%);
6858
visibility: visible;
6959
}
60+
61+
.chart-group-card__icon-wrapper {
62+
margin-right: -12px;
63+
}
7064
}
7165

7266
.devtron-stepper {
@@ -152,6 +146,11 @@
152146
overflow: hidden;
153147
}
154148

149+
.chart-group-card__icon-wrapper {
150+
margin-right: -24px;
151+
transition: transform 0.17s ease-out, margin-right 0.3s ease-out;
152+
}
153+
155154
.deploy-selected-charts__applications-edit {
156155
background-color: transparent;
157156
padding: 0px;

src/components/charts/charts.types.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export interface ChartGroup {
160160
name: string
161161
description: string
162162
chartGroupEntries: ChartGroupEntry[]
163+
createdBy: string
163164
}
164165

165166
export interface ChartEntryIdType {

src/components/charts/charts.util.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const renderDeprecatedWarning = () => {
5050

5151
export const getChartGroupSubgroup = (chartGroupEntries): ChartGroupEntry[] => {
5252
let len = chartGroupEntries.length
53-
len = len < 8 ? len : 8
53+
len = len < 4 ? len : 4
5454
return chartGroupEntries.slice(0, len)
5555
}
5656

src/css/base.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,6 +3306,10 @@ button.anchor {
33063306
height: 48px !important;
33073307
}
33083308

3309+
.h-50 {
3310+
height: 50px !important;
3311+
}
3312+
33093313
.h-56 {
33103314
height: 56px !important;
33113315
}

0 commit comments

Comments
 (0)