Skip to content

Commit 55be59a

Browse files
committed
rename AppConfigKey to AppConfigType
1 parent ebd3094 commit 55be59a

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

modules/app-config/index.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {getFeatureFlag} from '../../source/lib/storage'
2-
import {AppConfigKey, FeatureFlagType} from './types'
2+
import {AppConfigType, FeatureFlagType} from './types'
33
import {useQuery} from '@tanstack/react-query'
44
import {isDevMode} from '@frogpond/constants'
55

6-
export type {AppConfigKey, FeatureFlagType} from './types'
6+
export type {AppConfigType, FeatureFlagType} from './types'
77

88
// helper method to query exported __DEV__ feature flags
9-
const useFeature = (featureKey: AppConfigKey): boolean => {
9+
const useFeature = (featureKey: AppConfigType): boolean => {
1010
let {data: featureValue = false} = useQuery({
1111
queryKey: ['app', 'app:feature-flag', featureKey],
1212
queryFn: () => getFeatureFlag(featureKey),
@@ -23,12 +23,14 @@ export const AppConfig = async (): Promise<FeatureFlagType[]> => {
2323
return [
2424
{
2525
title: 'Show the course search recents screen',
26-
configKey: AppConfigKey.Courses_ShowRecentSearchScreen,
27-
active: await getFeatureFlag(AppConfigKey.Courses_ShowRecentSearchScreen),
26+
configKey: AppConfigType.Courses_ShowRecentSearchScreen,
27+
active: await getFeatureFlag(
28+
AppConfigType.Courses_ShowRecentSearchScreen,
29+
),
2830
},
2931
]
3032
}
3133

3234
// exported feature flags
3335
export const useCourseSearchRecentsScreen = (): boolean =>
34-
useFeature(AppConfigKey.Courses_ShowRecentSearchScreen)
36+
useFeature(AppConfigType.Courses_ShowRecentSearchScreen)

modules/app-config/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface FeatureFlagType {
2-
configKey: AppConfigKey
2+
configKey: AppConfigType
33
title: string
44
active: boolean
55
}
@@ -14,6 +14,6 @@ export interface FeatureFlagType {
1414
* split at render time for our view to group by, but the entirety
1515
* of the value (section + key) will be stored.
1616
*/
17-
export enum AppConfigKey {
17+
export enum AppConfigType {
1818
Courses_ShowRecentSearchScreen = 'Courses_ShowRecentSearchScreen',
1919
}

source/lib/storage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
setItem,
77
setStoragePrefix,
88
} from '@frogpond/storage'
9-
import {AppConfigKey} from '@frogpond/app-config'
9+
import {AppConfigType} from '@frogpond/app-config'
1010
import type {FilterComboType} from '../views/sis/course-search/lib/format-filter-combo'
1111
import type {CourseType, TermType} from './course-search/types'
1212

@@ -18,13 +18,13 @@ setStoragePrefix('aao:')
1818

1919
const featureFlagsKey = 'app:feature-flag'
2020
export function setFeatureFlag(
21-
name: AppConfigKey,
21+
name: AppConfigType,
2222
value: boolean,
2323
): Promise<void> {
2424
const key = `${featureFlagsKey}:${name}`
2525
return setItem(key, value)
2626
}
27-
export function getFeatureFlag(name: AppConfigKey): Promise<boolean> {
27+
export function getFeatureFlag(name: AppConfigType): Promise<boolean> {
2828
const key = `${featureFlagsKey}:${name}`
2929
return getItemAsBoolean(key)
3030
}

0 commit comments

Comments
 (0)