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

Add success factor filter in good practice #99

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
4 changes: 4 additions & 0 deletions app/Base/Page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function useYear(clientCode: string) {
}

function CountryProfileWithYear(props: Omit<CountryProfileProps, 'endYear'> & { clientCode: string }) {
// eslint-disable-next-line react/destructuring-assignment
const { loading, year } = useYear(props.clientCode);
if (loading || !year) {
return null;
Expand All @@ -76,6 +77,7 @@ function CountryProfileWithYear(props: Omit<CountryProfileProps, 'endYear'> & {
}

function GiddWithYear(props: Omit<GiddProps, 'endYear'>) {
// eslint-disable-next-line react/destructuring-assignment
const { loading, year } = useYear(props.clientCode);
if (loading || !year) {
return null;
Expand All @@ -89,6 +91,7 @@ function GiddWithYear(props: Omit<GiddProps, 'endYear'>) {
}

function ConflictWidgetWithYear(props: Omit<ConflictWidgetProps, 'endYear'>) {
// eslint-disable-next-line react/destructuring-assignment
const { loading, year } = useYear(props.clientCode);
if (loading || !year) {
return null;
Expand All @@ -102,6 +105,7 @@ function ConflictWidgetWithYear(props: Omit<ConflictWidgetProps, 'endYear'>) {
}

function DisasterWidgetWithYear(props: Omit<DisasterWidgetProps, 'endYear'>) {
// eslint-disable-next-line react/destructuring-assignment
const { loading, year } = useYear(props.clientCode);
if (loading || !year) {
return null;
Expand Down
4 changes: 4 additions & 0 deletions app/Base/configs/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export const goodPracticesDashboard = {
en: 'Stage',
fr: 'Organiser',
},
successFactorLabel: {
en: 'Success Factors',
fr: 'Facteurs de réussite',
},
clearButtonLabel: {
en: 'Clear All Filters',
fr: 'Effacer tous les filtres',
Expand Down
4 changes: 0 additions & 4 deletions app/components/FigureAnalysis/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
border: var(--tui-width-separator-thin) solid var(--tui-color-separator);
border-top: 0;

.separator {
border-bottom: var(--tui-width-separator-thin) solid var(--tui-color-separator);
}

.details {
.collapsible-children {
padding-bottom: var(--tui-spacing-medium);
Expand Down
41 changes: 0 additions & 41 deletions app/components/NumberBlock/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,4 @@
color: var(--tui-color-text-label);
font-size: var(--tui-font-size-small);
}

&.conflict {
.label,
.value {
color: var(--color-conflict);
}
}

&.disaster {
.label,
.value {
color: var(--color-disaster);
}
}

&.medium {
.value {
font-size: var(--tui-font-size-super-large);
}
}

&.large {
.value {
font-size: var(--tui-font-size-massive-large);
}
}

&.small {
.value {
font-size: var(--tui-font-size-large);
}
}

&.xsmall {
.value {
font-size: var(--tui-font-size-medium);
}
.label {
font-size: var(--tui-font-size-small);
}
}
}
4 changes: 0 additions & 4 deletions app/components/ProgressLine/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
.title {
flex-grow :1;
}

.numeral {
flex-shrink: 0;
}
}

.bottom {
Expand Down
1 change: 0 additions & 1 deletion app/components/Tabs/Tab/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
}

&.secondary {
/* border-radius: calc(1em + #{var(--tui-spacing-medium)}); */
border-radius: 0.25rem;

background-color: var(--tui-color-background);
Expand Down
3 changes: 0 additions & 3 deletions app/components/tableHelpers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export function createExternalLinkColumn<D, K>(
filterType: options?.filterType,
orderable: options?.orderable,
hideable: options?.hideable,
titleClassName: styles.title,
},
cellRenderer: ExternalLink,
cellRendererParams: (_: K, datum: D): ExternalLinkProps => {
Expand Down Expand Up @@ -93,7 +92,6 @@ export function createTextColumn<D, K>(
filterType: options?.filterType,
orderable: options?.orderable,
hideable: options?.hideable,
titleClassName: styles.title,
},
cellRenderer: Text,
columnWidth: options?.columnWidth,
Expand Down Expand Up @@ -137,7 +135,6 @@ export function createNumberColumn<D, K>(
filterType: options?.filterType,
orderable: options?.orderable,
hideable: options?.hideable,
titleClassName: styles.title,
},
cellRenderer: Numeral,
columnWidth: options?.columnWidth,
Expand Down
8 changes: 0 additions & 8 deletions app/components/tableHelpers/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
font-size: var(--tui-font-size-medium)!important;
}

&.conflict {
color: var(--color-conflict);
}

&.disaster {
color: var(--color-disaster);
}

&.number-header {
* {
justify-content: flex-end;
Expand Down
56 changes: 49 additions & 7 deletions app/views/GoodPractices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ query GoodPractices(
$driversOfDisplacements : [ID!],
$focusArea:[ID!] ,
$stages: [StageTypeEnum!]!,
$successFactor:[ID!] ,
$regions: [GoodPracticeRegion!],
$countries: [ID!],
$startYear: Int!,
Expand All @@ -123,6 +124,7 @@ query GoodPractices(
driversOfDisplacements: $driversOfDisplacements,
focusArea: $focusArea,
stages: $stages,
successFactor: $successFactor,
regions: $regions,
countries: $countries,
startYear: $startYear,
Expand Down Expand Up @@ -204,6 +206,10 @@ query GoodPracticeFilterChoices {
label
name
}
successFactor {
id
name
}
type {
label
name
Expand Down Expand Up @@ -298,6 +304,7 @@ type GoodPracticeDriveType = NonNullable<GoodPracticeFilter['driversOfDisplaceme
type GoodPracticeStageType = NonNullable<GoodPracticeFilter['stage']>[number]['name'];
type GoodPracticeRegionType = NonNullable<GoodPracticeFilter['regions']>[number]['name'];
type GoodPracticeCountryType = NonNullable<GoodPracticeFilter['countries']>[number]['name'];
type goodPracticeSuccessFactorType = NonNullable<GoodPracticeFilter['successFactor']>[number]['name'];

interface Props {
className?: string;
Expand Down Expand Up @@ -346,7 +353,11 @@ function GoodPractices(props: Props) {
const [goodPracticeType, setGoodPracticeType] = useInputState<GoodPracticeTypeType[]>([]);
const [goodPracticeArea, setGoodPracticeArea] = useInputState<GoodPracticeAreaType[]>([]);
const [goodPracticeDrive, setGoodPracticeDrive] = useInputState<GoodPracticeDriveType[]>([]);
const [goodpracticeStage, setGoodPracticeStage] = useInputState<GoodPracticeStageType[]>([]);
const [goodPracticeStage, setGoodPracticeStage] = useInputState<GoodPracticeStageType[]>([]);
const [goodPracticeSuccessFactor, setGoodPracticeSuccessFactor] = useInputState<
goodPracticeSuccessFactorType[]
>([]);

const [
goodPracticeRegion,
setGoodPracticeRegion,
Expand Down Expand Up @@ -396,6 +407,7 @@ function GoodPractices(props: Props) {
setGoodPracticeStage([]);
setGoodPracticeRegion([]);
setGoodPracticeCountry([]);
setGoodPracticeSuccessFactor([]);
}, [
setYearRange,
setGoodPracticeType,
Expand All @@ -404,6 +416,7 @@ function GoodPractices(props: Props) {
setGoodPracticeStage,
setGoodPracticeRegion,
setGoodPracticeCountry,
setGoodPracticeSuccessFactor,
goodPracticeFilterResponse,
]);

Expand All @@ -418,6 +431,7 @@ function GoodPractices(props: Props) {
stageFilterOptions,
regionFilterOptions,
countryFilterOptions,
successFactorFilterOptions,
] = React.useMemo(() => [
filterChoices?.type
?.map((v) => ({ key: v.name, label: v.label })),
Expand All @@ -428,6 +442,7 @@ function GoodPractices(props: Props) {
filterChoices?.regions
?.map((v) => ({ key: v.name, label: v.label })),
filterChoices?.countries,
filterChoices?.successFactor,
], [filterChoices]);

const [activePage, setActivePage] = useState<number>(1);
Expand All @@ -441,7 +456,8 @@ function GoodPractices(props: Props) {
|| goodPracticeCountry.length > 0
|| goodPracticeType.length > 0
|| goodPracticeArea.length > 0
|| goodpracticeStage.length > 0
|| goodPracticeStage.length > 0
|| goodPracticeSuccessFactor.length > 0
|| goodPracticeRegion.length > 0
|| goodPracticeDrive.length > 0
|| yearRange[0] !== minYear
Expand All @@ -451,7 +467,8 @@ function GoodPractices(props: Props) {
countries: goodPracticeCountry,
types: goodPracticeType,
focusArea: goodPracticeArea,
stages: goodpracticeStage,
stages: goodPracticeStage,
successFactor: goodPracticeSuccessFactor,
regions: goodPracticeRegion,
driversOfDisplacements: goodPracticeDrive,
startYear: yearRange[0],
Expand All @@ -465,10 +482,11 @@ function GoodPractices(props: Props) {
searchText,
goodPracticeCountry,
goodPracticeType,
goodpracticeStage,
goodPracticeStage,
goodPracticeRegion,
goodPracticeDrive,
goodPracticeArea,
goodPracticeSuccessFactor,
yearRange,
minYear,
maxYear,
Expand Down Expand Up @@ -680,14 +698,28 @@ function GoodPractices(props: Props) {
placeholder={strings.stageLabel}
label={strings.stageLabel}
name="stage"
value={goodpracticeStage}
value={goodPracticeStage}
options={stageFilterOptions}
keySelector={keySelector}
labelSelector={labelSelector}
onChange={setGoodPracticeStage}
inputSectionClassName={styles.inputSection}
/>
)}
{successFactorFilterOptions && successFactorFilterOptions.length > 0 && (
<MultiSelectInput
labelContainerClassName={styles.label}
placeholder={strings.successFactorLabel}
label={strings.successFactorLabel}
name="successFactor"
value={goodPracticeSuccessFactor}
options={successFactorFilterOptions}
keySelector={idSelector}
labelSelector={nameSelector}
onChange={setGoodPracticeSuccessFactor}
inputSectionClassName={styles.inputSection}
/>
)}
</>
);

Expand Down Expand Up @@ -1015,16 +1047,26 @@ function GoodPractices(props: Props) {
onChange={setGoodPracticeArea}
/>
)}
{goodpracticeStage.length > 0 && (
{goodPracticeStage.length > 0 && (
<DismissableListOutput
label={strings.stageLabel}
value={goodpracticeStage}
value={goodPracticeStage}
keySelector={keySelector}
labelSelector={labelSelector}
options={stageFilterOptions}
onChange={setGoodPracticeStage}
/>
)}
{goodPracticeSuccessFactor.length > 0 && (
<DismissableListOutput
label={strings.successFactorLabel}
value={goodPracticeSuccessFactor}
keySelector={idSelector}
labelSelector={nameSelector}
options={successFactorFilterOptions}
onChange={setGoodPracticeSuccessFactor}
/>
)}
<div className={styles.clearAllContainer}>
<Button
name={undefined}
Expand Down
Loading