Skip to content

Commit d7088fb

Browse files
committed
Move version indicator to the toolbar
1 parent 0d9430a commit d7088fb

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

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

-3
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,6 @@ class Editor extends React.Component {
576576
</span>
577577
<Timer />
578578
</div>
579-
<div className="editor__library-version">
580-
<VersionIndicator />
581-
</div>
582579
</div>
583580
<article
584581
ref={(element) => {

client/modules/IDE/components/Header/Toolbar.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import PlayIcon from '../../../../images/play.svg';
2020
import StopIcon from '../../../../images/stop.svg';
2121
import PreferencesIcon from '../../../../images/preferences.svg';
2222
import ProjectName from './ProjectName';
23+
import VersionIndicator from '../VersionIndicator';
2324

2425
const Toolbar = (props) => {
2526
const { isPlaying, infiniteLoop, preferencesIsVisible } = useSelector(
@@ -113,6 +114,8 @@ const Toolbar = (props) => {
113114
return null;
114115
})()}
115116
</div>
117+
<div style={{ flex: 1 }} />
118+
<VersionIndicator />
116119
<button
117120
className={preferencesButtonClass}
118121
onClick={() => dispatch(openPreferences())}

client/modules/IDE/components/VersionIndicator.jsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { useDispatch } from 'react-redux';
55
import { openPreferences } from '../actions/ide';
66
import { setPreferencesTab } from '../actions/preferences';
77
import { prop } from '../../../theme';
8-
import EditIcon from '../../../images/preferences.svg';
8+
import EditIcon from '../../../images/pencil.svg';
99

1010
import { useP5Version } from '../hooks/useP5Version';
1111

1212
const VersionPickerButton = styled.button`
1313
color: ${prop('Button.primary.default.foreground')};
14+
margin-right: 1rem;
1415
1516
&:hover {
1617
color: ${prop('Button.primary.hover.background')} !important;
@@ -19,9 +20,8 @@ const VersionPickerButton = styled.button`
1920
& svg {
2021
vertical-align: middle;
2122
margin-bottom: 2px;
22-
margin-left: 0.5rem;
23-
width: 1rem;
24-
height: 1rem;
23+
width: 1.5rem;
24+
height: 1.5rem;
2525
}
2626
2727
&:hover path {
@@ -61,22 +61,21 @@ const VersionIndicator = () => {
6161
window.localStorage.setItem(CLICKED_LIBRARY_VERSION_KEY, true);
6262
}, []);
6363

64-
const label = t('Toolbar.LibraryVersion');
65-
const currentVersion =
66-
versionInfo?.version || t('Toolbar.CustomLibraryVersion');
64+
const currentVersion = versionInfo?.version
65+
? `p5.js ${versionInfo.version}`
66+
: t('Toolbar.CustomLibraryVersion');
6767
const description = t(
6868
showNotificationDot
6969
? 'Toolbar.NewVersionPickerARIA'
7070
: 'Toolbar.VersionPickerARIA'
7171
);
72-
const ariaLabel = `${label}: ${currentVersion} - ${description}`;
72+
const ariaLabel = `${currentVersion} - ${description}`;
7373

7474
return (
7575
<VersionPickerButton onClick={openVersionSettings} ariaLabel={ariaLabel}>
76-
{label}:&nbsp;
7776
{currentVersion}
78-
{showNotificationDot && <NotificationDot />}
7977
<EditIcon focusable="false" aria-hidden="true" />
78+
{showNotificationDot && <NotificationDot />}
8079
</VersionPickerButton>
8180
);
8281
};

client/styles/components/_toolbar.scss

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
@extend %toolbar-button--selected;
7171
}
7272
}
73-
margin-left: auto;
7473
& span {
7574
padding-left: #{math.div(1, $base-font-size)}rem;
7675
display: flex;

translations/locales/en-US/translations.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@
157157
"EditSketchARIA": "Edit sketch name",
158158
"NewSketchNameARIA": "New sketch name",
159159
"By": " by ",
160-
"LibraryVersion": "p5.js version",
161-
"CustomLibraryVersion": "Custom",
160+
"CustomLibraryVersion": "Custom p5.js version",
162161
"VersionPickerARIA": "Version picker",
163162
"NewVersionPickerARIA": "Version picker"
164163
},

0 commit comments

Comments
 (0)