From b568b1f22f6fca14af0908ac97f896bb89dbcf94 Mon Sep 17 00:00:00 2001 From: James Chartrand Date: Fri, 17 Aug 2018 17:08:55 -0400 Subject: [PATCH] feat(save): allow creating private repositories and specifying a description fix #3 fix #4 --- src/Save.js | 2 +- src/VerifyRepo.js | 64 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/Save.js b/src/Save.js index 4c42481..0d1e57a 100644 --- a/src/Save.js +++ b/src/Save.js @@ -82,7 +82,7 @@ class SaveCmp extends Component { // action on button click in form saveFile() { - this.setState({submitted:true, userPR: false}) + this.setState({submitted:true, usePR: false}) } // action on button click in form diff --git a/src/VerifyRepo.js b/src/VerifyRepo.js index 1f71a96..81950ad 100644 --- a/src/VerifyRepo.js +++ b/src/VerifyRepo.js @@ -1,7 +1,7 @@ import React, {Component} from 'react' import ReactDOM from 'react-dom'; const cwrcGit = require('cwrc-git-server-client'); -import { Modal, Button } from 'react-bootstrap'; +import { Modal, Button, FormGroup, Checkbox, ControlLabel, FormControl, HelpBlock} from 'react-bootstrap'; const ErrorModal = ({cancel, error}) => ( ( + >OK ) -const ConfirmModal = ({cancel, title, body, ok}) => ( +const ConfirmModal = ({cancel, title, body, ok, buttonText}) => ( {title} @@ -33,7 +33,40 @@ const ConfirmModal = ({cancel, title, body, ok}) => ( + >{buttonText} + + +) + +const CreateModal = ({cancel,ok, repoDesc, isPrivate, handlePrivateChange, handleDescriptionChange}) => ( + + Create Repository + +

This repository doesn't yet exist, would you like to create it?

+ + Description + + The description will appear in the Github page for your new repository. + + + Make Private + You must have a paid Github account to create private repositories. + +
+ + +
) @@ -107,6 +140,15 @@ class VerifyRepo extends Component { ) } + // handles changes passed up from children + handleDescriptionChange(e) { + this.setState({repoDesc: e.target.value}); + } + + handlePrivateChange(e) { + this.setState({isPrivate: e.target.checked}) + } + render() { const {repoHasBeenChecked, doesRepoExist, error, checkingRepo} = this.state @@ -125,12 +167,14 @@ class VerifyRepo extends Component { cancel = {this.cancel.bind(this)} /> } else if (repoHasBeenChecked) { - return + return } else { return null; }