Skip to content

Commit

Permalink
feat: Show project archived message (#7899)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Aug 15, 2024
1 parent 977f969 commit a3decb5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const ProjectArchiveCard: FC<ProjectArchiveCardProps> = ({
</StyledParagraphInfo>
<p data-loading>
<TimeAgo
minPeriod={60}
date={
new Date(archivedAt as string)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
);
};
7 changes: 7 additions & 0 deletions frontend/src/component/project/Project/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -189,6 +192,10 @@ export const Project = () => {
</Box>
);

if (archiveProjectsEnabled && Boolean(project.archivedAt)) {
return <ProjectArchived name={project.name} />;
}

return (
<div ref={ref}>
<StyledHeader>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/interfaces/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface IProjectOverview {
defaultStickiness: string;
featureLimit?: number;
featureNaming?: FeatureNamingType;
archivedAt?: Date;
}

export interface IProjectHealthReport extends IProject {
Expand Down

0 comments on commit a3decb5

Please sign in to comment.