Skip to content
Draft
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
19 changes: 19 additions & 0 deletions src/components/ChallengeSandbox/ChallengeSandbox.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,25 @@
contain-intrinsic-size: auto 400px;
}

/* Monaco editor loading placeholder — shared by dynamic() loading and fallback render */
.editorLoadingPlaceholder {
padding: var(--base-size-16);
text-align: center;
height: 100%;
min-height: 300px;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--bgColor-muted);
color: var(--fgColor-muted);
font-size: var(--text-body-size-small);
}

/* Wrapper that adds bottom spacing after the solve-error Banner */
.solveErrorBanner {
margin-bottom: var(--base-size-16);
}

.codeTextarea {
width: 100%;
height: 100%;
Expand Down
45 changes: 10 additions & 35 deletions src/components/ChallengeSandbox/ChallengeSandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,7 @@ import React, { useCallback, useEffect, useState } from 'react';
// PERF: Set ssr: false to prevent hydration issues and reduce server bundle
const Editor = dynamic(() => import('@monaco-editor/react'), {
loading: () => (
<div
style={{
padding: '16px',
textAlign: 'center',
height: '100%',
minHeight: '300px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'var(--bgColor-muted, #f6f8fa)',
color: 'var(--fgColor-muted, #656d76)',
fontSize: '14px',
}}
>
<div className={styles.editorLoadingPlaceholder}>
Loading editor...
</div>
),
Expand Down Expand Up @@ -372,13 +359,14 @@ export function ChallengeSandbox({

{/* Solution error message */}
{solveError && (
<Banner
title="Error"
description={solveError}
variant="critical"
hideTitle
style={{ marginBottom: 16 }}
/>
<div className={styles.solveErrorBanner}>
<Banner
title="Error"
description={solveError}
variant="critical"
hideTitle
/>
</div>
)}

{mode === 'guided' && (
Expand Down Expand Up @@ -459,20 +447,7 @@ export function ChallengeSandbox({
aria-label={`Code editor for ${activeFileName}`}
/>
) : (
<div
style={{
padding: '16px',
textAlign: 'center',
height: '100%',
minHeight: '300px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'var(--bgColor-muted, #f6f8fa)',
color: 'var(--fgColor-muted, #656d76)',
fontSize: '14px',
}}
>
<div className={styles.editorLoadingPlaceholder}>
Loading editor...
</div>
)}
Expand Down
Loading