UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

83 lines (81 loc) 3.08 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import Grid from '@mui/material/Grid'; import PluginCard from '../PluginCard'; import { FormattedMessage } from 'react-intl'; import React from 'react'; import EmptyState from '../EmptyState/EmptyState'; export function PluginList(props) { const { plugins, onPluginDetails, onPluginSelected, installedPlugins = {}, installPermission, installingLookup = {} } = props; return React.createElement( Grid, { container: true, spacing: 3 }, plugins.length === 0 ? React.createElement(EmptyState, { styles: { root: { flexGrow: 1, justifyContent: 'center' } }, title: React.createElement(FormattedMessage, { id: 'InstallPluginDialog.empty', defaultMessage: 'No plugins found.' }) }) : plugins.map((plugin) => React.createElement( Grid, { item: true, xs: 12, sm: 6, md: 4, key: plugin.id }, React.createElement(PluginCard, { plugin: plugin, inUse: Boolean(installedPlugins[plugin.id]), usePermission: installPermission, disableCardActionClick: true, useLabel: Boolean(installedPlugins[plugin.id]) ? React.createElement(FormattedMessage, { id: 'words.installed', defaultMessage: 'Installed' }) : React.createElement(FormattedMessage, { id: 'words.install', defaultMessage: 'Install' }), beingInstalled: installingLookup[plugin.id], onDetails: onPluginDetails, onPluginSelected: onPluginSelected }) ) ) ); } export default PluginList;