2022-05-01 18:00:38 +02:00
|
|
|
import * as React from 'react';
|
2022-06-05 11:40:43 +02:00
|
|
|
import I18n from 'i18n-js';
|
2022-05-01 18:00:38 +02:00
|
|
|
|
|
|
|
|
import Spinner from './Spinner';
|
2022-06-08 10:20:36 +02:00
|
|
|
import Box from './Box';
|
2022-05-01 18:00:38 +02:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
areUpdating: boolean;
|
|
|
|
|
error: string;
|
2022-07-18 10:47:54 +02:00
|
|
|
areDirty?: boolean;
|
2024-08-29 22:14:04 +02:00
|
|
|
isSticky?: boolean;
|
|
|
|
|
saveButton?: React.ReactNode;
|
2022-05-01 18:00:38 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-29 22:14:04 +02:00
|
|
|
const SiteSettingsInfoBox = ({
|
|
|
|
|
areUpdating,
|
|
|
|
|
error,
|
|
|
|
|
areDirty = false,
|
|
|
|
|
isSticky = false,
|
|
|
|
|
saveButton = null,
|
|
|
|
|
}: Props) => (
|
|
|
|
|
<Box customClass={`siteSettingsInfo${isSticky ? ' siteSettingsInfoSticky' : ''}`}>
|
2022-05-01 18:00:38 +02:00
|
|
|
{
|
|
|
|
|
areUpdating ?
|
|
|
|
|
<Spinner />
|
|
|
|
|
:
|
|
|
|
|
error ?
|
2022-06-05 11:40:43 +02:00
|
|
|
<span className="error">
|
2022-07-18 10:47:54 +02:00
|
|
|
{ I18n.t('site_settings.info_box.error', { message: JSON.stringify(error) }) }
|
2022-06-05 11:40:43 +02:00
|
|
|
</span>
|
2022-05-01 18:00:38 +02:00
|
|
|
:
|
2022-07-18 10:47:54 +02:00
|
|
|
areDirty ?
|
2024-08-29 22:14:04 +02:00
|
|
|
<>
|
|
|
|
|
<span className="warning">{ I18n.t('site_settings.info_box.dirty') }</span>
|
|
|
|
|
{saveButton && saveButton}
|
|
|
|
|
</>
|
2022-07-18 10:47:54 +02:00
|
|
|
:
|
|
|
|
|
<span>{ I18n.t('site_settings.info_box.up_to_date') }</span>
|
2022-05-01 18:00:38 +02:00
|
|
|
}
|
2022-06-08 10:20:36 +02:00
|
|
|
</Box>
|
2022-05-01 18:00:38 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default SiteSettingsInfoBox;
|