Skip to content

Commit 424490e

Browse files
radi-choCompuIves
authored andcommitted
Add framework icon in user's list of sandboxes (codesandbox#453)
* Add icons on SANDBOXES page. * Improve how the Icon component is called in SandboxList. * The wrong module path and lint errors fixed. * Move the framework icons in new column. * Make the icons a bit smaller.
1 parent fe681a8 commit 424490e

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

.all-contributorsrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,17 @@
254254
"contributions": [
255255
"code"
256256
]
257+
},
258+
{
259+
"login": "radi-cho",
260+
"name": "Radi Cho",
261+
"avatar_url": "https://avatars3.githubusercontent.com/u/12954909?v=4",
262+
"profile": "https://github.com/RSG-Group",
263+
"contributions": [
264+
"bug",
265+
"code",
266+
"ideas"
267+
]
257268
}
258269
]
259270
}

README.md

Lines changed: 2 additions & 2 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-25-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) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/)
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-26-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) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![first-timers-only Friendly](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/)
22

33
An online code editor tailored for web applications.
44

@@ -40,5 +40,5 @@ Thanks goes to these wonderful people
4040
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
4141
| [<img src="https://avatars3.githubusercontent.com/u/1239401?v=4" width="100px;"/><br /><sub><b>Johann Hubert Sonntagbauer</b></sub>](https://github.com/johann-sonntagbauer)<br />[🐛](https://github.com/CompuIves/codesandbox-client/issues?q=author%3Ajohann-sonntagbauer "Bug reports") [💻](https://github.com/CompuIves/codesandbox-client/commits?author=johann-sonntagbauer "Code") | [<img src="https://avatars2.githubusercontent.com/u/9586897?v=4" width="100px;"/><br /><sub><b>Joachim Seminck</b></sub>](https://github.com/jseminck)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=jseminck "Code") | [<img src="https://avatars3.githubusercontent.com/u/5210019?v=4" width="100px;"/><br /><sub><b>Subramanya Chakravarthy</b></sub>](http://chakrihacker.github.io)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=chakrihacker "Code") | [<img src="https://avatars3.githubusercontent.com/u/23088?v=4" width="100px;"/><br /><sub><b>Robert (Robby) O'Connor</b></sub>](http://robby.oconnor.ninja)<br />[🚇](#infra-robbyoconnor "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars0.githubusercontent.com/u/2083930?v=4" width="100px;"/><br /><sub><b>Bogdan Luca</b></sub>](https://github.com/lbogdan)<br />[🐛](https://github.com/CompuIves/codesandbox-client/issues?q=author%3Albogdan "Bug reports") [💻](https://github.com/CompuIves/codesandbox-client/commits?author=lbogdan "Code") | [<img src="https://avatars3.githubusercontent.com/u/6177621?v=4" width="100px;"/><br /><sub><b>Divjot Singh</b></sub>](http://bogas04.github.io)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=bogas04 "Code") | [<img src="https://avatars3.githubusercontent.com/u/5249539?v=4" width="100px;"/><br /><sub><b>Jason Nall</b></sub>](http://www.jsonnull.com)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=jsonnull "Code") |
4242
| [<img src="https://avatars3.githubusercontent.com/u/784056?v=4" width="100px;"/><br /><sub><b>Lionel</b></sub>](https://elrumordelaluz.com)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=elrumordelaluz "Code") [🎨](#design-elrumordelaluz "Design") | [<img src="https://avatars3.githubusercontent.com/u/170500?v=4" width="100px;"/><br /><sub><b>Philipp Brumm</b></sub>](https://github.com/brumm)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=brumm "Code") | [<img src="https://avatars2.githubusercontent.com/u/2678610?v=4" width="100px;"/><br /><sub><b>Valentin Hervieu</b></sub>](http://valentin-hervieu.fr)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=ValentinH "Code") [🐛](https://github.com/CompuIves/codesandbox-client/issues?q=author%3AValentinH "Bug reports") | [<img src="https://avatars0.githubusercontent.com/u/1499218?v=4" width="100px;"/><br /><sub><b>Anenth</b></sub>](http://anenth.js.org)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=Anenth "Code") [🎨](#design-Anenth "Design") [🤔](#ideas-Anenth "Ideas, Planning, & Feedback") | [<img src="https://avatars0.githubusercontent.com/u/410792?v=4" width="100px;"/><br /><sub><b>Dony Sukardi</b></sub>](http://dsds.io)<br />[🐛](https://github.com/CompuIves/codesandbox-client/issues?q=author%3Adonysukardi "Bug reports") [💻](https://github.com/CompuIves/codesandbox-client/commits?author=donysukardi "Code") | [<img src="https://avatars3.githubusercontent.com/u/89046?v=4" width="100px;"/><br /><sub><b>Geoffrey Dhuyvetters</b></sub>](https://github.com/duivvv)<br />[🎨](#design-duivvv "Design") [💻](https://github.com/CompuIves/codesandbox-client/commits?author=duivvv "Code") | [<img src="https://avatars3.githubusercontent.com/u/3381746?v=4" width="100px;"/><br /><sub><b>Eswar Yaganti</b></sub>](http://nyaganti.com)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=nagamalli9999 "Code") [🚇](#infra-nagamalli9999 "Infrastructure (Hosting, Build-Tools, etc)") |
43-
| [<img src="https://avatars3.githubusercontent.com/u/9488719?v=4" width="100px;"/><br /><sub><b>Frank Tan</b></sub>](https://github.com/tansongyang)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=tansongyang "Code") | [<img src="https://avatars0.githubusercontent.com/u/1650995?v=4" width="100px;"/><br /><sub><b>Bilal Budhani</b></sub>](https://bilalbudhani.com)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=BilalBudhani "Code") | [<img src="https://avatars3.githubusercontent.com/u/843342?v=4" width="100px;"/><br /><sub><b>El Juli</b></sub>](https://github.com/JulianMayorga)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=JulianMayorga "Code") | [<img src="https://avatars0.githubusercontent.com/u/13774309?v=4" width="100px;"/><br /><sub><b>Arthur Denner</b></sub>](https://github.com/arthurdenner)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=arthurdenner "Code") |
43+
| [<img src="https://avatars3.githubusercontent.com/u/9488719?v=4" width="100px;"/><br /><sub><b>Frank Tan</b></sub>](https://github.com/tansongyang)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=tansongyang "Code") | [<img src="https://avatars0.githubusercontent.com/u/1650995?v=4" width="100px;"/><br /><sub><b>Bilal Budhani</b></sub>](https://bilalbudhani.com)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=BilalBudhani "Code") | [<img src="https://avatars3.githubusercontent.com/u/843342?v=4" width="100px;"/><br /><sub><b>El Juli</b></sub>](https://github.com/JulianMayorga)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=JulianMayorga "Code") | [<img src="https://avatars0.githubusercontent.com/u/13774309?v=4" width="100px;"/><br /><sub><b>Arthur Denner</b></sub>](https://github.com/arthurdenner)<br />[💻](https://github.com/CompuIves/codesandbox-client/commits?author=arthurdenner "Code") | [<img src="https://avatars3.githubusercontent.com/u/12954909?v=4" width="100px;"/><br /><sub><b>Radi Cho</b></sub>](https://github.com/radi-cho)<br />[🐛](https://github.com/CompuIves/codesandbox-client/issues?q=author%3Aradi-cho "Bug reports") [💻](https://github.com/CompuIves/codesandbox-client/commits?author=radi-cho "Code") [🤔](#ideas-radi-cho "Ideas, Planning, & Feedback") |
4444
<!-- ALL-CONTRIBUTORS-LIST:END -->

packages/app/src/app/components/sandbox/SandboxList.js

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Link } from 'react-router-dom';
77
import PrivacyStatus from 'app/components/sandbox/PrivacyStatus';
88
import delayEffect from 'common/utils/animation/delay-effect';
99
import { sandboxUrl } from 'common/utils/url-generator';
10+
import getDefinition from 'common/templates';
1011

1112
import type { SmallSandbox } from 'common/types';
1213

@@ -79,6 +80,7 @@ export default ({ sandboxes, isCurrentUser, onDelete }: Props) => (
7980
<HeaderTitle>Title</HeaderTitle>
8081
<HeaderTitle>Created</HeaderTitle>
8182
<HeaderTitle>Updated</HeaderTitle>
83+
<StatTitle />
8284
<StatTitle>
8385
<FullHeartIcon />
8486
</StatTitle>
@@ -92,24 +94,32 @@ export default ({ sandboxes, isCurrentUser, onDelete }: Props) => (
9294
</tr>
9395
</thead>
9496
<Body>
95-
{sandboxes.map((s, i) => (
96-
<SandboxRow index={i} key={s.id}>
97-
<td>
98-
<Link to={sandboxUrl(s)}>{s.title || s.id}</Link>
99-
<PrivacyStatus privacy={s.privacy} asIcon />
100-
</td>
101-
<td>{moment(s.insertedAt).format('ll')}</td>
102-
<td>{moment(s.updatedAt).format('ll')}</td>
103-
<StatBody>{s.likeCount}</StatBody>
104-
<StatBody>{s.viewCount}</StatBody>
105-
<StatBody>{s.forkCount}</StatBody>
106-
{isCurrentUser && (
107-
<StatBody style={{ padding: '0.55rem 0.5rem', cursor: 'pointer' }}>
108-
<DeleteSandboxButton id={s.id} onDelete={onDelete} />
97+
{sandboxes.map((s, i) => {
98+
const Icon = getDefinition(s.template).Icon || getDefinition().Icon;
99+
return (
100+
<SandboxRow index={i} key={s.id}>
101+
<td>
102+
<Link to={sandboxUrl(s)}>{s.title || s.id}</Link>
103+
<PrivacyStatus privacy={s.privacy} asIcon />
104+
</td>
105+
<td>{moment(s.insertedAt).format('ll')}</td>
106+
<td>{moment(s.updatedAt).format('ll')}</td>
107+
<StatBody>
108+
<Icon width={30} height={30} />
109109
</StatBody>
110-
)}
111-
</SandboxRow>
112-
))}
110+
<StatBody>{s.likeCount}</StatBody>
111+
<StatBody>{s.viewCount}</StatBody>
112+
<StatBody>{s.forkCount}</StatBody>
113+
{isCurrentUser && (
114+
<StatBody
115+
style={{ padding: '0.55rem 0.5rem', cursor: 'pointer' }}
116+
>
117+
<DeleteSandboxButton id={s.id} onDelete={onDelete} />
118+
</StatBody>
119+
)}
120+
</SandboxRow>
121+
);
122+
})}
113123
</Body>
114124
</Table>
115125
);

packages/common/templates/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export default function getDefinition(
119119
| 'create-react-app'
120120
| 'vue-cli'
121121
| 'preact-cli'
122+
| 'svelte'
122123
| 'create-react-app-typescript'
123124
) {
124125
if (!theme) {

0 commit comments

Comments
 (0)