Skip to content

pr05 Typescript #3: Migrate client/utils folder #3553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 66 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 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
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
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
4 changes: 2 additions & 2 deletions client/components/SkipLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { useTranslation } from 'react-i18next';

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

const SkipLink = ({ targetId, text }: SkipLinkProps) => {
Expand All @@ -31,4 +31,4 @@
);
};

export default SkipLink;

Check warning on line 34 in client/components/SkipLink.tsx

View workflow job for this annotation

GitHub Actions / Test and lint code base

Prefer named exports
2 changes: 1 addition & 1 deletion client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
enIN
} from 'date-fns/locale';

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

const fallbackLng = ['en-US'];

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
14 changes: 9 additions & 5 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 All @@ -15,9 +15,11 @@ import {
} from './ide';
import { clearState, saveState } from '../../../persistState';

const ROOT_URL = getConfig('API_URL');
const S3_BUCKET_URL_BASE = getConfig('S3_BUCKET_URL_BASE');
const S3_BUCKET = getConfig('S3_BUCKET');
const ROOT_URL = getConfig('API_URL', { throwErrorIfNotFound: true });
const S3_BUCKET_URL_BASE = getConfig('S3_BUCKET_URL_BASE', {
throwErrorIfNotFound: true
});
const S3_BUCKET = getConfig('S3_BUCKET', { throwErrorIfNotFound: true });
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khanniie what do you think of this update?

getConfig options param now has throwErrorIfNotFound, which throws and error if the value is not found (or is an empty string)
This allows the compiler to throw errors immediately when attempting a local build if these things are missing

I've done a search for all instances where getConfig is used and made a guess of what I think would be useful to fail at compile-time if the config variable doesn't exist, but this is totally a guess


export function setProject(project) {
return {
Expand Down Expand Up @@ -307,6 +309,8 @@ export function cloneProject(project) {
(file, callback) => {
if (
file.url &&
S3_BUCKET &&
S3_BUCKET_URL_BASE &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this check for safety because I think str.includes(undefined) runs the same as str.includes("undefined")
so

"foo undefined bar".includes(undefined); // true

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call!!

(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
6 changes: 3 additions & 3 deletions client/modules/IDE/components/AssetSize.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
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;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new parseNumber utility to transform the string from getConfig to a number

Currently this file is still jsx so it would be ok to use the string version of this number, but it's not as safe

const MAX_SIZE_B = limit;

const formatPercent = (percent) => {
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
4 changes: 2 additions & 2 deletions 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 All @@ -13,7 +13,7 @@ const Frame = styled.iframe`

function PreviewFrame({ fullView, isOverlayVisible }) {
const iframe = useRef();
const previewUrl = getConfig('PREVIEW_URL');
const previewUrl = getConfig('PREVIEW_URL', { throwErrorIfNotFound: true });
useEffect(() => {
const unsubscribe = registerFrame(iframe.current.contentWindow, previewUrl);
return () => {
Expand Down
2 changes: 0 additions & 2 deletions client/modules/IDE/components/ShareModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import CopyableInput from './CopyableInput';
// import getConfig from '../../../utils/getConfig';

const ShareModal = () => {
const { t } = useTranslation();
Expand All @@ -15,7 +14,6 @@ const ShareModal = () => {
);

const hostname = window.location.origin;
// const previewUrl = getConfig('PREVIEW_URL');
return (
<div className="share-modal">
<h3 className="share-modal__project-name">{projectName}</h3>
Expand Down
8 changes: 4 additions & 4 deletions client/modules/IDE/components/SketchListRowBase.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import * as ProjectActions from '../actions/project';
import * as IdeActions from '../actions/ide';
import TableDropdown from '../../../components/Dropdown/TableDropdown';
import MenuItem from '../../../components/Dropdown/MenuItem';
import dates from '../../../utils/formatDate';
import getConfig from '../../../utils/getConfig';
import { formatDateToString } from '../../../utils/formatDate';
import { getConfig } from '../../../utils/getConfig';

const ROOT_URL = getConfig('API_URL');
const ROOT_URL = getConfig('API_URL', { throwErrorIfNotFound: true });

const formatDateCell = (date, mobile = false) =>
dates.format(date, { showTime: !mobile });
formatDateToString(date, { showTime: !mobile });

const SketchListRowBase = ({
sketch,
Expand Down
8 changes: 3 additions & 5 deletions client/modules/IDE/components/Timer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import dates from '../../../utils/formatDate';
import { distanceInWordsToNow } from '../../../utils/formatDate';
import useInterval from '../hooks/useInterval';
import { getIsUserOwner } from '../selectors/users';

Expand All @@ -17,16 +17,14 @@ const Timer = () => {

// Update immediately upon saving.
useEffect(() => {
setTimeAgo(
projectSavedTime ? dates.distanceInWordsToNow(projectSavedTime) : ''
);
setTimeAgo(projectSavedTime ? distanceInWordsToNow(projectSavedTime) : '');
}, [projectSavedTime]);

// Update every 10 seconds.
useInterval(
() =>
setTimeAgo(
projectSavedTime ? dates.distanceInWordsToNow(projectSavedTime) : ''
projectSavedTime ? distanceInWordsToNow(projectSavedTime) : ''
),
10000
);
Expand Down
5 changes: 3 additions & 2 deletions client/modules/IDE/components/UploadFileModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { useDispatch, useSelector } from 'react-redux';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import prettyBytes from 'pretty-bytes';
import getConfig from '../../../utils/getConfig';
import { getConfig } from '../../../utils/getConfig';
import { closeUploadFileModal } from '../actions/ide';
import FileUploader from './FileUploader';
import { getreachedTotalSizeLimit } from '../selectors/users';
import Modal from './Modal';
import { parseNumber } from '../../../utils/parseStringToType';

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

const UploadFileModal = () => {
Expand Down
5 changes: 3 additions & 2 deletions client/modules/IDE/selectors/users.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createSelector } from '@reduxjs/toolkit';
import getConfig from '../../../utils/getConfig';
import { getConfig } from '../../../utils/getConfig';
import { parseNumber } from '../../../utils/parseStringToType';

export const getAuthenticated = (state) => state.user.authenticated;
const getTotalSize = (state) => state.user.totalSize;
const getAssetsTotalSize = (state) => state.assets.totalSize;
export const getSketchOwner = (state) => state.project.owner;
const getUserId = (state) => state.user.id;
const limit = getConfig('UPLOAD_LIMIT') || 250000000;
const limit = parseNumber(getConfig('UPLOAD_LIMIT')) || 250000000;

export const getCanUploadMedia = createSelector(
getAuthenticated,
Expand Down
Loading