feat(client): add multifile editor breadcrumbs (#42907)
* feat(client): add multifile editor breadcrumbs * adjust margin * update snapshot * re-remove duplicate css * adjust arrow colours * update that pesky snapshot * add title to editor jaw * remove bolding, and center * update snapshot
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import EditorTabs from './EditorTabs';
|
import EditorTabs from './EditorTabs';
|
||||||
|
import BreadCrumb from '../components/bread-crumb';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
block: PropTypes.string,
|
block: PropTypes.string,
|
||||||
@ -11,17 +12,20 @@ const propTypes = {
|
|||||||
switchDisplayTab: PropTypes.func
|
switchDisplayTab: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
const ActionRow = ({ switchDisplayTab, showPreview, showConsole }) => {
|
const ActionRow = ({
|
||||||
|
switchDisplayTab,
|
||||||
|
showPreview,
|
||||||
|
showConsole,
|
||||||
|
superBlock,
|
||||||
|
block
|
||||||
|
}) => {
|
||||||
const restartStep = () => {
|
const restartStep = () => {
|
||||||
console.log('restart');
|
console.log('restart');
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className='action-row'>
|
<div className='action-row'>
|
||||||
<div>
|
<div className='breadcrumbs-demo'>
|
||||||
<h5 className='breadcrumbs-demo'>
|
<BreadCrumb block={block} superBlock={superBlock} />
|
||||||
Responsive Web Design > Basic HTML Cat Photo App >{' '}
|
|
||||||
<span>Step 23 of 213</span>
|
|
||||||
</h5>
|
|
||||||
</div>
|
</div>
|
||||||
<div className='tabs-row'>
|
<div className='tabs-row'>
|
||||||
<EditorTabs />
|
<EditorTabs />
|
||||||
|
@ -13,6 +13,7 @@ const paneType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
block: PropTypes.string,
|
||||||
challengeFiles: PropTypes.object,
|
challengeFiles: PropTypes.object,
|
||||||
editor: PropTypes.element,
|
editor: PropTypes.element,
|
||||||
hasEditableBoundries: PropTypes.bool,
|
hasEditableBoundries: PropTypes.bool,
|
||||||
@ -30,6 +31,7 @@ const propTypes = {
|
|||||||
onStopResize: PropTypes.func,
|
onStopResize: PropTypes.func,
|
||||||
onResize: PropTypes.func
|
onResize: PropTypes.func
|
||||||
}),
|
}),
|
||||||
|
superBlock: PropTypes.string,
|
||||||
testOutput: PropTypes.element
|
testOutput: PropTypes.element
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -68,7 +70,9 @@ class DesktopLayout extends Component {
|
|||||||
hasPreview,
|
hasPreview,
|
||||||
layoutState,
|
layoutState,
|
||||||
preview,
|
preview,
|
||||||
hasEditableBoundries
|
hasEditableBoundries,
|
||||||
|
superBlock,
|
||||||
|
block
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { showPreview, showConsole } = this.state;
|
const { showPreview, showConsole } = this.state;
|
||||||
@ -85,7 +89,12 @@ class DesktopLayout extends Component {
|
|||||||
return (
|
return (
|
||||||
<ReflexContainer className='desktop-layout' orientation='horizontal'>
|
<ReflexContainer className='desktop-layout' orientation='horizontal'>
|
||||||
{projectBasedChallenge && (
|
{projectBasedChallenge && (
|
||||||
<ActionRow switchDisplayTab={this.switchDisplayTab} {...this.state} />
|
<ActionRow
|
||||||
|
block={block}
|
||||||
|
switchDisplayTab={this.switchDisplayTab}
|
||||||
|
{...this.state}
|
||||||
|
superBlock={superBlock}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<ReflexElement flex={8} {...reflexProps} {...resizeProps}>
|
<ReflexElement flex={8} {...reflexProps} {...resizeProps}>
|
||||||
<ReflexContainer orientation='vertical'>
|
<ReflexContainer orientation='vertical'>
|
||||||
|
@ -43,6 +43,7 @@ const propTypes = {
|
|||||||
setAccessibilityMode: PropTypes.func.isRequired,
|
setAccessibilityMode: PropTypes.func.isRequired,
|
||||||
setEditorFocusability: PropTypes.func,
|
setEditorFocusability: PropTypes.func,
|
||||||
theme: PropTypes.string,
|
theme: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
updateFile: PropTypes.func.isRequired,
|
updateFile: PropTypes.func.isRequired,
|
||||||
visibleEditors: PropTypes.shape({
|
visibleEditors: PropTypes.shape({
|
||||||
indexjs: PropTypes.bool,
|
indexjs: PropTypes.bool,
|
||||||
@ -98,6 +99,7 @@ class MultifileEditor extends Component {
|
|||||||
editorRef,
|
editorRef,
|
||||||
theme,
|
theme,
|
||||||
resizeProps,
|
resizeProps,
|
||||||
|
title,
|
||||||
visibleEditors: { indexcss, indexhtml, indexjs, indexjsx }
|
visibleEditors: { indexcss, indexhtml, indexjs, indexjsx }
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const editorTheme = theme === 'night' ? 'vs-dark-custom' : 'vs-custom';
|
const editorTheme = theme === 'night' ? 'vs-dark-custom' : 'vs-custom';
|
||||||
@ -155,6 +157,7 @@ class MultifileEditor extends Component {
|
|||||||
key='indexjsx'
|
key='indexjsx'
|
||||||
resizeProps={resizeProps}
|
resizeProps={resizeProps}
|
||||||
theme={editorTheme}
|
theme={editorTheme}
|
||||||
|
title={title}
|
||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
)}
|
)}
|
||||||
@ -174,6 +177,7 @@ class MultifileEditor extends Component {
|
|||||||
key='indexhtml'
|
key='indexhtml'
|
||||||
resizeProps={resizeProps}
|
resizeProps={resizeProps}
|
||||||
theme={editorTheme}
|
theme={editorTheme}
|
||||||
|
title={title}
|
||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
)}
|
)}
|
||||||
@ -191,6 +195,7 @@ class MultifileEditor extends Component {
|
|||||||
key='indexcss'
|
key='indexcss'
|
||||||
resizeProps={resizeProps}
|
resizeProps={resizeProps}
|
||||||
theme={editorTheme}
|
theme={editorTheme}
|
||||||
|
title={title}
|
||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
)}
|
)}
|
||||||
@ -209,6 +214,7 @@ class MultifileEditor extends Component {
|
|||||||
key='indexjs'
|
key='indexjs'
|
||||||
resizeProps={resizeProps}
|
resizeProps={resizeProps}
|
||||||
theme={editorTheme}
|
theme={editorTheme}
|
||||||
|
title={title}
|
||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
)}
|
)}
|
||||||
|
@ -303,7 +303,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
|
|
||||||
renderEditor() {
|
renderEditor() {
|
||||||
const { files } = this.props;
|
const { files } = this.props;
|
||||||
const { description } = this.getChallenge();
|
const { description, title } = this.getChallenge();
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
return (
|
return (
|
||||||
files && (
|
files && (
|
||||||
@ -314,6 +314,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
editorRef={this.editorRef}
|
editorRef={this.editorRef}
|
||||||
hasEditableBoundries={this.hasEditableBoundries()}
|
hasEditableBoundries={this.hasEditableBoundries()}
|
||||||
resizeProps={this.resizeProps}
|
resizeProps={this.resizeProps}
|
||||||
|
title={title}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -395,6 +396,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
</Media>
|
</Media>
|
||||||
<Media minWidth={MAX_MOBILE_WIDTH + 1}>
|
<Media minWidth={MAX_MOBILE_WIDTH + 1}>
|
||||||
<DesktopLayout
|
<DesktopLayout
|
||||||
|
block={block}
|
||||||
challengeFiles={files}
|
challengeFiles={files}
|
||||||
editor={this.renderEditor()}
|
editor={this.renderEditor()}
|
||||||
hasEditableBoundries={this.hasEditableBoundries()}
|
hasEditableBoundries={this.hasEditableBoundries()}
|
||||||
@ -405,6 +407,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
layoutState={this.state.layout}
|
layoutState={this.state.layout}
|
||||||
preview={this.renderPreview()}
|
preview={this.renderPreview()}
|
||||||
resizeProps={this.resizeProps}
|
resizeProps={this.resizeProps}
|
||||||
|
superBlock={superBlock}
|
||||||
testOutput={this.renderTestOutput()}
|
testOutput={this.renderTestOutput()}
|
||||||
/>
|
/>
|
||||||
</Media>
|
</Media>
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
|
|
||||||
.breadcrumbs-demo {
|
.breadcrumbs-demo {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
margin: 0 0 1.2rem;
|
||||||
|
|
||||||
.breadcrumbs-demo span {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-row {
|
.tabs-row {
|
||||||
|
@ -67,6 +67,7 @@ interface EditorProps {
|
|||||||
submitChallenge: () => void;
|
submitChallenge: () => void;
|
||||||
tests: TestType[];
|
tests: TestType[];
|
||||||
theme: string;
|
theme: string;
|
||||||
|
title: string;
|
||||||
updateFile: (objest: {
|
updateFile: (objest: {
|
||||||
key: FileKeyTypes;
|
key: FileKeyTypes;
|
||||||
editorValue: string;
|
editorValue: string;
|
||||||
@ -493,7 +494,9 @@ const Editor = (props: EditorProps): JSX.Element => {
|
|||||||
|
|
||||||
function createDescription(editor: editor.IStandaloneCodeEditor) {
|
function createDescription(editor: editor.IStandaloneCodeEditor) {
|
||||||
if (data.descriptionNode) return data.descriptionNode;
|
if (data.descriptionNode) return data.descriptionNode;
|
||||||
const { description } = props;
|
const { description, title } = props;
|
||||||
|
const jawHeading = document.createElement('h3');
|
||||||
|
jawHeading.innerText = title;
|
||||||
// TODO: var was used here. Should it?
|
// TODO: var was used here. Should it?
|
||||||
const domNode = document.createElement('div');
|
const domNode = document.createElement('div');
|
||||||
const desc = document.createElement('div');
|
const desc = document.createElement('div');
|
||||||
@ -501,6 +504,7 @@ const Editor = (props: EditorProps): JSX.Element => {
|
|||||||
descContainer.classList.add('description-container');
|
descContainer.classList.add('description-container');
|
||||||
domNode.classList.add('editor-upper-jaw');
|
domNode.classList.add('editor-upper-jaw');
|
||||||
domNode.appendChild(descContainer);
|
domNode.appendChild(descContainer);
|
||||||
|
descContainer.appendChild(jawHeading);
|
||||||
descContainer.appendChild(desc);
|
descContainer.appendChild(desc);
|
||||||
desc.innerHTML = description;
|
desc.innerHTML = description;
|
||||||
// desc.style.background = 'white';
|
// desc.style.background = 'white';
|
||||||
@ -708,8 +712,7 @@ const Editor = (props: EditorProps): JSX.Element => {
|
|||||||
// TODO: handle the case that the editable region reaches the bottom of the
|
// TODO: handle the case that the editable region reaches the bottom of the
|
||||||
// editor
|
// editor
|
||||||
return (
|
return (
|
||||||
data.model?.getDecorationRange(data.endEditDecId)
|
data.model?.getDecorationRange(data.endEditDecId)?.startLineNumber ?? 1
|
||||||
?.startLineNumber ?? 1
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@ interface BreadCrumbProps {
|
|||||||
function BreadCrumb({ block, superBlock }: BreadCrumbProps): JSX.Element {
|
function BreadCrumb({ block, superBlock }: BreadCrumbProps): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div className='challenge-title-breadcrumbs'>
|
<div className='challenge-title-breadcrumbs'>
|
||||||
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
|
||||||
{/* @ts-ignore */}
|
|
||||||
<Link
|
<Link
|
||||||
className='breadcrumb-left'
|
className='breadcrumb-left'
|
||||||
state={{ breadcrumbBlockClick: block }}
|
state={{ breadcrumbBlockClick: block }}
|
||||||
@ -24,8 +22,6 @@ function BreadCrumb({ block, superBlock }: BreadCrumbProps): JSX.Element {
|
|||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
<div className='breadcrumb-center' />
|
<div className='breadcrumb-center' />
|
||||||
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
|
||||||
{/* @ts-ignore */}
|
|
||||||
<Link
|
<Link
|
||||||
className='breadcrumb-right'
|
className='breadcrumb-right'
|
||||||
state={{ breadcrumbBlockClick: block }}
|
state={{ breadcrumbBlockClick: block }}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border: 1px solid var(--quaternary-background);
|
border: 1px solid var(--quaternary-background);
|
||||||
height: 25px;
|
height: 25px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumb-left {
|
.breadcrumb-left {
|
||||||
@ -30,7 +31,6 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-height: 25px;
|
max-height: 25px;
|
||||||
word-wrap: none;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 2;
|
flex-shrink: 2;
|
||||||
@ -57,7 +57,6 @@
|
|||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
flex-grow: 2;
|
flex-grow: 2;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
word-wrap: none;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@ -86,7 +85,6 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-height: fit-content;
|
max-height: fit-content;
|
||||||
word-wrap: none;
|
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
Reference in New Issue
Block a user