Skip to content

Commit

Permalink
Merge pull request #6208 from CitizenLabDotCo/TAN-424-disable-creatin…
Browse files Browse the repository at this point in the history
…g-continuous-projects

TAN-424: disable creating continuous projects
  • Loading branch information
EdwinKato authored Oct 20, 2023
2 parents 92be609 + e49bd2c commit f9d20d8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,26 @@ import React from 'react';
// components
import { IconTooltip, Radio } from '@citizenlab/cl2-component-library';
import { SubSectionTitle } from 'components/admin/Section';
import { StyledWarning } from './styling';
import Warning from 'components/UI/Warning';

// i18n
import { FormattedMessage } from 'utils/cl-intl';
import messages from '../messages';

interface Props {
projectType: 'continuous' | 'timeline';
handleProjectTypeOnChange: (projectType: 'continuous' | 'timeline') => void;
}

export default ({ projectType, handleProjectTypeOnChange }: Props) => (
export default ({ projectType }: Props) => (
<>
<SubSectionTitle>
<FormattedMessage {...messages.projectTypeTitle} />
<IconTooltip
content={<FormattedMessage {...messages.projectTypeTooltip} />}
/>
</SubSectionTitle>
<StyledWarning>
<FormattedMessage {...messages.projectTypeWarning} />
</StyledWarning>
<Radio
className="e2e-project-type-timeline"
onChange={handleProjectTypeOnChange}
currentValue={projectType}
value="timeline"
name="projecttype"
Expand All @@ -36,12 +31,15 @@ export default ({ projectType, handleProjectTypeOnChange }: Props) => (
/>
<Radio
className="e2e-project-type-continuous"
onChange={handleProjectTypeOnChange}
currentValue={projectType}
disabled
value="continuous"
name="projecttype"
id="projectype-continuous"
label={<FormattedMessage {...messages.continuous} />}
/>
<Warning>
<FormattedMessage {...messages.continousProjectDeprecationMessage} />
</Warning>
</>
);
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import InputMultilocWithLocaleSwitcher from 'components/UI/InputMultilocWithLoca
import MultipleSelect from 'components/UI/MultipleSelect';
import FileUploader from 'components/UI/FileUploader';
import { SectionField } from 'components/admin/Section';
import Warning from 'components/UI/Warning';

// styling
import styled from 'styled-components';
Expand Down Expand Up @@ -95,7 +94,3 @@ export const StyledFileUploader = styled(FileUploader)`
export const StyledMultipleSelect = styled(MultipleSelect)`
width: 500px;
`;

export const StyledWarning = styled(Warning)`
margin-bottom: 15px;
`;
16 changes: 1 addition & 15 deletions front/app/containers/Admin/projects/project/general/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,6 @@ const AdminProjectsProjectGeneral = () => {
}));
};

const handleProjectTypeOnChange = (
projectType: 'continuous' | 'timeline'
) => {
setProjectAttributesDiff((projectAttributesDiff) => ({
...projectAttributesDiff,
process_type: projectType,
}));
setSubmitState('enabled');
setProjectType(projectType);
};

const handleHeaderBgChange = (newImageBase64: string | null) => {
setProjectAttributesDiff((projectAttributesDiff) => ({
...projectAttributesDiff,
Expand Down Expand Up @@ -531,10 +520,7 @@ const AdminProjectsProjectGeneral = () => {

<StyledSectionField>
{!project ? (
<ProjectTypePicker
projectType={projectType}
handleProjectTypeOnChange={handleProjectTypeOnChange}
/>
<ProjectTypePicker projectType={projectType} />
) : (
<>
<SubSectionTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export default defineMessages({
id: 'app.containers.AdminPage.ProjectEdit.continuous',
defaultMessage: 'Continuous',
},
continousProjectDeprecationMessage: {
id: 'app.containers.AdminPage.ProjectEdit.continousProjectDeprecationMessage',
defaultMessage:
'Projects without a timeline have been deprecated. Instead, you can now decide not to add an end date to a phase if you want to keep it open indefinitely.',
},
timeline: {
id: 'app.containers.AdminPage.ProjectEdit.timeline',
defaultMessage: 'Timeline',
Expand Down
1 change: 1 addition & 0 deletions front/app/translations/admin/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,7 @@
"app.containers.AdminPage.ProjectEdit.cardDisplay": "Cards",
"app.containers.AdminPage.ProjectEdit.conductVotingOrPrioritizationDescriptionText2": "Select a voting method, and have users prioritize between a few different options.",
"app.containers.AdminPage.ProjectEdit.conductVotingOrPrioritizationText": "Conduct a voting or prioritization exercise",
"app.containers.AdminPage.ProjectEdit.continousProjectDeprecationMessage": "Projects without a timeline have been deprecated. Instead, you can now decide not to add an end date to a phase if you want to keep it open indefinitely.",
"app.containers.AdminPage.ProjectEdit.continuous": "Without a timeline",
"app.containers.AdminPage.ProjectEdit.createAProject": "Create a project",
"app.containers.AdminPage.ProjectEdit.createAProjectFromATemplate": "Create a project from a template",
Expand Down

0 comments on commit f9d20d8

Please sign in to comment.