Skip to content

Commit

Permalink
Adjust filter Label text on indicators page
Browse files Browse the repository at this point in the history
  • Loading branch information
lilia1891 committed Jan 7, 2025
1 parent 5f8a1c6 commit 6a2b978
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
13 changes: 9 additions & 4 deletions common/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import {
SiteGeneralContentActionTerm,
} from './__generated__/graphql';

export function getActionTermContext(plan: {
generalContent?: { actionTerm: SiteGeneralContentActionTerm };
}) {
const actionTerm = plan.generalContent?.actionTerm;
export function getActionTermContext(
plan: {
generalContent?: { actionTerm: SiteGeneralContentActionTerm };
},
actionTerm?: string
) {
if (!actionTerm) {
actionTerm = plan.generalContent?.actionTerm;
}
return actionTerm === 'ACTION'
? { context: undefined }
: { context: actionTerm };
Expand Down
18 changes: 13 additions & 5 deletions components/actions/ActionListFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,9 +811,9 @@ class ActionNameFilter implements ActionListFilter<string | undefined> {
hasActionIdentifiers: boolean;
ref: Ref<HTMLInputElement>;

constructor(plan: PlanContextType) {
constructor(plan: PlanContextType, actionTerm?: string) {
this.hasActionIdentifiers = plan.features.hasActionIdentifiers;
this.actionTermContext = getActionTermContext(plan);
this.actionTermContext = getActionTermContext(plan, actionTerm);
this.ref = createRef();
}

Expand Down Expand Up @@ -1067,11 +1067,19 @@ type ConstructFiltersOpts = {
orgs: ActionListOrganization[];
primaryOrgs: ActionListPrimaryOrg[];
filterByCommonCategory: boolean;
actionTerm?: string;
};

ActionListFilters.constructFilters = (opts: ConstructFiltersOpts) => {
const { mainConfig, plan, t, orgs, primaryOrgs, filterByCommonCategory } =
opts;
const {
mainConfig,
plan,
t,
orgs,
primaryOrgs,
filterByCommonCategory,
actionTerm,
} = opts;
const { primaryFilters, mainFilters, advancedFilters } = mainConfig;

function makeSection(
Expand Down Expand Up @@ -1219,7 +1227,7 @@ ActionListFilters.constructFilters = (opts: ConstructFiltersOpts) => {
};
filters.push(new GenericSelectFilter(opts));
}
filters.push(new ActionNameFilter(plan));
filters.push(new ActionNameFilter(plan, actionTerm));
}

const ret: ActionListFilterSection = {
Expand Down
1 change: 1 addition & 0 deletions components/indicators/IndicatorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ const IndicatorList = ({
plan,
filterByCommonCategory: false,
t,
actionTerm: 'INDICATOR',
});

const filteredIndicators = filterIndicators(
Expand Down
2 changes: 1 addition & 1 deletion locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"filter-primary-organization": "{context, select, DIVISION {Leitende Abteilung} other {Primäre Organisation}}",
"filter-result-actions": "{context, select, STRATEGY {Strategien} CASE_STUDY {Fallstudien} other {Maßnahmen}}",
"filter-schedule": "Zeitplan",
"filter-text": "{context, select, CASE_STUDY {Fallstudien durchsuchen} STRATEGY {Strategien durchsuchen} other {Maßnahmen durchsuchen}}",
"filter-text": "{context, select, CASE_STUDY {Fallstudien durchsuchen} STRATEGY {Strategien durchsuchen} INDICATOR {Indikatoren durchsuchen} other {Maßnahmen durchsuchen}}",
"filter-text-default": "Nach Schlüsselwort suchen",
"front-page": "Titelseite",
"give-feedback": "Feedback geben",
Expand Down
2 changes: 1 addition & 1 deletion locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"filter-result-actions": "{context, select, CASE_STUDY {case studies} STRATEGY {strategies} other {actions}}",
"filter-schedule": "Schedule",
"filter-status": "Status",
"filter-text": "{context, select, STRATEGY {Search strategies} CASE_STUDY {Search case studies} other {Search actions}}",
"filter-text": "{context, select, STRATEGY {Search strategies} CASE_STUDY {Search case studies} INDICATOR {Search indicators} other {Search actions}}",
"filter-text-default": "Search by keyword",
"front-page": "Front Page",
"give-feedback": "Give feedback",
Expand Down

0 comments on commit 6a2b978

Please sign in to comment.