File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
source/views/settings/screens Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 11import { getFeatureFlag } from '../../source/lib/storage'
2- import { AppConfigKey , AppConfigGroupKey , FeatureFlagType } from './types'
2+ import { AppConfigKey , FeatureFlagType } from './types'
33import { useQuery } from '@tanstack/react-query'
44import { isDevMode } from '@frogpond/constants'
55
@@ -10,7 +10,6 @@ export const AppConfig = async (): Promise<FeatureFlagType[]> => {
1010 return [
1111 {
1212 configKey : AppConfigKey . TestDataKey ,
13- group : AppConfigGroupKey . test ,
1413 title : 'Test config key' ,
1514 active : await getFeatureFlag ( AppConfigKey . TestDataKey ) ,
1615 } ,
Original file line number Diff line number Diff line change 11export interface FeatureFlagType {
22 configKey : AppConfigKey
33 title : string
4- group : AppConfigGroupKey
54 active : boolean
65}
76
87export enum AppConfigKey {
98 TestDataKey = 'TestData' ,
109}
1110
12- export enum AppConfigGroupKey {
13- test = 'test' ,
1411}
Original file line number Diff line number Diff line change @@ -27,15 +27,19 @@ export const FeatureFlagsView = (): JSX.Element => {
2727 return < ListEmpty mode = "bug" />
2828 }
2929
30+ let findGroup = ( configKey : FeatureFlagType [ 'configKey' ] ) => {
31+ return configKey . split ( '_' ) ?. [ 0 ] ?? 'Unknown'
32+ }
33+
3034 let sorters : Array < ( flag : FeatureFlagType ) => string > = [
31- ( flag ) => flag . group ,
35+ ( flag ) => findGroup ( flag . configKey ) ,
3236 ( flag ) => flag . title ,
3337 ]
3438
3539 let ordered : Array < 'desc' | 'asc' > = [ 'desc' , 'asc' , 'desc' ]
3640
3741 let sorted = orderBy ( sections , sorters , ordered )
38- let grouped = groupBy ( sorted , ( s ) => s . group )
42+ let grouped = groupBy ( sorted , ( s ) => findGroup ( s . configKey ) )
3943 let groupedSections = Object . entries ( grouped )
4044 . map ( ( [ key , value ] ) => ( {
4145 title : key ,
You can’t perform that action at this time.
0 commit comments