Skip to content

Commit

Permalink
Merge branch 'develop' into keyboard_shortcut_add_file
Browse files Browse the repository at this point in the history
  • Loading branch information
raclim authored Jun 3, 2024
2 parents 613e445 + 8287b5f commit a679475
Show file tree
Hide file tree
Showing 132 changed files with 7,189 additions and 3,150 deletions.
53 changes: 53 additions & 0 deletions .storybook/decorator-theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { upperFirst } from 'lodash';
import React from 'react';
import styled, { ThemeProvider } from 'styled-components';
import theme, { prop } from '../client/theme';

const PreviewArea = styled.div`
background: ${prop('backgroundColor')};
flex-grow: 1;
padding: 2rem;
& > h4 {
margin-top: 0;
color: ${prop('primaryTextColor')};
}
`;

const themeKeys = Object.keys(theme);

export const withThemeProvider = (Story, context) => {
const setting = context.globals.theme;
if (setting === 'all') {
return (
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
{Object.keys(theme).map((themeName) => (
<ThemeProvider theme={theme[themeName]} key={themeName}>
<PreviewArea className={themeName}>
<h4>{upperFirst(themeName)}</h4>
<Story />
</PreviewArea>
</ThemeProvider>
))}
</div>
);
} else {
const themeName = setting;
return (
<ThemeProvider theme={theme[themeName]}>
<PreviewArea className={themeName}>
<Story />
</PreviewArea>
</ThemeProvider>
);
}
};

export const themeToolbarItem = {
description: 'Global theme for components',
defaultValue: 'all',
toolbar: {
title: 'Theme',
icon: 'mirror',
items: [...themeKeys, 'all']
}
};
8 changes: 6 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from 'react';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router';

import ThemeProvider from '../client/modules/App/components/ThemeProvider';
import configureStore from '../client/store';
import '../client/i18n-test';
import '../client/styles/storybook.css'
import { withThemeProvider, themeToolbarItem } from './decorator-theme';

const initialState = window.__INITIAL_STATE__;

Expand All @@ -21,5 +21,9 @@ export const decorators = [
</MemoryRouter>
</Provider>
),
]
withThemeProvider
];

