Merge branch 'frontPR' into 'master'
Front pr change front design add rateMessage See merge request !4
Showing
5 changed files
with
83 additions
and
9 deletions
... | @@ -2,6 +2,7 @@ import React from 'react'; | ... | @@ -2,6 +2,7 @@ import React from 'react'; |
2 | import { View, Text} from 'react-native'; | 2 | import { View, Text} from 'react-native'; |
3 | import {connect} from 'react-redux' | 3 | import {connect} from 'react-redux' |
4 | import Icon from 'react-native-vector-icons/FontAwesome'; | 4 | import Icon from 'react-native-vector-icons/FontAwesome'; |
5 | +import RateMessage from '../RateMessage/RateMessage'; | ||
5 | import RateSentence from '../RateSentence/RateSentence'; | 6 | import RateSentence from '../RateSentence/RateSentence'; |
6 | import RateBar from '../RateBar/RateBar'; | 7 | import RateBar from '../RateBar/RateBar'; |
7 | import RateLine from '../RateLine/RateLine'; | 8 | import RateLine from '../RateLine/RateLine'; |
... | @@ -10,8 +11,9 @@ import scoring from '../../lib/scoring'; | ... | @@ -10,8 +11,9 @@ import scoring from '../../lib/scoring'; |
10 | const Rate = ({score}) => { | 11 | const Rate = ({score}) => { |
11 | return( | 12 | return( |
12 | <View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0, justifyContent:'center',alignItems:'center'}}> | 13 | <View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0, justifyContent:'center',alignItems:'center'}}> |
14 | + <RateMessage /> | ||
13 | <RateSentence /> | 15 | <RateSentence /> |
14 | - <RateBar score={score}/> | 16 | + <RateBar score={score}/> |
15 | <RateLine /> | 17 | <RateLine /> |
16 | </View> | 18 | </View> |
17 | ) | 19 | ) |
... | @@ -28,6 +30,6 @@ RateContainer.navigationOptions={ | ... | @@ -28,6 +30,6 @@ RateContainer.navigationOptions={ |
28 | 30 | ||
29 | export default connect( | 31 | export default connect( |
30 | ({search})=>({ | 32 | ({search})=>({ |
31 | - score: scoring(search.result.return_data) | 33 | + score: search.score |
32 | }) | 34 | }) |
33 | )(RateContainer); | 35 | )(RateContainer); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -10,7 +10,7 @@ export default RateBar = (props) => { | ... | @@ -10,7 +10,7 @@ export default RateBar = (props) => { |
10 | return ( | 10 | return ( |
11 | <Surface style={styles.surface}> | 11 | <Surface style={styles.surface}> |
12 | 12 | ||
13 | - {props.score.msg.length ? | 13 | + {props.score.msg ? |
14 | <> | 14 | <> |
15 | <View style={styles.container}> | 15 | <View style={styles.container}> |
16 | <Text style={styles.Text}>총 점수 : {props.score.full}</Text> | 16 | <Text style={styles.Text}>총 점수 : {props.score.full}</Text> | ... | ... |
... | @@ -38,7 +38,7 @@ const RateLine = ({load,pastScore }) => { | ... | @@ -38,7 +38,7 @@ const RateLine = ({load,pastScore }) => { |
38 | const styles = StyleSheet.create({ | 38 | const styles = StyleSheet.create({ |
39 | surface: { | 39 | surface: { |
40 | padding: 8, | 40 | padding: 8, |
41 | - flex: 0.4, | 41 | + flex: 0.3, |
42 | width: '95%', | 42 | width: '95%', |
43 | alignItems: 'center', | 43 | alignItems: 'center', |
44 | justifyContent: 'center', | 44 | justifyContent: 'center', | ... | ... |
1 | +import React,{ useState } from 'react'; | ||
2 | +import { Surface, Text } from 'react-native-paper'; | ||
3 | +import { StyleSheet,View } from 'react-native'; | ||
4 | +import {connect} from 'react-redux'; | ||
5 | +import PromptSearchRate from '../PromptSearch/PromptSearchRate'; | ||
6 | + | ||
7 | +const SentenceInfo = (props) => ( | ||
8 | + <View> | ||
9 | + <Text style={[styles.Text,{color:props.color}]}>{props.Text}</Text> | ||
10 | + </View> | ||
11 | +) | ||
12 | + | ||
13 | +const RateMessage = ({keywordText, score }) => { | ||
14 | + | ||
15 | + return ( | ||
16 | + <Surface style={styles.surface} > | ||
17 | + { keywordText ? | ||
18 | + <> | ||
19 | + <View style={{textAlign:"center", height:35}}> | ||
20 | + <Text >길잡이가 교정해준 문장을 확인하세요!</Text> | ||
21 | + </View> | ||
22 | + <View> | ||
23 | + <Text style={styles.msg} >{score.msg}</Text> | ||
24 | + </View> | ||
25 | + <View> | ||
26 | + <SentenceInfo Text={keywordText} color={'#281e94'} /> | ||
27 | + </View> | ||
28 | + </> | ||
29 | + : <PromptSearchRate /> | ||
30 | + } | ||
31 | + </Surface> | ||
32 | + ) | ||
33 | +} | ||
34 | + | ||
35 | + const styles = StyleSheet.create({ | ||
36 | + surface: { | ||
37 | + padding: 8, | ||
38 | + flex: 0.3, | ||
39 | + width: '95%', | ||
40 | + alignItems: 'center', | ||
41 | + justifyContent: 'center', | ||
42 | + elevation: 2, | ||
43 | + marginTop: 10 | ||
44 | + }, | ||
45 | + Text:{ | ||
46 | + fontSize: 25, | ||
47 | + textAlign:'center' | ||
48 | + }, | ||
49 | + infoText:{ | ||
50 | + fontSize: 20, | ||
51 | + textAlign:'center' | ||
52 | + }, | ||
53 | + msg:{ | ||
54 | + fontSize: 20, | ||
55 | + textAlign:'center', | ||
56 | + }, | ||
57 | +}); | ||
58 | + | ||
59 | + | ||
60 | +const RateMessageContainer = ( { keywordText, score } ) => ( | ||
61 | + <RateMessage keywordText={keywordText} score={score} /> | ||
62 | +); | ||
63 | + | ||
64 | +export default connect( | ||
65 | + ({search})=>({ | ||
66 | + keywordText: search.result.return_data.keywordText, | ||
67 | + score : search.score | ||
68 | + }) | ||
69 | +)(RateMessageContainer); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -23,13 +23,14 @@ export const load = () => async (dispatch) =>{ | ... | @@ -23,13 +23,14 @@ export const load = () => async (dispatch) =>{ |
23 | export const submit = (text) => async (dispatch) => { | 23 | export const submit = (text) => async (dispatch) => { |
24 | dispatch( {type:START}); | 24 | dispatch( {type:START}); |
25 | try{ | 25 | try{ |
26 | - const response = await sendSearch(text.nativeEvent.text); | 26 | + const response = await readTest() |
27 | - let tempScore = scoring(response.return_data).full; | 27 | + //const response = await sendSearch(text.nativeEvent.text); |
28 | - await sqlite.insert(tempScore); | 28 | + let tempScore = scoring(response.return_data); |
29 | + await sqlite.insert(tempScore.full); | ||
29 | let past = await sqlite.select(); | 30 | let past = await sqlite.select(); |
30 | past = past.map( elem => elem.score ); | 31 | past = past.map( elem => elem.score ); |
31 | //dispatch( { type:SUCCESS, result:response } | 32 | //dispatch( { type:SUCCESS, result:response } |
32 | - dispatch( { type:SUCCESS, result:response, past: past}) | 33 | + dispatch( { type:SUCCESS, result:response, past: past, score:tempScore}) |
33 | } | 34 | } |
34 | catch(err){ | 35 | catch(err){ |
35 | console.log(err); | 36 | console.log(err); |
... | @@ -51,6 +52,7 @@ const initialState = { | ... | @@ -51,6 +52,7 @@ const initialState = { |
51 | searchResults: [] | 52 | searchResults: [] |
52 | } | 53 | } |
53 | }, | 54 | }, |
55 | + score : {}, | ||
54 | isLoading: false, | 56 | isLoading: false, |
55 | pastScore: [10,10,10,10,10,10], | 57 | pastScore: [10,10,10,10,10,10], |
56 | }; | 58 | }; |
... | @@ -60,7 +62,8 @@ export default ToggleLoading = (state = initialState, action) => { | ... | @@ -60,7 +62,8 @@ export default ToggleLoading = (state = initialState, action) => { |
60 | case CHANGE: | 62 | case CHANGE: |
61 | return {...state, query: action.text}; | 63 | return {...state, query: action.text}; |
62 | case SUCCESS: | 64 | case SUCCESS: |
63 | - return {...state, isLoading:false,result: action.result, pastScore: action.past}; | 65 | + return {...state, isLoading:false, score: action.score, |
66 | + result: action.result, pastScore: action.past}; | ||
64 | case FAILURE: | 67 | case FAILURE: |
65 | return {...state, isLoading:false}; | 68 | return {...state, isLoading:false}; |
66 | case START: | 69 | case START: | ... | ... |
-
Please register or login to post a comment