Skip to content

Commit f15893b

Browse files
authored
Merge branch 'develop' into develop-preferences-test
2 parents 4dd68e5 + 3b3c79e commit f15893b

File tree

138 files changed

+14948
-6378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+14948
-6378
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ ML5_LIBRARY_PASS=helloml5
2222
MOBILE_ENABLED=true
2323
MONGO_URL=mongodb://localhost:27017/p5js-web-editor
2424
PORT=8000
25+
PREVIEW_PORT=8002
26+
EDITOR_URL=http://localhost:8000
27+
PREVIEW_URL=http://localhost:8002
2528
S3_BUCKET=<your-s3-bucket>
2629
S3_BUCKET_URL_BASE=<alt-for-s3-url>
2730
SESSION_SECRET=whatever_you_want_this_to_be_it_only_matters_for_production

.github/CODE_OF_CONDUCT.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,51 @@
1-
# p5.js Code of Conduct
1+
## [p5.js community statement](http://p5js.org/community/)
2+
3+
p5.js is a community interested in exploring the creation of art and design with technology.
4+
5+
We are a community of, and in solidarity with, people from every gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, disability, class, religion, culture, subculture, political opinion, age, skill level, occupation, and background. We acknowledge that not everyone has the time, financial means, or capacity to actively participate, but we recognize and encourage involvement of all kinds. We facilitate and foster access and empowerment. We are all learners.
6+
7+
We like these hashtags: #noCodeSnobs (because we value community over efficiency), #newKidLove (because we all started somewhere), #unassumeCore (because we don't assume knowledge), and #BlackLivesMatter (because of course).
8+
9+
In practice:
10+
* We are not code snobs. We do not assume knowledge or imply there are things that somebody should know.
11+
* We insist on actively engaging with requests for feedback regardless of their complexity.
12+
* We welcome newcomers and prioritize the education of others. We strive to approach all tasks with the enthusiasm of a newcomer. Because we believe that newcomers are just as valuable in this effort as experts.
13+
* We consistently make the effort to actively recognize and validate multiple types of contributions.
14+
* We are always willing to offer help or guidance.
15+
16+
In times of conflict:
17+
* We listen.
18+
* We clearly communicate while acknowledging other's feelings.
19+
* We admit when we're wrong, apologize, and accept responsibility for our actions.
20+
* We are continuously seeking to improve ourselves and our community.
21+
* We keep our community respectful and open.
22+
* We make everyone feel heard.
23+
* We are mindful and kind in our interactions.
24+
25+
In the future:
26+
* The future is now.
27+
28+
29+
## p5.js Code of Conduct
230

331
* **Be mindful of your language.** Any of the following behavior is unacceptable:
432
* Offensive comments related to gender identity and expression, sexual orientation, race, ethnicity, language, neuro-type, size, ability, class, religion, culture, subculture, political opinion, age, skill level, occupation, or background
533
* Threats of violence
634
* Deliberate intimidation
7-
* Sexually explicit or violent material
35+
* Sexually explicit or violent material that is not contextualized and preceded by a considerate warning
836
* Unwelcome sexual attention
937
* Stalking or following
1038
* Or any other kinds of harassment
1139

1240
Use your best judgement. If it will possibly make others uncomfortable, do not post it.
1341

14-
* **Be respectful.** Disagreement is not an opportunity to attack someone else's thoughts or opinions. Although views may differ, remember to approach every situation with patience and care.
15-
* **Be considerate.** Think about how your contribution will affect others in the community.
42+
* **Be respectful.** Disagreement is not an opportunity to attack someone else's thoughts or opinions. Although views may differ, remember to approach every situation with patience and care.
43+
* **Be considerate.** Think about how your contribution will affect others in the community.
1644
* **Be open minded.** Embrace new people and new ideas. Our community is continually evolving and we welcome positive change.
1745

1846
If you believe someone is violating the code of conduct, we ask that you report it by emailing [hello@p5js.org](mailto:hello@p5js.org). Please include your name and a description of the incident, and we will get back to you ASAP.
1947

