From 4728855b40d2d37da8e035c5081fab5819b07fd0 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Thu, 1 Sep 2016 01:44:34 -0400 Subject: [refactor] move js to top-level folder --- .../app/components/wizard/add_provider_modal.js | 94 ---------------------- src/leap/bitmask_js/app/components/wizard/index.js | 38 --------- .../app/components/wizard/provider_select_stage.js | 86 -------------------- .../app/components/wizard/stage_layout.js | 37 --------- .../bitmask_js/app/components/wizard/wizard.less | 36 --------- 5 files changed, 291 deletions(-) delete mode 100644 src/leap/bitmask_js/app/components/wizard/add_provider_modal.js delete mode 100644 src/leap/bitmask_js/app/components/wizard/index.js delete mode 100644 src/leap/bitmask_js/app/components/wizard/provider_select_stage.js delete mode 100644 src/leap/bitmask_js/app/components/wizard/stage_layout.js delete mode 100644 src/leap/bitmask_js/app/components/wizard/wizard.less (limited to 'src/leap/bitmask_js/app/components/wizard') diff --git a/src/leap/bitmask_js/app/components/wizard/add_provider_modal.js b/src/leap/bitmask_js/app/components/wizard/add_provider_modal.js deleted file mode 100644 index bc5e0236..00000000 --- a/src/leap/bitmask_js/app/components/wizard/add_provider_modal.js +++ /dev/null @@ -1,94 +0,0 @@ -// -// A modal popup to add a new provider. -// - -import React from 'react' -import { FormGroup, ControlLabel, FormControl, HelpBlock, Button, Modal } from 'react-bootstrap' -import Spinner from '../spinner' -import Validate from '../../lib/validate' -import App from '../../app' - -class AddProviderModal extends React.Component { - - static get defaultProps() {return{ - title: 'Add a provider', - onClose: null - }} - - constructor(props) { - super(props) - this.state = { - validationState: null, - errorMsg: null, - domain: "" - } - this.accept = this.accept.bind(this) - this.cancel = this.cancel.bind(this) - this.changed = this.changed.bind(this) - } - - accept() { - if (this.state.domain) { - App.providers.add(this.state.domain) - } - this.props.onClose() - } - - cancel() { - this.props.onClose() - } - - changed(e) { - let domain = e.target.value - let newState = null - let newMsg = null - - if (domain.length > 0) { - let error = Validate.domain(domain) - newState = error ? 'error' : 'success' - newMsg = error - } - this.setState({ - domain: domain, - validationState: newState, - errorMsg: newMsg - }) - } - - render() { - let help = null - if (this.state.errorMsg) { - help = {this.state.errorMsg} - } else { - help =   - } - let form =
- - Domain - - - {help} - - -
- - return( - - - {this.props.title} - - - {form} - - - ) - } -} - -export default AddProviderModal \ No newline at end of file diff --git a/src/leap/bitmask_js/app/components/wizard/index.js b/src/leap/bitmask_js/app/components/wizard/index.js deleted file mode 100644 index 613b88fd..00000000 --- a/src/leap/bitmask_js/app/components/wizard/index.js +++ /dev/null @@ -1,38 +0,0 @@ -// -// The provider setup wizard -// - -import React from 'react' -import App from 'app' - -import ProviderSelectStage from './provider_select_stage' -import './wizard.less' - -export default class Wizard extends React.Component { - - constructor(props) { - super(props) - this.state = { - stage: 'provider' - } - } - - setStage(stage) { - this.setState({stage: stage}) - } - - render() { - let stage = null - switch(this.state.stage) { - case 'provider': - stage = - break - } - return( -
- {stage} -
- ) - } - -} diff --git a/src/leap/bitmask_js/app/components/wizard/provider_select_stage.js b/src/leap/bitmask_js/app/components/wizard/provider_select_stage.js deleted file mode 100644 index 20674be1..00000000 --- a/src/leap/bitmask_js/app/components/wizard/provider_select_stage.js +++ /dev/null @@ -1,86 +0,0 @@ -import React from 'react' -import {Button, ButtonGroup, ButtonToolbar, Glyphicon} from 'react-bootstrap' - -import App from 'app' -import ListEdit from 'components/list_edit' -import StageLayout from './stage_layout' -import AddProviderModal from './add_provider_modal' - -export default class ProviderSelectStage extends React.Component { - - static get defaultProps() {return{ - title: "Choose a provider", - subtitle: "This doesn't work yet" - }} - - constructor(props) { - super(props) - let domains = this.currentDomains() - this.state = { - domains: domains, - showModal: false - } - this.add = this.add.bind(this) - this.remove = this.remove.bind(this) - this.close = this.close.bind(this) - this.previous = this.previous.bind(this) - } - - currentDomains() { - // return(App.providers.domains().slice() || []) - return ['domain1', 'domain2', 'domain3'] - } - - add() { - this.setState({showModal: true}) - } - - remove(provider) { - // App.providers.remove(provider) - this.setState({domains: this.currentDomains()}) - } - - close() { - let domains = this.currentDomains() - if (domains.length != this.state.domains.length) { - // this is ugly, but i could not get selection working - // by passing it as a property - this.refs.list.setSelected(0) - } - this.setState({ - domains: domains, - showModal: false - }) - } - - previous() { - App.start() - } - - render() { - let modal = null - if (this.state.showModal) { - modal = - } - let buttons = ( - - - - - ) - let select = - return( - - {select} - {modal} - - ) - } -} diff --git a/src/leap/bitmask_js/app/components/wizard/stage_layout.js b/src/leap/bitmask_js/app/components/wizard/stage_layout.js deleted file mode 100644 index 31540221..00000000 --- a/src/leap/bitmask_js/app/components/wizard/stage_layout.js +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' - -class StageLayout extends React.Component { - - static get defaultProps() {return{ - title: 'untitled', - subtitle: null, - buttons: null - }} - - constructor(props) { - super(props) - } - - render() { - let subtitle = null - if (this.props.subtitle) { - subtitle = {this.props.subtitle} - } - return( -
-
- {this.props.title} - {subtitle} -
-
- {this.props.children} -
-
- {this.props.buttons} -
-
- ) - } -} - -export default StageLayout \ No newline at end of file diff --git a/src/leap/bitmask_js/app/components/wizard/wizard.less b/src/leap/bitmask_js/app/components/wizard/wizard.less deleted file mode 100644 index 3336ffb8..00000000 --- a/src/leap/bitmask_js/app/components/wizard/wizard.less +++ /dev/null @@ -1,36 +0,0 @@ -.wizard .stage { - position: absolute; - height: 100%; - width: 100%; - - display: flex; - flex-direction: column; - flex: 1; -} - -.wizard .stage .footer { - flex: 0 0 auto; - background-color: #ddd; - padding: 20px; - text-align: right; -} - -.wizard .stage .header { - flex: 0 0 auto; - padding: 20px; - background-color: #333; - color: white; - font-size: 2em; - span { - margin-left: 10px; - font-size: 0.5em; - } -} - -.wizard .stage .body { - flex: 1 1 auto; - padding: 20px; - overflow: auto; - display: flex; - flex-direction: column; -} \ No newline at end of file -- cgit v1.2.3