fix: apply feedback update

This commit is contained in:
yassinedorbozgithub 2024-12-19 07:16:06 +01:00
parent bc5d6d3303
commit fddaafc0e1

View File

@ -53,12 +53,14 @@ interface ContentFieldInput {
[key: string]: any; [key: string]: any;
} }
>; >;
idx: number;
} }
const ContentFieldInput: React.FC<ContentFieldInput> = ({ const ContentFieldInput: React.FC<ContentFieldInput> = ({
contentField: contentField, contentField: contentField,
field, field,
errors, errors,
idx,
}) => { }) => {
const { t } = useTranslate(); const { t } = useTranslate();
@ -68,7 +70,7 @@ const ContentFieldInput: React.FC<ContentFieldInput> = ({
case ContentFieldType.URL: case ContentFieldType.URL:
return ( return (
<Input <Input
autoFocus autoFocus={idx === 0}
multiline={contentField.type === ContentFieldType.TEXTAREA} multiline={contentField.type === ContentFieldType.TEXTAREA}
rows={contentField.type === ContentFieldType.TEXTAREA ? 5 : 1} rows={contentField.type === ContentFieldType.TEXTAREA ? 5 : 1}
label={t(`label.${contentField.name}`, { label={t(`label.${contentField.name}`, {
@ -226,7 +228,7 @@ export const ContentDialog: FC<ContentDialogProps> = ({
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<ContentContainer> <ContentContainer>
{(contentType?.fields || []).map((contentField) => ( {(contentType?.fields || []).map((contentField, index) => (
<ContentItem key={contentField.name}> <ContentItem key={contentField.name}>
<Controller <Controller
name={contentField.name} name={contentField.name}
@ -249,6 +251,7 @@ export const ContentDialog: FC<ContentDialogProps> = ({
contentField={contentField} contentField={contentField}
field={field} field={field}
errors={errors} errors={errors}
idx={index}
/> />
</FormControl> </FormControl>
)} )}