Skip to content

Commit 848464a

Browse files
alexnmzehfernandesolarclaratristandubbeldlenasmayor
authored
chore: dashboard release (#6987)
* Update styles (#6962) * ui(create-modal): polish card sizes and overflow (#6959) * ui(create-modal): polish card sizes and overflow * chore: disable checkbox for creating repo from sandbox * feat(responsive-modal): lazy implementation, but it works * chore: remove skeleton loading for mobile * fix: initial orientation based on mobile view * feat(dashboard): import and redirect if user has write access (#6964) * wip * Update useImportAndRedirect.tsx and api.ts * loading state when importing * fix auth * feat: move to recent on workspace change and reset state data (#6966) * feat(dashboard): Implement empty state for repos and contributions (#6965) * Create contributions empty state * Open create sandbox modal on import tab * Hide image when screen is small * Repositories empty state * Responsively stack buttons * Comment start from template button for later * feat(dashboard): fork repositories from github (#6967) * fix: text-overflow for folders in sidebar (#6972) * Fix(dashboard): Use react router links (#6975) * Use react router link for sandboxes * Use react router Link for Repository cards and listitems * feat(dashboard): Implement notifications (#6973) * Implement notifications first draft * Add border radius to Notification * Call items to show once and move dismissal logic to notification * Fix indicator and highlight text * feat(dashboard): Whats new modal (#6971) * Create whats new modal * Show whatsnew modal based on storage * Responsive modal * Remove whats new text * Add grid icon * Update text * fix: sort recents by lastAccessedAt (#6969) * fix: sort recents by lastAccessedAt * fix: remove fields to avoid typecheck errors (not used yet) * Change section names on sidebar (#6961) * Change section names on sidebar * Change breadcrumb section title * Change CTA text on Header (#6976) * QA: Review Branch and Synced Sandboxes Branch cards (#6978) * Review synced sanboxes and branch cards * Correct paddingX of Repository cards * QA: Change 'Recent'page title and notification colors (#6979) * Change recent page title * Change colors of notifications * feat: create branch / import repo cards (#6977) * feat: create branch / import repo cards * fix: replace + with Icon * fix: size and color for cards * fix: filter recent branches by teamId (#6970) * fix: filter recent branches by teamId * fix: build * feat(create-new): Analytics (#6981) * Track Click Create New * Track clicks on tabs * Track import button clicked * Track import and fork * Add template forking tracking * Show empty state instead of import button when no repos (#6982) * fix: one-click sandbox create and proper redirect to v2 editor (#6983) * fix: sort repos by name (#6985) * chore: update quick start selection * chore: change order for quick start * feat(dashboard): Learn more links point to blogpost (#6984) * Add temporary hrefs to learn more links * Add target blank * Accept rel prop on Button component * Style adjusments to New modal (#6988) * Style adjusments to New modal * Fixing type error * chore: remove unimplemented action from dropdown (#6991) Co-authored-by: Zeh Fernandes <[email protected]> Co-authored-by: Maria Clara <[email protected]> Co-authored-by: Tristan <[email protected]> Co-authored-by: Lena Sotto Mayor <[email protected]>
1 parent f0ebe9c commit 848464a

File tree

60 files changed

+1654
-357
lines changed

Some content is hidden

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

60 files changed

+1654
-357
lines changed

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@
228228
"shelljs": "^0.7.8",
229229
"store": "^2.0.12",
230230
"string-replace-loader": "^2.1.1",
231+
"string-similarity": "^4.0.4",
231232
"styled-components": "^5.2.0",
232233
"subworkers": "^1.0.1",
233234
"svg-react-loader": "^0.4.4",

packages/app/src/app/components/CreateNewSandbox/CreateSandbox/CreateSandbox.tsx

Lines changed: 138 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { TabStateReturn, useTabState } from 'reakit/Tab';
1212
import slugify from '@codesandbox/common/lib/utils/slugify';
1313
import { getTemplateIcon } from '@codesandbox/common/lib/utils/getTemplateIcon';
1414
import { TemplateFragment } from 'app/graphql/types';
15+
import track from '@codesandbox/common/lib/utils/analytics';
1516

1617
import {
1718
Container,
@@ -42,13 +43,14 @@ export const COLUMN_MEDIA_THRESHOLD = 1600;
4243
const QUICK_START_IDS = [
4344
'new',
4445
'rjk9n4zj7m', // static v1
45-
'k8dsq1', // blank v2
46+
'vue',
4647
'fxis37', // next v2
4748
'prp60l', // remix v2
48-
'6xxu1m', // nuxt (TODO: move it to v2 and make it official)
49-
'vue',
50-
'svelte',
49+
'k8dsq1', // blank v2
50+
// '6xxu1m', // nuxt v2
51+
'vanilla',
5152
'angular',
53+
'react-ts',
5254
];
5355

5456
interface PanelProps {
@@ -90,6 +92,8 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
9092
const defaultSelectedTab =
9193
initialTab || isUnderRepositoriesSection ? 'import' : 'quickstart';
9294
const isUser = user?.username === activeTeamInfo?.name;
95+
const mediaQuery = window.matchMedia('screen and (max-width: 950px)');
96+
const mobileScreenSize = mediaQuery.matches;
9397

9498
/**
9599
* Checking for user because user is undefined when landing on /s/, even though
@@ -139,7 +143,7 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
139143
teamTemplatesData.state === 'ready' ? teamTemplatesData.teamTemplates : [];
140144

141145
const tabState = useTabState({
142-
orientation: 'vertical',
146+
orientation: mobileScreenSize ? 'horizontal' : 'vertical',
143147
selectedId: defaultSelectedTab,
144148
});
145149

@@ -148,7 +152,7 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
148152
>('initial');
149153
// ❗️ We could combine viewState with selectedTemplate
150154
// and selectedRepo to limit the amount of states.
151-
const [selectedTemplate, setSelectedTemplate] = useState<TemplateFragment>();
155+
const [selectedTemplate] = useState<TemplateFragment>();
152156
const [selectedRepo, setSelectedRepo] = useState<GithubRepoToImport>();
153157
const [searchQuery, setSearchQuery] = useState<string>('');
154158

@@ -177,8 +181,11 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
177181
};
178182

179183
const selectTemplate = (template: TemplateFragment) => {
180-
setSelectedTemplate(template);
181-
setViewState('fromTemplate');
184+
createFromTemplate(template, {});
185+
186+
// Temporarily disable the second screen until we have more functionality on it
187+
// setSelectedTemplate(template);
188+
// setViewState('fromTemplate');
182189
};
183190

184191
const selectGithubRepo = (repo: GithubRepoToImport) => {
@@ -189,7 +196,14 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
189196
return (
190197
<ThemeProvider>
191198
<Container>
192-
<Stack gap={4} align="center" css={{ width: '100%', padding: '24px' }}>
199+
<Stack
200+
gap={4}
201+
align="center"
202+
css={{
203+
width: '100%',
204+
padding: mobileScreenSize ? '16px' : '24px',
205+
}}
206+
>
193207
<HeaderInformation>
194208
{viewState === 'initial' ? (
195209
<Text size={4} variant="muted">
@@ -246,30 +260,80 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
246260
{viewState === 'initial' ? (
247261
<Stack direction="vertical">
248262
<Tabs {...tabState} aria-label="Create new">
249-
<Tab {...tabState} stopId="quickstart">
263+
<Tab
264+
{...tabState}
265+
onClick={() => {
266+
track('Create New - Click Quick Start', {
267+
codesandbox: 'V1',
268+
event_source: 'UI',
269+
});
270+
}}
271+
stopId="quickstart"
272+
>
250273
Quick start
251274
</Tab>
252275

253-
<Tab {...tabState} stopId="import">
276+
<Tab
277+
{...tabState}
278+
onClick={() => {
279+
track('Create New - Click Import from Github', {
280+
codesandbox: 'V1',
281+
event_source: 'UI',
282+
});
283+
}}
284+
stopId="import"
285+
>
254286
Import from GitHub
255287
</Tab>
256288

257289
<Element css={{ height: '24px' }} />
258290

259291
{showTeamTemplates ? (
260-
<Tab {...tabState} stopId="team-templates">
292+
<Tab
293+
{...tabState}
294+
onClick={() => {
295+
track(
296+
`Create New - Click ${
297+
isUser ? 'My' : 'Team'
298+
} Templates`,
299+
{
300+
codesandbox: 'V1',
301+
event_source: 'UI',
302+
}
303+
);
304+
}}
305+
stopId="team-templates"
306+
>
261307
{`${isUser ? 'My' : 'Team'} templates`}
262308
</Tab>
263309
) : null}
264310

265-
<Tab {...tabState} stopId="cloud-templates">
311+
<Tab
312+
{...tabState}
313+
onClick={() => {
314+
track('Create New - Click Cloud templates', {
315+
codesandbox: 'V1',
316+
event_source: 'UI',
317+
});
318+
}}
319+
stopId="cloud-templates"
320+
>
266321
<Stack gap={2}>
267322
<span>Cloud templates</span>
268323
<CloudBetaBadge hideIcon />
269324
</Stack>
270325
</Tab>
271326

272-
<Tab {...tabState} stopId="official-templates">
327+
<Tab
328+
{...tabState}
329+
onClick={() => {
330+
track('Create New - Click Official Templates', {
331+
codesandbox: 'V1',
332+
event_source: 'UI',
333+
});
334+
}}
335+
stopId="official-templates"
336+
>
273337
Official templates
274338
</Tab>
275339

@@ -279,13 +343,19 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
279343
key={essential.key}
280344
{...tabState}
281345
stopId={slugify(essential.title)}
346+
onClick={() => {
347+
track(`Create New - Click ${essential.title}`, {
348+
codesandbox: 'V1',
349+
event_source: 'UI',
350+
});
351+
}}
282352
>
283353
{essential.title}
284354
</Tab>
285355
))
286356
: null}
287357

288-
{essentialState.state === 'loading' ? (
358+
{!mobileScreenSize && essentialState.state === 'loading' ? (
289359
<Stack direction="vertical" css={{ marginTop: 6 }} gap={5}>
290360
<SkeletonText css={{ width: 100 }} />
291361
<SkeletonText css={{ width: 90 }} />
@@ -328,7 +398,14 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
328398
<TemplateCategoryList
329399
title="Start from a template"
330400
templates={quickStartTemplates}
331-
onSelectTemplate={selectTemplate}
401+
onSelectTemplate={template => {
402+
track('Create New - Fork Quickstart template', {
403+
codesandbox: 'V1',
404+
event_source: 'UI',
405+
});
406+
407+
selectTemplate(template);
408+
}}
332409
/>
333410
</Panel>
334411

@@ -343,27 +420,49 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
343420
isUser ? 'My' : activeTeamInfo.name
344421
} templates`}
345422
templates={teamTemplates}
346-
onSelectTemplate={selectTemplate}
423+
onSelectTemplate={template => {
424+
track(
425+
`Create New - Fork ${
426+
isUser ? 'my' : 'team'
427+
} template`,
428+
{ codesandbox: 'V1', event_source: 'UI' }
429+
);
430+
431+
selectTemplate(template);
432+
}}
347433
/>
348434
</Panel>
349435
) : null}
350436

351437
<Panel tab={tabState} id="cloud-templates">
352438
<TemplateCategoryList
353439
title="Cloud templates"
354-
showBetaTag
355440
templates={officialTemplates.filter(
356441
template => template.sandbox.isV2
357442
)}
358-
onSelectTemplate={selectTemplate}
443+
onSelectTemplate={template => {
444+
track('Create New - Fork Cloud template', {
445+
codesandbox: 'V1',
446+
event_source: 'UI',
447+
});
448+
449+
selectTemplate(template);
450+
}}
359451
/>
360452
</Panel>
361453

362454
<Panel tab={tabState} id="official-templates">
363455
<TemplateCategoryList
364456
title="Official templates"
365457
templates={officialTemplates}
366-
onSelectTemplate={selectTemplate}
458+
onSelectTemplate={template => {
459+
track('Create New - Fork Official template', {
460+
codesandbox: 'V1',
461+
event_source: 'UI',
462+
});
463+
464+
selectTemplate(template);
465+
}}
367466
/>
368467
</Panel>
369468

@@ -377,7 +476,14 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
377476
<TemplateCategoryList
378477
title={essential.title}
379478
templates={essential.templates}
380-
onSelectTemplate={selectTemplate}
479+
onSelectTemplate={template => {
480+
track('Create New - Fork Essential template', {
481+
codesandbox: 'V1',
482+
event_source: 'UI',
483+
});
484+
485+
selectTemplate(template);
486+
}}
381487
/>
382488
</Panel>
383489
))
@@ -398,7 +504,12 @@ export const CreateSandbox: React.FC<CreateSandboxProps> = ({
398504
) : null}
399505

400506
{viewState === 'fork' ? (
401-
<FromRepo githubRepo={selectedRepo} />
507+
<FromRepo
508+
repository={selectedRepo}
509+
onCancel={() => {
510+
setViewState('initial');
511+
}}
512+
/>
402513
) : null}
403514
</ModalContent>
404515
</ModalBody>
@@ -421,12 +532,14 @@ const TemplateInfo = ({ template }: TemplateInfoProps) => {
421532
<Stack direction="vertical" gap={6}>
422533
<UserIcon />
423534
<Stack direction="vertical">
424-
<Text size={3}>{template.sandbox.title}</Text>
425-
<Text size={2} css={{ color: '#808080' }}>
535+
<Text size={3} weight="500">
536+
{template.sandbox.title}
537+
</Text>
538+
<Text size={2} css={{ color: '#999', marginTop: '4px' }}>
426539
{template.sandbox.collection?.team?.name}
427540
</Text>
428541
</Stack>
429-
<Text size={2} css={{ color: '#808080' }}>
542+
<Text size={2} css={{ color: '#999', lineHeight: '1.4' }}>
430543
{template.sandbox.description}
431544
</Text>
432545
</Stack>

packages/app/src/app/components/CreateNewSandbox/CreateSandbox/FromTemplate.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Text,
1010
} from '@codesandbox/components';
1111

12-
import { StyledInput, StyledLabel, StyledSelect } from './elements';
12+
import { StyledInput, StyledSelect } from './elements';
1313
import { CloudBetaBadge } from '../../CloudBetaBadge';
1414
import { CreateSandboxParams } from './types';
1515

@@ -29,7 +29,10 @@ export const FromTemplate: React.FC<FromTemplateProps> = ({
2929
// TODO: Set generated name as default value if we can / need
3030
// otherwise tell the user if empty we generate a name
3131
const [sandboxName, setSandboxName] = useState<string>();
32-
const [createRepo, setCreateRepo] = useState<boolean>(false);
32+
33+
const createRepo = false;
34+
// TODO: Enable when checkbox is active again
35+
// const [createRepo, setCreateRepo] = useState<boolean>(false);
3336
const [selectedTeam, setSelectedTeam] = useState<string>(activeTeam);
3437

3538
return (
@@ -88,30 +91,28 @@ export const FromTemplate: React.FC<FromTemplateProps> = ({
8891
id="name-desc"
8992
css={{ color: '#999999', fontSize: '12px' }}
9093
>
91-
Leaving the field empty will generate a random name.
94+
Leaving this field empty will generate a random name.
9295
</Element>
9396
</Stack>
9497

9598
<Checkbox
9699
id="sb-repo"
97-
onChange={e => {
98-
setCreateRepo(e.target.checked);
99-
}}
100+
disabled
100101
checked={createRepo}
101102
label={
102-
<StyledLabel
103+
<Text
103104
css={{
104105
fontSize: 13,
105106
display: 'block',
106107
marginTop: 2,
107108
marginLeft: 4,
109+
color: '#999999',
110+
lineHeight: '16px',
108111
}}
109-
htmlFor="sb-repo"
110112
>
111-
Create git repository
112-
</StyledLabel>
113+
Create git repository (coming soon)
114+
</Text>
113115
}
114-
disabled={!hasLogIn || !user || !dashboard.teams}
115116
/>
116117

117118
{createRepo ? (
@@ -140,7 +141,11 @@ export const FromTemplate: React.FC<FromTemplateProps> = ({
140141
>
141142
Cancel
142143
</Button>
143-
<Button type="submit" variant="primary" css={{ width: 'auto' }}>
144+
<Button
145+
type="submit"
146+
variant="primary"
147+
css={{ width: 'auto', paddingRight: 24, paddingLeft: 24 }}
148+
>
144149
Create Sandbox
145150
</Button>
146151
</Stack>

0 commit comments

Comments
 (0)