Merge pull request #300 from getmaxun/listui-fix

feat: add message to display list being empty
This commit is contained in:
Karishma Shukla
2025-01-13 13:30:04 +05:30
committed by GitHub
6 changed files with 68 additions and 70 deletions

View File

@@ -192,7 +192,8 @@
"field_data": "Felddaten" "field_data": "Felddaten"
}, },
"messages": { "messages": {
"list_selected": "Liste erfolgreich ausgewählt" "list_selected": "Liste erfolgreich ausgewählt",
"list_empty": "Liste ausgewählt. Bitte wählen Sie Felder innerhalb der Liste aus."
}, },
"errors": { "errors": {
"select_pagination": "Bitte wählen Sie einen Paginierungstyp aus.", "select_pagination": "Bitte wählen Sie einen Paginierungstyp aus.",

View File

@@ -193,7 +193,8 @@
"field_data": "Field Data" "field_data": "Field Data"
}, },
"messages": { "messages": {
"list_selected": "List Selected Successfully" "list_selected": "List Selected Successfully",
"list_empty": "List selected. Please select fields inside the list."
}, },
"errors": { "errors": {
"select_pagination": "Please select a pagination type.", "select_pagination": "Please select a pagination type.",

View File

@@ -193,7 +193,8 @@
"field_data": "Datos del Campo" "field_data": "Datos del Campo"
}, },
"messages": { "messages": {
"list_selected": "Lista seleccionada exitosamente" "list_selected": "Lista seleccionada exitosamente",
"list_empty": "Lista seleccionada. Seleccione los campos dentro de la lista."
}, },
"errors": { "errors": {
"select_pagination": "Por favor seleccione un tipo de paginación.", "select_pagination": "Por favor seleccione un tipo de paginación.",

View File

@@ -193,7 +193,8 @@
"field_data": "フィールドデータ" "field_data": "フィールドデータ"
}, },
"messages": { "messages": {
"list_selected": "リストが正常に選択されました" "list_selected": "リストが正常に選択されました",
"list_empty": "リストが選択されました。リスト内のフィールドを選択してください。"
}, },
"errors": { "errors": {
"select_pagination": "ページネーションタイプを選択してください。", "select_pagination": "ページネーションタイプを選択してください。",

View File

@@ -193,7 +193,8 @@
"field_data": "字段数据" "field_data": "字段数据"
}, },
"messages": { "messages": {
"list_selected": "列表选择成功" "list_selected": "列表选择成功",
"list_empty": "已选择列表。请选择列表内的字段。"
}, },
"errors": { "errors": {
"select_pagination": "请选择分页类型。", "select_pagination": "请选择分页类型。",

View File

@@ -747,71 +747,64 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
</Box> </Box>
)} )}
{step.type === 'list' && ( {step.type === 'list' && (
<> Object.entries(step.fields).length === 0 ? (
<Typography>{t('right_panel.messages.list_selected')}</Typography> <Typography>{t('right_panel.messages.list_empty')}</Typography>
{Object.entries(step.fields).map(([key, field]) => ( ) : (
<Box key={key} sx={{ background: `${isDarkMode ? "#1E2124" : 'white'}` }}> <>
<TextField <Typography>{t('right_panel.messages.list_selected')}</Typography>
label={t('right_panel.fields.field_label')} {Object.entries(step.fields).map(([key, field]) => (
value={field.label || ''} <Box key={key}>
onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)} <TextField
fullWidth label={t('right_panel.fields.field_label')}
margin="normal" value={field.label || ''}
InputProps={{ onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)}
readOnly: confirmedListTextFields[field.id]?.[key], fullWidth
startAdornment: ( margin="normal"
<InputAdornment position="start"> InputProps={{
<EditIcon /> readOnly: confirmedListTextFields[field.id]?.[key],
</InputAdornment> startAdornment: (
) <InputAdornment position="start">
}} <EditIcon />
/> </InputAdornment>
<TextField )
label={t('right_panel.fields.field_data')} }}
value={field.data || ''} />
fullWidth <TextField
margin="normal" label={t('right_panel.fields.field_data')}
InputProps={{ value={field.data || ''}
readOnly: true, fullWidth
startAdornment: ( margin="normal"
<InputAdornment position="start"> InputProps={{
<TextFieldsIcon /> readOnly: true,
</InputAdornment> startAdornment: (
) <InputAdornment position="start">
}} <TextFieldsIcon />
</InputAdornment>
/> )
{!confirmedListTextFields[step.id]?.[key] ? ( }}
<Box display="flex" justifyContent="space-between" gap={2}> />
<Button {!confirmedListTextFields[step.id]?.[key] && (
variant="contained" <Box display="flex" justifyContent="space-between" gap={2}>
onClick={() => handleListTextFieldConfirm(step.id, key)} <Button
disabled={!field.label?.trim()} variant="contained"
> onClick={() => handleListTextFieldConfirm(step.id, key)}
{t('right_panel.buttons.confirm')} disabled={!field.label?.trim()}
</Button> >
<Button {t('right_panel.buttons.confirm')}
variant="contained" </Button>
color="error" <Button
onClick={() => handleListTextFieldDiscard(step.id, key)} variant="contained"
> color="error"
{t('right_panel.buttons.discard')} onClick={() => handleListTextFieldDiscard(step.id, key)}
</Button> >
</Box> {t('right_panel.buttons.discard')}
) : !isCaptureListConfirmed && ( </Button>
<Box display="flex" justifyContent="flex-end" gap={2}> </Box>
<Button )}
variant="contained" </Box>
color="error" ))}
onClick={() => handleListTextFieldDelete(step.id, key)} </>
> )
{t('right_panel.buttons.delete')}
</Button>
</Box>
)}
</Box>
))}
</>
)} )}
</Box> </Box>
))} ))}