Skip to content

Commit bd0c2f0

Browse files
authored
Merge pull request #43 from ivan09069/copilot/fix-c08554e1-7823-4863-af74-44b7960cfb13
Refactor template views to follow DRY principle by extracting duplicate view tab definitions
2 parents 402a7b0 + 699a48d commit bd0c2f0

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)