Skip to content

Commit

Permalink
Merge pull request #503 from France-ioi/fix-task-restart-button
Browse files Browse the repository at this point in the history
[Fix] Put task restart button only when there is a code for this plat…
  • Loading branch information
SebastienTainon authored Jul 24, 2024
2 parents d55d725 + 8c5975c commit 20dc45b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/task/TaskRestartButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import {useDispatch} from 'react-redux';
import {bufferResetToDefaultSourceCode} from '../buffers/buffer_actions';
import {useAppSelector} from '../hooks';
import {quickAlgoLibraries} from './libs/quick_algo_libraries_model';
import {selectActiveBufferPlatform} from '../buffers/buffer_selectors';

export function TaskRestartButton() {
const dispatch = useDispatch();
const activeBufferName = useAppSelector(state => state.buffers.activeBufferName);
const activeBufferPlatform = useAppSelector(selectActiveBufferPlatform);

const environment = useAppSelector(state => state.environment);
const context = quickAlgoLibraries.getContext(null, environment);
if (!context?.infos?.startingExample) {
if (!context?.infos?.startingExample || !(activeBufferPlatform in context?.infos?.startingExample)) {
return null;
}

Expand Down

0 comments on commit 20dc45b

Please sign in to comment.