From e29242accfefbdcc6699930fefa73c1c548c57b1 Mon Sep 17 00:00:00 2001 From: Primakov Alexandr Date: Sun, 14 Dec 2025 15:59:07 +0300 Subject: [PATCH] Add feature flag for task skip functionality in TaskWorkspace. Update bro.config.js to enable skip button based on feature toggle, enhancing user experience in task management. --- bro.config.js | 1 + src/components/personal/TaskWorkspace.tsx | 26 ++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/bro.config.js b/bro.config.js index f412954..639d8bc 100644 --- a/bro.config.js +++ b/bro.config.js @@ -23,6 +23,7 @@ module.exports = { features: { 'challenge': { // add your features here in the format [featureName]: { value: string } + 'task.skip.enabled': { value: 'true' }, // Включить кнопку пропуска задания }, }, config: { diff --git a/src/components/personal/TaskWorkspace.tsx b/src/components/personal/TaskWorkspace.tsx index 26211e0..0f99f6c 100644 --- a/src/components/personal/TaskWorkspace.tsx +++ b/src/components/personal/TaskWorkspace.tsx @@ -9,6 +9,7 @@ import { } from '@chakra-ui/react' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' +import { useFeature } from '@brojs/cli' import type { ChallengeTask } from '../../__data__/types' import { useChallenge } from '../../context/ChallengeContext' @@ -27,6 +28,9 @@ export const TaskWorkspace = ({ task, onTaskComplete, onTaskSkip }: TaskWorkspac taskId: task.id, }) + // Проверяем, включена ли кнопка пропуска через feature flag + const skipEnabled = useFeature('challenge', 'task.skip.enabled', 'false') === 'true' + // Сохраняем последний результат, чтобы блок не исчезал const [lastResult, setLastResult] = useState(null) // Состояние для показа дополнительного материала @@ -397,16 +401,18 @@ export const TaskWorkspace = ({ task, onTaskComplete, onTaskSkip }: TaskWorkspac {!isAccepted && ( <> - + {skipEnabled && ( + + )} {/* @ts-expect-error Chakra UI v2 uses isLoading/isDisabled */}