Skip to content

Commit 1ed517f

Browse files
committed
feat: add hideShowMoreMessageButton prop to WorkerStatus and ShowMoreText components for better control over message display
1 parent 45489be commit 1ed517f

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/Shared/Components/CICDHistory/BuildAndTaskSummaryTooltipCard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const BuildAndTaskSummaryTooltipCard = memo(
4545
workerMessageContainerClassName="cn-7 fs-12 fw-4 lh-18"
4646
titleClassName="cn-9 fs-12 fw-4 lh-20"
4747
viewWorkerPodClassName="fs-12"
48+
hideShowMoreMessageButton
4849
/>
4950
</div>
5051

src/Shared/Components/CICDHistory/TriggerOutput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export const WorkerStatus = React.memo(
139139
workerMessageContainerClassName,
140140
titleClassName = 'cn-9 fs-13 fw-4 lh-20',
141141
viewWorkerPodClassName = 'fs-13',
142+
hideShowMoreMessageButton = false,
142143
}: WorkerStatusType): JSX.Element | null => {
143144
if (!message && !podStatus) {
144145
return null
@@ -191,6 +192,7 @@ export const WorkerStatus = React.memo(
191192
key={message}
192193
textClass="cn-7"
193194
containerClass={workerMessageContainerClassName}
195+
hideShowMore={hideShowMoreMessageButton}
194196
/>
195197
)}
196198
</div>

src/Shared/Components/CICDHistory/types.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ export interface WorkerStatusType
348348
workerMessageContainerClassName?: string
349349
titleClassName?: string
350350
viewWorkerPodClassName?: string
351+
/**
352+
* @default false
353+
*/
354+
hideShowMoreMessageButton?: boolean
351355
}
352356

353357
export type FinishedType = { artifact: string; type: HistoryComponentType } & (

src/Shared/Components/ShowMoreText/ShowMoreText.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ interface ShowMoreTextProps {
2121
text: string
2222
textClass?: string
2323
containerClass?: string
24+
hideShowMore?: boolean
2425
}
2526

26-
const ShowMoreText = ({ text, textClass, containerClass = 'min-w-385 pr-20' }: ShowMoreTextProps) => {
27+
const ShowMoreText = ({ text, textClass, containerClass = 'min-w-385 pr-20', hideShowMore }: ShowMoreTextProps) => {
2728
const ellipsisText = useRef(null)
2829
const [showToggle, setShowToggle] = useState(false)
2930
const [showAllText, setShowAllText] = useState(false)
3031

3132
useEffect(() => {
32-
if (ellipsisText.current?.offsetHeight && ellipsisText.current?.scrollHeight) {
33+
if (!hideShowMore && ellipsisText.current?.offsetHeight && ellipsisText.current?.scrollHeight) {
3334
if (ellipsisText.current.offsetHeight === ellipsisText.current?.scrollHeight) {
3435
setShowToggle(false)
3536
} else {
@@ -46,7 +47,7 @@ const ShowMoreText = ({ text, textClass, containerClass = 'min-w-385 pr-20' }: S
4647
<div className={containerClass}>
4748
<span
4849
ref={ellipsisText}
49-
className={`${textClass || ''} ${!showAllText ? 'dc__truncate' : ''} dc__word-break`}
50+
className={`${textClass || ''} ${hideShowMore ? 'dc__truncate--clamp-3' : ''} ${!showAllText ? 'dc__truncate' : ''} dc__word-break`}
5051
>
5152
{text}
5253
</span>

0 commit comments

Comments
 (0)