From 55d88e895a61160a941b94ea19cdc0499297bcb9 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Wed, 26 May 2021 15:50:58 +0430 Subject: [PATCH] ingreza added someth --- src/Redux/proxy.js | 2 +- src/views/Auth/Auth.js | 2 +- src/views/Auth/Login/Code/Code.js | 83 +++++++++++-------- src/views/Auth/Login/Login.js | 5 ++ src/views/Auth/Login/Mobile/Mobile.js | 33 ++++---- src/views/ChatRoom/Body/Body.js | 13 ++- .../Body/ChatSuggest/ChatSuggest.scss | 22 +++-- .../DraggableMessage/DraggableMessage.js | 12 ++- .../Body/Message/RadioMessage/RadioMessage.js | 37 ++++++--- 9 files changed, 133 insertions(+), 76 deletions(-) diff --git a/src/Redux/proxy.js b/src/Redux/proxy.js index 848c53c..f5edec1 100644 --- a/src/Redux/proxy.js +++ b/src/Redux/proxy.js @@ -31,7 +31,7 @@ class Proxy { if (await this.refresh()) return this.result(url, (await fetch()).data.data); break; default: - toast(response.data.message); + toast.error(response.data.message); } return false; }; diff --git a/src/views/Auth/Auth.js b/src/views/Auth/Auth.js index 124d1b9..e3e9c70 100644 --- a/src/views/Auth/Auth.js +++ b/src/views/Auth/Auth.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; - +import {ToastContainer} from 'react-toastify'; import Logo from './Logo/Logo'; import Bio from './Bio/Bio'; import Login from './Login/Login'; diff --git a/src/views/Auth/Login/Code/Code.js b/src/views/Auth/Login/Code/Code.js index b7796e9..dd19579 100644 --- a/src/views/Auth/Login/Code/Code.js +++ b/src/views/Auth/Login/Code/Code.js @@ -6,10 +6,6 @@ export default class Code extends Component { super(props); this.state = { - auth_code1: '', - auth_code2: '', - auth_code3: '', - auth_code4: '', flag: false, resendStatus: false, }; @@ -23,19 +19,21 @@ export default class Code extends Component { changeValue = (e) => { if (e.target.value.match('^[0-9]{1}$')) { - this.setState({ - [e.target.name]: e.target.value, - }); - if (e.target.name === 'auth_code1') { - this.setState({ o1: e.target.value }); + if (e.target.name === 'o1') { + if(typeof this.state.o1 === Number){ + console.log(e.target.value); + }else{ + this.setState({ o1 : e.target.value }); + } this.inputRef2.focus(); - } else if (e.target.name === 'auth_code2') { + } else if (e.target.name === 'o2') { this.setState({ o2: e.target.value }); this.inputRef3.focus(); - } else if (e.target.name === 'auth_code3') { + } else if (e.target.name === 'o3') { this.setState({ o3: e.target.value }); this.inputRef4.focus(); - } else if (e.target.name === 'auth_code4') { + } else if (e.target.name === 'o4') { + this.setState({ o4: e.target.value }); const o4 = e.target.value; const { o1, o2, o3 } = this.state; this.props.parent.setState({ otp: `${o1}${o2}${o3}${o4}` }); @@ -51,15 +49,15 @@ export default class Code extends Component { this.setState({ [e.target.name]: '', }); - if (e.target.name === 'auth_code1') { + if (e.target.name === 'o1') { return; - } else if (e.target.name === 'auth_code2') { + } else if (e.target.name === 'o2') { this.inputRef1.focus(); return; - } else if (e.target.name === 'auth_code3') { + } else if (e.target.name === 'o3') { this.inputRef2.focus(); return; - } else if (e.target.name === 'auth_code4') { + } else if (e.target.name === 'o4') { this.inputRef3.focus(); return; } @@ -70,6 +68,17 @@ export default class Code extends Component { this.inputRef1.focus(); } + onInput= (e) => { + e.target.value = e.target.value + .replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (c) { + return c.charCodeAt(0) & 0xf; + }) + .replace(/[^\d]/, '') + .slice(-1); + + + } + render() { return ( <> @@ -79,55 +88,63 @@ export default class Code extends Component {
this.changeValue(e)} - maxLength="1" + maxLength="2" + inputMode="numeric" ref={(input) => { this.inputRef1 = input; }} autoComplete="false" - value={this.state.auth_code1} + value={this.state.o1} onKeyDown={(e) => this.keyboardEvent(e)} + onInput={this.onInput} /> this.changeValue(e)} - maxLength="1" + maxLength="2" + inputMode="numeric" ref={(input) => { this.inputRef2 = input; }} autoComplete="false" - value={this.state.auth_code2} + value={this.state.o2} onKeyDown={(e) => this.keyboardEvent(e)} + onInput={this.onInput} /> this.changeValue(e)} - maxLength="1" + maxLength="2" + inputMode="numeric" ref={(input) => { this.inputRef3 = input; }} autoComplete="false" - value={this.state.auth_code3} + value={this.state.o3} onKeyDown={(e) => this.keyboardEvent(e)} + onInput={this.onInput} /> this.changeValue(e)} - maxLength="1" + maxLength="2" + inputMode="numeric" ref={(input) => { this.inputRef4 = input; }} autoComplete="false" - value={this.state.auth_code4} + value={this.state.o4} onKeyDown={(e) => this.keyboardEvent(e)} + onInput={this.onInput} /> {!this.state.resendStatus ? ( - + ) : (
@@ -11,20 +12,24 @@ export default class Mobile extends Component {
- this.setState({ cellphone: e.target.value })} - onInput={(e) => - (e.target.value = e.target.value - .replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (c) { - return c.charCodeAt(0) & 0xf; - }) - .replace(/[^\d]/, '')) - } - /> -
09
+
this.props.parent.setState({ section: 1, cellphone: '09' + this.state.cellphone })} > + this.setState({ cellphone: e.target.value })} + onInput={(e) => + (e.target.value = e.target.value + .replace(/[\u0660-\u0669\u06f0-\u06f9]/g, function (c) { + return c.charCodeAt(0) & 0xf; + }) + .replace(/[^\d]/, '')) + } + // onAction={} + /> + +
09
+
+ ); } diff --git a/src/views/ChatRoom/Body/ChatSuggest/ChatSuggest.scss b/src/views/ChatRoom/Body/ChatSuggest/ChatSuggest.scss index d30b707..11de6d7 100644 --- a/src/views/ChatRoom/Body/ChatSuggest/ChatSuggest.scss +++ b/src/views/ChatRoom/Body/ChatSuggest/ChatSuggest.scss @@ -6,16 +6,20 @@ // height : 40px; padding: 2px 0px 0px; align-items: flex-end; - &__item { - padding: 8px 6px; - background-color: white; - border-radius: 5px; - margin: 5px; - width: 100% !important; - justify-content: center; - color: black; - min-height: 60px; + &__row{ + width: 100%; + &--item { + padding: 8px 6px; + background-color: white; + border-radius: 5px; + margin: 5px; + width: 100% !important; + justify-content: center; + color: black; + min-height: 60px; + } } + } } diff --git a/src/views/ChatRoom/Body/Message/DraggableMessage/DraggableMessage.js b/src/views/ChatRoom/Body/Message/DraggableMessage/DraggableMessage.js index acc4095..24408be 100644 --- a/src/views/ChatRoom/Body/Message/DraggableMessage/DraggableMessage.js +++ b/src/views/ChatRoom/Body/Message/DraggableMessage/DraggableMessage.js @@ -3,15 +3,19 @@ import { SortableContainer, SortableElement } from 'react-sortable-hoc'; import arrayMove from 'array-move'; import ArrowRightAltIcon from '@material-ui/icons/ArrowRightAlt'; -const SortableItem = SortableElement(({ value }) => ( -
{value}
+const SortableItem = SortableElement(({ row }) => ( +
+ {row.map((item) => ( +
{item.text}
+ ))} +
)); const SortableList = SortableContainer(({ items }) => { return (
- {items.map((value, index) => ( - + {items.map((row, index) => ( + ))}
); diff --git a/src/views/ChatRoom/Body/Message/RadioMessage/RadioMessage.js b/src/views/ChatRoom/Body/Message/RadioMessage/RadioMessage.js index cdca83d..f38745d 100644 --- a/src/views/ChatRoom/Body/Message/RadioMessage/RadioMessage.js +++ b/src/views/ChatRoom/Body/Message/RadioMessage/RadioMessage.js @@ -38,19 +38,8 @@ export default class RadioMessage extends Component { ) : null}
- {message.options.map((item, i) => ( -
this.handleRadioChange(item.name)} - className="message-2d__options--radio" - style={{ - backgroundColor: - item.name === this.state.value ? '#0000cc' : 'rgba(153, 153, 153, 0.87)', - color: item.name === this.state.value ? 'white' : 'black', - }} - > - {item.name} -
+ {message.options.map((row, i) => ( + ))}