Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(react): solve-button not working before lesson loads #266

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/components/react/src/Panels/EditorPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function FileTab({ i18n, editorDocument, helpAction, onHelpClick }: FileTabProps
<span className="text-sm">{fileName}</span>
</div>
{!!helpAction && (
<button onClick={onHelpClick} className="panel-button px-2 py-0.5 -mr-1 -my-1">
<button onClick={onHelpClick} disabled={!onHelpClick} className="panel-button px-2 py-0.5 -mr-1 -my-1">
{helpAction === 'solve' && <div className="i-ph-lightbulb-duotone text-lg" />}
{helpAction === 'solve' && i18n.solveButtonText}
{helpAction === 'reset' && <div className="i-ph-clock-counter-clockwise-duotone" />}
Expand Down
3 changes: 2 additions & 1 deletion packages/components/react/src/Panels/WorkspacePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function WorkspacePanel({ tutorialStore, theme }: Props) {

const selectedFile = useStore(tutorialStore.selectedFile);
const currentDocument = useStore(tutorialStore.currentDocument);
const lessonFullyLoaded = useStore(tutorialStore.lessonFullyLoaded);

const lesson = tutorialStore.lesson!;

Expand Down Expand Up @@ -162,7 +163,7 @@ export function WorkspacePanel({ tutorialStore, theme }: Props) {
i18n={lesson.data.i18n as I18n}
hideRoot={lesson.data.hideRoot}
helpAction={helpAction}
onHelpClick={onHelpClick}
onHelpClick={lessonFullyLoaded ? onHelpClick : undefined}
onFileSelect={onFileSelect}
selectedFile={selectedFile}
onEditorScroll={onEditorScroll}
Expand Down