Skip to content

Commit ec1b3ab

Browse files
committed
🔨 Switch PRModal to use useOvermind
1 parent 0a00a11 commit ec1b3ab

File tree

5 files changed

+40
-35
lines changed

5 files changed

+40
-35
lines changed

‎packages/app/src/app/components/GitProgress/index.ts‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from 'react';
1+
import React, { FunctionComponent, ReactNode } from 'react';
2+
23
import {
34
Container,
45
Cube,
@@ -9,27 +10,26 @@ import {
910
Result,
1011
} from './elements';
1112

12-
interface IGitProgressProps {
13-
result: string | null;
13+
type Props = {
1414
message: string;
15-
}
16-
17-
export const GitProgress: React.FC<IGitProgressProps> = ({
18-
message,
19-
result,
20-
}) => (
15+
result: ReactNode;
16+
};
17+
export const GitProgress: FunctionComponent<Props> = ({ message, result }) => (
2118
<Container>
2219
{result ? (
2320
<Result>{result}</Result>
2421
) : (
2522
<>
2623
<DeployAnimationContainer deploying>
27-
<OpaqueLogo width={70} height={70} />
24+
<OpaqueLogo height={70} width={70} />
25+
2826
{[0, 1, 2, 3].map(i => (
29-
<Cube key={i} delay={i} size={20} />
27+
<Cube delay={i} key={i} size={20} />
3028
))}
29+
3130
<GitHubLogo />
3231
</DeployAnimationContainer>
32+
3333
<DeployText>{message}</DeployText>
3434
</>
3535
)}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import styled from 'styled-components';
2+
3+
export const ButtonContainer = styled.div`
4+
font-size: 0.875rem;
5+
margin-top: 1rem;
6+
`;
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
import React, { FunctionComponent } from 'react';
2-
import { useOvermind } from 'app/overmind';
2+
33
import { GitProgress } from 'app/components/GitProgress';
4+
import { useOvermind } from 'app/overmind';
5+
6+
import { ButtonContainer } from './elements';
47

5-
const PRModal: FunctionComponent = () => {
8+
export const PRModal: FunctionComponent = () => {
69
const {
710
state: {
8-
git: { isCreatingPr, pr },
11+
git: {
12+
isCreatingPr,
13+
pr: { prURL },
14+
},
915
},
1016
} = useOvermind();
1117

12-
let result = null;
13-
14-
if (!isCreatingPr) {
15-
result = (
16-
<div>
17-
Done! We{"'"}ll now open the new sandbox of this PR and GitHub in 3
18-
seconds...
19-
<div style={{ fontSize: '.875rem', marginTop: '1rem' }}>
20-
<a href={pr.prURL} target="_blank" rel="noreferrer noopener">
21-
Click here if nothing happens.
22-
</a>
23-
</div>
24-
</div>
25-
);
26-
}
27-
2818
return (
2919
<GitProgress
30-
result={result}
3120
message="Forking Repository & Creating PR..."
21+
result={
22+
isCreatingPr ? (
23+
<div>
24+
{`Done! We'll now open the new sandbox of this PR and GitHub in 3 seconds...`}
25+
26+
<ButtonContainer>
27+
<a href={prURL} rel="noreferrer noopener" target="_blank">
28+
Click here if nothing happens.
29+
</a>
30+
</ButtonContainer>
31+
</div>
32+
) : null
33+
}
3234
/>
3335
);
3436
};
35-
36-
export default PRModal;

‎packages/app/src/app/pages/common/Modals/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import LiveSessionVersionMismatch from './LiveSessionVersionMismatch';
2626
import { NetlifyLogs } from './NetlifyLogs';
2727
import { PickSandboxModal } from './PickSandboxModal';
2828
import PreferencesModal from './PreferencesModal';
29-
import PRModal from './PRModal';
29+
import { PRModal } from './PRModal';
3030
import { SearchDependenciesModal } from './SearchDependenciesModal';
3131
import { SelectSandboxModal } from './SelectSandboxModal';
3232
import { ShareModal } from './ShareModal';

0 commit comments

Comments
 (0)