Commit 4969a710 authored by Ludovic Le Frioux's avatar Ludovic Le Frioux
Browse files

Merge branch '20-remove-unused-code' into 'master'

Resolve "Remove unused code"

Closes #20

See merge request !15
parents f55be38e da1a477d
......@@ -26,7 +26,6 @@ import React from 'react';
import assert from 'assert';
import Cell from './Cell';
import { validInput, GRIDS } from '../constants'
import Submit1Input from './Submit1Input';
/**
* Interface for the state of the Grid
......@@ -57,19 +56,6 @@ class Grid extends React.Component<{}, IGridState> {
this.initFrom(generateStaticGrid());
}
/**
* Update cells values from C-Client.
*/
updateGrid() {
let cells = this.state.cells;
for (let index = 0; index < 81; index++) {
if (cells[index].modifiable) {
cells[index].value = "";
}
}
this.updateState(cells)
}
/**
* Initialize the grid with the given values.
* @param values values to be set in the grid.
......@@ -336,20 +322,4 @@ function blockIndex(block: number) {
return index
}
/**
* Concatenates all values of a HashSet as a String.
* @param set HashSet to be concatenated.
*/
function hashSetToString(set: any) {
let res = new Set();
let it = set.iterator();
while (it.hasNext()) {
let val = it.next();
if (val !== "") {
res.add(val);
}
}
return Array.from(res).sort().join(' ')
}
export default Grid
/**
* MIT License
*
* Copyright (c) 2020, Concordant and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import React from 'react';
interface ISubmit1InputProps {
onSubmit: any,
inputName: string
}
interface ISubmit1InputState {
value: string
}
class Submit1Input extends React.Component<ISubmit1InputProps, ISubmit1InputState> {
constructor(props: any) {
super(props);
this.state = {value: "1"};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
/**
* onChange event handler
* @param event handled
*/
handleChange(event: any) {
this.setState({value: event.target.value});
}
handleSubmit(event: any) {
event.preventDefault();
if (Number(this.state.value) >= 1 && Number(this.state.value) <= 100) {
this.props.onSubmit(this.state.value);
}
}
render() {
return (
<form onSubmit={this.handleSubmit}>
<label>
{this.props.inputName} :
<input type="number" value={this.state.value} onChange={this.handleChange}
min="1" max="100"/>
</label>
<input type="submit" value={"Change " + this.props.inputName} />
</form>
);
}
}
export default Submit1Input
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment