Skip to content

Commit

Permalink
fix(ExternalTasks): show external task form only for beta users
Browse files Browse the repository at this point in the history
  • Loading branch information
LamaEats committed Sep 12, 2024
1 parent a25dcfd commit 568bfc3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/components/BetaLiteral.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Text } from '@taskany/bricks/harmony';

export const BetaLiteral: React.FC<Pick<React.ComponentProps<typeof Text>, 'size'>> = ({ size }) => {
return (
<Text as="span" color="var(--brand-color)" size={size}>
{String.fromCharCode(0x03b2)}
</Text>
);
};
8 changes: 5 additions & 3 deletions src/components/CriteriaForm/CriteriaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { FilterAutoCompleteInput } from '../FilterAutoCompleteInput/FilterAutoCo
import { AddInlineTrigger } from '../AddInlineTrigger/AddInlineTrigger';
import { StateDot } from '../StateDot/StateDot';
import { JiraTaskBadge, JiraTaskBadgeIcon } from '../JiraTaskBadge/JiraTaskBadge';
import { BetaLiteral } from '../BetaLiteral';

import { tr } from './CriteriaForm.i18n';
import s from './CriteriaForm.module.css';
Expand Down Expand Up @@ -335,14 +336,14 @@ export const CriteriaForm = ({

const isEditMode = values != null && !!values.title?.length;

const radios = useMemo<Array<{ value: CriteriaFormMode; title: string }>>(() => {
const base: Array<{ value: CriteriaFormMode; title: string }> = [
const radios = useMemo<Array<{ value: CriteriaFormMode; title: string; iconRight?: React.ReactNode }>>(() => {
const base: Array<{ value: CriteriaFormMode; title: string; iconRight?: React.ReactNode }> = [
{ title: tr('Simple'), value: 'simple' },
{ title: tr('Goal'), value: 'goal' },
];

if (externalAllowed) {
base.push({ title: tr('Task'), value: 'task' });
base.push({ title: tr('Task'), value: 'task', iconRight: <BetaLiteral size="s" /> });
}

return base;
Expand Down Expand Up @@ -465,6 +466,7 @@ export const CriteriaForm = ({
key={radio.value}
text={radio.title}
value={radio.value}
iconRight={radio.iconRight}
/>
))}
</Switch>
Expand Down
2 changes: 1 addition & 1 deletion src/components/GoalActivityFeed/GoalActivityFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export const GoalActivityFeed = forwardRef<HTMLDivElement, GoalActivityFeedProps
validateGoalCriteriaBindings={validateGoalCriteriaBindings}
validityData={criteriaValidityData}
filter={[goal.id, ...parentGoalIds.map((id) => id.id)]}
externalAllowed={allowedServices?.jira || false}
externalAllowed={(user?.settings?.beta && allowedServices?.jira) || false}
/>
</GoalFormPopupTrigger>
))}
Expand Down

0 comments on commit 568bfc3

Please sign in to comment.