feat: editor page title rework (#44246)
* fix: remove "learn" from title * feat: translate title element
This commit is contained in:
committed by
GitHub
parent
312b7afaf4
commit
edf3185b2b
@ -280,12 +280,9 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
|
|
||||||
getChallenge = () => this.props.data.challengeNode;
|
getChallenge = () => this.props.data.challengeNode;
|
||||||
|
|
||||||
getBlockNameTitle() {
|
getBlockNameTitle(t: TFunction) {
|
||||||
const {
|
const { block, superBlock, title } = this.getChallenge();
|
||||||
fields: { blockName },
|
return `${t(`intro:${superBlock}.blocks.${block}.title`)}: ${title}`;
|
||||||
title
|
|
||||||
} = this.getChallenge();
|
|
||||||
return `${blockName}: ${title}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getVideoUrl = () => this.getChallenge().videoUrl;
|
getVideoUrl = () => this.getChallenge().videoUrl;
|
||||||
@ -422,11 +419,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
usesMultifileEditor={usesMultifileEditor}
|
usesMultifileEditor={usesMultifileEditor}
|
||||||
>
|
>
|
||||||
<LearnLayout>
|
<LearnLayout>
|
||||||
<Helmet
|
<Helmet title={`${this.getBlockNameTitle(t)} | freeCodeCamp.org`} />
|
||||||
title={`${t(
|
|
||||||
'learn.learn'
|
|
||||||
)} ${this.getBlockNameTitle()} | freeCodeCamp.org`}
|
|
||||||
/>
|
|
||||||
<Media maxWidth={MAX_MOBILE_WIDTH}>
|
<Media maxWidth={MAX_MOBILE_WIDTH}>
|
||||||
<MobileLayout
|
<MobileLayout
|
||||||
editor={this.renderEditor()}
|
editor={this.renderEditor()}
|
||||||
|
@ -203,7 +203,9 @@ class BackEnd extends Component<BackEndProps> {
|
|||||||
updateSolutionFormValues
|
updateSolutionFormValues
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const blockNameTitle = `${blockName} - ${title}`;
|
const blockNameTitle = `${t(
|
||||||
|
`intro:${superBlock}.blocks.${block}.title`
|
||||||
|
)} - ${title}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hotkeys
|
<Hotkeys
|
||||||
|
@ -149,7 +149,9 @@ class Project extends Component<ProjectProps> {
|
|||||||
updateSolutionFormValues
|
updateSolutionFormValues
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const blockNameTitle = `${blockName} - ${title}`;
|
const blockNameTitle = `${t(
|
||||||
|
`intro:${superBlock}.blocks.${block}.title`
|
||||||
|
)} - ${title}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Hotkeys
|
<Hotkeys
|
||||||
|
@ -189,7 +189,9 @@ class ShowVideo extends Component<ShowVideoProps, ShowVideoState> {
|
|||||||
isChallengeCompleted
|
isChallengeCompleted
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const blockNameTitle = `${blockName} - ${title}`;
|
const blockNameTitle = `${t(
|
||||||
|
`intro:${superBlock}.blocks.${block}.title`
|
||||||
|
)} - ${title}`;
|
||||||
return (
|
return (
|
||||||
<Hotkeys
|
<Hotkeys
|
||||||
executeChallenge={() => {
|
executeChallenge={() => {
|
||||||
|
@ -19,7 +19,7 @@ describe('Backend challenge', function () {
|
|||||||
|
|
||||||
cy.title().should(
|
cy.title().should(
|
||||||
'eq',
|
'eq',
|
||||||
'Managing Packages with Npm - How to Use package.json, the Core of Any' +
|
'Managing Packages with NPM - How to Use package.json, the Core of Any' +
|
||||||
' Node.js Project or npm Package | Learn | freeCodeCamp.org'
|
' Node.js Project or npm Package | Learn | freeCodeCamp.org'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -27,8 +27,7 @@ describe('Classic challenge', function () {
|
|||||||
it('renders the default output text', () => {
|
it('renders the default output text', () => {
|
||||||
cy.title().should(
|
cy.title().should(
|
||||||
'eq',
|
'eq',
|
||||||
'Learn Basic HTML and HTML5: Say Hello to HTML Elements |' +
|
'Basic HTML and HTML5: Say Hello to HTML Elements |' + ' freeCodeCamp.org'
|
||||||
' freeCodeCamp.org'
|
|
||||||
);
|
);
|
||||||
cy.get(selectors.defaultOutput).contains(defaultOutput);
|
cy.get(selectors.defaultOutput).contains(defaultOutput);
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@ describe('challenges/superblock/block/challenge redirect', function () {
|
|||||||
cy.title().should(
|
cy.title().should(
|
||||||
'eq',
|
'eq',
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
'Learn Basic HTML and HTML5: Say Hello to HTML Elements | freeCodeCamp.org'
|
'Basic HTML and HTML5: Say Hello to HTML Elements | freeCodeCamp.org'
|
||||||
);
|
);
|
||||||
cy.location().should(loc => {
|
cy.location().should(loc => {
|
||||||
expect(loc.pathname).to.eq(locations.learnChallenge);
|
expect(loc.pathname).to.eq(locations.learnChallenge);
|
||||||
|
Reference in New Issue
Block a user