|
|
@ -17,16 +17,24 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import React, {Component} from 'react';
|
|
|
|
import React, {Component} from 'react';
|
|
|
|
import {Badge, Button, FormGroup, Input, Label, Row} from 'reactstrap';
|
|
|
|
import {Button, FormGroup, Input, Label, Row} from 'reactstrap';
|
|
|
|
import Dropzone from 'react-dropzone';
|
|
|
|
import Dropzone from 'react-dropzone';
|
|
|
|
import {FormattedMessage} from 'react-intl';
|
|
|
|
import {FormattedMessage} from 'react-intl';
|
|
|
|
|
|
|
|
import Chip from "../../../UIComponents/Chip/Chip";
|
|
|
|
|
|
|
|
|
|
|
|
class GeneralInfo extends Component {
|
|
|
|
class GeneralInfo extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.onTextFieldChange = this.onTextFieldChange.bind(this);
|
|
|
|
|
|
|
|
this.addTags = this.addTags.bind(this);
|
|
|
|
|
|
|
|
this.handleRequestDelete = this.handleRequestDelete.bind(this);
|
|
|
|
|
|
|
|
this.handleTagChange = this.handleTagChange.bind(this);
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
defValue: "",
|
|
|
|
defValue: "",
|
|
|
|
|
|
|
|
title: "",
|
|
|
|
|
|
|
|
description: "",
|
|
|
|
|
|
|
|
shortDescription: "",
|
|
|
|
tags: [],
|
|
|
|
tags: [],
|
|
|
|
screenshots: [],
|
|
|
|
screenshots: [],
|
|
|
|
icon: [],
|
|
|
|
icon: [],
|
|
|
@ -34,6 +42,62 @@ class GeneralInfo extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Set text field values to state.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
onTextFieldChange(event) {
|
|
|
|
|
|
|
|
let field = event.target.name;
|
|
|
|
|
|
|
|
console.log(event.target.value);
|
|
|
|
|
|
|
|
switch (field) {
|
|
|
|
|
|
|
|
case "appName": {
|
|
|
|
|
|
|
|
this.setState({name: event.target.value});
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case "appDescription": {
|
|
|
|
|
|
|
|
this.setState({description: event.target.value});
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case "appShortDescription": {
|
|
|
|
|
|
|
|
this.setState({shortDescription: event.target.value});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Create a tag on Enter key press and set it to the state.
|
|
|
|
|
|
|
|
* Clears the tags text field.
|
|
|
|
|
|
|
|
* Chip gets two parameters: Key and value.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
addTags(event) {
|
|
|
|
|
|
|
|
let tags = this.state.tags;
|
|
|
|
|
|
|
|
if (event.charCode === 13) {
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
tags.push({key: Math.floor(Math.random() * 1000), value: event.target.value});
|
|
|
|
|
|
|
|
this.setState({tags, defValue: ""}, console.log(tags));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Set the value for tag.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
handleTagChange(event) {
|
|
|
|
|
|
|
|
let defaultValue = this.state.defValue;
|
|
|
|
|
|
|
|
defaultValue = event.target.value;
|
|
|
|
|
|
|
|
this.setState({defValue: defaultValue})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Handles Chip delete function.
|
|
|
|
|
|
|
|
* Removes the tag from state.tags
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
handleRequestDelete(key) {
|
|
|
|
|
|
|
|
let chipData = this.state.tags;
|
|
|
|
|
|
|
|
const chipToDelete = chipData.map((chip) => chip.key).indexOf(key);
|
|
|
|
|
|
|
|
chipData.splice(chipToDelete, 1);
|
|
|
|
|
|
|
|
this.setState({tags: chipData});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Remove Console logs.
|
|
|
|
//TODO: Remove Console logs.
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -44,13 +108,31 @@ class GeneralInfo extends Component {
|
|
|
|
<Label for="app-title">
|
|
|
|
<Label for="app-title">
|
|
|
|
<FormattedMessage id="Title" defaultMessage="Title"/>*
|
|
|
|
<FormattedMessage id="Title" defaultMessage="Title"/>*
|
|
|
|
</Label>
|
|
|
|
</Label>
|
|
|
|
<Input required type="text" name="appName" id="app-title"/>
|
|
|
|
<Input required type="text" name="appName" id="app-title"
|
|
|
|
|
|
|
|
onChange={this.onTextFieldChange}/>
|
|
|
|
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
<FormGroup>
|
|
|
|
|
|
|
|
<Label for="app-short-description">
|
|
|
|
|
|
|
|
<FormattedMessage id="shortDescription" defaultMessage="shortDescription"/>*
|
|
|
|
|
|
|
|
</Label>
|
|
|
|
|
|
|
|
<Input
|
|
|
|
|
|
|
|
required
|
|
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
|
|
name="appShortDescription"
|
|
|
|
|
|
|
|
id="app-short-description"
|
|
|
|
|
|
|
|
onChange={this.onTextFieldChange}
|
|
|
|
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<Label for="app-title">
|
|
|
|
<Label for="app-title">
|
|
|
|
<FormattedMessage id="Description" defaultMessage="Description"/>*
|
|
|
|
<FormattedMessage id="Description" defaultMessage="Description"/>*
|
|
|
|
</Label>
|
|
|
|
</Label>
|
|
|
|
<Input required type="textarea" multiline name="appName" id="app-title"/>
|
|
|
|
<Input
|
|
|
|
|
|
|
|
required
|
|
|
|
|
|
|
|
type="textarea"
|
|
|
|
|
|
|
|
name="appDescription"
|
|
|
|
|
|
|
|
id="app-description"
|
|
|
|
|
|
|
|
onChange={this.onTextFieldChange}/>
|
|
|
|
</FormGroup>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<FormGroup>
|
|
|
|
<Label for="app-category">
|
|
|
|
<Label for="app-category">
|
|
|
@ -74,16 +156,23 @@ class GeneralInfo extends Component {
|
|
|
|
<Label for="app-tags">
|
|
|
|
<Label for="app-tags">
|
|
|
|
<FormattedMessage id="Tags" defaultMessage="Tags"/>*
|
|
|
|
<FormattedMessage id="Tags" defaultMessage="Tags"/>*
|
|
|
|
</Label>
|
|
|
|
</Label>
|
|
|
|
<Input required type="text" value={this.state.defValue} name="app-tags" id="app-tags"/>
|
|
|
|
<Input
|
|
|
|
|
|
|
|
required
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
value={this.state.defValue}
|
|
|
|
|
|
|
|
name="app-tags"
|
|
|
|
|
|
|
|
id="app-tags"
|
|
|
|
|
|
|
|
onChange={this.handleTagChange.bind(this)}
|
|
|
|
|
|
|
|
onKeyPress={this.addTags.bind(this)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
<div id="batch-content">
|
|
|
|
<div id="batch-content">
|
|
|
|
{this.state.tags.map(tag => {
|
|
|
|
{this.state.tags.map(tag => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Badge
|
|
|
|
<Chip
|
|
|
|
style={{margin: '0 2px 0 2px'}}
|
|
|
|
key={tag.key}
|
|
|
|
value={tag.value}
|
|
|
|
content={tag}
|
|
|
|
>
|
|
|
|
onDelete={this.handleRequestDelete}
|
|
|
|
{tag.value}
|
|
|
|
/>
|
|
|
|
</Badge>
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)}
|
|
|
|
)}
|
|
|
@ -185,7 +274,8 @@ class GeneralInfo extends Component {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="save-info">
|
|
|
|
<div className="save-info">
|
|
|
|
<Button>Save</Button>
|
|
|
|
<Button className="custom-flat danger-flat">Cancel</Button>
|
|
|
|
|
|
|
|
<Button className="custom-raised primary">Save</Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
</Row>
|
|
|
|
</Row>
|
|
|
|