Skip to content

Commit d5dfa73

Browse files
committed
fix(react): solve-button not working before lesson loads
1 parent e946c5a commit d5dfa73

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

@@ -158,7 +159,7 @@ export function WorkspacePanel({ tutorialStore, theme }: Props) {
158159
i18n={lesson.data.i18n as I18n}
159160
hideRoot={lesson.data.hideRoot}
160161
helpAction={helpAction}
161-
onHelpClick={onHelpClick}
162+
onHelpClick={lessonFullyLoaded ? onHelpClick : undefined}
162163
onFileSelect={onFileSelect}
163164
selectedFile={selectedFile}
164165
onEditorScroll={onEditorScroll}

0 commit comments

Comments
 (0)