
* Add analysis tools * Use deep imports to reduce bundle size * Remove tslint config * Remove unused packages * Remove lodash-es references * Use root level mui imports * Remove mui from restricted imports
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
import { Card, CardContent, TextField } from "@material-ui/core";
|
|
import CardTitle from "@saleor/components/CardTitle";
|
|
import { AppErrorFragment } from "@saleor/fragments/types/AppErrorFragment";
|
|
import { FormChange } from "@saleor/hooks/useForm";
|
|
import { getFormErrors } from "@saleor/utils/errors";
|
|
import getAppErrorMessage from "@saleor/utils/errors/app";
|
|
import React from "react";
|
|
import { useIntl } from "react-intl";
|
|
|
|
export interface CustomAppInfoProps {
|
|
data: {
|
|
name: string;
|
|
};
|
|
disabled: boolean;
|
|
errors: AppErrorFragment[];
|
|
onChange: FormChange;
|
|
}
|
|
|
|
const CustomAppInformation: React.FC<CustomAppInfoProps> = ({
|
|
data,
|
|
disabled,
|
|
errors,
|
|
onChange
|
|
}) => {
|
|
const intl = useIntl();
|
|
|
|
const formErrors = getFormErrors(["name"], errors);
|
|
|
|
return (
|
|
<Card>
|
|
<CardTitle
|
|
title={intl.formatMessage({
|
|
defaultMessage: "App Information",
|
|
description: "header"
|
|
})}
|
|
/>
|
|
<CardContent>
|
|
<TextField
|
|
disabled={disabled}
|
|
error={!!formErrors.name}
|
|
label={intl.formatMessage({
|
|
defaultMessage: "App Name",
|
|
description: "custom app name"
|
|
})}
|
|
helperText={getAppErrorMessage(formErrors.name, intl)}
|
|
fullWidth
|
|
name="name"
|
|
value={data.name}
|
|
onChange={onChange}
|
|
/>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
CustomAppInformation.displayName = "CustomAppInformation";
|
|
export default CustomAppInformation;
|