Skip to content

Commit 3018bec

Browse files
authored
feat: Responsive features page (#5809)
1 parent c533d95 commit 3018bec

29 files changed

Lines changed: 618 additions & 556 deletions

frontend/common/useDebouncedSearch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import useDebounce from './useDebounce'
44
export default function useDebouncedSearch(initialValue = '') {
55
const [searchInput, setSearchInput] = useState(initialValue)
66
const [search, setSearch] = useState(initialValue)
7-
const [debounceTime, setDebounceTime] = useState(500);
7+
const [debounceTime, setDebounceTime] = useState(500)
88

99
useEffect(() => {
10-
setDebounceTime(searchInput.length < 1 ? 0 : 500);
10+
setDebounceTime(searchInput.length < 1 ? 0 : 500)
1111
}, [searchInput])
1212

1313
const debouncedSearch = useDebounce((value: string) => {
@@ -23,7 +23,7 @@ export default function useDebouncedSearch(initialValue = '') {
2323
return {
2424
search,
2525
searchInput,
26-
setSearchInput: handleSearchInput
26+
setSearchInput: handleSearchInput,
2727
}
2828
}
2929

frontend/e2e/init.cafe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fixture`E2E Tests`.requestHooks(logger).before(async () => {
9696
await logResults(logger.requests, t)
9797
})
9898

99-
test('Segment-part-1', async () => await testSegment1(flagsmith)).meta({ autoLogout: true, category: 'oss' })
99+
test('Segment-part-1', async () => await testSegment1(flagsmith)).meta({ category: 'oss' })
100100

101101
test('Segment-part-2', testSegment2).meta({ autoLogout: true, category: 'oss' })
102102

frontend/web/components/CompareEnvironments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { Component } from 'react'
33
import EnvironmentSelect from './EnvironmentSelect'
44
import data from 'common/data/base/_data'
55
import ProjectStore from 'common/stores/project-store'
6-
import FeatureRow from './FeatureRow'
6+
import FeatureRow from './feature-summary/FeatureRow'
77
import FeatureListStore from 'common/stores/feature-list-store'
88
import ConfigProvider from 'common/providers/ConfigProvider'
99
import Permission from 'common/providers/Permission'

frontend/web/components/CompareFeatures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { Component } from 'react'
33
import FlagSelect from './FlagSelect'
44
import ProjectStore from 'common/stores/project-store'
55
import data from 'common/data/base/_data'
6-
import FeatureRow from './FeatureRow'
6+
import FeatureRow from './feature-summary/FeatureRow'
77
import ConfigProvider from 'common/providers/ConfigProvider'
88
import Permission from 'common/providers/Permission'
99
import { withRouter } from 'react-router-dom'

frontend/web/components/CompareIdentities.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import PanelSearch from './PanelSearch'
1212
import { IdentityFeatureState } from 'common/types/responses'
1313
import Icon from './Icon'
1414
import Switch from './Switch'
15-
import FeatureValue from './FeatureValue'
15+
import FeatureValue from './feature-summary/FeatureValue'
1616
import { sortBy } from 'lodash'
1717
import { useHasPermission } from 'common/providers/Permission'
1818
import Constants from 'common/constants'

frontend/web/components/CondensedFeatureRow.tsx

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
import classNames from 'classnames'
22
import Switch from './Switch'
3-
import {
4-
FeatureListProviderData,
5-
FeatureState,
6-
ProjectFlag,
7-
} from 'common/types/responses'
8-
import FeatureValue from './FeatureValue'
3+
import { FeatureListProviderData, ProjectFlag } from 'common/types/responses'
4+
import FeatureValue from './feature-summary/FeatureValue'
95
import SegmentOverridesIcon from './SegmentOverridesIcon'
106
import IdentityOverridesIcon from './IdentityOverridesIcon'
117
import Constants from 'common/constants'
12-
import Utils from 'common/utils/utils'
138

149
export interface CondensedFeatureRowProps {
1510
disableControls?: boolean
1611
readOnly: boolean
1712
projectFlag: ProjectFlag
1813
environmentFlags: FeatureListProviderData['environmentFlags']
1914
permission?: boolean
20-
editFeature: (
21-
projectFlag: ProjectFlag,
22-
environmentFlag?: FeatureState,
23-
tab?: string,
24-
) => void
15+
editFeature: (tab?: string) => void
2516
onChange: () => void
2617
style?: React.CSSProperties
2718
className?: string
@@ -58,8 +49,6 @@ const CondensedFeatureRow: React.FC<CondensedFeatureRowProps> = ({
5849
if (disableControls) return
5950
!readOnly &&
6051
editFeature(
61-
projectFlag,
62-
environmentFlags?.[id],
6352
hasUnhealthyEvents
6453
? Constants.featurePanelTabs.FEATURE_HEALTH
6554
: undefined,
@@ -86,11 +75,7 @@ const CondensedFeatureRow: React.FC<CondensedFeatureRowProps> = ({
8675
<Flex className='table-column clickable'>
8776
<Row>
8877
<div
89-
onClick={() =>
90-
permission &&
91-
!readOnly &&
92-
editFeature(projectFlag, environmentFlags?.[id])
93-
}
78+
onClick={() => permission && !readOnly && editFeature()}
9479
style={{ flex: 1 }}
9580
className={`overflow-hidden ${fadeValue ? 'faded' : ''}`}
9681
>
@@ -103,22 +88,14 @@ const CondensedFeatureRow: React.FC<CondensedFeatureRowProps> = ({
10388
<SegmentOverridesIcon
10489
onClick={(e) => {
10590
e.stopPropagation()
106-
editFeature(
107-
projectFlag,
108-
environmentFlags?.[id],
109-
Constants.featurePanelTabs.SEGMENT_OVERRIDES,
110-
)
91+
editFeature(Constants.featurePanelTabs.SEGMENT_OVERRIDES)
11192
}}
11293
count={projectFlag.num_segment_overrides}
11394
/>
11495
<IdentityOverridesIcon
11596
onClick={(e) => {
11697
e.stopPropagation()
117-
editFeature(
118-
projectFlag,
119-
environmentFlags?.[id],
120-
Constants.featurePanelTabs.IDENTITY_OVERRIDES,
121-
)
98+
editFeature(Constants.featurePanelTabs.IDENTITY_OVERRIDES)
12299
}}
123100
count={projectFlag.num_identity_overrides}
124101
showPlusIndicator={showPlusIndicator}

0 commit comments

Comments
 (0)