Skip to content

Commit ddc2d68

Browse files
iberdinsky-skilldiberdinsky-skilld
andauthored
Fix for long action name/description (#97)
Co-authored-by: iberdinsky-skilld <iberdinsky@slilld.cloud>
1 parent 051636f commit ddc2d68

File tree

4 files changed

+61
-3
lines changed

4 files changed

+61
-3
lines changed

client/src/components/ActionsFlow.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'reactflow/dist/style.css'
22

3+
import { Typography } from '@mui/material'
34
import Box from '@mui/material/Box'
45
import CircularProgress from '@mui/material/CircularProgress'
56
import Paper from '@mui/material/Paper'
@@ -118,6 +119,11 @@ const WhiteBand = ({ data }: { data: INodeData }) => {
118119
typography: 'subtitle2',
119120
fontSize: `${16 * elementsScaleCoef}px`,
120121
lineHeight: 1,
122+
overflow: 'hidden',
123+
textOverflow: 'ellipsis',
124+
display: '-webkit-box',
125+
WebkitLineClamp: '1',
126+
WebkitBoxOrient: 'vertical',
121127
}}
122128
>
123129
{data?.label}
@@ -128,7 +134,12 @@ const WhiteBand = ({ data }: { data: INodeData }) => {
128134
typography: 'subtitle2',
129135
fontSize: `${11 * elementsScaleCoef}px`,
130136
color: '#667085',
131-
lineHeight: 1.2,
137+
lineHeight: 1,
138+
overflow: 'hidden',
139+
textOverflow: 'ellipsis',
140+
display: '-webkit-box',
141+
WebkitLineClamp: '1',
142+
WebkitBoxOrient: 'vertical',
132143
}}
133144
>
134145
{data?.description}
@@ -232,7 +243,18 @@ function NodeWrapper({ data }: { data: INodeData }) {
232243
color: '#fff',
233244
}}
234245
>
235-
{data?.label}
246+
<Typography
247+
sx={{
248+
lineHeight: 1,
249+
overflow: 'hidden',
250+
textOverflow: 'ellipsis',
251+
display: '-webkit-box',
252+
WebkitLineClamp: '2',
253+
WebkitBoxOrient: 'vertical',
254+
}}
255+
>
256+
{data?.label}
257+
</Typography>
236258
{data.actionsAmount && (
237259
<Box
238260
className={'actions-pill'}

client/src/utils/react-flow-builder.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getCustomisation } from '../utils/page-customisation'
1010
// Coefficient less than 0.51 behaves unpredictably.
1111
// Use coefficient between 0.51 till endless
1212
export const elementsScaleCoef = 1
13-
export const actionWidth = 260 * elementsScaleCoef
13+
export const actionWidth = 300 * elementsScaleCoef
1414
export const actionHeight = 60 * elementsScaleCoef
1515
export const grandFolderGap = 80 * elementsScaleCoef
1616
export const folderLabelHeight = 50 * elementsScaleCoef
@@ -34,6 +34,10 @@ const layerColorSchemesHSL = [
3434
[346.93, 83.26, 57.84],
3535
[160.47, 68.42, 51.57],
3636
[252.15, 91.86, 66.27],
37+
[214.79, 87.25, 50.78],
38+
[346.93, 83.26, 57.84],
39+
[160.47, 68.42, 51.57],
40+
[252.15, 91.86, 66.27],
3741
]
3842

3943
export const buildNodeColor = ({
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
action:
2+
title: Lorem ipsum dolor sit amet, an nam copiosae principes pertinacia. Ea decore sanctus vel. Ut regione pertinacia vel. Dolorum facilis at vix
3+
description: Lorem ipsum dolor sit amet, an nam copiosae principes pertinacia. Ea decore sanctus vel. Ut regione pertinacia vel. Dolorum facilis at vix
4+
arguments:
5+
- name: arg1
6+
title: Argument 1
7+
description: Some additional info for arg
8+
- name: arg2
9+
title: Argument 2
10+
description: Some additional info for arg
11+
options: # TODO Use json schema. By default string. Do not allow complex data.
12+
- name: opt1
13+
title: Option 1
14+
description: Some additional info for option
15+
image: python:3.7-slim
16+
command: python3 %s
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
action:
2+
title: Lorem ipsum dolor sit amet, an nam copiosae principes pertinacia. Ea decore sanctus vel. Ut regione pertinacia vel. Dolorum facilis at vix
3+
description: Lorem ipsum dolor sit amet, an nam copiosae principes pertinacia. Ea decore sanctus vel. Ut regione pertinacia vel. Dolorum facilis at vix
4+
arguments:
5+
- name: arg1
6+
title: Argument 1
7+
description: Some additional info for arg
8+
- name: arg2
9+
title: Argument 2
10+
description: Some additional info for arg
11+
options: # TODO Use json schema. By default string. Do not allow complex data.
12+
- name: opt1
13+
title: Option 1
14+
description: Some additional info for option
15+
image: python:3.7-slim
16+
command: python3 %s

0 commit comments

Comments
 (0)