Skip to content

Commit 8679674

Browse files
authored
TEMPLATES YAAAY (codesandbox#2003)
* start * add styles * move checkbox to common * move template to common * add hooooookd fam * add actions * add * start modal * start dashboard * add color * much progress on modal * fix non logged in * add empty state * small fixes * fix filtering * update yarn lock * final sandbnox modal fixes * Update packages/common/src/components/Template/elements.ts Co-Authored-By: Michaël De Boey <[email protected]> * Small design tweaks - Make the tabs animate on hover - Remove main animation of screen, feels bit faster * add edit and delete * upadte state * add hover * ✨ Add Frozen/Editing Indicator, Apply Coding Conventions to Header (WIP) Refactored a bunch of the Header components for better organization and to conform to coding conventions. Added a new HazardButton primitive and used it to create a ToggleFrozenButton for the Sandbox Header. This button has the same effect as the Frozen toggle switch inside of the Project Info workspace and is used to give the user a visual indicator that they are viewing a frozen or editable sandbox. TODO: - Maybe move the HazardButton to common components and improve it's styling API. Could also use better types. - Change the Fork button to show 'Use Template" when the current Sandbox is a Template. This would create a new Sandbox using the Template, but would sever the link to source GitHub repository, which the current Fork method preserves. - Maybe rearrange the Header buttons? - Continue refactoring remaining Header components to apply coding conventions. * update state on start and edit * 🔨 Refactor remaining Header components, Move onClick to Action container Converted all Header sub-components to TypeScript using React Hooks. As requested by @CompuIves, fixed the Action button behavior for onClick events, moving it from being triggered from clicks on the Icon to clicks on the container element. * Update packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/HazardButton/types.ts Co-Authored-By: Michaël De Boey <[email protected]> * add indicators * add naming * clean reload * pr updates * make components * move to ts * add gh check * add warning modal * remove header button0 * add store hooks * Update packages/app/src/app/pages/Sandbox/Editor/Workspace/items/NotOwnedSandboxInfo/NotOwnedSandboxInfo.tsx Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/app/src/app/pages/Sandbox/Editor/Workspace/items/NotOwnedSandboxInfo/NotOwnedSandboxInfo.tsx Co-Authored-By: Michaël De Boey <[email protected]> * pr fixes * Update packages/common/src/components/Tags/index.tsx Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/app/src/app/store/modules/workspace/sequences.js Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/app/src/app/store/modules/workspace/sequences.js Co-Authored-By: Ives van Hoorne <[email protected]> * pr fixers * pr fixes * revert deleted files * fix now.json * fix yarn * fix icons * fix ts * Update packages/app/src/app/pages/Dashboard/Content/routes/PathedTemplates/index.js Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/app/src/app/pages/Dashboard/Content/routes/PathedTemplates/index.js Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/Action/types.ts Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/app/src/app/pages/Sandbox/Editor/Header/index.tsx Co-Authored-By: Michaël De Boey <[email protected]> * Update packages/app/src/app/pages/Dashboard/Content/routes/PathedTemplates/Folders.js Co-Authored-By: Michaël De Boey <[email protected]> * simplyfy types * 🔨 Apply Coding Conventions to CreateNewSandboxModal Applied our coding conventions, reorganized, and converted most of the CreateNewSandbox files to TypeScript. Was unabled to refactor CreateNewSandbox/index.js as I wasn't quite sure about how it works. @CompuIves you may want to take a shot at this or otherwise I'll just have to come back to it later. Tested locally, all the functionality appears to be the same as before. * fix lint * 🚧 WIP - Change file extensions on PathedTemplates/Navigation * 🧹 Cleanup PathedTemplates/Navigation Converted to TypeScript and applied coding conventions. * 🧹 Cleanup PathedTemplates Applied coding conventions and added types. It's worth noting that I was unable to add types for react-router-dom without having to upgrade multiple dependencies, which quickly grew outside of the scope of this PR. So instead proper types will be added at a later date once the build process and project dependencies are overhauled. * fx ts * 📦 Update Apollo Dependencies to Latest Verified to solve type checking errors in app Ran lint, test, typecheck, and ran a cold start, all passed. Tested locally to verify graphql queries still worked * Rename prop * Capitalize titles * Remove spaces from css rules This should fix these rules not displaying properly * Update packages/app/src/app/store/modules/workspace/sequences.js Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/app/src/app/store/modules/workspace/sequences.js Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/app/src/app/pages/Sandbox/Editor/Workspace/items/NotOwnedSandboxInfo/NotOwnedSandboxInfo.tsx Co-Authored-By: Ives van Hoorne <[email protected]> * Fix types * Regenerate yarn.lock * Reset yarn cache * Refactor templates to remove path logic * add converted; make width in before 56px * Reset sidebar active style * Add team templates, make the icon white on hover * Put module.ts back from master, it's fixed with old yarn.lock * move to common * 🔨 Apply new design to ForkFrozenSandboxModal * Fix typecheck * 🔧 Fix common/Button children Type Always use `React.ReactNode` for the `children` prop. * add grid * remove public checkbox * fix lint * 0fix descriptrion * Support team templates * 🔨 Apply new design to TempalteModal Also applied padding changes to ForkFrozenSandboxModal and added a 8px border radius to all modal containers. * fix minor card issues * fix overflow * Don't show modal asking for fork for custom templates * Fix menu bar styling * ⚡️ Swap Buttons on ForkFrozenSandboxModal, Add react-use As requested by Bas, the Fork and Unlock buttons have been swapped and there is now an event listener on the Fork button to fork the sandbox on pressing "enter", which is handled by `useKeyPressEvent` from `react-use`. * Changes based on our ideas yesterday - Make the template title and description from the sandbox - Hide templates from "My Sandboxes" and "Recent Sandboxes" - Update header to not show folders for templates * fix weird jumping behavior * fix plus button on header * fix description * 📝 Fix Types on common/Button and app/TemplateModal, Upgrade TypeScript Upgraded TypeScript to the latest version across all packages. Fixed typechecck errors caused by missing/incorrect types. * 📝 Fix Types on NewSandboxModal/MyTemplates * fix header * Dashboard sandbox improvements * Add context menu item * Fix context menu hover width * design changes0 * Fix template xolor * Fix type errors * fix the title of the sandbox * Fix the height of templates * Fix * Fix caching logic * Fix a type * Fix another type issue * Show templates for deleted sandboxes * Filter templates in client * Fix template count * Show team templates in modal * some fixes * Fix all templates * Support template forking inside new sandbox modal * 🔨 Refactor Sandbox Info, Add Template Config WIP commit updating the Sandbox Info workspace to add template configuration controls according to Bas's design in Figma. Still requires testing and fine tuning. * Allow exporting templates * 🔧 Fix Sandbox Info, Add missing Peer Dependencies for react-use Updated some react-use and react-spring to their latest in-range versions. Added rebound and keyboardjs as recommended by this issue: streamich/react-use#187 Sandbox Info should all work now! * 👕 Fix Linting Errors in Modals + Editor * Fixes * make notlogged in modal * pr comments * tweaks| * add docs * add tooltip to tenmplate in the header * Tweaks * Last fixes * Fix lint * Client * More fixes * Tweaks * Patron fixes * Style tweaks * move template color to common * add margin-top back on gh page * 📚 (WIP) Add Documentation for Templates, Environment, Add Blog Post Documentation for Templates still needs gifs. The blog post also needs the existing images replaced with gifs, and the Roadmap section needs to be completed as well, perhaps with additional closing thoughts. Environment documentation is merely a draft and needs to be finished before it can be published. * Remove mention of template from sidebar * Fix types * Improve types * Move template filter to be environment filter * Tweak styling of sandboxes in new sandbox modal * Don't show templates in search results * Make replaceHistory the default for name changes * 📚 Update Roadmap section of Templates Blog Post * Remove onMouseDown listener * add gifs * Update packages/homepage/content/articles/templates.md Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/homepage/content/articles/templates.md Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/homepage/content/articles/templates.md Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/homepage/content/articles/templates.md Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/homepage/content/articles/templates.md Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/homepage/content/docs/6-templates.md Co-Authored-By: Ives van Hoorne <[email protected]> * Apply suggestions from code review Co-Authored-By: Ives van Hoorne <[email protected]> * Update packages/homepage/content/docs/7-environment.md Co-Authored-By: Ives van Hoorne <[email protected]> * Apply suggestions from code review Co-Authored-By: Ives van Hoorne <[email protected]> * Apply suggestions from code review Co-Authored-By: Ives van Hoorne <[email protected]> * Add a bit of tracking * 🎨 Crop Template Documentation Gifs Removed browser address bar from all Templates gifs * Fix modal showing in dashboard * Style hovers * 📚 Change wording on Client Environment configuration * Sidebar fixes * fix gifs in docs * Update packages/homepage/content/docs/7-environment.md Co-Authored-By: Ives van Hoorne <[email protected]> * chnage to io * 📚 Add Container Environment Explanation, Remove Bundlers We'll add explanations for Bundlers at a later date. * fix cards * add environment link * Apply suggestions from code review Co-Authored-By: Ives van Hoorne <[email protected]> * change cover image * fix color picker * remove alpha * delete template modal * 📚 Replace images in Templates Blog Post, Add More Details to Environment * Remove template modal * fix ts * fix gatsby
1 parent 90d2b2b commit 8679674

File tree

210 files changed

+4823
-1743
lines changed

Some content is hidden

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

210 files changed

+4823
-1743
lines changed

.circleci/config.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ version: 2.1
66

77
aliases:
88
- &restore_repo_cache
9-
key: v18-repo-{{ .Environment.CIRCLE_SHA1 }}
9+
key: v21-repo-{{ .Environment.CIRCLE_SHA1 }}
1010

1111
- &save_repo_cache
12-
key: v18-repo-{{ .Environment.CIRCLE_SHA1 }}
12+
key: v21-repo-{{ .Environment.CIRCLE_SHA1 }}
1313
paths:
1414
- ~/codesandbox-client
1515

1616
- &restore_deps_cache
1717
keys:
18-
- v18-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
19-
- v18-dependency-cache-{{ .Branch }}
20-
- v18-dependency-cache
18+
- v21-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
19+
- v21-dependency-cache-{{ .Branch }}
20+
- v21-dependency-cache
2121

2222
- &save_deps_cache
23-
key: v18-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
23+
key: v21-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2424
paths:
2525
- node_modules
2626
- packages/app/node_modules
@@ -39,29 +39,29 @@ aliases:
3939

4040
- &restore_standalone_deps_cache
4141
keys:
42-
- v18-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
43-
- v18-standalone-dependency-cache-{{ .Branch }}
44-
- v18-standalone-dependency-cache
42+
- v21-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
43+
- v21-standalone-dependency-cache-{{ .Branch }}
44+
- v21-standalone-dependency-cache
4545

4646
- &save_standalone_deps_cache
47-
key: v18-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
47+
key: v21-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
4848
paths:
4949
- standalone-packages/codesandbox-browserfs/node_modules
5050

5151
- &restore_prod_build_cache
52-
key: v18-prod-app-build-cache-master
52+
key: v21-prod-app-build-cache-master
5353

5454
- &restore_prod_cache
55-
key: v18-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
55+
key: v21-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
5656

5757
- &save_prod_app_cache
58-
key: v18-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
58+
key: v21-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
5959
paths:
6060
- ./packages/app/www
6161
- ./packages/homepage/.cache
6262

6363
- &save_prod_cache
64-
key: v18-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
64+
key: v21-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6565
paths:
6666
- ./www
6767

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@
4545
"react-hooks/rules-of-hooks": "error",
4646
"react-hooks/exhaustive-deps": "warn",
4747
"jsx-a11y/href-no-hash": "off",
48-
"jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["noHref", "invalidHref"] }],
48+
"jsx-a11y/anchor-is-valid": [
49+
"warn",
50+
{ "aspects": ["noHref", "invalidHref"] }
51+
],
4952
"jsx-a11y/label-has-for": "off"
5053
},
5154
"overrides": [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"lerna": "^2.5.1",
7878
"prettier": "1.17.0",
7979
"pretty-quick": "^1.10.0",
80-
"typescript": "3.4.5"
80+
"typescript": "3.5.2"
8181
},
8282
"dependencies": {
8383
"@typescript-eslint/eslint-plugin": "^1.9.0",

packages/app/package.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
"terser": "^3.17.0",
113113
"terser-webpack-plugin": "^1.2.3",
114114
"thread-loader": "^2.1.2",
115-
"typescript": "3.3.4000",
115+
"typescript": "3.5.2",
116116
"url-loader": "1.0.1",
117117
"webpack": "^4.35.0",
118118
"webpack-bundle-analyzer": "^2.13.1",
@@ -125,6 +125,7 @@
125125
"worker-loader": "2.0.0"
126126
},
127127
"dependencies": {
128+
"@apollo/react-hooks": "^0.1.0-beta.2",
128129
"@babel/plugin-transform-destructuring": "^7.1.2",
129130
"@babel/preset-env": "^7.4.2",
130131
"@cerebral/http": "^4.0.0",
@@ -134,9 +135,9 @@
134135
"@svgr/core": "^2.4.1",
135136
"@vue/babel-preset-app": "^3.2.0",
136137
"airtable": "^0.5.8",
137-
"apollo-boost": "^0.3.1",
138-
"apollo-link-batch-http": "^1.2.2",
139-
"apollo-link-context": "^1.0.8",
138+
"apollo-boost": "^0.4.3",
139+
"apollo-link-batch-http": "^1.2.12",
140+
"apollo-link-context": "^1.0.18",
140141
"axios": "^0.19.0",
141142
"babel-code-frame": "^6.26.0",
142143
"babel-helper-vue-jsx-merge-props": "^2.0.2",
@@ -198,6 +199,7 @@
198199
"jest-each": "^24.8.0",
199200
"jest-snapshot": "^22.1.2",
200201
"jszip": "^3.1.3",
202+
"keyboardjs": "^2.5.1",
201203
"localforage": "^1.5.5",
202204
"lodash-es": "^4.17.2",
203205
"lru-cache": "^4.1.3",
@@ -230,7 +232,8 @@
230232
"rc-slider": "^8.2.0",
231233
"react": "^16.8.6",
232234
"react-addons-css-transition-group": "^15.6.0",
233-
"react-apollo": "^2.5.4",
235+
"react-apollo": "^2.5.6",
236+
"react-color": "^2.17.3",
234237
"react-day-picker": "^7.2.4",
235238
"react-dnd": "^7.0.2",
236239
"react-dnd-html5-backend": "^2.4.1",
@@ -244,13 +247,16 @@
244247
"react-media": "^1.9.2",
245248
"react-modal": "^3.6.1",
246249
"react-motion": "^0.5.0",
250+
"react-outside-click-handler": "^1.2.3",
247251
"react-router-dom": "^4.3.1",
248252
"react-show": "^3.0.4",
249253
"react-split-pane": "^0.1.85",
250-
"react-spring": "^8.0.19",
254+
"react-spring": "^8.0.25",
251255
"react-stripe-elements": "^1.2.0",
252256
"react-tagsinput": "^3.19.0",
257+
"react-use": "^9.7.2",
253258
"react-virtualized": "^9.19.1",
259+
"rebound": "^0.1.0",
254260
"resize-observer-polyfill": "^1.5.1",
255261
"sha1": "^1.1.1",
256262
"shelljs": "^0.7.8",

packages/app/src/app/components/ContextMenu/elements.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const Item = styled.button`
3535
border-left: 2px solid transparent;
3636
cursor: pointer;
3737
38+
width: 100%;
3839
min-width: 10rem;
3940
4041
svg {

packages/app/src/app/components/DelayedAnimation/index.js renamed to packages/app/src/app/components/DelayedAnimation/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components';
22
import delayEffect from '@codesandbox/common/lib/utils/animation/delay-effect';
33

4-
export default styled.div`
4+
export default styled.div<{ delay?: number }>`
55
${props => delayEffect(props.delay || 0)};
66
`;
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
1-
import styled from 'styled-components';
1+
import styled, { css } from 'styled-components';
22

33
export const CLOSE_TIMEOUT_MS = 300;
44

55
export const BaseModal = styled.div`
6-
background-color: ${props => props.theme.background3};
6+
${({ theme }) => css`
7+
border-radius: 8px;
8+
background-color: ${theme.background3};
9+
`}
710
`;
811

912
export const ModalTitle = styled.h1`
10-
background-color: ${props => props.theme.secondary};
11-
color: white;
12-
padding: 1rem;
13-
margin: 0;
14-
font-size: 1.25rem;
15-
text-align: center;
16-
background-image: linear-gradient(-225deg, #31b0ff 0%, #47a8e5 100%);
13+
${({ theme }) => css`
14+
padding: 1rem;
15+
margin: 0;
16+
background-color: ${theme.secondary};
17+
background-image: linear-gradient(-225deg, #31b0ff 0%, #47a8e5 100%);
18+
color: white;
19+
font-size: 1.25rem;
20+
text-align: center;
21+
`}
1722
`;
1823

1924
export const ModalBody = styled.div`
20-
background-color: ${props => props.theme.background2};
21-
color: rgba(255, 255, 255, 0.8);
25+
${({ theme }) => css`
26+
border-radius: 8px;
27+
background-color: ${theme.background2};
28+
color: rgba(255, 255, 255, 0.8);
29+
`}
2230
`;

packages/app/src/app/components/Modal/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ModalComponent extends React.Component {
7373
right: 0,
7474
margin: `0 auto ${top}vh`,
7575
border: 'none',
76-
borderRadius: '4px',
76+
borderRadius: '8px',
7777
},
7878
});
7979

packages/app/src/app/components/PrivacyStatus/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Tooltip from '@codesandbox/common/lib/components/Tooltip';
33

44
import { StyledUnlisted, StyledPrivate, Icon } from './elements';
55

6-
function PrivacyStatus({ privacy, asIcon }) {
6+
function PrivacyStatus({ privacy, asIcon = null }) {
77
const PRIVACY_MESSAGES = {
88
0: {
99
title: 'Public',

packages/app/src/app/components/Title/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import delayEffect from '@codesandbox/common/lib/utils/animation/delay-effect';
44
export default styled.h1`
55
${props => props.delay != null && delayEffect(props.delay || 0)};
66
color: white;
7-
font-size: 2.5rem;
7+
font-size: 2rem;
88
font-weight: 300;
99
background-color: transparent;
1010
margin-top: 0;

0 commit comments

Comments
 (0)