Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Show project archived message #7899

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading