Skip to content

Commit d4d109d

Browse files
committed
fix(react): solve-button not working before lesson loads
1 parent 316d743 commit d4d109d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/components/react/src/Panels/EditorPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function FileTab({ i18n, editorDocument, helpAction, onHelpClick }: FileTabProps
125125
<span className="text-sm">{fileName}</span>
126126
</div>
127127
{!!helpAction && (
128-
<button onClick={onHelpClick} className="panel-button px-2 py-0.5 -mr-1 -my-1">
128+
<button onClick={onHelpClick} disabled={!onHelpClick} className="panel-button px-2 py-0.5 -mr-1 -my-1">
129129
{helpAction === 'solve' && <div className="i-ph-lightbulb-duotone text-lg" />}
130130
{helpAction === 'solve' && i18n.solveButtonText}
131131
{helpAction === 'reset' && <div className="i-ph-clock-counter-clockwise-duotone" />}

packages/components/react/src/Panels/WorkspacePanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function WorkspacePanel({ tutorialStore, theme }: Props) {
4040

4141
const selectedFile = useStore(tutorialStore.selectedFile);
4242
const currentDocument = useStore(tutorialStore.currentDocument);
43+
const lessonFullyLoaded = useStore(tutorialStore.lessonFullyLoaded);
4344

4445
const lesson = tutorialStore.lesson!;
4546

@@ -162,7 +163,7 @@ export function WorkspacePanel({ tutorialStore, theme }: Props) {
162163
i18n={lesson.data.i18n as I18n}
163164
hideRoot={lesson.data.hideRoot}
164165
helpAction={helpAction}
165-
onHelpClick={onHelpClick}
166+
onHelpClick={lessonFullyLoaded ? onHelpClick : undefined}
166167
onFileSelect={onFileSelect}
167168
selectedFile={selectedFile}
168169
onEditorScroll={onEditorScroll}

0 commit comments

Comments
 (0)