Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
a52d312
apiClient: update extension to ts
clairep94 Jul 26, 2025
2480bd1
apiClient: add axios instance type
clairep94 Jul 26, 2025
87adc72
device: update extension to ts
clairep94 Jul 26, 2025
9efdd25
device: add test
clairep94 Jul 26, 2025
462524c
eslint: remove prefer-default-export rule
clairep94 Jul 26, 2025
8010af7
device.ts: add edgecase test and refactor
clairep94 Jul 26, 2025
cb9ddc5
metaKey.js: update extention to ts
clairep94 Jul 26, 2025
f7282c2
metaKey: update to use isMac() -- due to navigator.platform being dep…
clairep94 Jul 26, 2025
411eb4a
useKeyDownHandler: refactor to use isMac()
clairep94 Jul 26, 2025
e7eaa2c
language-utils.js: update ext to ts
clairep94 Jul 26, 2025
53962db
language-utils.ts: add test
clairep94 Jul 26, 2025
3efc164
language-utils: add types, passes typecheck
clairep94 Jul 26, 2025
fa6d69f
language-utils: refactor for clarity & disable eslint noplusplus rule
clairep94 Jul 26, 2025
75b35a3
formatDate: update ext to ts
clairep94 Jul 26, 2025
b7fb7a0
formatDate.js: add test
clairep94 Jul 26, 2025
2440d6f
formatDate.js: add types and refactor
clairep94 Jul 26, 2025
0a9af47
consoleUtils: update extension to ts
clairep94 Jul 26, 2025
5302f54
consoleUtils: add tests and bare minimum type
clairep94 Jul 26, 2025
2638c32
consoleUtils.ts: add jsdocs and return type
clairep94 Jul 26, 2025
723cac3
dispatcher.js: update extention to ts --no-verify
clairep94 Jul 26, 2025
e0cb6c7
dispatcher: add unit test
clairep94 Jul 26, 2025
0aab549
dispatcher.ts: update with types
clairep94 Jul 26, 2025
60f8a6e
dispatcher.ts: add jsdocs
clairep94 Jul 26, 2025
04ca29a
remove jsdocs on internal functions to retain git history?
clairep94 Jul 26, 2025
e91000f
evaluateExpression: update ext to ts --no-verify
clairep94 Jul 26, 2025
0713173
evaluateExpression: add unit test
clairep94 Jul 26, 2025
16d84e1
evaluateExpression: add tests
clairep94 Jul 26, 2025
6957124
reduxFormUtils: update ext to ts --no-verify
clairep94 Jul 26, 2025
97754db
reduxFormUtils: add unit test, no-verify
clairep94 Jul 26, 2025
ed0c6f0
reduxFormUtils: delete unused dom-onlyprops function
clairep94 Jul 26, 2025
0b223df
reduxFormUtils: add types and jsdocs
clairep94 Jul 26, 2025
a52372d
getConfig.js: change to ts, no-verify
clairep94 Jul 26, 2025
de6fc10
getConfig.ts: remove circular logic for env check and add types
clairep94 Jul 26, 2025
8061e09
migrate getConfig.test to ts
clairep94 Jul 26, 2025
058d155
update tests for get config after typing
clairep94 Jul 26, 2025
34f0735
add parseStringToType util
clairep94 Jul 26, 2025
c6c7d40
update parsers and update useages of getConfig
clairep94 Jul 26, 2025
2362807
update formatDate to ts, fix type errors
clairep94 Jul 26, 2025
1f5614c
Merge branch 'develop' into pr05/migrate_client_utils_folder
clairep94 Jul 31, 2025
8febdcb
Merge branch 'develop' into pr05/migrate_client_utils_folder
clairep94 Aug 1, 2025
a9d954f
turn on no-underscore-dangle warning
clairep94 Aug 13, 2025
50eab48
getConfig: underscore-dangle stylefix for internal function
clairep94 Aug 13, 2025
87d9c0d
evaluateExpression: underscore-dangle stylefix for internal function
clairep94 Aug 13, 2025
e387df2
parseString: fix to address nullish check
clairep94 Aug 13, 2025
c4af496
device: simplify check for isMac()
clairep94 Aug 13, 2025
c67d841
evaluateExpression: address comments
clairep94 Aug 13, 2025
589318b
.prettierrc: remove hardcoded babel as parser setting to allow typesc…
clairep94 Aug 3, 2025
5f2d878
dispatcher: remove old comments
clairep94 Aug 13, 2025
7421ef9
lint-fix after removing prettier hardcoded parser babel
clairep94 Aug 13, 2025
5de3876
formatDate: update to named export and update format function to form…
clairep94 Aug 13, 2025
2cc486a
remove prettier/prettier eslint error ignore
clairep94 Aug 13, 2025
c92d53e
language-utils: update to named export
clairep94 Aug 13, 2025
0418d8c
apiClient: update to named export and update instances of importing
clairep94 Aug 13, 2025
7173d5d
getConfig: update to named export and update instances of import
clairep94 Aug 13, 2025
02428a0
turn underscore dangle to warn in ts only
clairep94 Aug 14, 2025
15cabf8
dispatcher: update to use enum
clairep94 Aug 14, 2025
bbeac90
getConfig: update to have failOnNotFound option to fail on compiler
clairep94 Aug 14, 2025
fcc9a4a
getConfig: handle instances of useage where should throw error in pro…
clairep94 Aug 14, 2025
919ab3b
getConfig: cleanup new optional property names
clairep94 Aug 14, 2025
de0f4da
cleanup unused import
clairep94 Aug 14, 2025
482fb18
reduxFormUtils: address comments for double partial
clairep94 Aug 14, 2025
640a0bb
evaluateExpression: update to named export
clairep94 Aug 14, 2025
8b3fee5
language-utils: remove check for navigatory == type of undefined
clairep94 Aug 15, 2025
6de4d6d
move isTestEnvironemnt to its own module for better testability
clairep94 Aug 15, 2025
0ad638f
getConfig: wip update to remove superfluous fail in test env option
clairep94 Aug 15, 2025
c832736
fix test
clairep94 Aug 15, 2025
31f137c
Update Ukrainian translation
gtmizyuk Aug 17, 2025
9fe530a
Merge branch 'develop' into pr05/migrate_client_utils_folder
clairep94 Aug 18, 2025
e11c82a
SkipLink: update type to interface
clairep94 Aug 19, 2025
ed2114c
SkipLink: Update to named export
clairep94 Aug 19, 2025
c98ad97
parseStringToType: handle when original input is already a bool
clairep94 Aug 19, 2025
1c2ce16
getConfig: update to constant case
clairep94 Aug 19, 2025
9f80ead
evaluateExpression: update to interface
clairep94 Aug 19, 2025
92f2060
remove throwErrorIfNotFound from getConfig
clairep94 Aug 19, 2025
bd998b3
remove throwErrorIfNotFound from getConfig - useages
clairep94 Aug 19, 2025
8fe7b3e
dispatcher: update to interface
clairep94 Aug 19, 2025
23653aa
Edits to clarify the "share" modal
team-epk Aug 8, 2025
f978ca2
Updating pt-BR translations (fixing some existing entries and adding …
cassiano Aug 18, 2025
bbe84f1
Fixing additional translations
cassiano Aug 18, 2025
16cad7a
More translations fixed
cassiano Aug 18, 2025
17e5b98
Adding new translation `AssetList.maximum` (in us-EN and pt-BR)
cassiano Aug 18, 2025
d5da431
One more incorrect translation
cassiano Aug 18, 2025
1a7e439
Avoiding male-gendered words
cassiano Aug 18, 2025
26bb4af
Removing unused pt-BR entries
cassiano Aug 18, 2025
5dc5f8a
Removing unused translations (i.e. entries which do not appear anywhe…
cassiano Aug 18, 2025
e2145a7
Removing unused pt-BR translations
cassiano Aug 19, 2025
72f771e
Adding missing translation
cassiano Aug 20, 2025
654d935
Reviewing additional entries
cassiano Aug 20, 2025
2f1caa1
Reviewing additional translations
cassiano Aug 20, 2025
1634692
Fixing translations
cassiano Aug 20, 2025
29669a9
Fixing translations
cassiano Aug 20, 2025
32453f3
Fixing translations
cassiano Aug 21, 2025
7c6d650
login-translation-bug
Nishantkumar012 Aug 22, 2025
7617910
Merge branch 'develop' into bug/login-page-translation-error
Nishantkumar012 Aug 22, 2025
0f50ca4
adding social media links to the community section of readme
alisonkim12 Aug 22, 2025
aeebb57
Merge branch 'develop' into develop
raclim Aug 22, 2025
6f32344
Merge branch 'develop' into share-modal
raclim Aug 22, 2025
42d761f
Update p5Versions.js to include 1.11.10
ksen0 Aug 23, 2025
e390dcf
i18n(be): Update Settings and SubmitSaveAllSettings Keys
adi-ray Aug 23, 2025
1f95dc6
adjust toolbar spacing
raclim Aug 24, 2025
6f0158e
remove extra folder
raclim Aug 24, 2025
e75e749
Merge branch 'develop' into ksen0-patch-2
raclim Aug 24, 2025
9ba39a5
Merge pull request #3600 from processing/ksen0-patch-2
raclim Aug 24, 2025
9b0a11a
2.18.0
raclim Aug 24, 2025
b201533
Merge branch 'release-2.18.0' into release
raclim Aug 24, 2025
c486593
Merge branch 'release-2.18.0' into develop
raclim Aug 24, 2025
34123d5
Merge branch 'release' into develop
raclim Aug 24, 2025
c555977
Bump path-to-regexp and express
dependabot[bot] Aug 24, 2025
ec8de0a
Merge branch 'develop' into pr05/migrate_client_utils_folder
clairep94 Aug 24, 2025
f8af6ef
Merge branch 'develop' into updating-ptbr-translations
cassiano Aug 25, 2025
b095dba
Merge branch 'processing:develop' into readme-social-links
runningonsideprojects Aug 25, 2025
f2a97aa
Fixed Documentation Typo
SHAMIKH-ANWAR Aug 26, 2025
266e9e1
Merge pull request #3553 from clairep94/pr05/migrate_client_utils_folder
raclim Aug 26, 2025
4105ec0
Merge branch 'develop' into readme-social-links
raclim Aug 26, 2025
7f50497
Merge branch 'develop' into updating-ptbr-translations
raclim Aug 26, 2025
4ec6a73
Merge pull request #3593 from cassiano/updating-ptbr-translations
raclim Aug 26, 2025
2511756
Merge branch 'develop' into bug/login-page-translation-error
raclim Aug 26, 2025
f623987
Merge branch 'develop' into patch-2
raclim Aug 26, 2025
fc5f6ed
Merge pull request #3601 from adi-ray/patch-2
raclim Aug 26, 2025
9e002df
Merge branch 'develop' into develop
raclim Aug 26, 2025
1d7c55c
Merge pull request #3591 from gtmizyuk/develop
raclim Aug 26, 2025
553804a
Merge branch 'develop' into bug/login-page-translation-error
raclim Aug 26, 2025
8b73697
Merge pull request #3598 from Nishantkumar012/bug/login-page-translat…
raclim Aug 26, 2025
e551d4b
Merge branch 'develop' into readme-social-links
raclim Aug 26, 2025
57e62c8
Merge pull request #3606 from runningonsideprojects/readme-social-links
raclim Aug 26, 2025
9ee982b
Merge branch 'develop' into fix-doc-typo
raclim Aug 26, 2025
b4fd152
Merge pull request #3607 from SHAMIKH-ANWAR/fix-doc-typo
raclim Aug 26, 2025
445c8d1
Merge branch 'develop' into dependabot/npm_and_yarn/multi-e981fcb12d
raclim Aug 26, 2025
8ebf9e3
Merge pull request #3602 from processing/dependabot/npm_and_yarn/mult…
raclim Aug 26, 2025
89e7ec4
fix(i18n): Update Bengali locale code
adi-ray Aug 26, 2025
37bba04
Merge branch 'develop' into patch-2
raclim Aug 26, 2025
9d6e0a0
Merge pull request #3610 from adi-ray/patch-2
raclim Aug 26, 2025
f94b1ce
Edits to clarify the "share" modal
team-epk Aug 8, 2025
4334518
minor edits to earlier commit (#3595)
team-epk Aug 26, 2025
7dd44ac
Edits to clarify the "share" modal
team-epk Aug 8, 2025
a0801e2
Merge branch 'share-modal' of https://github.com/team-epk/p5.js-web-e…
team-epk Aug 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"tsx": "never"
}
],
"import/prefer-default-export": "off",
"react/jsx-filename-extension": [1, { "extensions": [".jsx", ".tsx"] }],
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
"default-param-last": 0,
Expand All @@ -41,6 +42,7 @@
"no-restricted-exports": 1,
"no-underscore-dangle": 0,
"no-useless-catch": 2,
"no-plusplus": "off",
"prefer-object-spread": 0,
"max-len": [1, 120, 2, {"ignoreComments": true, "ignoreTemplateLiterals": true}],
"max-classes-per-file": 0,
Expand Down Expand Up @@ -131,7 +133,9 @@
"rules": {
"no-use-before-define": "off",
"import/no-extraneous-dependencies": "off",
"no-unused-vars": "off"
"no-unused-vars": "off",
"import/no-default-export": "warn",
"no-underscore-dangle": "warn",
}
},
{
Expand Down
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"parser": "babel",
"printWidth": 80,
"proseWrap": "never",
"requirePragma": false,
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ We are a community of, and in solidarity with, people from every gender identity

Learn more about [our community](https://p5js.org/community/) and read our [Community Statement and Code of Conduct](./.github/CODE_OF_CONDUCT.md). You can directly support our work with p5.js by [donating to the Processing Foundation](https://processingfoundation.org/support).

Stay in touch with Processing Foundation across other platforms:
- [Instagram](https://www.instagram.com/p5xjs)
- [Youtube](https://www.youtube.com/@ProcessingFoundation)
- [X](https://x.com/p5xjs)
- Discord (invitation link coming soon!)
- [Forum](https://discourse.processing.org)


## Using the p5.js Editor 🤔

Make your first sketch in the [p5.js Editor](https://editor.p5js.org/)! Learn more about sketching with p5.js on the [Get Started](https://p5js.org/tutorials/get-started/) and find everything you can do in the [Reference](https://p5js.org/reference/). You can also look at [examples](https://editor.p5js.org/p5/sketches) and remix them in the p5.js Editor.
Expand Down
4 changes: 2 additions & 2 deletions client/common/useKeyDownHandlers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { mapKeys } from 'lodash';
import PropTypes from 'prop-types';
import { useCallback, useEffect, useRef } from 'react';
import { isMac } from '../utils/device';

/**
* Attaches keydown handlers to the global document.
Expand Down Expand Up @@ -30,8 +31,7 @@ export default function useKeyDownHandlers(keyHandlers) {
*/
const handleEvent = useCallback((e) => {
if (!e.key) return;
const isMac = navigator.userAgent.toLowerCase().indexOf('mac') !== -1;
const isCtrl = isMac ? e.metaKey : e.ctrlKey;
const isCtrl = isMac() ? e.metaKey : e.ctrlKey;
if (e.shiftKey && isCtrl) {
handlers.current[
`ctrl-shift-${
Expand Down
2 changes: 1 addition & 1 deletion client/components/SkipLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen, fireEvent } from '@testing-library/react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import '@testing-library/jest-dom';
import SkipLink from './SkipLink';
import { SkipLink } from './SkipLink';

jest.mock('react-i18next', () => ({
useTranslation: () => ({
Expand Down
12 changes: 5 additions & 7 deletions client/components/SkipLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { useState } from 'react';
import classNames from 'classnames';
import { useTranslation } from 'react-i18next';

type SkipLinkProps = {
targetId: string,
text: string
};
interface SkipLinkProps {
targetId: string;
text: string;
}

const SkipLink = ({ targetId, text }: SkipLinkProps) => {
export const SkipLink = ({ targetId, text }: SkipLinkProps) => {
const [focus, setFocus] = useState(false);
const { t } = useTranslation();
const handleFocus = () => {
Expand All @@ -30,5 +30,3 @@ const SkipLink = ({ targetId, text }: SkipLinkProps) => {
</a>
);
};

export default SkipLink;
10 changes: 5 additions & 5 deletions client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { initReactI18next } from 'react-i18next';
import Backend from 'i18next-http-backend';

import {
be,
bn,
enUS,
es,
ja,
Expand All @@ -21,12 +21,12 @@ import {
enIN
} from 'date-fns/locale';

import getPreferredLanguage from './utils/language-utils';
import { getPreferredLanguage } from './utils/language-utils';

const fallbackLng = ['en-US'];

export const availableLanguages = [
'be',
'bn',
'de',
'en-US',
'es-419',
Expand Down Expand Up @@ -61,7 +61,7 @@ if (

export function languageKeyToLabel(lang) {
const languageMap = {
be: 'বাংলা',
bn: 'বাংলা',
de: 'Deutsch',
'en-US': 'English',
'es-419': 'Español',
Expand All @@ -83,7 +83,7 @@ export function languageKeyToLabel(lang) {

export function languageKeyToDateLocale(lang) {
const languageMap = {
be,
bn,
de,
'en-US': enUS,
'es-419': es,
Expand Down
2 changes: 1 addition & 1 deletion client/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Routing from './routes';
import ThemeProvider from './modules/App/components/ThemeProvider';
import Loader from './modules/App/components/loader';
import './i18n';
import SkipLink from './components/SkipLink';
import { SkipLink } from './components/SkipLink';

require('./styles/main.scss');

Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/actions/assets.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import apiClient from '../../../utils/apiClient';
import { apiClient } from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from '../reducers/loading';
import { assetsActions } from '../reducers/assets';
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/actions/collections.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import browserHistory from '../../../browserHistory';
import apiClient from '../../../utils/apiClient';
import { apiClient } from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from '../reducers/loading';
import { setToastText, showToast } from './toast';
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/actions/files.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import objectID from 'bson-objectid';
import blobUtil from 'blob-util';
import apiClient from '../../../utils/apiClient';
import { apiClient } from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import {
setUnsavedChanges,
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/actions/preferences.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18next from 'i18next';
import apiClient from '../../../utils/apiClient';
import { apiClient } from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';

function updatePreferences(formParams, dispatch) {
Expand Down
6 changes: 4 additions & 2 deletions client/modules/IDE/actions/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import objectID from 'bson-objectid';
import each from 'async/each';
import { isEqual } from 'lodash';
import browserHistory from '../../../browserHistory';
import apiClient from '../../../utils/apiClient';
import getConfig from '../../../utils/getConfig';
import { apiClient } from '../../../utils/apiClient';
import { getConfig } from '../../../utils/getConfig';
import * as ActionTypes from '../../../constants';
import { showToast, setToastText } from './toast';
import {
Expand Down Expand Up @@ -308,6 +308,8 @@ export function cloneProject(project) {
(file, callback) => {
if (
file.url &&
S3_BUCKET &&
S3_BUCKET_URL_BASE &&
(file.url.includes(S3_BUCKET_URL_BASE) ||
file.url.includes(S3_BUCKET))
) {
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/actions/projects.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import apiClient from '../../../utils/apiClient';
import { apiClient } from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from '../reducers/loading';

Expand Down
20 changes: 14 additions & 6 deletions client/modules/IDE/actions/uploader.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import { TEXT_FILE_REGEX } from '../../../../server/utils/fileUtils';
import apiClient from '../../../utils/apiClient';
import getConfig from '../../../utils/getConfig';
import { apiClient } from '../../../utils/apiClient';
import { getConfig } from '../../../utils/getConfig';
import { isTestEnvironment } from '../../../utils/checkTestEnv';
import { handleCreateFile } from './files';

const s3BucketUrlBase = getConfig('S3_BUCKET_URL_BASE');
const awsRegion = getConfig('AWS_REGION');
const s3Bucket = getConfig('S3_BUCKET');

if (!isTestEnvironment && !s3BucketUrlBase && !(awsRegion && s3Bucket)) {
throw new Error(`S3 bucket address not configured.
Configure either S3_BUCKET_URL_BASE or both AWS_REGION & S3_BUCKET in env vars`);
}

export const s3BucketHttps =
getConfig('S3_BUCKET_URL_BASE') ||
`https://s3-${getConfig('AWS_REGION')}.amazonaws.com/${getConfig(
'S3_BUCKET'
)}/`;
s3BucketUrlBase || `https://s3-${awsRegion}.amazonaws.com/${s3Bucket}/`;

const MAX_LOCAL_FILE_SIZE = 80000; // bytes, aka 80 KB

function isS3Upload(file) {
Expand Down
13 changes: 9 additions & 4 deletions client/modules/IDE/components/AssetSize.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import prettyBytes from 'pretty-bytes';
import { getConfig } from '../../../utils/getConfig';
import { parseNumber } from '../../../utils/parseStringToType';

import getConfig from '../../../utils/getConfig';

const limit = getConfig('UPLOAD_LIMIT') || 250000000;
const limit = parseNumber(getConfig('UPLOAD_LIMIT')) || 250000000;
const MAX_SIZE_B = limit;

const formatPercent = (percent) => {
Expand All @@ -18,6 +19,8 @@ const formatPercent = (percent) => {

/* Eventually, this copy should be Total / 250 MB Used */
const AssetSize = () => {
const { t } = useTranslation();

const totalSize = useSelector(
(state) => state.user.totalSize || state.assets.totalSize
);
Expand All @@ -38,7 +41,9 @@ const AssetSize = () => {
<p className="asset-current">
{currentSize} ({percent})
</p>
<p className="asset-max">Max: {sizeLimit}</p>
<p className="asset-max">
{t('AssetList.maximum')}: {sizeLimit}
</p>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as ProjectActions from '../../actions/project';
import * as CollectionsActions from '../../actions/collections';
import * as IdeActions from '../../actions/ide';
import * as ToastActions from '../../actions/toast';
import dates from '../../../../utils/formatDate';
import { formatDateToString } from '../../../../utils/formatDate';
import { remSize, prop } from '../../../../theme';

const SketchsTableRow = styled.tr`
Expand Down Expand Up @@ -93,7 +93,7 @@ const SketchlistDropdownColumn = styled.td`
}
`;
const formatDateCell = (date, mobile = false) =>
dates.format(date, { showTime: !mobile });
formatDateToString(date, { showTime: !mobile });

const CollectionListRowBase = (props) => {
const [renameOpen, setRenameOpen] = useState(false);
Expand Down
21 changes: 13 additions & 8 deletions client/modules/IDE/components/Header/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { useTranslation } from 'react-i18next';
import MenubarSubmenu from '../../../../components/Menubar/MenubarSubmenu';
import MenubarItem from '../../../../components/Menubar/MenubarItem';
import { availableLanguages, languageKeyToLabel } from '../../../../i18n';
import getConfig from '../../../../utils/getConfig';
import { getConfig } from '../../../../utils/getConfig';
import { parseBoolean } from '../../../../utils/parseStringToType';
import { showToast } from '../../actions/toast';
import { setLanguage } from '../../actions/preferences';
import Menubar from '../../../../components/Menubar/Menubar';
Expand Down Expand Up @@ -80,8 +81,14 @@ LeftLayout.defaultProps = {
layout: 'project'
};

const isLoginEnabled = parseBoolean(getConfig('LOGIN_ENABLED'), true);
const isUiCollectionsEnabled = parseBoolean(
getConfig('UI_COLLECTIONS_ENABLED'),
true
);
const isExamplesEnabled = parseBoolean(getConfig('EXAMPLES_ENABLED'), true);

const UserMenu = () => {
const isLoginEnabled = getConfig('LOGIN_ENABLED');
const isAuthenticated = useSelector(getAuthenticated);

if (isLoginEnabled && isAuthenticated) {
Expand Down Expand Up @@ -177,7 +184,7 @@ const ProjectMenu = () => {
id="file-save"
isDisabled={
!user.authenticated ||
!getConfig('LOGIN_ENABLED') ||
!isLoginEnabled ||
(project?.owner && !isUserOwner)
}
onClick={() => saveSketch(cmRef.current)}
Expand Down Expand Up @@ -216,17 +223,15 @@ const ProjectMenu = () => {
<MenubarItem
id="file-add-to-collection"
isDisabled={
!getConfig('UI_COLLECTIONS_ENABLED') ||
!user.authenticated ||
isUnsaved
!isUiCollectionsEnabled || !user.authenticated || isUnsaved
}
href={`/${user.username}/sketches/${project?.id}/add-to-collection`}
>
{t('Nav.File.AddToCollection')}
</MenubarItem>
<MenubarItem
id="file-examples"
isDisabled={!getConfig('EXAMPLES_ENABLED')}
isDisabled={!isExamplesEnabled}
href="/p5/sketches"
>
{t('Nav.File.Examples')}
Expand Down Expand Up @@ -370,7 +375,7 @@ const AuthenticatedUserMenu = () => {
<MenubarItem
id="account-collections"
href={`/${username}/collections`}
isDisabled={!getConfig('UI_COLLECTIONS_ENABLED')}
isDisabled={!isUiCollectionsEnabled}
>
{t('Nav.Auth.MyCollections')}
</MenubarItem>
Expand Down
19 changes: 9 additions & 10 deletions client/modules/IDE/components/Header/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ const Toolbar = (props) => {

<div className="toolbar__project-name-container">
<ProjectName />
{/* Still show owner if not you */}
{project?.owner && !userIsOwner && (
<p className="toolbar__project-owner">
{t('Toolbar.By')}{' '}
<Link to={`/${project.owner.username}/sketches`}>
{project.owner.username}
</Link>
</p>
)}
</div>

<div style={{ flex: 1 }} />
Expand All @@ -127,16 +136,6 @@ const Toolbar = (props) => {
</div>
)}

{/* Still show owner if not you */}
{project?.owner && !userIsOwner && (
<p className="toolbar__project-owner">
{t('Toolbar.By')}{' '}
<Link to={`/${project.owner.username}/sketches`}>
{project.owner.username}
</Link>
</p>
)}

<VersionIndicator />

<button
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/components/PreviewFrame.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import getConfig from '../../../utils/getConfig';
import { getConfig } from '../../../utils/getConfig';
import { registerFrame } from '../../../utils/dispatcher';

const Frame = styled.iframe`
Expand Down
Loading