1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-09 00:18:26 +01:00

feat: Show project archived message (#7899)

This commit is contained in:
Mateusz Kwasniewski 2024-08-15 14:56:12 +02:00 committed by GitHub
parent 977f969b80
commit a3decb543f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 0 deletions

View File

@ -85,6 +85,7 @@ export const ProjectArchiveCard: FC<ProjectArchiveCardProps> = ({
</StyledParagraphInfo>
<p data-loading>
<TimeAgo
minPeriod={60}
date={
new Date(archivedAt as string)
}

View File

@ -0,0 +1,12 @@
import { Link } from 'react-router-dom';
import type { FC } from 'react';
export const ProjectArchived: FC<{ name: string }> = ({ name }) => {
return (
<p>
The project <strong>{name}</strong> has been archived. You can find
it on the{' '}
<Link to={`/projects-archive`}>projects archive page</Link>.
</p>
);
};

View File

@ -43,6 +43,8 @@ import { ChangeRequestPlausibleProvider } from 'component/changeRequest/ChangeRe
import { ProjectApplications } from '../ProjectApplications/ProjectApplications';
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
import { ProjectArchived } from './ArchiveProject/ProjectArchived';
import { useUiFlag } from 'hooks/useUiFlag';
const StyledBadge = styled(Badge)(({ theme }) => ({
position: 'absolute',
@ -75,6 +77,7 @@ export const Project = () => {
const basePath = `/projects/${projectId}`;
const projectName = project?.name || projectId;
const { favorite, unfavorite } = useFavoriteProjectsApi();
const archiveProjectsEnabled = useUiFlag('archiveProjects');
const [showDelDialog, setShowDelDialog] = useState(false);
@ -189,6 +192,10 @@ export const Project = () => {
</Box>
);
if (archiveProjectsEnabled && Boolean(project.archivedAt)) {
return <ProjectArchived name={project.name} />;
}
return (
<div ref={ref}>
<StyledHeader>

View File

@ -59,6 +59,7 @@ export interface IProjectOverview {
defaultStickiness: string;
featureLimit?: number;
featureNaming?: FeatureNamingType;
archivedAt?: Date;
}
export interface IProjectHealthReport extends IProject {