Skip to content

Commit 2cd9067

Browse files
authored
Merge pull request processing#2118 from dewanshDT/about-version-info
added web editor and p5 version info to the about section
2 parents e24cc8f + bae13f1 commit 2cd9067

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

client/modules/IDE/components/About.jsx

+14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import React from 'react';
2+
import { useSelector } from 'react-redux';
23
import { Helmet } from 'react-helmet';
34
import { useTranslation } from 'react-i18next';
45
import { Link } from 'react-router';
56
import SquareLogoIcon from '../../../images/p5js-square-logo.svg';
67
// import PlayIcon from '../../../images/play.svg';
78
import AsteriskIcon from '../../../images/p5-asterisk.svg';
9+
import packageData from '../../../../package.json';
810

911
function About(props) {
1012
const { t } = useTranslation();
13+
const p5version = useSelector((state) => {
14+
const index = state.files.find((file) => file.name === 'index.html');
15+
return index?.content.match(/\/p5\.js\/([\d.]+)\//)?.[1];
16+
});
1117
return (
1218
<div className="about__content">
1319
<Helmet>
@@ -20,6 +26,14 @@ function About(props) {
2026
aria-label={t('Common.p5logoARIA')}
2127
focusable="false"
2228
/>
29+
<div className="about__content-column">
30+
<p className="about__version-info">
31+
Web Editor: <span>v{packageData?.version}</span>
32+
</p>
33+
<p className="about__version-info">
34+
p5.js: <span>v{p5version}</span>
35+
</p>
36+
</div>
2337
</div>
2438
<div className="about__content-column">
2539
<h3 className="about__content-column-title">{t('About.NewP5')}</h3>

client/styles/components/_about.scss

+18
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@
7474
}
7575
}
7676

77+
.about__version-info {
78+
@include themify() {
79+
padding-top: #{8 / $base-font-size}rem;
80+
font-size: #{16 / $base-font-size}rem;
81+
span {
82+
color: getThemifyVariable('logo-color');
83+
}
84+
&:first-child {
85+
padding-top: #{30 /$base-font-size}rem;
86+
}
87+
}
88+
// span {
89+
// @include themify() {
90+
// fill: getThemifyVariable('logo-color');
91+
// }
92+
// }
93+
}
94+
7795
.about__footer {
7896
display: flex;
7997
justify-content: space-between;

0 commit comments

Comments
 (0)