Skip to content

Commit f3f4846

Browse files
committed
feat: add utility functions for app status management and update AppStatusModal to utilize dynamic titles
1 parent 0995322 commit f3f4846

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/Shared/Components/AppStatusModal/AppStatusModal.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const AppStatusModal = ({
127127
>
128128
<div className="flexbox-col px-20 border__primary--bottom dc__no-shrink">
129129
<div className="flexbox py-12 dc__content-space">
130-
<div className="fs-16 fw-6 lh-1-5">{title}</div>
130+
{title}
131131

132132
<Button
133133
dataTestId="close-modal-header-icon-button"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as AppStatusContent } from './AppStatusContent'
22
export { default as AppStatusModal } from './AppStatusModal.component'
3+
export { getAppStatusModalTitle } from './utils'

src/Shared/Components/AppStatusModal/utils.ts renamed to src/Shared/Components/AppStatusModal/utils.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Fragment } from 'react'
2+
13
import { DEPLOYMENT_STATUS } from '@Shared/constants'
24
import { aggregateNodes } from '@Shared/Helpers'
35
import { AppDetails, Node } from '@Shared/types'
@@ -64,3 +66,18 @@ export const getFlattenedNodesFromAppDetails = ({
6466
}
6567

6668
export const getResourceKey = (nodeDetails: Node) => `${nodeDetails.kind}/${nodeDetails.name}`
69+
70+
export const getAppStatusModalTitle = (segments: string[]) => {
71+
const filteredSegments = (segments || []).filter((segment) => !!segment)
72+
73+
return (
74+
<h2 className="m-0 dc__truncate fs-16 fw-6 lh-1-5">
75+
{filteredSegments?.map((segment, index) => (
76+
<Fragment key={segment}>
77+
{segment}
78+
{index !== segments.length - 1 && <span className="cn-6 fs-16 fw-4">/</span>}
79+
</Fragment>
80+
))}
81+
</h2>
82+
)
83+
}

0 commit comments

Comments
 (0)