Skip to content

Commit eff7529

Browse files
fix: remove deprecated features from search filters (#1168)
1 parent c9824d3 commit eff7529

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

web-app/src/app/screens/Feeds/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
import { useSearchParams } from 'react-router-dom';
3030
import SearchTable from './SearchTable';
3131
import { Trans, useTranslation } from 'react-i18next';
32-
import { groupFeaturesByComponent } from '../../utils/consts';
32+
import { DATASET_FEATURES, groupFeaturesByComponent } from '../../utils/consts';
3333
import NestedCheckboxList, {
3434
type CheckboxStructure,
3535
} from '../../components/NestedCheckboxList';
@@ -240,14 +240,19 @@ export default function Feed(): React.ReactElement {
240240

241241
function setInitialExpandGroup(): Record<string, boolean> {
242242
const expandGroup: Record<string, boolean> = {};
243-
Object.keys(groupFeaturesByComponent()).forEach((featureGroup) => {
243+
Object.keys(
244+
groupFeaturesByComponent(Object.keys(DATASET_FEATURES), true),
245+
).forEach((featureGroup) => {
244246
expandGroup[featureGroup] = false;
245247
});
246248
return expandGroup;
247249
}
248250

249251
function generateCheckboxStructure(): CheckboxStructure[] {
250-
const groupedFeatures = groupFeaturesByComponent();
252+
const groupedFeatures = groupFeaturesByComponent(
253+
Object.keys(DATASET_FEATURES),
254+
true,
255+
);
251256
return Object.entries(groupedFeatures)
252257
.filter(([parent]) => parent !== 'Other')
253258
.sort(([keyA], [keyB]) => keyA.localeCompare(keyB))

web-app/src/app/utils/consts.tsx

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface DatasetFeature {
99
componentSubgroup?: string;
1010
fileName: string;
1111
linkToInfo: string;
12+
deprecated?: boolean;
1213
}
1314

1415
type DatasetFeatures = Record<string, DatasetFeature>;
@@ -31,12 +32,16 @@ interface ComprehensiveDatasetFeature extends DatasetFeature {
3132

3233
export function groupFeaturesByComponent(
3334
features: string[] = Object.keys(DATASET_FEATURES),
35+
removeDeprecated = false,
3436
): Record<string, DatasetComponentFeature[]> {
3537
const groupedFeatures: Record<string, DatasetComponentFeature[]> = {};
3638

3739
features.forEach((feature) => {
3840
const featureData = DATASET_FEATURES[feature];
3941
if (featureData !== undefined) {
42+
if (removeDeprecated && featureData.deprecated === true) {
43+
return;
44+
}
4045
const component =
4146
featureData.component !== '' ? featureData.component : 'Other';
4247
if (groupedFeatures[component] === undefined) {
@@ -287,24 +292,43 @@ export const DATASET_FEATURES: DatasetFeatures = {
287292
},
288293
};
289294
// SPELLING CORRECTIONS
290-
DATASET_FEATURES['Text-to-Speech'] = DATASET_FEATURES['Text-To-Speech'];
295+
DATASET_FEATURES['Text-to-Speech'] = {
296+
...DATASET_FEATURES['Text-To-Speech'],
297+
deprecated: true,
298+
};
291299

292300
// DEPRECATED FEATURES
293301
DATASET_FEATURES['Wheelchair Accessibility'] = {
294302
// as of 6.0
295303
component: 'Accessibility',
296304
fileName: 'trips.txt',
297305
linkToInfo: 'https://gtfs.org/getting-started/features/accessibility',
306+
deprecated: true,
307+
};
308+
DATASET_FEATURES['Bikes Allowance'] = {
309+
...DATASET_FEATURES['Bike Allowed'],
310+
deprecated: true,
311+
};
312+
DATASET_FEATURES['Transfer Fares'] = {
313+
...DATASET_FEATURES['Fare Transfers'],
314+
deprecated: true,
315+
}; // as of 6.0
316+
DATASET_FEATURES['Pathways (basic)'] = {
317+
...DATASET_FEATURES['Pathway Connections'],
318+
deprecated: true,
319+
}; // as of 6.0
320+
DATASET_FEATURES['Pathways (extra)'] = {
321+
...DATASET_FEATURES['Pathway Details'],
322+
deprecated: true,
323+
}; // as of 6.0
324+
DATASET_FEATURES['Traversal Time'] = {
325+
...DATASET_FEATURES['In-station Traversal Time'],
326+
deprecated: true,
298327
};
299-
DATASET_FEATURES['Bikes Allowance'] = DATASET_FEATURES['Bike Allowed'];
300-
DATASET_FEATURES['Transfer Fares'] = DATASET_FEATURES['Fare Transfers']; // as of 6.0
301-
DATASET_FEATURES['Pathways (basic)'] = DATASET_FEATURES['Pathway Connections']; // as of 6.0
302-
DATASET_FEATURES['Pathways (extra)'] = DATASET_FEATURES['Pathway Details']; // as of 6.0
303-
DATASET_FEATURES['Traversal Time'] =
304-
DATASET_FEATURES['In-station Traversal Time'];
305328
DATASET_FEATURES['Pathways Directions'] = {
306329
// as of 6.0
307330
component: 'Pathways',
308331
fileName: 'pathways.txt',
309332
linkToInfo: 'https://gtfs.org/schedule/reference/#pathwaystxt',
333+
deprecated: true,
310334
};

0 commit comments

Comments
 (0)