1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00
unleash.unleash/frontend/src/component/common/Table/cells/FeatureSeenCell/FeatureEnvironmentSeenCell.tsx
2025-04-09 13:44:32 +02:00

72 lines
1.9 KiB
TypeScript

import React, { type VFC } from 'react';
import { FeatureEnvironmentSeen } from 'component/feature/FeatureView/FeatureEnvironmentSeen/FeatureEnvironmentSeen';
import type { FeatureSearchEnvironmentSchema } from 'openapi';
import { FeatureLifecycle } from 'component/feature/FeatureView/FeatureOverview/FeatureLifecycle/FeatureLifecycle';
import { Box } from '@mui/material';
interface IFeatureSeenCellProps {
feature: {
environments?: FeatureSearchEnvironmentSchema[];
lastSeenAt?: string | null;
};
}
export const FeatureEnvironmentSeenCell: VFC<IFeatureSeenCellProps> = ({
feature,
...rest
}) => {
const environments = feature.environments
? Object.values(feature.environments)
: [];
return (
<FeatureEnvironmentSeen
featureLastSeen={feature.lastSeenAt || undefined}
environments={environments}
{...rest}
/>
);
};
interface IFeatureLifecycleProps {
feature: {
environments?: FeatureSearchEnvironmentSchema[];
lastSeenAt?: string | null;
project: string;
name: string;
};
onComplete?: () => void;
onUncomplete?: () => void;
onArchive?: () => void;
expanded?: boolean;
}
export const FeatureLifecycleCell: VFC<IFeatureLifecycleProps> = ({
feature,
onComplete,
onUncomplete,
onArchive,
expanded,
...rest
}) => {
const environments = feature.environments
? Object.values(feature.environments)
: [];
return (
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
<FeatureLifecycle
onArchive={onArchive}
onComplete={onComplete}
onUncomplete={onUncomplete}
feature={feature}
expanded={expanded}
/>
</Box>
);
};
export const MemoizedFeatureEnvironmentSeenCell = React.memo(
FeatureEnvironmentSeenCell,
);