Skip to content
Snippets Groups Projects
Commit 9055b928 authored by Bereczki Sandor's avatar Bereczki Sandor
Browse files

Clear textfields fix on various form + message warning type added

parent a65ad842
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,7 @@ class AddSolutionForm extends Component {
color='red'
onClick={() => {
this.setState({ showModal: false });
this.props.clearWrite();
}}
>
<Icon name='remove' /> Mégse
......@@ -95,6 +96,7 @@ class AddSolutionForm extends Component {
task, accepted, corrected, note, name, description, file,
});
this.setState({ showModal: false });
this.props.clearWrite();
}
}
/>
......@@ -104,11 +106,11 @@ class AddSolutionForm extends Component {
color='green'
disabled={(name === '' || description === '')}
onClick={() => {
console.log()
this.props.addSolution({
task, accepted, corrected, note, name, description, file,
});
this.setState({ showModal: false });
this.props.clearWrite();
}
}
>
......
import React, { Component } from 'react';
import { Modal, Button, Icon, Checkbox, Form, TextArea, Header } from 'semantic-ui-react';
import { connect } from 'react-redux';
import { correctSolution, writeSolution, check } from '../../actions/homework';
import { correctSolution, writeSolution, check, clearWrite } from '../../actions/homework';
class CorrectSolutionForm extends Component {
constructor(props) {
......@@ -86,6 +86,7 @@ class CorrectSolutionForm extends Component {
color='red'
onClick={() => {
this.setState({ showModal: false });
this.props.clearWrite();
}}
>
<Icon name='remove' /> Mégse
......@@ -101,6 +102,7 @@ class CorrectSolutionForm extends Component {
this.props.correction.note,
);
this.setState({ showModal: false });
this.props.clearWrite();
}}
>
<Icon name='checkmark' /> Beadás
......@@ -117,4 +119,5 @@ export default connect(mapStateToProps, {
correctSolution,
writeSolution,
check,
clearWrite,
})(CorrectSolutionForm);
......@@ -54,11 +54,12 @@ const displayTypes = {
},
};
export const emptyMessage = (header, text, marginBottom) => (
export const emptyMessage = (header, text, marginBottom, warning) => (
<Message
style={{ marginBottom }}
icon='info'
icon={warning ? 'warning' : 'info'}
info
warning={warning}
header={header}
content={text}
/>
......@@ -275,7 +276,7 @@ class Homework extends Component {
}}
/>
{empty
? emptyMessage(emptyHeaderText, emptyText, marginBottom)
? emptyMessage(emptyHeaderText, emptyText, marginBottom, false)
: this.renderHomeworksTable(active, staff)}
</Container>
</Segment>
......
import { WRITE_SOLUTION, CHECK } from '../actions/types';
import { WRITE_SOLUTION, CHECK, CLEAR_WRITE } from '../actions/types';
const INITIAL_STATE = {
accepted: false,
......@@ -11,6 +11,8 @@ export default (state = INITIAL_STATE, action) => {
return { ...state, [action.target]: action.payload };
case CHECK:
return { ...state, accepted: !state.accepted };
case CLEAR_WRITE:
return INITIAL_STATE;
default:
return state;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment