Skip to content

Commit 2e8638b

Browse files
Tushar SonawaneCompuIves
authored andcommitted
add preference button to header (codesandbox#116)
* add preference button to header * update contributors list
1 parent 2b87714 commit 2e8638b

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@
7171
"contributions": [
7272
"code"
7373
]
74+
},
75+
{
76+
"login": "Tushkiz",
77+
"name": "Tushar Sonawane",
78+
"avatar_url": "https://avatars1.githubusercontent.com/u/1854763?v=4",
79+
"profile": "https://twitter.com/tushkiz",
80+
"contributions": [
81+
"code"
82+
]
7483
}
7584
]
7685
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ www
1616
npm-debug.log
1717
yarn-error.log
1818
.vscode
19+
.idea
1920
jest

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [CodeSandbox](https://codesandbox.io) [![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/KE3TbEZ) [![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors) [![Build Status](https://travis-ci.org/CompuIves/codesandbox-client.svg?branch=master)](https://travis-ci.org/CompuIves/codesandbox-client)
1+
# [CodeSandbox](https://codesandbox.io) [![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/KE3TbEZ) [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors) [![Build Status](https://travis-ci.org/CompuIves/codesandbox-client.svg?branch=master)](https://travis-ci.org/CompuIves/codesandbox-client)
22

33
An online code editor with a focus on React.
44

@@ -44,8 +44,8 @@ CodeSandbox consists several separate servers, some of these are open sourced.
4444
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
4545

4646
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
47-
| [<img src="https://avatars0.githubusercontent.com/u/587016?v=3" width="100px;"/><br /><sub>Ives van Hoorne</sub>](http://ivesvh.com)<br />[💬](#question-CompuIves "Answering Questions") [📝](#blog-CompuIves "Blogposts") [🐛](https://github.com/CompuIves/CodeSandbox/issues?q=author%3ACompuIves "Bug reports") [💻](https://github.com/CompuIves/CodeSandbox/commits?author=CompuIves "Code") [🎨](#design-CompuIves "Design") [📖](https://github.com/CompuIves/CodeSandbox/commits?author=CompuIves "Documentation") [💡](#example-CompuIves "Examples") [🚇](#infra-CompuIves "Infrastructure (Hosting, Build-Tools, etc)") [👀](#review-CompuIves "Reviewed Pull Requests") [⚠️](https://github.com/CompuIves/CodeSandbox/commits?author=CompuIves "Tests") [🔧](#tool-CompuIves "Tools") | [<img src="https://avatars0.githubusercontent.com/u/887639?v=3" width="100px;"/><br /><sub>Donavon West</sub>](http://donavon.com)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=donavon "Code") | [<img src="https://avatars0.githubusercontent.com/u/5266810?v=3" width="100px;"/><br /><sub>Jeff Allen</sub>](http://www.jeffallen.io/)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=vueu "Code") | [<img src="https://avatars0.githubusercontent.com/u/1089897?v=3" width="100px;"/><br /><sub>Ben Gummer</sub>](https://github.com/bengummer)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=bengummer "Code") | [<img src="https://avatars3.githubusercontent.com/u/154732?v=3" width="100px;"/><br /><sub>James Gillmore</sub>](http://twitter.com/faceyspacey)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=faceyspacey "Code") [🐛](https://github.com/CompuIves/CodeSandbox/issues?q=author%3Afaceyspacey "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/9636410?v=4" width="100px;"/><br /><sub>Ade Viankakrisna Fadlil</sub>](https://musify.id)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=viankakrisna "Code") |
48-
| :---: | :---: | :---: | :---: | :---: | :---: |
47+
| [<img src="https://avatars0.githubusercontent.com/u/587016?v=3" width="100px;"/><br /><sub>Ives van Hoorne</sub>](http://ivesvh.com)<br />[💬](#question-CompuIves "Answering Questions") [📝](#blog-CompuIves "Blogposts") [🐛](https://github.com/CompuIves/CodeSandbox/issues?q=author%3ACompuIves "Bug reports") [💻](https://github.com/CompuIves/CodeSandbox/commits?author=CompuIves "Code") [🎨](#design-CompuIves "Design") [📖](https://github.com/CompuIves/CodeSandbox/commits?author=CompuIves "Documentation") [💡](#example-CompuIves "Examples") [🚇](#infra-CompuIves "Infrastructure (Hosting, Build-Tools, etc)") [👀](#review-CompuIves "Reviewed Pull Requests") [⚠️](https://github.com/CompuIves/CodeSandbox/commits?author=CompuIves "Tests") [🔧](#tool-CompuIves "Tools") | [<img src="https://avatars0.githubusercontent.com/u/887639?v=3" width="100px;"/><br /><sub>Donavon West</sub>](http://donavon.com)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=donavon "Code") | [<img src="https://avatars0.githubusercontent.com/u/5266810?v=3" width="100px;"/><br /><sub>Jeff Allen</sub>](http://www.jeffallen.io/)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=vueu "Code") | [<img src="https://avatars0.githubusercontent.com/u/1089897?v=3" width="100px;"/><br /><sub>Ben Gummer</sub>](https://github.com/bengummer)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=bengummer "Code") | [<img src="https://avatars3.githubusercontent.com/u/154732?v=3" width="100px;"/><br /><sub>James Gillmore</sub>](http://twitter.com/faceyspacey)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=faceyspacey "Code") [🐛](https://github.com/CompuIves/CodeSandbox/issues?q=author%3Afaceyspacey "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/9636410?v=4" width="100px;"/><br /><sub>Ade Viankakrisna Fadlil</sub>](https://musify.id)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=viankakrisna "Code") | [<img src="https://avatars1.githubusercontent.com/u/1854763?v=4" width="100px;"/><br /><sub>Tushar Sonawane</sub>](https://twitter.com/tushkiz)<br />[💻](https://github.com/CompuIves/CodeSandbox/commits?author=Tushkiz "Code") |
48+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
4949
<!-- ALL-CONTRIBUTORS-LIST:END -->
5050

5151
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

src/app/pages/Sandbox/Editor/Content/Header/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ import HeartIcon from 'react-icons/lib/fa/heart-o';
1313
import FullHeartIcon from 'react-icons/lib/fa/heart';
1414
import TwitterIcon from 'react-icons/lib/fa/twitter';
1515
import SearchIcon from 'react-icons/lib/go/search';
16+
import SettingsIcon from 'react-icons/lib/md/settings';
1617
import { Tooltip } from 'react-tippy';
1718

1819
import type { Sandbox, CurrentUser } from 'common/types';
1920
import sandboxActionCreators from 'app/store/entities/sandboxes/actions';
2021
import userActionCreators from 'app/store/user/actions';
22+
import modalActionCreators from 'app/store/modal/actions';
2123
import {
2224
searchUrl,
2325
newSandboxUrl,
@@ -31,6 +33,7 @@ import PatronBadge from '-!svg-react-loader!app/utils/badges/svg/patron-4.svg';
3133
import Margin from 'app/components/spacing/Margin';
3234
import HeaderSearchBar from 'app/components/HeaderSearchBar';
3335
import UserMenu from 'app/containers/UserMenu';
36+
import Preferences from 'app/containers/Preferences';
3437

3538
import Action from './Action';
3639
import FeedbackView from './FeedbackView';
@@ -94,6 +97,7 @@ type Props = {
9497
sandbox: Sandbox,
9598
sandboxActions: typeof sandboxActionCreators,
9699
userActions: typeof userActionCreators,
100+
modalActions: typeof modalActionCreators,
97101
user: CurrentUser,
98102
canSave: boolean,
99103
};
@@ -147,6 +151,13 @@ export default class Header extends React.PureComponent {
147151
}
148152
};
149153

154+
openPreferences = () => {
155+
this.props.modalActions.openModal({
156+
width: 900,
157+
Body: <Preferences />,
158+
});
159+
};
160+
150161
render() {
151162
const {
152163
sandbox,
@@ -249,6 +260,12 @@ export default class Header extends React.PureComponent {
249260
tooltip="New Sandbox"
250261
Icon={PlusIcon}
251262
/>
263+
{user.jwt &&
264+
<Action
265+
onClick={this.openPreferences}
266+
tooltip="Preferences"
267+
Icon={SettingsIcon}
268+
/>}
252269
<Margin
253270
style={{
254271
zIndex: 20,

src/app/pages/Sandbox/Editor/Content/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
import { currentUserSelector } from 'app/store/user/selectors';
1818
import moduleActionCreators from 'app/store/entities/sandboxes/modules/actions';
1919
import sandboxActionCreators from 'app/store/entities/sandboxes/actions';
20+
import modalActionCreators from 'app/store/modal/actions';
2021
import previewApiActionCreators from 'app/store/preview-actions-api/actions';
2122
import userActionCreators from 'app/store/user/actions';
2223
import {
@@ -49,6 +50,7 @@ type Props = {
4950
moduleActions: typeof moduleActionCreators,
5051
sandboxActions: typeof sandboxActionCreators,
5152
userActions: typeof userActionCreators,
53+
modalActions: typeof modalActionCreators,
5254
previewApiActions: typeof previewApiActionCreators,
5355
};
5456

@@ -79,6 +81,7 @@ const mapDispatchToProps = dispatch => ({
7981
moduleActions: bindActionCreators(moduleActionCreators, dispatch),
8082
sandboxActions: bindActionCreators(sandboxActionCreators, dispatch),
8183
userActions: bindActionCreators(userActionCreators, dispatch),
84+
modalActions: bindActionCreators(modalActionCreators, dispatch),
8285
previewApiActions: bindActionCreators(previewApiActionCreators, dispatch),
8386
});
8487
class EditorPreview extends React.PureComponent {
@@ -131,6 +134,7 @@ class EditorPreview extends React.PureComponent {
131134
directories,
132135
preferences,
133136
userActions,
137+
modalActions,
134138
user,
135139
workspaceHidden,
136140
toggleWorkspace,
@@ -209,6 +213,7 @@ class EditorPreview extends React.PureComponent {
209213
sandbox={sandbox}
210214
sandboxActions={sandboxActions}
211215
userActions={userActions}
216+
modalActions={modalActions}
212217
user={user}
213218
workspaceHidden={workspaceHidden}
214219
toggleWorkspace={toggleWorkspace}

0 commit comments

Comments
 (0)