export const globalTypes = {
theme: themeToolbarItem
};
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ FROM base as development
ENV NODE_ENV development
COPY package.json package-lock.json ./
RUN npm install
RUN npm rebuild node-sass
COPY .babelrc index.js nodemon.json ./
COPY ./webpack ./webpack
COPY client ./client
Expand All @@ -27,6 +26,5 @@ FROM base as production
ENV NODE_ENV=production
COPY package.json package-lock.json index.js ./
RUN npm install --production
RUN npm rebuild node-sass
COPY --from=build $APP_HOME/dist ./dist
CMD ["npm", "run", "start:prod"]
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ If you have found a bug in the p5.js Web Editor, you can file it under the ["iss

To see which pull requests and issues are currently being reviewed, check the [PR Review Board](https://github.com/processing/p5.js-web-editor/projects/9) or the following Milestones: [MINOR Release](https://github.com/processing/p5.js-web-editor/milestone/8).

Issues and Pull Requests categorized under the PATCH or MINOR Release Milestones will be prioritized since they are planned to be merged for the next release to Production. Please feel free to [comment on this pinned issue](https://github.com/processing/p5.js-web-editor/issues/2534) if you would like your issue to be considered for the next release!


### When Will the Next Production Release Be?

We will aim to deploy on a 1-2 month basis. Here are some dates we’re working towards:

2.11.0 MINOR Release: By January 16, 2023

[You can read more about Semantic Versioning and the differences between a MINOR and PATCH release](https://semver.org/).


## References for Contributing to the p5.js Web Editor

Expand Down
32 changes: 0 additions & 32 deletions client/components/AddRemoveButton.jsx

This file was deleted.

6 changes: 2 additions & 4 deletions client/components/Dropdown/TableDropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import React from 'react';
import { useMediaQuery } from 'react-responsive';
import styled from 'styled-components';
import { prop, remSize } from '../../theme';
import DropdownMenu from './DropdownMenu';

import DownFilledTriangleIcon from '../../images/down-filled-triangle.svg';
import MoreIconSvg from '../../images/more.svg';
import useIsMobile from '../../modules/IDE/hooks/useIsMobile';

const DotsHorizontal = styled(MoreIconSvg)`
transform: rotate(90deg);
`;

const TableDropdownIcon = () => {
// TODO: centralize breakpoints
const isMobile = useMediaQuery({ maxWidth: 770 });

const isMobile = useIsMobile();
return isMobile ? (
<DotsHorizontal focusable="false" aria-hidden="true" />
) : (
Expand Down
52 changes: 0 additions & 52 deletions client/components/NavBasic.jsx

This file was deleted.

26 changes: 0 additions & 26 deletions client/components/OverlayManager.jsx

This file was deleted.

4 changes: 0 additions & 4 deletions client/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// multiple files
export const UPDATE_FILE_CONTENT = 'UPDATE_FILE_CONTENT';
export const TOGGLE_SKETCH = 'TOGGLE_SKETCH';

export const START_SKETCH = 'START_SKETCH';
export const STOP_SKETCH = 'STOP_SKETCH';

Expand Down Expand Up @@ -137,9 +136,6 @@ export const SET_SORT_PARAMS = 'SET_SORT_PARAMS';
export const SET_SEARCH_TERM = 'SET_SEARCH_TERM';
export const CLOSE_SKETCHLIST_MODAL = 'CLOSE_SKETCHLIST_MODAL';

export const START_LOADING = 'START_LOADING';
export const STOP_LOADING = 'STOP_LOADING';

export const START_SAVING_PROJECT = 'START_SAVING_PROJECT';
export const END_SAVING_PROJECT = 'END_SAVING_PROJECT';

Expand Down
1 change: 0 additions & 1 deletion client/i18n-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

import translations from '../translations/locales/en-US/translations.json';

i18n.use(initReactI18next).init({
Expand Down
25 changes: 10 additions & 15 deletions client/modules/App/components/ThemeProvider.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { useSelector } from 'react-redux';
import { ThemeProvider } from 'styled-components';
import theme from '../../../theme';

import theme, { Theme } from '../../../theme';

const Provider = ({ children, currentTheme }) => (
<ThemeProvider theme={{ ...theme[currentTheme] }}>{children}</ThemeProvider>
);
const Provider = ({ children }) => {
const currentTheme = useSelector((state) => state.preferences.theme);
return (
<ThemeProvider theme={{ ...theme[currentTheme] }}>{children}</ThemeProvider>
);
};

Provider.propTypes = {
children: PropTypes.node.isRequired,
currentTheme: PropTypes.oneOf(Object.keys(Theme)).isRequired
children: PropTypes.node.isRequired
};

function mapStateToProps(state) {
return {
currentTheme: state.preferences.theme
};
}

export default connect(mapStateToProps)(Provider);
export default Provider;
2 changes: 1 addition & 1 deletion client/modules/IDE/actions/assets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import apiClient from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from './loader';
import { startLoader, stopLoader } from '../reducers/loading';
import { assetsActions } from '../reducers/assets';

const { setAssets, deleteAsset } = assetsActions;
Expand Down
6 changes: 3 additions & 3 deletions client/modules/IDE/actions/collections.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import browserHistory from '../../../browserHistory';
import apiClient from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from './loader';
import { startLoader, stopLoader } from '../reducers/loading';
import { setToastText, showToast } from './toast';

const TOAST_DISPLAY_TIME_MS = 1500;
Expand Down Expand Up @@ -80,7 +80,7 @@ export function addToCollection(collectionId, projectId) {

const collectionName = response.data.name;

dispatch(setToastText(`Added to "${collectionName}`));
dispatch(setToastText(`Added to "${collectionName}"`));
dispatch(showToast(TOAST_DISPLAY_TIME_MS));

return response.data;
Expand Down Expand Up @@ -110,7 +110,7 @@ export function removeFromCollection(collectionId, projectId) {

const collectionName = response.data.name;

dispatch(setToastText(`Removed from "${collectionName}`));
dispatch(setToastText(`Removed from "${collectionName}"`));
dispatch(showToast(TOAST_DISPLAY_TIME_MS));

return response.data;
Expand Down
9 changes: 0 additions & 9 deletions client/modules/IDE/actions/loader.js

This file was deleted.

2 changes: 1 addition & 1 deletion client/modules/IDE/actions/projects.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import apiClient from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from './loader';
import { startLoader, stopLoader } from '../reducers/loading';

// eslint-disable-next-line
export function getProjects(username) {
Expand Down
5 changes: 3 additions & 2 deletions client/modules/IDE/actions/projects.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { rest } from 'msw';

import * as ProjectActions from './projects';
import * as ActionTypes from '../../../constants';
import { startLoader, stopLoader } from '../reducers/loading';
import {
initialTestState,
mockProjects
Expand Down Expand Up @@ -33,9 +34,9 @@ describe('projects action creator tests', () => {
store = mockStore(initialTestState);

const expectedActions = [
{ type: ActionTypes.START_LOADING },
{ type: startLoader.type },
{ type: ActionTypes.SET_PROJECTS, projects: mockProjects },
{ type: ActionTypes.STOP_LOADING }
{ type: stopLoader.type }
];

return store
Expand Down
Loading

0 comments on commit a679475

Please sign in to comment.