Skip to content

Commit 699a48d

Browse files
Copilotivan09069
andcommitted
Extract duplicate view tabs into constants to follow DRY principle
Co-authored-by: ivan09069 <202161141+ivan09069@users.noreply.github.com>
1 parent 38adc6f commit 699a48d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

packages/common/src/templates/template.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ export type ViewConfig = {
5858
views: ViewTab[];
5959
};
6060

61+
const BROWSER_VIEW: ViewTab = { id: 'codesandbox.browser' };
62+
const CONSOLE_VIEW: ViewTab = { id: 'codesandbox.console' };
63+
const PROBLEMS_VIEW: ViewTab = { id: 'codesandbox.problems' };
64+
6165
const CLIENT_VIEWS: ViewConfig[] = [
6266
{
6367
views: [
64-
{ id: 'codesandbox.browser' },
68+
BROWSER_VIEW,
6569
{ id: 'codesandbox.tests' },
6670
{
6771
id: 'codesandbox.terminalUpgrade',
@@ -71,20 +75,20 @@ const CLIENT_VIEWS: ViewConfig[] = [
7175
],
7276
},
7377
{
74-
views: [{ id: 'codesandbox.console' }, { id: 'codesandbox.problems' }],
78+
views: [CONSOLE_VIEW, PROBLEMS_VIEW],
7579
},
7680
];
7781

7882
const SERVER_VIEWS: ViewConfig[] = [
7983
{
80-
views: [{ id: 'codesandbox.browser' }],
84+
views: [BROWSER_VIEW],
8185
},
8286
{
8387
open: true,
8488
views: [
8589
{ id: 'codesandbox.terminal' },
86-
{ id: 'codesandbox.console' },
87-
{ id: 'codesandbox.problems' },
90+
CONSOLE_VIEW,
91+
PROBLEMS_VIEW,
8892
],
8993
},
9094
];

0 commit comments

Comments
 (0)