export const AsDeploymentList = () => {
const { text, color } = useTheme();
const deploymentColumns: DataTableColumn<Deployment>[] = [
{
id: 'message',
header: 'Déploiement',
width: 400,
renderCell: deployment => <Typography style={text['Corps de texte'].SM.Regular}>{deployment.message}</Typography>,
},
{
id: 'status',
header: 'Statut',
width: 140,
renderCell: deployment => (
<Box display="flex" flexDirection="row" gap={'1W'} style={{ alignItems: 'center' }}>
<Badge variant={deployment.status === 'error' ? 'error' : 'success'} size="sm">
{deployment.status === 'error' ? 'Error' : 'Ready'}
</Badge>
<Typography style={{ ...text['Corps de texte'].SM.Regular, color: color.light.text['mention-grey'] }}>
{deployment.duration}
</Typography>
</Box>
),
},
{
id: 'environment',
header: 'Environnement',
width: 100,
renderCell: deployment => (
<Tag color={deployment.promoted ? 'action' : 'default'} size="sm">
{deployment.environment === 'production' ? 'Production' : 'Preview'}
</Tag>
),
},
{
id: 'commit',
header: 'Commit',
width: 110,
renderCell: deployment => (
<Box display="flex" flexDirection="row" gap={'1V'} style={{ alignItems: 'center' }}>
<LucideIcon name="GitCommitHorizontal" size="sm" />
<Typography style={{ ...text['Corps de texte'].SM.Regular, fontFamily: 'monospace' }}>
{deployment.commit}
</Typography>
</Box>
),
},
{
id: 'source',
header: 'Source',
width: 353,
renderCell: deployment => (
<Box display="flex" flexDirection="row" gap={'1V'} style={{ alignItems: 'center', minWidth: 0 }}>
<LucideIcon name="GitBranch" size="sm" />
<Typography
style={{
...text['Corps de texte'].SM.Regular,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{deployment.source}
</Typography>
</Box>
),
},
{
id: 'date',
header: 'Date',
width: 70,
renderCell: deployment => <DeploymentDateCell deployment={deployment} />,
},
{
id: 'author',
header: '',
width: 56,
renderCell: deployment => <Avatar size="sm" fallbackText={deployment.author} />,
},
{
id: 'actions',
header: '',
width: 40,
align: 'end',
renderCell: () => <DeploymentActionsCell />,
},
];
return (
<Box display="flex" flexDirection="column" gap={'3V'}>
<Typography style={{ fontSize: 20, fontWeight: 700 }}>Deployments</Typography>
<DataTable
size="md"
data={deployments}
columns={deploymentColumns}
keyExtractor={deployment => deployment.id}
hideHeader
/>
<Box display="flex" flexDirection="column" gap="1W">
<Box>
<Button title="Charger plus" variant="secondary" size="md" fullWidth />
</Box>
<Box display="flex" flexDirection="row" style={{ alignItems: 'center', justifyContent: 'space-between' }}>
<Typography style={{ ...text['Corps de texte'].XS.Regular, color: color.light.text['mention-grey'] }}>
La rétention des déploiements est activée — certains seront supprimés après un délai.
</Typography>
<Button title="Voir les supprimés" variant="secondary" size="sm" />
</Box>
</Box>
</Box>
);
};