Skip to content

Commit 8d0b3ef

Browse files
committed
Fix MarkdownText using a div instead of a span when not a standalone text
* Also add a missing translation * Also enable player authentication by default when creating a new game
1 parent 7ccd2cd commit 8d0b3ef

File tree

4 files changed

+47
-31
lines changed

4 files changed

+47
-31
lines changed

newIDE/app/src/GameDashboard/LeaderboardAdmin/LeaderboardSortOptionsDialog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ function LeaderboardSortOptionsDialog({
165165
<MarkdownText
166166
source={i18n._(
167167
sortOrder === 'ASC'
168-
? `Any submitted score that is lower than the set value will not be saved in the leaderboard.`
169-
: `Any submitted score that is higher than the set value will not be saved in the leaderboard.`
168+
? t`Any submitted score that is lower than the set value will not be saved in the leaderboard.`
169+
: t`Any submitted score that is higher than the set value will not be saved in the leaderboard.`
170170
)}
171171
/>
172172
</FormHelperText>

newIDE/app/src/ProjectCreation/NewProjectSetupDialog.js

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import SelectField from '../UI/SelectField';
1818
import SelectOption from '../UI/SelectOption';
1919
import CreateProfile from '../Profile/CreateProfile';
2020
import Paper from '../UI/Paper';
21-
import { Line, Spacer } from '../UI/Grid';
21+
import { Line } from '../UI/Grid';
2222
import LeftLoader from '../UI/LeftLoader';
2323
import {
2424
checkIfHasTooManyCloudProjects,
@@ -28,8 +28,7 @@ import { SubscriptionSuggestionContext } from '../Profile/Subscription/Subscript
2828
import optionalRequire from '../Utils/OptionalRequire';
2929
import PreferencesContext from '../MainFrame/Preferences/PreferencesContext';
3030
import Checkbox from '../UI/Checkbox';
31-
import Link from '../UI/Link';
32-
import Window from '../Utils/Window';
31+
import { MarkdownText } from '../UI/MarkdownText';
3332

3433
const electron = optionalRequire('electron');
3534
const remote = optionalRequire('@electron/remote');
@@ -109,7 +108,7 @@ const NewProjectSetupDialog = ({
109108
false
110109
);
111110
const [allowPlayersToLogIn, setAllowPlayersToLogIn] = React.useState<boolean>(
112-
false
111+
true
113112
);
114113
const newProjectsDefaultFolder = app
115114
? findEmptyPathInWorkspaceFolder(app, values.newProjectsDefaultFolder || '')
@@ -347,21 +346,9 @@ const NewProjectSetupDialog = ({
347346
}}
348347
disabled={isOpening}
349348
tooltipOrHelperText={
350-
<Line noMargin>
351-
<Trans>Learn more about</Trans>
352-
<Spacer />
353-
<Link
354-
href="https://wiki.gdevelop.io/gdevelop5/all-features/player-authentication"
355-
onClick={() =>
356-
Window.openExternalURL(
357-
'https://wiki.gdevelop.io/gdevelop5/all-features/player-authentication'
358-
)
359-
}
360-
>
361-
<Trans>player authentication</Trans>
362-
</Link>
363-
.
364-
</Line>
349+
<MarkdownText
350+
translatableSource={t`Learn more about [player authentication](https://wiki.gdevelop.io/gdevelop5/all-features/player-authentication).`}
351+
/>
365352
}
366353
/>
367354
</ColumnStackLayout>

newIDE/app/src/UI/MarkdownText.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const makeMarkdownCustomComponents = (
1111
isStandaloneText: boolean,
1212
allowParagraphs: boolean
1313
) => ({
14-
'**': props => (isStandaloneText ? <div {...props} /> : <span {...props} />),
1514
// Ensure link are opened in a new page
1615
a: props =>
1716
props.href ? (
@@ -51,22 +50,27 @@ export const MarkdownText = (props: Props) => {
5150
[props.isStandaloneText, props.allowParagraphs]
5251
);
5352

54-
return (
53+
const markdownElement = (
5554
<I18n>
5655
{({ i18n }) => (
57-
<ReactMarkdown
58-
className={classNames({
59-
'gd-markdown': true,
60-
[gdevelopTheme.markdownRootClassName]: true,
61-
'standalone-text-container': props.isStandaloneText,
62-
})}
63-
components={markdownCustomComponents}
64-
>
56+
<ReactMarkdown components={markdownCustomComponents}>
6557
{props.translatableSource
6658
? i18n._(props.translatableSource)
6759
: props.source}
6860
</ReactMarkdown>
6961
)}
7062
</I18n>
7163
);
64+
65+
const className = classNames({
66+
'gd-markdown': true,
67+
[gdevelopTheme.markdownRootClassName]: true,
68+
'standalone-text-container': props.isStandaloneText,
69+
});
70+
71+
return props.isStandaloneText ? (
72+
<div className={className}>{markdownElement}</div>
73+
) : (
74+
<span className={className}>{markdownElement}</span>
75+
);
7276
};

newIDE/app/yarn.lock

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5154,6 +5154,13 @@
51545154
"buffers" "~0.1.1"
51555155
"chainsaw" "~0.1.0"
51565156

5157+
"bindings@^1.5.0":
5158+
"integrity" "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ=="
5159+
"resolved" "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
5160+
"version" "1.5.0"
5161+
dependencies:
5162+
"file-uri-to-path" "1.0.0"
5163+
51575164
"bluebird@^3.3.5", "bluebird@^3.5.5":
51585165
"integrity" "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
51595166
"resolved" "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz"
@@ -8799,6 +8806,19 @@
87998806
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
88008807
"version" "1.0.0"
88018808

8809+
"fsevents@^1.2.7":
8810+
"integrity" "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw=="
8811+
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz"
8812+
"version" "1.2.13"
8813+
dependencies:
8814+
"bindings" "^1.5.0"
8815+
"nan" "^2.12.1"
8816+
8817+
"fsevents@^2.1.2", "fsevents@^2.1.3", "fsevents@~2.3.2":
8818+
"integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
8819+
"resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
8820+
"version" "2.3.2"
8821+
88028822
"fstream@^1.0.12":
88038823
"integrity" "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg=="
88048824
"resolved" "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz"
@@ -12222,6 +12242,11 @@
1222212242
"resolved" "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz"
1222312243
"version" "0.0.7"
1222412244

12245+
"nan@^2.12.1":
12246+
"integrity" "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
12247+
"resolved" "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz"
12248+
"version" "2.14.1"
12249+
1222512250
"nanoid@^3.3.3":
1222612251
"integrity" "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw=="
1222712252
"resolved" "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz"

0 commit comments

Comments
 (0)