bluejoyq

Merge branch 'frontPR' into 'master'

Front pr

change front design

add rateMessage

See merge request !4
......@@ -2,6 +2,7 @@ import React from 'react';
import { View, Text} from 'react-native';
import {connect} from 'react-redux'
import Icon from 'react-native-vector-icons/FontAwesome';
import RateMessage from '../RateMessage/RateMessage';
import RateSentence from '../RateSentence/RateSentence';
import RateBar from '../RateBar/RateBar';
import RateLine from '../RateLine/RateLine';
......@@ -10,8 +11,9 @@ import scoring from '../../lib/scoring';
const Rate = ({score}) => {
return(
<View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0, justifyContent:'center',alignItems:'center'}}>
<RateMessage />
<RateSentence />
<RateBar score={score}/>
<RateBar score={score}/>
<RateLine />
</View>
)
......@@ -28,6 +30,6 @@ RateContainer.navigationOptions={
export default connect(
({search})=>({
score: scoring(search.result.return_data)
score: search.score
})
)(RateContainer);
\ No newline at end of file
......
......@@ -10,7 +10,7 @@ export default RateBar = (props) => {
return (
<Surface style={styles.surface}>
{props.score.msg.length ?
{props.score.msg ?
<>
<View style={styles.container}>
<Text style={styles.Text}> 점수 : {props.score.full}</Text>
......
......@@ -38,7 +38,7 @@ const RateLine = ({load,pastScore }) => {
const styles = StyleSheet.create({
surface: {
padding: 8,
flex: 0.4,
flex: 0.3,
width: '95%',
alignItems: 'center',
justifyContent: 'center',
......
import React,{ useState } from 'react';
import { Surface, Text } from 'react-native-paper';
import { StyleSheet,View } from 'react-native';
import {connect} from 'react-redux';
import PromptSearchRate from '../PromptSearch/PromptSearchRate';
const SentenceInfo = (props) => (
<View>
<Text style={[styles.Text,{color:props.color}]}>{props.Text}</Text>
</View>
)
const RateMessage = ({keywordText, score }) => {
return (
<Surface style={styles.surface} >
{ keywordText ?
<>
<View style={{textAlign:"center", height:35}}>
<Text >길잡이가 교정해준 문장을 확인하세요!</Text>
</View>
<View>
<Text style={styles.msg} >{score.msg}</Text>
</View>
<View>
<SentenceInfo Text={keywordText} color={'#281e94'} />
</View>
</>
: <PromptSearchRate />
}
</Surface>
)
}
const styles = StyleSheet.create({
surface: {
padding: 8,
flex: 0.3,
width: '95%',
alignItems: 'center',
justifyContent: 'center',
elevation: 2,
marginTop: 10
},
Text:{
fontSize: 25,
textAlign:'center'
},
infoText:{
fontSize: 20,
textAlign:'center'
},
msg:{
fontSize: 20,
textAlign:'center',
},
});
const RateMessageContainer = ( { keywordText, score } ) => (
<RateMessage keywordText={keywordText} score={score} />
);
export default connect(
({search})=>({
keywordText: search.result.return_data.keywordText,
score : search.score
})
)(RateMessageContainer);
\ No newline at end of file
......@@ -23,13 +23,14 @@ export const load = () => async (dispatch) =>{
export const submit = (text) => async (dispatch) => {
dispatch( {type:START});
try{
const response = await sendSearch(text.nativeEvent.text);
let tempScore = scoring(response.return_data).full;
await sqlite.insert(tempScore);
const response = await readTest()
//const response = await sendSearch(text.nativeEvent.text);
let tempScore = scoring(response.return_data);
await sqlite.insert(tempScore.full);
let past = await sqlite.select();
past = past.map( elem => elem.score );
//dispatch( { type:SUCCESS, result:response }
dispatch( { type:SUCCESS, result:response, past: past})
dispatch( { type:SUCCESS, result:response, past: past, score:tempScore})
}
catch(err){
console.log(err);
......@@ -51,6 +52,7 @@ const initialState = {
searchResults: []
}
},
score : {},
isLoading: false,
pastScore: [10,10,10,10,10,10],
};
......@@ -60,7 +62,8 @@ export default ToggleLoading = (state = initialState, action) => {
case CHANGE:
return {...state, query: action.text};
case SUCCESS:
return {...state, isLoading:false,result: action.result, pastScore: action.past};
return {...state, isLoading:false, score: action.score,
result: action.result, pastScore: action.past};
case FAILURE:
return {...state, isLoading:false};
case START:
......