2023-01-27 13:00:23 +01:00
|
|
|
import { FC } from 'react';
|
2023-02-03 12:58:21 +01:00
|
|
|
import { styled, Typography } from '@mui/material';
|
2023-01-27 13:00:23 +01:00
|
|
|
|
|
|
|
import {
|
|
|
|
StyledProjectInfoWidgetContainer,
|
|
|
|
StyledWidgetTitle,
|
|
|
|
} from './ProjectInfo.styles';
|
|
|
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
2023-02-03 12:58:21 +01:00
|
|
|
import { WidgetFooterLink } from './WidgetFooterLink';
|
2023-01-27 13:00:23 +01:00
|
|
|
|
|
|
|
interface IMetaWidgetProps {
|
|
|
|
id?: string;
|
|
|
|
description?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const StyledIDContainer = styled('div')(({ theme }) => ({
|
|
|
|
textAlign: 'left',
|
|
|
|
borderRadius: `${theme.shape.borderRadius}px`,
|
2023-03-06 11:58:36 +01:00
|
|
|
backgroundColor: `${theme.palette.background.elevation2}`,
|
2023-01-27 13:00:23 +01:00
|
|
|
padding: theme.spacing(0.5, 2),
|
|
|
|
fontSize: theme.typography.body2.fontSize,
|
|
|
|
}));
|
|
|
|
|
|
|
|
export const MetaWidget: FC<IMetaWidgetProps> = ({ id, description }) => {
|
|
|
|
return (
|
|
|
|
<StyledProjectInfoWidgetContainer>
|
2023-11-13 14:08:48 +01:00
|
|
|
<StyledWidgetTitle data-loading>Project Meta</StyledWidgetTitle>
|
|
|
|
<StyledIDContainer data-loading>
|
2023-01-27 13:00:23 +01:00
|
|
|
<Typography
|
2023-10-02 14:25:46 +02:00
|
|
|
component='span'
|
|
|
|
variant='body2'
|
|
|
|
color='text.secondary'
|
2023-01-27 13:00:23 +01:00
|
|
|
>
|
|
|
|
ID:
|
|
|
|
</Typography>{' '}
|
|
|
|
<code data-loading>{id || '__________'}</code>
|
|
|
|
</StyledIDContainer>
|
2023-02-03 12:58:21 +01:00
|
|
|
<ConditionallyRender
|
|
|
|
condition={Boolean(description)}
|
|
|
|
show={
|
|
|
|
<Typography
|
2023-11-13 14:08:48 +01:00
|
|
|
data-loading
|
2023-10-02 14:25:46 +02:00
|
|
|
variant='body2'
|
2023-02-03 12:58:21 +01:00
|
|
|
sx={{
|
2023-10-02 14:25:46 +02:00
|
|
|
marginTop: (theme) => theme.spacing(1.5),
|
2023-02-03 12:58:21 +01:00
|
|
|
marginBottom: 0,
|
|
|
|
textAlign: 'left',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{description}
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
<ConditionallyRender
|
2023-10-02 14:25:46 +02:00
|
|
|
condition={!description}
|
2023-02-03 12:58:21 +01:00
|
|
|
show={
|
2023-10-25 14:23:53 +02:00
|
|
|
<WidgetFooterLink to={`/projects/${id}/settings`}>
|
2023-02-03 12:58:21 +01:00
|
|
|
Add description
|
|
|
|
</WidgetFooterLink>
|
|
|
|
}
|
|
|
|
/>
|
2023-01-27 13:00:23 +01:00
|
|
|
</StyledProjectInfoWidgetContainer>
|
|
|
|
);
|
|
|
|
};
|