openreplay/frontend/app/components/FFlags/NewFFlag/HowTo.tsx
Delirium 203791f0f6
Remove unused code, refactor frontend and revisit libraries (#2458)
* start frontend thinning

* continue thinning

* removing moment and moment-range

* remove highlightjs

* remove semantic-ui

* ghaida commits to openreplay finally

* unused icons

* unused icons

* unused icons

* fix missing icons

---------

Co-authored-by: Ghaida Bouchaala <ghaida.bouchaala@gmail.com>
2024-08-27 16:15:14 +02:00

44 lines
993 B
TypeScript

import React from 'react';
import { PageTitle, CodeBlock } from 'UI';
function HowTo() {
const code = `
// can be imported from @openreplay/tracker
interface IFeatureFlag {
key: string
is_persist: boolean
value: string | boolean
payload: string
}
tracker.onFlagsLoad((flags: IFeatureFlag[]) => {
/* run code */
})
// or
if (openreplay.isFlagEnabled('my_flag')) {
// run your activation code here
}
// or
// returns FeatureFlag if exists
tracker.getFeatureFlag('my_flag')
// reload flags from server
// (in case if any user data changed during the session)
tracker.reloadFlags()
`
return (
<div className={'w-full h-screen p-4'}>
<PageTitle title={'Implement feature flags'} />
<div className={'my-2'}>
<CodeBlock code={code} language={'typescript'} />
</div>
<a className={'link'} href={"https://docs.openreplay.com/en/installation/feature-flags"}>Documentation</a>
</div>
);
}
export default HowTo;