Skip to content

Commit 52a3b53

Browse files
committed
merge old develop branch into connie's cm develop branch
2 parents 172d573 + e8bdb3b commit 52a3b53

File tree

30 files changed

+454
-226
lines changed

30 files changed

+454
-226
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Issues with these labels are a great place to start!
5353
- [Need Steps to Reproduce](https://github.com/processing/p5.js-web-editor/labels/Needs%20Steps%20to%20Reproduce)
5454
- [Ready for Work](https://github.com/processing/p5.js-web-editor/labels/Ready%20for%20Work)
5555

56-
A breakdown of what each label means can be found in the [Preparing an Issue Guide](#preparing-an-issue).
56+
A breakdown of what each label means can be found in the [Preparing an Issue Guide](../contributor_docs/preparing_an_issue.md).
5757

5858
When approaching these issues, know that it's okay to not know how to fix an issue! Feel free to ask questions about to approach the problem. We are all here to learn and make something awesome. Someone from the community will help you out, and asking questions is a great way to learn about the p5.js editor, its file structure, and development process.
5959

@@ -83,7 +83,7 @@ Before submitting a pull request, make sure that:
8383
---
8484

8585
## Ideas for Getting Started
86-
* Use the [p5.js Editor](https://editor.p5js.org)! Find a bug? Think of something you think would add to the project? Reference the [Preparing an Issue Guide](#preparing-an-issue) and open an issue.
86+
* Use the [p5.js Editor](https://editor.p5js.org)! Find a bug? Think of something you think would add to the project? Reference the [Preparing an Issue Guide](../contributor_docs/preparing_an_issue.md) and open an issue.
8787
* Expand an existing issue. Sometimes issues are missing steps to reproduce, or need suggestions for potential solutions. Sometimes they need another voice saying, "this is really important!"
8888
* Try getting the project running locally on your computer by following the [installation steps](./../contributor_docs/installation.md).
8989
* Look through the documentation in the [developer docs](../contributor_docs/) and the [development guide](./../contributor_docs/development.md). Is there anything that could be expanded? Is there anything missing?

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY .babelrc index.js nodemon.json ./
1414
COPY ./webpack ./webpack
1515
COPY client ./client
1616
COPY server ./server
17+
COPY common ./common
1718
COPY translations/locales ./translations/locales
1819
COPY public ./public
1920
CMD ["npm", "start"]

client/common/icons.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import styled from 'styled-components';
4-
import { prop } from '../theme';
54
import SortArrowUp from '../images/sort-arrow-up.svg';
65
import SortArrowDown from '../images/sort-arrow-down.svg';
76
import Github from '../images/github.svg';
@@ -35,20 +34,20 @@ import Copy from '../images/copy.svg';
3534
function withLabel(SvgComponent) {
3635
const StyledIcon = styled(SvgComponent)`
3736
&&& {
38-
color: ${prop('Icon.default')};
37+
color: ${(props) => props.Icon?.default};
3938
& g,
4039
& path,
4140
& polygon {
4241
opacity: 1;
43-
fill: ${prop('Icon.default')};
42+
fill: ${(props) => props.Icon?.default};
4443
}
4544
&:hover {
46-
color: ${prop('Icon.hover')};
45+
color: ${(props) => props.Icon?.hover};
4746
& g,
4847
& path,
4948
& polygon {
5049
opacity: 1;
51-
fill: ${prop('Icon.hover')};
50+
fill: ${(props) => props.Icon?.hover};
5251
}
5352
}
5453
}

client/i18n.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
enIN
2222
} from 'date-fns/locale';
2323

24+
import getPreferredLanguage from './utils/language-utils';
25+
2426
const fallbackLng = ['en-US'];
2527

2628
export const availableLanguages = [
@@ -42,6 +44,21 @@ export const availableLanguages = [
4244
'ur'
4345
];
4446

47+
const detectedLanguage = getPreferredLanguage(
48+
availableLanguages,
49+
fallbackLng[0]
50+
);
51+
52+
let initialLanguage = detectedLanguage;
53+
54+
// if user has a saved preference (e.g., from redux or window.__INITIAL_STATE__), use that
55+
if (
56+
window.__INITIAL_STATE__?.preferences?.language &&
57+
availableLanguages.includes(window.__INITIAL_STATE__.preferences.language)
58+
) {
59+
initialLanguage = window.__INITIAL_STATE__.preferences.language;
60+
}
61+
4562
export function languageKeyToLabel(lang) {
4663
const languageMap = {
4764
be: 'বাংলা',
@@ -104,7 +121,7 @@ i18n
104121
// .use(LanguageDetector)// to detect the language from currentBrowser
105122
.use(Backend) // to fetch the data from server
106123
.init({
107-
lng: 'en-US',
124+
lng: initialLanguage,
108125
fallbackLng, // if user computer language is not on the list of available languages, than we will be using the fallback language specified earlier
109126
debug: false,
110127
backend: options,

client/images/cross.svg

Lines changed: 1 addition & 1 deletion
Loading

client/modules/About/pages/About.jsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,22 @@ const About = () => {
130130
<Link to="/code-of-conduct">{t('About.CodeOfConduct')}</Link>
131131
</div>
132132
<p>
133-
{t('About.WebEditor')}: <span>v{packageData?.version}</span>
133+
<a
134+
href="https://github.com/processing/p5.js-web-editor/releases"
135+
target="_blank"
136+
rel="noreferrer"
137+
>
138+
{t('About.WebEditor')}: <span>v{packageData?.version}</span>
139+
</a>
134140
</p>
135141
<p>
136-
p5.js: <span>v{p5version}</span>
142+
<a
143+
href="https://github.com/processing/p5.js/releases"
144+
target="_blank"
145+
rel="noreferrer"
146+
>
147+
p5.js: <span>v{p5version}</span>
148+
</a>
137149
</p>
138150
</Footer>
139151
</AboutPageContent>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { CrossIcon } from '../../../common/icons';
4+
5+
/**
6+
* Banner displays a dismissible announcement bar with a link and a close icon.
7+
* It's typically used to highlight opportunities, but use and design can be flexible.
8+
*
9+
* This component is **presentational only** — visibility logic (open/close state) should be
10+
* controlled by the parent via the `onClose` handler.
11+
*
12+
* @param {Object} props
13+
* @param {function} props.onClose - Function called when the user clicks the close (✕) button
14+
* @returns {JSX.Element} The banner component with a call-to-action link and a close button
15+
*
16+
* @example
17+
* const [showBanner, setShowBanner] = useState(true);
18+
*
19+
* {showBanner && (
20+
* <Banner onClose={() => setShowBanner(false)} />
21+
* )}
22+
*/
23+
24+
const Banner = ({ onClose }) => {
25+
// URL can be updated depending on the opportunity or announcement.
26+
const bannerURL = 'https://openprocessing.org/curation/89576';
27+
const bannerCopy = (
28+
<>
29+
We’re accepting p5.js sketches for a special curation exploring mental
30+
health and the newest features in p5.js 2.0!{' '}
31+
<span style={{ fontWeight: 600 }}>Submit by July 13!</span>
32+
</>
33+
);
34+
35+
return (
36+
<div className="banner">
37+
<a href={bannerURL}>{bannerCopy}</a>
38+
<button className="banner-close-button" onClick={onClose}>
39+
<CrossIcon Icon={{ default: '#000', hover: '#333' }} />
40+
</button>
41+
</div>
42+
);
43+
};
44+
45+
Banner.propTypes = {
46+
onClose: PropTypes.func.isRequired
47+
};
48+
49+
export default Banner;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function Editor({
215215
<section className={editorSectionClass}>
216216
<div className="editor__header">
217217
<button
218-
aria-label={t('Editor.OpenSketchARIA')}
218+
aria-label={t('Editor.CloseSketchARIA')}
219219
className="sidebar__contract"
220220
onClick={() => {
221221
collapseSidebar();
@@ -225,7 +225,7 @@ function Editor({
225225
<LeftArrowIcon focusable="false" aria-hidden="true" />
226226
</button>
227227
<button
228-
aria-label={t('Editor.CloseSketchARIA')}
228+
aria-label={t('Editor.OpenSketchARIA')}
229229
className="sidebar__expand"
230230
onClick={expandSidebar}
231231
>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ const AuthenticatedUserMenu = () => {
378378
{t('Nav.Auth.MyAssets')}
379379
</MenubarItem>
380380
<MenubarItem id="account-settings" href="/account">
381-
{t('Preferences.Settings')}
381+
{t('Nav.Auth.MyAccount')}
382382
</MenubarItem>
383383
<MenubarItem id="account-logout" onClick={() => dispatch(logoutUser())}>
384384
{t('Nav.Auth.LogOut')}

client/modules/IDE/components/Header/__snapshots__/Nav.unit.test.jsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ exports[`Nav renders dashboard version for mobile 1`] = `
335335
>
336336
<test-file-stub
337337
aria-hidden="true"
338-
classname="icons__StyledIcon-sc-xmer15-0 dStXqm"
338+
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
339339
focusable="false"
340340
/>
341341
</button>
@@ -351,7 +351,7 @@ exports[`Nav renders dashboard version for mobile 1`] = `
351351
>
352352
<test-file-stub
353353
aria-hidden="true"
354-
classname="icons__StyledIcon-sc-xmer15-0 dStXqm"
354+
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
355355
focusable="false"
356356
/>
357357
</button>
@@ -930,7 +930,7 @@ exports[`Nav renders editor version for mobile 1`] = `
930930
>
931931
<test-file-stub
932932
aria-hidden="true"
933-
classname="icons__StyledIcon-sc-xmer15-0 dStXqm"
933+
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
934934
focusable="false"
935935
/>
936936
</button>
@@ -946,7 +946,7 @@ exports[`Nav renders editor version for mobile 1`] = `
946946
>
947947
<test-file-stub
948948
aria-hidden="true"
949-
classname="icons__StyledIcon-sc-xmer15-0 dStXqm"
949+
classname="icons__StyledIcon-sc-xmer15-0 kjSZIe"
950950
focusable="false"
951951
/>
952952
</button>

0 commit comments

Comments
 (0)