4 Commits

Author SHA1 Message Date
23ec02e29a 1.4.1
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
2025-12-14 16:05:18 +03:00
1291519cda Refactor TaskWorkspace to use getFeatureValue for feature flag retrieval, improving clarity and consistency in skip button functionality.
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
2025-12-14 16:05:05 +03:00
d2783d01c9 1.4.0
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
2025-12-14 16:00:07 +03:00
e29242accf 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.
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
2025-12-14 15:59:07 +03:00
4 changed files with 20 additions and 13 deletions

View File

@@ -23,6 +23,7 @@ module.exports = {
features: { features: {
'challenge': { 'challenge': {
// add your features here in the format [featureName]: { value: string } // add your features here in the format [featureName]: { value: string }
'task.skip.enabled': { value: 'true' }, // Включить кнопку пропуска задания
}, },
}, },
config: { config: {

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "challenge", "name": "challenge",
"version": "1.3.0", "version": "1.4.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "challenge", "name": "challenge",
"version": "1.3.0", "version": "1.4.1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@brojs/cli": "^1.9.4", "@brojs/cli": "^1.9.4",

View File

@@ -1,6 +1,6 @@
{ {
"name": "challenge", "name": "challenge",
"version": "1.3.0", "version": "1.4.1",
"description": "", "description": "",
"main": "./src/index.tsx", "main": "./src/index.tsx",
"scripts": { "scripts": {

View File

@@ -9,6 +9,7 @@ import {
} from '@chakra-ui/react' } from '@chakra-ui/react'
import ReactMarkdown from 'react-markdown' import ReactMarkdown from 'react-markdown'
import remarkGfm from 'remark-gfm' import remarkGfm from 'remark-gfm'
import { getFeatureValue } from '@brojs/cli'
import type { ChallengeTask } from '../../__data__/types' import type { ChallengeTask } from '../../__data__/types'
import { useChallenge } from '../../context/ChallengeContext' import { useChallenge } from '../../context/ChallengeContext'
@@ -27,6 +28,9 @@ export const TaskWorkspace = ({ task, onTaskComplete, onTaskSkip }: TaskWorkspac
taskId: task.id, taskId: task.id,
}) })
// Проверяем, включена ли кнопка пропуска через feature flag
const skipEnabled = getFeatureValue('challenge', 'task.skip.enabled', 'false').value === 'true'
// Сохраняем последний результат, чтобы блок не исчезал // Сохраняем последний результат, чтобы блок не исчезал
const [lastResult, setLastResult] = useState<typeof finalSubmission>(null) const [lastResult, setLastResult] = useState<typeof finalSubmission>(null)
// Состояние для показа дополнительного материала // Состояние для показа дополнительного материала
@@ -397,6 +401,7 @@ export const TaskWorkspace = ({ task, onTaskComplete, onTaskSkip }: TaskWorkspac
<HStack justify="space-between" gap={2}> <HStack justify="space-between" gap={2}>
{!isAccepted && ( {!isAccepted && (
<> <>
{skipEnabled && (
<Button <Button
onClick={onTaskSkip} onClick={onTaskSkip}
variant="outline" variant="outline"
@@ -407,6 +412,7 @@ export const TaskWorkspace = ({ task, onTaskComplete, onTaskSkip }: TaskWorkspac
> >
Пропустить Пропустить
</Button> </Button>
)}
{/* @ts-expect-error Chakra UI v2 uses isLoading/isDisabled */} {/* @ts-expect-error Chakra UI v2 uses isLoading/isDisabled */}
<Button onClick={submit} colorScheme="teal" size="sm" isLoading={isChecking} isDisabled={!result.trim() || isChecking}> <Button onClick={submit} colorScheme="teal" size="sm" isLoading={isChecking} isDisabled={!result.trim() || isChecking}>
{needsRevision ? 'Отправить снова' : 'Отправить на проверку'} {needsRevision ? 'Отправить снова' : 'Отправить на проверку'}