20-
Participants asked to stop any harassing behavior are expected to comply immediately. If a participant engages in harassing behavior, the p5.js Team may take any action they deem appropriate, up to and including expulsion from all p5.js spaces and identification of the participant as a harasser to other p5.js members or the general public.
21-
22-
## Also
48+
Sometimes, participants violating the Code of Conduct are unaware that their behavior is harmful, and an open conversation clears things up to move forward. However, if a participant continues with the behavior, the p5.js team may take any action they deem appropriate, up to and including expulsion from all p5.js spaces and identification of the participant as a harasser to other p5.js members or the general public.
2349

24-
* You can read our [community statement](http://p5js.org/community/) on our website.
50+
---
51+
This statement is licensed under a [Creative Commons license](https://creativecommons.org/licenses/by-sa/4.0/). Please feel free to share and remix with attribution.

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
steps:
2121
- name: Check out the repo
2222
uses: actions/checkout@v2
23+
with:
24+
ref: release
2325
- name: Set up Docker Buildx
2426
uses: docker/setup-buildx-action@v1
2527
- name: Login to Docker Hub

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
node_modules/
77
npm-debug.log
88
dump.rdb
9-
public/*
109
static/dist/
1110
static/css/app.min.css
1211
dist/

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"tabWidth": 2,
1515
"trailingComma": "none",
1616
"useTabs": false,
17-
"quoteProps": "as-needed"
17+
"quoteProps": "as-needed",
18+
"endOfLine":"auto"
1819
}

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ENV APP_HOME=/usr/src/app \
44
RUN mkdir -p $APP_HOME
55
WORKDIR $APP_HOME
66
EXPOSE 8000
7+
EXPOSE 8002
78

89
FROM base as development
910
ENV NODE_ENV development
@@ -15,6 +16,7 @@ COPY ./webpack ./webpack
1516
COPY client ./client
1617
COPY server ./server
1718
COPY translations/locales ./translations/locales
19+
COPY public ./public
1820
CMD ["npm", "start"]
1921

2022
FROM development as build
File renamed without changes.

client/__mocks__/i18n.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { enUS, es, ja, hi } from 'date-fns/locale';
2+
import i18n from '../i18n-test';
3+
4+
export function languageKeyToLabel(lang) {
5+
const languageMap = {
6+
'en-US': 'English',
7+
'es-419': 'Español',
8+
ja: '日本語',
9+
hi: 'हिन्दी'
10+
};
11+
return languageMap[lang];
12+
}
13+
14+
export function languageKeyToDateLocale(lang) {
15+
const languageMap = {
16+
'en-US': enUS,
17+
'es-419': es,
18+
ja,
19+
hi
20+
};
21+
return languageMap[lang];
22+
}
23+
24+
export function currentDateLocale() {
25+
return languageKeyToDateLocale(i18n.language);
26+
}
27+
28+
export default i18n;

client/__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

client/common/Button.jsx

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ import { Link } from 'react-router';
66
import { remSize, prop } from '../theme';
77

88
const kinds = {
9+
primary: 'primary',
10+
secondary: 'secondary'
11+
};
12+
13+
const displays = {
914
block: 'block',
10-
icon: 'icon',
1115
inline: 'inline'
1216
};
1317

@@ -16,52 +20,57 @@ const kinds = {
1620
// general global styles
1721
const StyledButton = styled.button`
1822
&&& {
23+
font-weight: bold;
1924
display: flex;
2025
justify-content: center;
2126
align-items: center;
2227
2328
width: max-content;
2429
text-decoration: none;
2530
26-
color: ${prop('Button.default.foreground')};
27-
background-color: ${prop('Button.default.background')};
31+
color: ${({ kind }) => prop(`Button.${kind}.default.foreground`)};
32+
background-color: ${({ kind }) =>
33+
prop(`Button.${kind}.default.background`)};
2834
cursor: pointer;
29-
border: 2px solid ${prop('Button.default.border')};
35+
border: 2px solid ${({ kind }) => prop(`Button.${kind}.default.border`)};
3036
border-radius: 2px;
3137
padding: ${remSize(8)} ${remSize(25)};
3238
line-height: 1;
3339
3440
svg * {
35-
fill: ${prop('Button.default.foreground')};
41+
fill: ${({ kind }) => prop(`Button.${kind}.default.foreground`)};
3642
}
3743
3844
&:hover:not(:disabled) {
39-
color: ${prop('Button.hover.foreground')};
40-
background-color: ${prop('Button.hover.background')};
41-
border-color: ${prop('Button.hover.border')};
45+
color: ${({ kind }) => prop(`Button.${kind}.hover.foreground`)};
46+
background-color: ${({ kind }) =>
47+
prop(`Button.${kind}.hover.background`)};
48+
border-color: ${({ kind }) => prop(`Button.${kind}.hover.border`)};
4249
4350
svg * {
44-
fill: ${prop('Button.hover.foreground')};
51+
fill: ${({ kind }) => prop(`Button.${kind}.hover.foreground`)};
4552
}
4653
}
4754
4855
&:active:not(:disabled) {
49-
color: ${prop('Button.active.foreground')};
50-
background-color: ${prop('Button.active.background')};
56+
color: ${({ kind }) => prop(`Button.${kind}.active.foreground`)};
57+
background-color: ${({ kind }) =>
58+
prop(`Button.${kind}.active.background`)};
5159
5260
svg * {
53-
fill: ${prop('Button.active.foreground')};
61+
fill: ${({ kind }) => prop(`Button.${kind}.active.foreground`)};
5462
}
5563
}
5664
5765
&:disabled {
58-
color: ${prop('Button.disabled.foreground')};
59-
background-color: ${prop('Button.disabled.background')};
60-
border-color: ${prop('Button.disabled.border')};
66+
color: ${({ kind }) => prop(`Button.${kind}.disabled.foreground`)};
67+
background-color: ${({ kind }) =>
68+
prop(`Button.${kind}.disabled.background`)};
69+
border-color: ${({ kind }) => prop(`Button.${kind}.disabled.border`)};
6170
cursor: not-allowed;
6271
6372
svg * {
64-
fill: ${prop('Button.disabled.foreground')};
73+
fill: ${({ kind }) => prop(`Button.${kind}.disabled.foreground`)};
6574
}
6675
}
6776
@@ -108,35 +117,38 @@ const StyledIconButton = styled.button`
108117
height: ${remSize(32)}px;
109118
text-decoration: none;
110119
111-
color: ${prop('Button.default.foreground')};
112-
background-color: ${prop('Button.hover.background')};
120+
color: ${({ kind }) => prop(`Button.${kind}.default.foreground`)};
121+
background-color: ${({ kind }) => prop(`Button.${kind}.hover.background`)};
113122
cursor: pointer;
114123
border: 1px solid transparent;
115124
border-radius: 50%;
116125
padding: ${remSize(8)} ${remSize(25)};
117126
line-height: 1;
118127
119128
&:hover:not(:disabled) {
120-
color: ${prop('Button.hover.foreground')};
121-
background-color: ${prop('Button.hover.background')};
129+
color: ${({ kind }) => prop(`Button.${kind}.hover.foreground`)};
130+
background-color: ${({ kind }) =>
131+
prop(`Button.${kind}.hover.background`)};
122132
123133
svg * {
124-
fill: ${prop('Button.hover.foreground')};
134+
fill: ${({ kind }) => prop(`Button.${kind}.hover.foreground`)};
125135
}
126136
}
127137
128138
&:active:not(:disabled) {
129-
color: ${prop('Button.active.foreground')};
130-
background-color: ${prop('Button.active.background')};
139+
color: ${({ kind }) => prop(`Button.${kind}.active.foreground`)};
140+
background-color: ${({ kind }) =>
141+
prop(`Button.${kind}.active.background`)};
131142
132143
svg * {
133-
fill: ${prop('Button.active.foreground')};
144+
fill: ${({ kind }) => prop(`Button.${kind}.active.foreground`)};
134145
}
135146
}
136147
137148
&:disabled {
138-
color: ${prop('Button.disabled.foreground')};
139-
background-color: ${prop('Button.disabled.background')};
149+
color: ${({ kind }) => prop(`Button.${kind}.disabled.foreground`)};
150+
background-color: ${({ kind }) =>
151+
prop(`Button.${kind}.disabled.background`)};
140152
cursor: not-allowed;
141153
}
142154
@@ -151,10 +163,12 @@ const StyledIconButton = styled.button`
151163
*/
152164
const Button = ({
153165
children,
166+
display,
154167
href,
155168
kind,
156169
iconBefore,
157170
iconAfter,
171+
iconOnly,
158172
'aria-label': ariaLabel,
159173
to,
160174
type,
@@ -170,16 +184,19 @@ const Button = ({
170184
);
171185
let StyledComponent = StyledButton;
172186

173-
if (kind === kinds.inline) {
187+
if (display === displays.inline) {
174188
StyledComponent = StyledInlineButton;
175-
} else if (kind === kinds.icon) {
189+
}
190+
191+
if (iconOnly) {
176192
StyledComponent = StyledIconButton;
177193
}
178194

179195
if (href) {
180196
return (
181197
<StyledComponent
182198
kind={kind}
199+
display={display}
183200
as="a"
184201
aria-label={ariaLabel}
185202
href={href}
@@ -194,6 +211,7 @@ const Button = ({
194211
return (
195212
<StyledComponent
196213
kind={kind}
214+
display={display}
197215
as={Link}
198216
aria-label={ariaLabel}
199217
to={to}
@@ -205,7 +223,13 @@ const Button = ({
205223
}
206224

207225
return (
208-
<StyledComponent kind={kind} aria-label={ariaLabel} type={type} {...props}>
226+
<StyledComponent
227+
kind={kind}
228+
display={display}
229+
aria-label={ariaLabel}
230+
type={type}
231+
{...props}
232+
>
209233
{content}
210234
</StyledComponent>
211235
);
@@ -214,16 +238,19 @@ const Button = ({
214238
Button.defaultProps = {
215239
children: null,
216240
disabled: false,
241+
display: displays.block,
217242
iconAfter: null,
218243
iconBefore: null,
219-
kind: kinds.block,
244+
iconOnly: false,
245+
kind: kinds.primary,
220246
href: null,
221247
'aria-label': null,
222248
to: null,
223249
type: 'button'
224250
};
225251

226252
Button.kinds = kinds;
253+
Button.displays = displays;
227254

228255
Button.propTypes = {
229256
/**
@@ -235,6 +262,10 @@ Button.propTypes = {
235262
If the button can be activated or not
236263
*/
237264
disabled: PropTypes.bool,
265+
/**
266+
* The display type of the button—inline or block
267+
*/
268+
display: PropTypes.string,
238269
/**
239270
* SVG icon to place after child content
240271
*/
@@ -243,6 +274,10 @@ Button.propTypes = {
243274
* SVG icon to place before child content
244275
*/
245276
iconBefore: PropTypes.element,
277+
/**
278+
* If the button content is only an SVG icon
279+
*/
280+
iconOnly: PropTypes.bool,
246281
/**
247282
* The kind of button - determines how it appears visually
248283
*/

client/common/Button.stories.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const ButtonWithIconAfter = () => (
5959
);
6060

6161
export const InlineButtonWithIconAfter = () => (
62-
<Button iconAfter={<DropdownArrowIcon />} kind={Button.kinds.inline}>
62+
<Button iconAfter={<DropdownArrowIcon />} display={Button.displays.inline}>
6363
File name
6464
</Button>
6565
);
@@ -68,6 +68,6 @@ export const InlineIconOnlyButton = () => (
6868
<Button
6969
aria-label="Add to collection"
7070
iconBefore={<PlusIcon />}
71-
kind={Button.kinds.inline}
71+
display={Button.displays.inline}
7272
/>
7373
);

0 commit comments

Comments
 (0)