Skip to content

Commit f893446

Browse files
authored
Merge branch 'develop' into feat/login-required-upload
2 parents 7e779db + 15c7797 commit f893446

File tree

21 files changed

+377
-137
lines changed

21 files changed

+377
-137
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ Changes:
44

55
I have verified that this pull request:
66

7+
feat/login-required-upload
78
- [ ] has no linting errors (`npm run lint`)
89
- [ ] has no test errors (`npm run test`)
910
- [ ] is from a uniquely-named feature branch and is up to date with the `develop` branch.
1011
- [ ] is descriptively named and links to an issue number, i.e. `Fixes #123`
1112
- [ ] meets the standards outlined in the [accessibility guidelines](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/accessibility.md)
13+
14+
* [ ] has no linting errors (`npm run lint`)
15+
* [ ] has no test errors (`npm run test`)
16+
* [ ] has no typecheck errors (`npm run typecheck`)
17+
* [ ] is from a uniquely-named feature branch and is up to date with the `develop` branch.
18+
* [ ] is descriptively named and links to an issue number, i.e. `Fixes #123`
19+
* [ ] meets the standards outlined in the [accessibility guidelines](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/accessibility.md)
20+
develop

client/modules/IDE/actions/preferences.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {
66
UpdatePreferencesDispatch,
77
SetPreferencesTabValue,
88
SetFontSizeValue,
9-
GetRootState,
109
SetLineNumbersValue,
1110
SetAutocloseBracketsQuotesValue,
1211
SetAutocompleteHinterValue,
@@ -20,6 +19,7 @@ import type {
2019
SetLanguageValue,
2120
SetThemeValue
2221
} from './preferences.types';
22+
import type { GetRootState } from '../../../reducers';
2323

2424
function updatePreferences(
2525
formParams: UpdatePreferencesRequestBody,

client/modules/IDE/actions/preferences.types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as ActionTypes from '../../../constants';
22
import type { PreferencesState } from '../reducers/preferences';
3-
import type { RootState } from '../../../reducers';
3+
import type { GetRootState } from '../../../reducers';
44

55
// Value Definitions:
66
export type SetPreferencesTabValue = PreferencesState['tabIndex'];
@@ -113,5 +113,3 @@ export type PreferencesThunk = (
113113
dispatch: UpdatePreferencesDispatch,
114114
getState: GetRootState
115115
) => void;
116-
117-
export type GetRootState = () => RootState;

client/modules/IDE/components/VersionPicker.jsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,23 @@ const VersionPicker = React.forwardRef(({ onChangeVersion }, ref) => {
7777
return (
7878
<VersionDropdownMenu
7979
className="versionPicker"
80+
aria-label="Select p5.js version"
8081
anchor={
8182
<VersionPickerButton ref={ref}>
82-
<VersionPickerText>{versionInfo.version}</VersionPickerText>
83+
<VersionPickerText>
84+
{versionInfo
85+
? (() => {
86+
const current = p5Versions.find((v) =>
87+
typeof v === 'string'
88+
? v === versionInfo.version
89+
: v.version === versionInfo.version
90+
);
91+
if (!current) return versionInfo.version;
92+
if (typeof current === 'string') return current;
93+
return `${current.version} ${current.label}`;
94+
})()
95+
: t('Toolbar.CustomLibraryVersion')}
96+
</VersionPickerText>
8397
<VersionPickerArrow>
8498
<DropdownArrowIcon />
8599
</VersionPickerArrow>
@@ -88,11 +102,20 @@ const VersionPicker = React.forwardRef(({ onChangeVersion }, ref) => {
88102
align="left"
89103
maxHeight="50vh"
90104
>
91-
{p5Versions.map((version) => (
92-
<MenuItem key={version} onClick={() => dispatchReplaceVersion(version)}>
93-
{version}
94-
</MenuItem>
95-
))}
105+
{p5Versions.map((item) => {
106+
const version = typeof item === 'string' ? item : item.version;
107+
const label =
108+
typeof item === 'string' ? item : `${item.version} ${item.label}`;
109+
110+
return (
111+
<MenuItem
112+
key={version}
113+
onClick={() => dispatchReplaceVersion(version)}
114+
>
115+
{label}
116+
</MenuItem>
117+
);
118+
})}
96119
</VersionDropdownMenu>
97120
);
98121
});

client/modules/IDE/hooks/useP5Version.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ export function P5VersionProvider(props) {
6060
if (!match) return null;
6161

6262
// See if this is a version we recognize
63-
if (p5Versions.includes(match[1])) {
63+
const versionExists = p5Versions.some((v) =>
64+
typeof v === 'string' ? v === match[1] : v.version === match[1]
65+
);
66+
if (versionExists) {
6467
return { version: match[1], minified: !!match[2], scriptNode };
6568
}
6669
return null;

0 commit comments

Comments
 (0)