Skip to content

Commit

Permalink
fix: simplify ApiInformationDialog component
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jul 9, 2020
1 parent d7edc0a commit 757d906
Showing 1 changed file with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from "emotion";
import { i18n } from "@webiny/app/i18n";
import { Dialog, DialogTitle, DialogContent } from "@webiny/ui/Dialog";
import { getPlugins } from "@webiny/plugins";
import { ApiInformationDialog } from "@webiny/app-admin/types";
import { ApiInformationDialogPlugin } from "@webiny/app-admin/types";

export type NewContentModelDialogProps = {
open: boolean;
Expand All @@ -23,36 +23,23 @@ const style = {
})
};

const EnvironmentInfoDialog: React.FC<NewContentModelDialogProps> = ({
open,
onClose,
name,
type
}) => {
const adminInfoPlugins = getPlugins<ApiInformationDialog>(
"admin-api-information-dialog"
);
const ApiInformationDialog: React.FC<NewContentModelDialogProps> = ({ open, onClose }) => {
const adminInfoPlugins = getPlugins<ApiInformationDialogPlugin>("admin-api-information-dialog");
return (
<Dialog
open={open}
onClose={onClose}
className={style.narrowDialog}
data-testid="environment-info-modal"
>
<DialogTitle>{t`Environment: `}{name}</DialogTitle>
<DialogTitle>{t`API Information`}</DialogTitle>
<DialogContent>
{
adminInfoPlugins.map(pl => {
return (
<div key={pl.name}>
{pl.render({ name, type })}
</div>
)
})
}
{adminInfoPlugins.map(pl => (
<div key={pl.name}>{pl.render()}</div>
))}
</DialogContent>
</Dialog>
)
);
};

export default EnvironmentInfoDialog;
export default ApiInformationDialog;

0 comments on commit 757d906

Please sign in to comment.