bluejoyq

add chart

......@@ -2,7 +2,7 @@
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": 19001,
"packagerPid": 23132,
"packagerPid": 31648,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null
......
......@@ -3,6 +3,6 @@
"lanType": "ip",
"dev": true,
"minify": false,
"urlRandomness": "s4-47j",
"urlRandomness": "83-zd2",
"https": false
}
......
......@@ -13,12 +13,12 @@ const Home = ({searchResults}) => {
<SearchBar />
<ScrollView>
{ searchResults.length ? ( searchResults.map((searchResult, index) => (
<SearchCard key={index} title={searchResult.title} content={searchResult.passage} url={searchResult.url}/>)))
<SearchCard key={index} title={searchResult.title} content={searchResult.passage}
url={searchResult.url} metric={Math.round(searchResult.confidence * 100)} />)))
: <PromptSearch />
}
</ScrollView>
</View>
)
}
......
import React from 'react';
import { View, Text} from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import RateSentence from '../RateSentence/RateSentence';
import RateBar from '../RateBar/RateBar';
import RateLine from '../RateLine/RateLine';
const Rate = () => {
return(
<View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0}}>
<Text >평ㄴ가</Text>
<View style={{flex: 1, backgroundColor:'#eee', margin:0,padding:0, justifyContent:'center',alignItems:'center'}}>
<RateSentence />
<RateBar />
<RateLine />
</View>
)
}
......
import React from 'react';
import { Surface, Text } from 'react-native-paper';
import { StyleSheet } from 'react-native';
import { StackedBarChart } from 'react-native-svg-charts';
export default RateBar = (props) => (
<Surface style={styles.surface}>
<StackedBarChart
data={ [{keyword:20,korean:20}]}
style={{height:50, width:'100%'}}
keys={['keyword','korean']}
colors={['#a5aa5a','#2cc3c2']}
showGrid={ false }
horizontal={ true }
contentInset={ { top: 30, bottom: 30 } }
yMax={100}
/>
</Surface>
);
const styles = StyleSheet.create({
surface: {
padding: 8,
flex: 0.3,
width: '95%',
alignItems: 'center',
justifyContent: 'center',
elevation: 2,
marginTop: 10
},
});
\ No newline at end of file
import React from 'react';
import { Surface, Text } from 'react-native-paper';
import { StyleSheet } from 'react-native';
export default RateLine = () => (
<Surface style={styles.surface}>
<Text>Surface</Text>
</Surface>
);
const styles = StyleSheet.create({
surface: {
padding: 8,
flex: 0.4,
width: '95%',
alignItems: 'center',
justifyContent: 'center',
elevation: 2,
marginTop: 10,
marginBottom: 10,
},
});
\ No newline at end of file
import React,{ useState } from 'react';
import { Surface, Text } from 'react-native-paper';
import { StyleSheet,View } from 'react-native';
import {connect} from 'react-redux';
const SentenceInfo = (props) => (
<View>
<Text style={[styles.infoText,{color:props.color}]} >{props.info}</Text>
<Text style={[styles.Text,{color:props.color}]}>{props.Text}</Text>
</View>
)
const RateSentence = ({originalText, fixedText, keywordText }) => {
const [ count,setCount ] = useState(0);
const calCount = () => {
if(count > 1 || !keywordText) setCount(0);
else setCount(count+1);
}
return (
<Surface style={styles.surface} onTouchStart={calCount} >
{ keywordText ?
<View>
{count == 0 && ( <SentenceInfo Text={originalText} info={'원래 검색 문장'} color={'#B71C1C'} />) }
{count == 1 && ( <SentenceInfo Text={fixedText} info={'맞춤법 교정 문장'} color={'#2196F3'} />) }
{count == 2 && ( <SentenceInfo Text={keywordText} info={'키워드 교정 문장'} color={'#00a676'} />) }
</View>
: <View style={{alignItems:'center'}}>
<Text style={styles.Text}>아직 검색</Text>
<Text style={styles.Text}>결과가 없습니다!</Text>
</View>
}
</Surface>
)
}
const styles = StyleSheet.create({
surface: {
padding: 8,
flex: 0.3,
width: '95%',
alignItems: 'center',
justifyContent: 'center',
elevation: 2,
marginTop: 10
},
Text:{
fontSize: 25,
},
infoText:{
fontSize: 20,
}
});
const RateSentenceContainer = ( {originalText, fixedText, keywordText } ) => (
<RateSentence originalText={originalText} fixedText={fixedText} keywordText={keywordText} />
);
export default connect(
({search})=>({
originalText: search.result.return_data.originalText,
fixedText: search.result.return_data.fixedText,
keywordText: search.result.return_data.keywordText
})
)(RateSentenceContainer);
\ No newline at end of file
import React from 'react';
import { DARK_MAIN,LIGHT_MAIN, WHITE_MAIN} from 'react-native-dotenv';
import { Avatar, Button, Card, Title, Paragraph } from 'react-native-paper';
import { Avatar, Button, Card, Title, Paragraph, Text } from 'react-native-paper';
import {Linking } from 'react-native';
const SearchCard = (props) => (
<Card style={{margin:10}}>
<Card style={{marginTop:10, marginLeft:10, marginRight:10}}>
<Card.Title title={props.title}
left={ (props) => ( <Avatar.Icon {...props} icon="folder" color={WHITE_MAIN}style={{backgroundColor:LIGHT_MAIN}} /> ) } />
<Card.Content>
<Paragraph>{props.content}</Paragraph>
</Card.Content>
<Card.Actions style={{flexDirection:'row-reverse'}}>
<Card.Actions style={{flexDirection:'row', justifyContent:'space-between'}}>
<Text style={{marginTop:7, fontStyle:'italic'}}>정확도 : {props.metric}%</Text>
<Button mode='contained' color= {LIGHT_MAIN} labelStyle={{color:WHITE_MAIN}} onPress={()=>{Linking.openURL(props.url)}}>
자세히보기
</Button>
......
......@@ -1794,6 +1794,11 @@
"resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.12.0.tgz",
"integrity": "sha512-zo+HIdIhzojv6F1siQPqPFROyVy7C50KzHv/k/Iz+BtvtVzSHXiMXOpq2wCfNkeBqdCv+V8XOV96tsEt2W/3rQ=="
},
"boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"bplist-creator": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz",
......@@ -2264,6 +2269,114 @@
}
}
},
"css-select": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz",
"integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==",
"requires": {
"boolbase": "^1.0.0",
"css-what": "^3.2.1",
"domutils": "^1.7.0",
"nth-check": "^1.0.2"
}
},
"css-tree": {
"version": "1.0.0-alpha.37",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz",
"integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==",
"requires": {
"mdn-data": "2.0.4",
"source-map": "^0.6.1"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
}
}
},
"css-what": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-3.2.1.tgz",
"integrity": "sha512-WwOrosiQTvyms+Ti5ZC5vGEK0Vod3FTt1ca+payZqvKuGJF+dq7bG63DstxtN0dpm6FxY27a/zS3Wten+gEtGw=="
},
"d3-array": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz",
"integrity": "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw=="
},
"d3-collection": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.7.tgz",
"integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A=="
},
"d3-color": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.4.0.tgz",
"integrity": "sha512-TzNPeJy2+iEepfiL92LAAB7fvnp/dV2YwANPVHdDWmYMm23qIJBYww3qT8I8C1wXrmrg4UWs7BKc2tKIgyjzHg=="
},
"d3-format": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.2.tgz",
"integrity": "sha512-gco1Ih54PgMsyIXgttLxEhNy/mXxq8+rLnCb5shQk+P5TsiySrwWU5gpB4zen626J4LIwBxHvDChyA8qDm57ww=="
},
"d3-interpolate": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.3.3.tgz",
"integrity": "sha512-wTsi4AqnC2raZ3Q9eqFxiZGUf5r6YiEdi23vXjjKSWXFYLCQNUtBVMk6uk2tg4cOY6YrjRdmSmI/Mf0ze1zPzQ==",
"requires": {
"d3-color": "1"
}
},
"d3-interpolate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/d3-interpolate-path/-/d3-interpolate-path-2.0.0.tgz",
"integrity": "sha1-ywMnMU/tsU5uoXiat+CVoWwvirI=",
"requires": {
"d3-interpolate": "^1.1.1"
}
},
"d3-path": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz",
"integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="
},
"d3-scale": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-1.0.7.tgz",
"integrity": "sha512-KvU92czp2/qse5tUfGms6Kjig0AhHOwkzXG0+PqIJB3ke0WUv088AHMZI0OssO9NCkXt4RP8yju9rpH8aGB7Lw==",
"requires": {
"d3-array": "^1.2.0",
"d3-collection": "1",
"d3-color": "1",
"d3-format": "1",
"d3-interpolate": "1",
"d3-time": "1",
"d3-time-format": "2"
}
},
"d3-shape": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz",
"integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==",
"requires": {
"d3-path": "1"
}
},
"d3-time": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz",
"integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA=="
},
"d3-time-format": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.2.2.tgz",
"integrity": "sha512-pweL2Ri2wqMY+wlW/wpkl8T3CUzKAha8S9nmiQlMABab8r5MJN0PD1V4YyRNVaKQfeh4Z0+VO70TLw6ESVOYzw==",
"requires": {
"d3-time": "1"
}
},
"debounce": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.0.tgz",
......@@ -2375,11 +2488,41 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"dom-serializer": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz",
"integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==",
"requires": {
"domelementtype": "^2.0.1",
"entities": "^2.0.0"
},
"dependencies": {
"domelementtype": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz",
"integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ=="
}
}
},
"dom-walk": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz",
"integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg="
},
"domelementtype": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz",
"integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w=="
},
"domutils": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz",
"integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==",
"requires": {
"dom-serializer": "0",
"domelementtype": "1"
}
},
"dotenv": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-2.0.0.tgz",
......@@ -2417,6 +2560,11 @@
"once": "^1.4.0"
}
},
"entities": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz",
"integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw=="
},
"envinfo": {
"version": "5.12.1",
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-5.12.1.tgz",
......@@ -4111,6 +4259,11 @@
"buffer-alloc": "^1.1.0"
}
},
"mdn-data": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz",
"integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA=="
},
"mem": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz",
......@@ -4814,6 +4967,14 @@
"gauge": "~1.2.5"
}
},
"nth-check": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
"integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==",
"requires": {
"boolbase": "~1.0.0"
}
},
"nullthrows": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz",
......@@ -5633,6 +5794,27 @@
"debounce": "^1.2.0"
}
},
"react-native-svg": {
"version": "9.13.3",
"resolved": "https://registry.npmjs.org/react-native-svg/-/react-native-svg-9.13.3.tgz",
"integrity": "sha512-H50b2m4jvrQ7KxKs8uYSuWecr6e5XC7BDfS7DaA96+0Owjh0C9DksI5l8SRyHnmE+emiYMPu6Qqfr9dCyKkaJQ==",
"requires": {
"css-select": "^2.0.2",
"css-tree": "^1.0.0-alpha.37"
}
},
"react-native-svg-charts": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/react-native-svg-charts/-/react-native-svg-charts-5.3.0.tgz",
"integrity": "sha512-XxKDqMdOl8EhQGhLAzWtmfhhiTuPeeRrLvLQ5+BzaRoCgdBO1CGGKeLvEor8OU8QUi3IXSdbbTi+fVrFq5hqaQ==",
"requires": {
"d3-array": "^1.2.0",
"d3-interpolate-path": "2.0.0",
"d3-scale": "^1.0.6",
"d3-shape": "^1.0.6",
"prop-types": "^15.6.0"
}
},
"react-native-tab-view": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/react-native-tab-view/-/react-native-tab-view-2.10.0.tgz",
......
......@@ -21,6 +21,8 @@
"react-native-navigation": "^3.6.0",
"react-native-paper": "^3.2.1",
"react-native-reanimated": "^1.4.0",
"react-native-svg": "^9.13.3",
"react-native-svg-charts": "^5.3.0",
"react-native-voice": "^0.3.0",
"react-native-web": "^0.11.7",
"react-navigation": "^4.0.10",
......