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"
},
"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": {
"select_pagination": "Bitte wählen Sie einen Paginierungstyp aus.",

View File

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

View File

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

View File

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

View File

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

View File

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