Skip to content

Commit aed84f4

Browse files
MichaelDeBoeyCompuIves
authored andcommitted
🔨 Switch Git to use useOvermind (codesandbox#2555)
1 parent e5b7489 commit aed84f4

File tree

1 file changed

+15
-14
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/items/GitHub/Git

1 file changed

+15
-14
lines changed

‎packages/app/src/app/pages/Sandbox/Editor/Workspace/items/GitHub/Git/Git.tsx‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
import React, { useEffect } from 'react';
21
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
32
import { Button } from '@codesandbox/common/lib/components/Button';
43
import GithubBadge from '@codesandbox/common/lib/components/GithubBadge';
54
import Input, { TextArea } from '@codesandbox/common/lib/components/Input';
65
import Notice from '@codesandbox/common/lib/components/Notice';
76
import { githubRepoUrl } from '@codesandbox/common/lib/utils/url-generator';
7+
import React, { ChangeEvent, FunctionComponent, useEffect } from 'react';
8+
89
import { useOvermind } from 'app/overmind';
9-
import { WorkspaceSubtitle, WorkspaceInputContainer } from '../../../elements';
10+
11+
import { WorkspaceInputContainer, WorkspaceSubtitle } from '../../../elements';
12+
1013
import { Container, Buttons, ErrorMessage, NoChanges } from './elements';
1114
import { TotalChanges } from './TotalChanges';
1215

1316
const hasWriteAccess = (rights: string) => ['admin', 'write'].includes(rights);
1417

15-
export const Git = () => {
18+
export const Git: FunctionComponent = () => {
1619
const {
17-
state: {
18-
editor: {
19-
currentSandbox: { originalGit },
20-
isAllModulesSynced,
21-
},
22-
git: { description, isFetching, originalGitChanges: gitChanges, subject },
23-
},
2420
actions: {
2521
git: {
2622
createCommitClicked,
@@ -30,6 +26,13 @@ export const Git = () => {
3026
subjectChanged,
3127
},
3228
},
29+
state: {
30+
editor: {
31+
currentSandbox: { originalGit },
32+
isAllModulesSynced,
33+
},
34+
git: { description, isFetching, originalGitChanges: gitChanges, subject },
35+
},
3336
} = useOvermind();
3437

3538
useEffect(() => {
@@ -38,14 +41,12 @@ export const Git = () => {
3841

3942
const createCommit = () => createCommitClicked();
4043
const createPR = () => createPrClicked();
41-
4244
const changeSubject = ({
4345
target: { value },
44-
}: React.ChangeEvent<HTMLInputElement>) => subjectChanged({ subject: value });
45-
46+
}: ChangeEvent<HTMLInputElement>) => subjectChanged({ subject: value });
4647
const changeDescription = ({
4748
target: { value },
48-
}: React.ChangeEvent<HTMLTextAreaElement>) =>
49+
}: ChangeEvent<HTMLTextAreaElement>) =>
4950
descriptionChanged({ description: value });
5051

5152
const modulesNotSaved = !isAllModulesSynced;

0 commit comments

Comments
 (0)