* fix(player): fix initial visual offset jump check * change(ui): add empty feature flags page * change(ui): add empty feature flags page * fix(ui): some more fixes * change(ui): add subrouting for sessions tab * change(ui): more fixes for routing * change(ui): add flag creation page, flags list table, flag store/type * change(tracker): flags in tracker * change(tracker): return all flags * feat(ui): add API and types connector * feat(ui): split components to prevent rerendering * feat(ui): add icon, fix redirect.path crashlooping * feat(ui): add conditions and stuff, add flags class to tracker to handle stuff * feat(ui): add condition state and filters * feat(ui): fix flag creation with api change * feat(ui): fix flag editing (api changes); simplify new/edit flag component * feat(ui): add filters, make table pretty :insert_magic_emoji: * feat(ui): remove rollout percentage from list, remove console logs * feat(ui): multivar toggler * feat(tracker): add more methods to tracker * feat(tracker): more type coverage * feat(tracker): add tests * fix(ui): some fixes for multivar * feat(ui): multivar api support * fix(ui):start adding tests for fflags * fix(ui): rm not working file.. * fix(ui): rm unused packages * fix(ui): remove name field, fix some api and type names * fix(ui): fix crash * fix(tracker/ui): keep flags in sessionStorage, support API errors in feature flags storage * fix(tracker/ui): clear unused things, fix url handling, fix icons rendering etc
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
import { observer } from 'mobx-react-lite';
|
|
import { Button } from 'UI';
|
|
import cn from 'classnames';
|
|
import FeatureFlag from 'MOBX/types/FeatureFlag';
|
|
|
|
function Description({
|
|
isDescrEditing,
|
|
current,
|
|
setEditing,
|
|
showDescription,
|
|
}: {
|
|
showDescription: boolean;
|
|
isDescrEditing: boolean;
|
|
current: FeatureFlag;
|
|
setEditing: ({ isDescrEditing }: { isDescrEditing: boolean }) => void;
|
|
}) {
|
|
return (
|
|
<>
|
|
<label>
|
|
<span className={'font-semibold'}>Description </span> <span className={"text-disabled-text text-sm"}>(Optional)</span>
|
|
</label>
|
|
{isDescrEditing ? (
|
|
<textarea
|
|
name="flag-description"
|
|
placeholder="Description..."
|
|
rows={3}
|
|
autoFocus
|
|
className="rounded fluid border px-2 py-1 w-full"
|
|
value={current.description}
|
|
onChange={(e) => {
|
|
if (current) current.setDescription(e.target.value);
|
|
}}
|
|
onBlur={() => setEditing({ isDescrEditing: false })}
|
|
onFocus={() => setEditing({ isDescrEditing: true })}
|
|
/>
|
|
) : showDescription ? (
|
|
<div
|
|
onClick={() => setEditing({ isDescrEditing: true })}
|
|
className={cn(
|
|
'cursor-pointer border-b w-fit',
|
|
'border-b-borderColor-transparent hover:border-dotted hover:border-gray-medium'
|
|
)}
|
|
>
|
|
{current.description}
|
|
</div>
|
|
) : (
|
|
<Button
|
|
variant={'text-primary'}
|
|
icon={'edit'}
|
|
onClick={() => setEditing({ isDescrEditing: true })}
|
|
>
|
|
Add
|
|
</Button>
|
|
)}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default observer(Description);
|