Skip to content

Commit c7da275

Browse files
authored
feat: add CloudBetaBadge (#6949)
* feat: add cloud badge to repository pages * fix: template card name * feat: add badge for sandbox cards * chore: update sandbox url to include v2 check * feat: show badge on branch card
1 parent 558fd34 commit c7da275

File tree

24 files changed

+71
-73
lines changed

24 files changed

+71
-73
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { useEssentialTemplates } from './useEssentialTemplates';
2929
import { FromTemplate } from './FromTemplate';
3030
import { useOfficialTemplates } from './useOfficialTemplates';
3131
import { useTeamTemplates } from './useTeamTemplates';
32-
import { CloudBetaBadge } from './CloudBetaBadge';
32+
import { CloudBetaBadge } from '../../CloudBetaBadge';
3333
import { CreateSandboxParams } from './types';
3434

3535
export const COLUMN_MEDIA_THRESHOLD = 1600;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '@codesandbox/components';
1111

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

1616
export interface FromTemplateProps {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getTemplateIcon } from '@codesandbox/common/lib/utils/getTemplateIcon';
55
import { TemplateFragment } from 'app/graphql/types';
66
import { VisuallyHidden } from 'reakit/VisuallyHidden';
77
import { TemplateButton } from './elements';
8-
import { CloudBetaBadge } from './CloudBetaBadge';
8+
import { CloudBetaBadge } from '../../CloudBetaBadge';
99

1010
interface TemplateCardProps {
1111
template: TemplateFragment;
@@ -21,7 +21,7 @@ export const TemplateCard = ({
2121
template.sandbox?.source?.template
2222
);
2323

24-
const sandboxTitle = template.sandbox?.title;
24+
const sandboxTitle = template.sandbox?.title || template.sandbox?.alias;
2525
const isV2 = template.sandbox?.isV2;
2626
const teamName = template.sandbox?.collection?.team?.name;
2727

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Text, Stack } from '@codesandbox/components';
55
import { TemplateFragment } from 'app/graphql/types';
66
import { TemplateCard } from './TemplateCard';
77
import { TemplateGrid } from './elements';
8-
import { CloudBetaBadge } from './CloudBetaBadge';
8+
import { CloudBetaBadge } from '../../CloudBetaBadge';
99

1010
interface TemplateCategoryListProps {
1111
title: string;

packages/app/src/app/graphql/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,7 @@ export type SandboxFragmentDashboardFragment = {
21342134
| 'viewCount'
21352135
| 'likeCount'
21362136
| 'alwaysOn'
2137+
| 'isV2'
21372138
| 'authorId'
21382139
| 'teamId'
21392140
> & {

packages/app/src/app/overmind/effects/gql/dashboard/fragments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const sandboxFragmentDashboard = gql`
1616
viewCount
1717
likeCount
1818
alwaysOn
19+
isV2
1920
2021
source {
2122
template

packages/app/src/app/overmind/effects/router.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
import { GitInfo } from '@codesandbox/common/lib/types';
22
import { getSandboxOptions } from '@codesandbox/common/lib/url';
3-
import {
4-
sandboxUrl,
5-
sandboxV2Url,
6-
} from '@codesandbox/common/lib/utils/url-generator';
3+
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
74
import history from '../../utils/history';
85

96
export default new (class RouterEffect {
107
replaceSandboxUrl({
118
id,
129
alias,
1310
git,
11+
isV2,
1412
}: {
1513
id?: string | null;
1614
alias?: string | null;
1715
git?: GitInfo | null;
16+
isV2?: boolean;
1817
}) {
19-
window.history.replaceState({}, '', sandboxUrl({ id, alias, git }));
18+
window.history.replaceState({}, '', sandboxUrl({ id, alias, git, isV2 }));
2019
}
2120

2221
updateSandboxUrl(
@@ -33,13 +32,7 @@ export default new (class RouterEffect {
3332
},
3433
{ openInNewWindow = false }: { openInNewWindow?: boolean } = {}
3534
) {
36-
const url = v2
37-
? sandboxV2Url({ id, alias })
38-
: sandboxUrl({
39-
id,
40-
alias,
41-
git,
42-
});
35+
const url = sandboxUrl({ id, alias, isV2: v2 });
4336

4437
if (openInNewWindow) {
4538
window.open(url, '_blank');

packages/app/src/app/pages/Dashboard/Components/Branch/BranchCard.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import {
55
Stack,
66
Text,
77
Tooltip,
8+
Element,
89
} from '@codesandbox/components';
910
import { css } from '@styled-system/css';
11+
import { CloudBetaBadge } from 'app/components/CloudBetaBadge';
1012
import { BranchProps } from './types';
1113

1214
export const BranchCard: React.FC<BranchProps> = ({
@@ -53,11 +55,15 @@ export const BranchCard: React.FC<BranchProps> = ({
5355
css={css({
5456
backgroundColor: 'rgba(229, 229, 229, 0.04)',
5557
paddingY: 10,
58+
position: 'relative',
5659
})}
5760
align="center"
5861
justify="center"
5962
>
6063
<Icon color="#808080" name="branch" size={40} />
64+
<Element css={{ position: 'absolute', top: 6, right: 6 }}>
65+
<CloudBetaBadge />
66+
</Element>
6167
</Stack>
6268
<Stack
6369
css={css({

packages/app/src/app/pages/Dashboard/Components/Breadcrumbs/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const Breadcrumbs: React.FC<BreadcrumbProps> = ({
3333
} else if (albumId) prefix = 'Discover';
3434

3535
return (
36-
<Text marginBottom={1} marginTop={-2} block weight="regular" size={6} paddingRight={4} >
36+
<Text block size={6}>
3737
<Link
3838
to={link}
3939
as={LinkBase}

0 commit comments

Comments
 (0)