Skip to content

Commit 21ca306

Browse files
authored
Merge branch 'develop' into replacing-any-by-unknown-as-a-good-practice-in-ts
2 parents 3dcec5f + fa70fe2 commit 21ca306

File tree

17 files changed

+5661
-1342
lines changed

17 files changed

+5661
-1342
lines changed

client/index.jsx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { render } from 'react-dom';
33
import { Provider } from 'react-redux';
44
import { Router } from 'react-router-dom';
55

6+
import { useTranslation } from 'react-i18next';
67
import browserHistory from './browserHistory';
78
import configureStore from './store';
89
import Routing from './routes';
@@ -63,14 +64,32 @@ if (
6364
document.body.appendChild(buttonScript);
6465
}
6566

66-
const App = () => (
67-
<div>
68-
<Router history={browserHistory}>
69-
<SkipLink targetId="play-sketch" text="PlaySketch" />
70-
<Routing />
71-
</Router>
72-
</div>
73-
);
67+
const App = () => {
68+
const { t } = useTranslation();
69+
70+
setTimeout(() => {
71+
const donateButton = document.getElementsByClassName(
72+
'dbox-donation-button'
73+
)[0];
74+
75+
if (donateButton) {
76+
const donateLogoImage = document.createElement('img');
77+
donateLogoImage.src = 'https://donorbox.org/images/white_logo.svg';
78+
79+
donateButton.text = t('About.Donate');
80+
donateButton.prepend(donateLogoImage);
81+
}
82+
}, 0);
83+
84+
return (
85+
<div>
86+
<Router history={browserHistory}>
87+
<SkipLink targetId="play-sketch" text="PlaySketch" />
88+
<Routing />
89+
</Router>
90+
</div>
91+
);
92+
};
7493

7594
render(
7695
<Provider store={store}>

client/modules/About/pages/About.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const About = () => {
5252

5353
const p5version = useSelector((state) => {
5454
const index = state.files.find((file) => file.name === 'index.html');
55-
return index?.content.match(/\/p5\.js\/([\d.]+)\//)?.[1];
55+
return index?.content.match(/\/p5@([\d.]+)\//)?.[1];
5656
});
5757

5858
return (

client/modules/IDE/components/Preferences/Preferences.unit.test.jsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -442,43 +442,44 @@ describe('<Preferences />', () => {
442442
);
443443
});
444444
});
445-
describe('start wordwrap at false', () => {
446-
it('wordwrap toggle, starting at false', () => {
447-
// render the component with wordwrap prop set to false
448-
subject({ wordwrap: false });
449-
450-
// get ahold of the radio buttons for toggling wordwrap
451-
const wordwrapRadioFalse = screen.getByRole('radio', {
445+
// TODO: Consolidate "linewrap" (reference from backend/User model) and "word wrap" (currently used in UI) into consistent naming.
446+
describe('start linewrap at false', () => {
447+
it('linewrap toggle, starting at false', () => {
448+
// render the component with linewrap prop set to false
449+
subject({ linewrap: false });
450+
451+
// get ahold of the radio buttons for toggling linewrap
452+
const linewrapRadioFalse = screen.getByRole('radio', {
452453
name: /wordwrap off/i
453454
});
454-
const wordwrapRadioTrue = screen.getByRole('radio', {
455+
const linewrapRadioTrue = screen.getByRole('radio', {
455456
name: /wordwrap on/i
456457
});
457458

458459
testToggle(
459-
wordwrapRadioFalse,
460-
wordwrapRadioTrue,
460+
linewrapRadioFalse,
461+
linewrapRadioTrue,
461462
props.setLinewrap,
462463
true
463464
);
464465
});
465466
});
466-
describe('start wordwrap at true', () => {
467-
it('wordwrap toggle, starting at true', () => {
468-
// render the component with wordwrap prop set to true
469-
subject({ wordwrap: true });
467+
describe('start linewrap at true', () => {
468+
it('linewrap toggle, starting at true', () => {
469+
// render the component with linewrap prop set to true
470+
subject({ linewrap: true });
470471

471-
// get ahold of the radio buttons for toggling wordwrap
472-
const wordwrapRadioFalse = screen.getByRole('radio', {
472+
// get ahold of the radio buttons for toggling linewrap
473+
const linewrapRadioFalse = screen.getByRole('radio', {
473474
name: /wordwrap off/i
474475
});
475-
const wordwrapRadioTrue = screen.getByRole('radio', {
476+
const linewrapRadioTrue = screen.getByRole('radio', {
476477
name: /wordwrap on/i
477478
});
478479

479480
testToggle(
480-
wordwrapRadioTrue,
481-
wordwrapRadioFalse,
481+
linewrapRadioTrue,
482+
linewrapRadioFalse,
482483
props.setLinewrap,
483484
false
484485
);

client/modules/IDE/components/Preferences/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function Preferences() {
4343
tabIndex,
4444
fontSize,
4545
autosave,
46-
wordwrap,
46+
linewrap,
4747
lineNumbers,
4848
lintWarning,
4949
textOutput,
@@ -398,7 +398,7 @@ export default function Preferences() {
398398
id="wordwrap-on"
399399
className="preference__radio-button"
400400
value="On"
401-
checked={wordwrap}
401+
checked={linewrap}
402402
/>
403403
<label htmlFor="wordwrap-on" className="preference__option">
404404
{t('Preferences.On')}
@@ -411,7 +411,7 @@ export default function Preferences() {
411411
id="wordwrap-off"
412412
className="preference__radio-button"
413413
value="Off"
414-
checked={!wordwrap}
414+
checked={!linewrap}
415415
/>
416416
<label htmlFor="wordwrap-off" className="preference__option">
417417
{t('Preferences.Off')}

0 commit comments

Comments
 (0)