UNPKG

@craftercms/studio-ui

Version:

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

75 lines (73 loc) 3.01 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 ListItem from '@mui/material/ListItem'; import ListItemAvatar from '@mui/material/ListItemAvatar'; import PublishingStatusAvatar from '../PublishingStatusAvatar'; import ListItemText from '@mui/material/ListItemText'; import Skeleton from '@mui/material/Skeleton'; import * as React from 'react'; import { useIntl } from 'react-intl'; import { getPublishingStatusMessage, publishingStatusMessages } from './utils'; export function PublishingStatusDisplay(props) { const { isFetching, status, enabled, lockOwner, lockTTL } = props; const { formatMessage } = useIntl(); return React.createElement( React.Fragment, null, React.createElement( ListItem, { component: 'div' }, React.createElement( ListItemAvatar, null, React.createElement(PublishingStatusAvatar, { enabled: enabled, status: isFetching ? null : status }) ), React.createElement(ListItemText, { primary: isFetching ? React.createElement(Skeleton, null) : getPublishingStatusMessage(props, formatMessage), secondary: isFetching ? React.createElement(Skeleton, null) : React.createElement( React.Fragment, null, lockOwner && React.createElement( React.Fragment, null, formatMessage(publishingStatusMessages.lockOwner, { lockOwner }), React.createElement('br', null) ), lockTTL && formatMessage(publishingStatusMessages.lockTTL, { lockTTL }) ) }) ) ); } export default PublishingStatusDisplay;