Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/components/LoadingModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import styled from 'styled-components';
import Card from '../ui/Card';

const Modal = styled.div`
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.4);
`;

const ModalCardArea = styled.div`
width: 100%;
max-width: 800px;
margin: 200px auto;
`;

function LoadingModal({
message,
pullRequestURL,
}: {
message: string;
pullRequestURL: string | null;
}) {
return (
<Modal>
<ModalCardArea>
<Card>
<h2>{pullRequestURL == null ? 'Loading...' : 'Congratulations'}</h2>
<p>{message}</p>
{pullRequestURL != null && (
<p>
<a href={pullRequestURL}>Go to newly generated pull request</a>
</p>
)}
</Card>
</ModalCardArea>
</Modal>
);
}

export default LoadingModal;
52 changes: 3 additions & 49 deletions src/screens/SplitScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TypedDocumentNode, gql, useMutation } from '@apollo/client';
import React, { useEffect, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { useParams } from 'react-router-dom';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example comment.

import {
ApplySplitMutation,
ApplySplitMutationVariables,
Expand All @@ -17,6 +17,8 @@ import getGithubAuthURL from '../util/getGithubAuthURL';
import useQueryParams from '../util/useQueryParams';
import nullThrows from 'capital-t-null-throws';
import TopBar from '../components/TopBar';
import Card from '../ui/Card';
import LoadingModal from '../components/LoadingModal';

const Page = styled.div`
background-color: #fafbfc;
Expand All @@ -32,15 +34,6 @@ const DescriptionSections = styled.div`
flex-direction: row;
`;

const Card = styled.div`
background-color: #fff;
border: 1px solid #eee;
border-radius: 8px;
padding: 16px;
margin: 12px 16px;
width: 100%;
`;

const Label = styled.div`
font-size: 14px;
margin-bottom: 4px;
Expand Down Expand Up @@ -104,45 +97,6 @@ function DescriptionSection({
);
}

const Modal = styled.div`
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.4);
`;

const ModalCardArea = styled.div`
width: 100%;
max-width: 800px;
margin: 200px auto;
`;

function LoadingModal({
message,
pullRequestURL,
}: {
message: string;
pullRequestURL: string | null;
}) {
return (
<Modal>
<ModalCardArea>
<Card>
<h2>{pullRequestURL == null ? 'Loading...' : 'Congratulations'}</h2>
<p>{message}</p>
{pullRequestURL != null && (
<p>
<a href={pullRequestURL}>Go to newly generated pull request</a>
</p>
)}
</Card>
</ModalCardArea>
</Modal>
);
}

function generateFilePatches(diffFiles: File[], splitDiffIndexes: number[]) {
// TODO: DRY this out.
return {
Expand Down
12 changes: 12 additions & 0 deletions src/ui/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import styled from 'styled-components';

const Card = styled.div`
background-color: #fff;
border: 1px solid #eee;
border-radius: 8px;
padding: 16px;
margin: 12px 16px;
width: 100%;
`;

export default Card;