-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: feature filters and compact mode (#3136)
- Loading branch information
Showing
37 changed files
with
1,058 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import flagsmith from 'flagsmith' | ||
|
||
export type ViewMode = 'compact' | 'normal' | ||
export function getViewMode() { | ||
const viewMode = flagsmith.getTrait('view_mode') | ||
if (viewMode === 'compact') { | ||
return 'compact' as ViewMode | ||
} | ||
return 'default' as ViewMode | ||
} | ||
export function setViewMode(viewMode: ViewMode) { | ||
return flagsmith.setTrait('view_mode', viewMode) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import React, { FC } from 'react' | ||
import { FeatureState, ProjectFlag } from 'common/types/responses' | ||
import { useGetTagsQuery } from 'common/services/useTag' | ||
import FeatureRow from './FeatureRow' | ||
import { flag } from 'ionicons/icons' | ||
|
||
type ExampleFeatureRowType = {} | ||
|
||
const ExampleFeatureRow: FC<ExampleFeatureRowType> = ({}) => { | ||
const flag: ProjectFlag = { | ||
created_date: new Date().toISOString(), | ||
default_enabled: true, | ||
description: 'Feature description', | ||
id: 1, | ||
initial_value: 'Blue', | ||
is_archived: false, | ||
is_server_key_only: false, | ||
multivariate_options: [], | ||
name: 'example_feature', | ||
num_identity_overrides: 1, | ||
num_segment_overrides: 1, | ||
owner_groups: [], | ||
owners: [], | ||
project: 1, | ||
tags: [], | ||
type: 'STANDARD', | ||
uuid: '1', | ||
} | ||
const flag2: ProjectFlag = { | ||
created_date: new Date().toISOString(), | ||
default_enabled: true, | ||
description: 'Feature description', | ||
id: 1, | ||
initial_value: `2`, | ||
is_archived: false, | ||
is_server_key_only: false, | ||
multivariate_options: [], | ||
name: 'example_feature2', | ||
num_identity_overrides: 1, | ||
num_segment_overrides: 1, | ||
owner_groups: [], | ||
owners: [], | ||
project: 1, | ||
tags: [], | ||
type: 'STANDARD', | ||
uuid: '1', | ||
} | ||
const featureState: FeatureState = { | ||
created_at: '', | ||
enabled: false, | ||
environment: 1, | ||
feature: flag.id, | ||
feature_state_value: flag.initial_value, | ||
id: 1, | ||
multivariate_feature_state_values: [], | ||
updated_at: '', | ||
uuid: '', | ||
} | ||
return ( | ||
<div className='panel no-pad'> | ||
<div className='panel-content'> | ||
<div className='search-list'> | ||
<FeatureRow | ||
environmentFlags={{ 1: featureState }} | ||
projectFlags={[flag, flag2]} | ||
environmentId={1} | ||
disableControls | ||
permission={true} | ||
projectId={'2'} | ||
index={0} | ||
toggleFlag={() => {}} | ||
removeFlag={() => {}} | ||
projectFlag={flag} | ||
/> | ||
<FeatureRow | ||
environmentFlags={{ 1: featureState }} | ||
projectFlags={[flag, flag2]} | ||
environmentId={1} | ||
disableControls | ||
permission={true} | ||
projectId={'2'} | ||
index={1} | ||
toggleFlag={() => {}} | ||
removeFlag={() => {}} | ||
projectFlag={flag} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default ExampleFeatureRow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
f6319e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
docs-flagsmith.vercel.app
docs-git-main-flagsmith.vercel.app
docs.bullet-train.io
docs.flagsmith.com
f6319e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-preview – ./frontend
flagsmith-frontend-preview-git-main-flagsmith.vercel.app
flagsmith-frontend-production-native.vercel.app
flagsmith-frontend-preview-flagsmith.vercel.app
f6319e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-staging – ./frontend
flagsmith-frontend-staging-flagsmith.vercel.app
flagsmith-staging-frontend.vercel.app
flagsmith-frontend-staging-git-main-flagsmith.vercel.app
staging.flagsmith.com