Skip to content

Commit

Permalink
[Gitar] Updating TSX files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitar committed Sep 20, 2024
1 parent 0e6d062 commit 24ac541
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 40 deletions.
4 changes: 1 addition & 3 deletions frontend/src/component/project/Project/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ 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 @@ -77,7 +76,6 @@ 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 @@ -192,7 +190,7 @@ export const Project = () => {
</Box>
);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import { Alert, styled } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { UpdateEnterpriseSettings } from './UpdateEnterpriseSettings';
import { UpdateProject } from './UpdateProject';
import { DeleteProjectForm } from './DeleteProjectForm';
import useProjectOverview, {
featuresCount,
} from 'hooks/api/getters/useProjectOverview/useProjectOverview';
import { ArchiveProjectForm } from './ArchiveProjectForm';
import { useUiFlag } from 'hooks/useUiFlag';

const StyledFormContainer = styled('div')(({ theme }) => ({
display: 'flex',
Expand All @@ -28,7 +26,6 @@ const EditProject = () => {
const { hasAccess } = useContext(AccessContext);
const id = useRequiredPathParam('projectId');
const { project } = useProjectOverview(id);
const archiveProjectsEnabled = useUiFlag('archiveProjects');

if (!project.name) {
return null;
Expand All @@ -52,19 +49,7 @@ const EditProject = () => {
condition={isEnterprise()}
show={<UpdateEnterpriseSettings project={project} />}
/>
<ConditionallyRender
condition={archiveProjectsEnabled}
show={
<ArchiveProjectForm
featureCount={featuresCount(project)}
/>
}
elseShow={
<DeleteProjectForm
featureCount={featuresCount(project)}
/>
}
/>
<ArchiveProjectForm featureCount={featuresCount(project)} />
</StyledFormContainer>
</>
);
Expand Down
25 changes: 9 additions & 16 deletions frontend/src/component/project/ProjectList/LegacyProjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { useProfile } from 'hooks/api/getters/useProfile/useProfile';
import { groupProjects } from './group-projects';
import { ProjectGroup } from './ProjectGroup';
import { CreateProjectDialog } from '../Project/CreateProject/NewCreateProjectForm/CreateProjectDialog';
import { useUiFlag } from 'hooks/useUiFlag';

const StyledApiError = styled(ApiError)(({ theme }) => ({
maxWidth: '500px',
Expand Down Expand Up @@ -126,7 +125,6 @@ export const ProjectList = () => {
const [searchValue, setSearchValue] = useState(
searchParams.get('search') || '',
);
const archiveProjectsEnabled = useUiFlag('archiveProjects');

const myProjects = new Set(useProfile().profile?.projects || []);

Expand Down Expand Up @@ -200,20 +198,15 @@ export const ProjectList = () => {
</>
}
/>
<ConditionallyRender
condition={Boolean(archiveProjectsEnabled)}
show={
<>
<Link
component={RouterLink}
to='/projects-archive'
>
Archived projects
</Link>
<PageHeader.Divider />
</>
}
/>
<>
<Link
component={RouterLink}
to='/projects-archive'
>
Archived projects
</Link>
<PageHeader.Divider />
</>

<ProjectCreationButton />
</>
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/component/project/ProjectList/ProjectList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const NewProjectList = () => {
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));

const [state, setState] = useProjectsListState();
const archiveProjectsEnabled = useUiFlag('archiveProjects');

const myProjects = new Set(useProfile().profile?.projects || []);

Expand Down Expand Up @@ -78,10 +77,7 @@ const NewProjectList = () => {
}
/>

<ConditionallyRender
condition={Boolean(archiveProjectsEnabled)}
show={<ProjectArchiveLink />}
/>
<ProjectArchiveLink />
<ProjectCreationButton
isDialogOpen={Boolean(state.create)}
setIsDialogOpen={(create) =>
Expand Down

0 comments on commit 24ac541

Please sign in to comment.