Skip to content

Commit 8030236

Browse files
committed
add config key for showing/hiding recent course search filters
1 parent 7ed9909 commit 8030236

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

modules/app-config/index.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@ import {isDevMode} from '@frogpond/constants'
55

66
export type {AppConfigKey, FeatureFlagType} from './types'
77

8-
// datastore for the __DEV__ feature flags
9-
export const AppConfig = async (): Promise<FeatureFlagType[]> => {
10-
return [
11-
{
12-
configKey: AppConfigKey.TestDataKey,
13-
title: 'Test config key',
14-
active: await getFeatureFlag(AppConfigKey.TestDataKey),
15-
},
16-
]
17-
}
18-
198
// helper method to query exported __DEV__ feature flags
209
const useFeature = (featureKey: AppConfigKey): boolean => {
2110
let {data: featureValue = false} = useQuery({
@@ -29,6 +18,17 @@ const useFeature = (featureKey: AppConfigKey): boolean => {
2918
return isDevMode() ? featureValue : false
3019
}
3120

21+
// datastore for the __DEV__ feature flags
22+
export const AppConfig = async (): Promise<FeatureFlagType[]> => {
23+
return [
24+
{
25+
title: 'Show the course search recents screen',
26+
configKey: AppConfigKey.Courses_ShowRecentSearchScreen,
27+
active: await getFeatureFlag(AppConfigKey.Courses_ShowRecentSearchScreen),
28+
},
29+
]
30+
}
31+
3232
// exported feature flags
33-
export const useTestFeature = (): boolean =>
34-
useFeature(AppConfigKey.TestDataKey)
33+
export const useCourseSearchRecentsScreen = (): boolean =>
34+
useFeature(AppConfigKey.Courses_ShowRecentSearchScreen)

modules/app-config/types.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ export interface FeatureFlagType {
44
active: boolean
55
}
66

7+
/**
8+
* __DEV__ app config keys
9+
*
10+
* Reserved for dev-only flags for internal experimentation, these
11+
* will never be A/B flags nor will they return true in production.
12+
*
13+
* The format is SECTION_KEY where the first underscore will be
14+
* split at render time for our view to group by, but the entirety
15+
* of the value (section + key) will be stored.
16+
*/
717
export enum AppConfigKey {
8-
TestDataKey = 'TestData',
9-
}
10-
18+
Courses_ShowRecentSearchScreen = 'Courses_ShowRecentSearchScreen',
1119
}

source/navigation/types.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export type RootViewsParamList = {
4848
More: undefined
4949
PrintJobs: undefined
5050
StudentOrgs: undefined
51-
}
51+
} & Pick<MiscViewParamList, 'CourseSearchResults'>
5252

5353
export type CafeMenuParamList = {
5454
CarletonBurtonMenu: undefined
@@ -76,10 +76,9 @@ export type MiscViewParamList = {
7676
DirectoryDetail: {contact: DirectoryItem}
7777
Job: undefined
7878
JobDetail: {job: JobType}
79-
CourseSearchResults: {
80-
initialQuery?: string
81-
initialFilters?: FilterType<CourseType>[]
82-
}
79+
CourseSearchResults:
80+
| {initialQuery?: string; initialFilters?: FilterType<CourseType>[]}
81+
| undefined
8382
CourseDetail: {course: CourseType}
8483
StudentOrgsDetail: {org: StudentOrgType}
8584
BusMapView: {line: UnprocessedBusLine}

0 commit comments

Comments
 (0)