1+ import type { I18n } from '@tutorialkit/types' ;
12import { useEffect , useRef } from 'react' ;
23import { Panel , PanelGroup , PanelResizeHandle , type ImperativePanelHandle } from 'react-resizable-panels' ;
34import {
78 type OnScrollCallback as OnEditorScroll ,
89} from '../core/CodeMirrorEditor/index.js' ;
910import { FileTree } from '../core/FileTree.js' ;
10- import resizePanelStyles from '../styles/resize-panel.module.css' ;
1111import type { Theme } from '../core/types.js' ;
12+ import resizePanelStyles from '../styles/resize-panel.module.css' ;
1213import { isMobile } from '../utils/mobile.js' ;
1314
1415const DEFAULT_FILE_TREE_SIZE = 25 ;
@@ -17,6 +18,7 @@ interface Props {
1718 theme : Theme ;
1819 id : unknown ;
1920 files : string [ ] ;
21+ i18n : I18n ;
2022 hideRoot ?: boolean ;
2123 fileTreeScope ?: string ;
2224 showFileTree ?: boolean ;
@@ -33,6 +35,7 @@ export function EditorPanel({
3335 theme,
3436 id,
3537 files,
38+ i18n,
3639 hideRoot,
3740 fileTreeScope,
3841 showFileTree = true ,
@@ -68,7 +71,7 @@ export function EditorPanel({
6871 < div className = "panel-header border-r border-b border-tk-elements-app-borderColor" >
6972 < div className = "panel-title" >
7073 < div className = "panel-icon i-ph-tree-structure-duotone shrink-0" > </ div >
71- < span className = "text-sm" > Files </ span >
74+ < span className = "text-sm" > { i18n . filesTitleText } </ span >
7275 </ div >
7376 </ div >
7477 < FileTree
@@ -86,7 +89,7 @@ export function EditorPanel({
8689 hitAreaMargins = { { fine : 8 , coarse : 8 } }
8790 />
8891 < Panel className = "flex flex-col" defaultSize = { 100 } minSize = { 10 } >
89- < FileTab editorDocument = { editorDocument } onHelpClick = { onHelpClick } helpAction = { helpAction } />
92+ < FileTab i18n = { i18n } editorDocument = { editorDocument } onHelpClick = { onHelpClick } helpAction = { helpAction } />
9093 < div className = "h-full flex-1 overflow-hidden" >
9194 < CodeMirrorEditor
9295 className = "h-full"
@@ -104,12 +107,13 @@ export function EditorPanel({
104107}
105108
106109interface FileTabProps {
110+ i18n : I18n ;
107111 editorDocument : EditorDocument | undefined ;
108112 helpAction ?: 'reset' | 'solve' ;
109113 onHelpClick ?: ( ) => void ;
110114}
111115
112- function FileTab ( { editorDocument, helpAction, onHelpClick } : FileTabProps ) {
116+ function FileTab ( { i18n , editorDocument, helpAction, onHelpClick } : FileTabProps ) {
113117 const filePath = editorDocument ?. filePath ;
114118 const fileName = filePath ?. split ( '/' ) . at ( - 1 ) ?? '' ;
115119 const icon = fileName ? getFileIcon ( fileName ) : '' ;
@@ -123,9 +127,9 @@ function FileTab({ editorDocument, helpAction, onHelpClick }: FileTabProps) {
123127 { ! ! helpAction && (
124128 < button onClick = { onHelpClick } className = "panel-button px-2 py-0.5 -mr-1 -my-1" >
125129 { helpAction === 'solve' && < div className = "i-ph-lightbulb-duotone text-lg" /> }
126- { helpAction === 'solve' && 'Solve' }
130+ { helpAction === 'solve' && i18n . solveButtonText }
127131 { helpAction === 'reset' && < div className = "i-ph-clock-counter-clockwise-duotone" /> }
128- { helpAction === 'reset' && 'Reset' }
132+ { helpAction === 'reset' && i18n . resetButtonText }
129133 </ button >
130134 ) }
131135 </ div >
0 commit comments