2019-08-26 17:08:32 +00:00
|
|
|
import Card from "@material-ui/core/Card";
|
|
|
|
import CardContent from "@material-ui/core/CardContent";
|
|
|
|
import Typography from "@material-ui/core/Typography";
|
2019-08-30 11:58:48 +00:00
|
|
|
import makeStyles from "@material-ui/styles/makeStyles";
|
2019-08-26 17:08:32 +00:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import CardTitle from "@saleor/components/CardTitle";
|
|
|
|
import ControlledSwitch from "@saleor/components/ControlledSwitch";
|
|
|
|
import FormSpacer from "@saleor/components/FormSpacer";
|
|
|
|
import Hr from "@saleor/components/Hr";
|
|
|
|
import i18n from "../../../i18n";
|
|
|
|
import { FormData } from "../PluginsDetailsPage";
|
|
|
|
|
|
|
|
interface PluginInfoProps {
|
|
|
|
data: FormData;
|
2019-08-30 11:46:50 +00:00
|
|
|
description: string;
|
|
|
|
name: string;
|
2019-08-26 17:08:32 +00:00
|
|
|
onChange: (event: React.ChangeEvent<any>) => void;
|
|
|
|
}
|
|
|
|
|
2019-08-30 11:58:48 +00:00
|
|
|
const useStyles = makeStyles(() => ({
|
2019-08-27 12:36:19 +00:00
|
|
|
status: {
|
|
|
|
paddingTop: 20
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
fontSize: 14,
|
|
|
|
paddingTop: 10
|
|
|
|
}
|
2019-08-30 11:58:48 +00:00
|
|
|
}));
|
2019-08-26 17:08:32 +00:00
|
|
|
|
2019-08-30 11:58:48 +00:00
|
|
|
const PluginInfo: React.StatelessComponent<PluginInfoProps> = ({
|
|
|
|
data,
|
|
|
|
description,
|
|
|
|
name,
|
|
|
|
onChange
|
|
|
|
}) => {
|
|
|
|
const classes = useStyles({});
|
|
|
|
return (
|
|
|
|
<Card>
|
|
|
|
<CardTitle
|
|
|
|
title={i18n.t("Plugin Information and Status", {
|
|
|
|
context: "plugin configuration"
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
<CardContent>
|
|
|
|
<Typography className={classes.title} variant="h6">
|
|
|
|
{i18n.t("Plugin Name")}
|
|
|
|
</Typography>
|
|
|
|
<Typography>{name}</Typography>
|
|
|
|
{description && (
|
|
|
|
<>
|
|
|
|
<Typography className={classes.title} variant="h6">
|
|
|
|
{i18n.t("Plugin Description")}
|
|
|
|
</Typography>
|
|
|
|
<Typography>{description}</Typography>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<FormSpacer />
|
|
|
|
<Hr />
|
|
|
|
<Typography className={classes.status}>{i18n.t("Status")}</Typography>
|
|
|
|
<ControlledSwitch
|
|
|
|
checked={data.active}
|
|
|
|
label={"Set plugin as Active"}
|
|
|
|
name={"active" as keyof FormData}
|
|
|
|
onChange={onChange}
|
2019-08-26 17:08:32 +00:00
|
|
|
/>
|
2019-08-30 11:58:48 +00:00
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|
2019-08-26 17:08:32 +00:00
|
|
|
PluginInfo.displayName = "PluginInfo";
|
|
|
|
export default PluginInfo;
|