diff --git a/App.js b/App.js index 2e65a0c..c6a5ae7 100644 --- a/App.js +++ b/App.js @@ -6,22 +6,21 @@ import Enrollment from "./app/screens/Enrollment"; import WritePettition from "./app/screens/WritePettition"; import SimilarCaseAnalysis from "./app/screens/SimilarCaseAnalysis"; import TerminologyExplanation from "./app/screens/TerminologyExplanation"; -import CaseBefore from "./app/screens/CaseBefore"; import CaseView from "./app/screens/CaseView"; import QnaList from "./app/screens/QnaList"; -import QnA from "./app/screens/QnA"; import QaLawyer from "./app/screens/QaLawyer"; import QaUser from "./app/screens/QaUser"; import QaWrite from "./app/screens/QaWrite"; import QaAnswer from "./app/screens/QaAnswer"; import QnaView from "./app/screens/QnaView"; +import SideMenu from "./app/screens/SideMenu"; import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; -// import { createDrawerNavigator } from '@react-navigation/drawer'; +import { createDrawerNavigator } from '@react-navigation/drawer'; import { MyContext, PRODUCTION_URL } from './context.js'; const Stack = createStackNavigator(); -// const Drawer = createDrawerNavigator(); +const Drawer = createDrawerNavigator(); export default class App extends Component { state = { @@ -82,7 +81,7 @@ export default class App extends Component { updateToken: this.updateToken, }}> - + {/* @@ -98,9 +97,22 @@ export default class App extends Component { - - {/* - */} + */} + } initialRouteName={this.state.firstPage}> + + + + + + + + + + + + + + ) diff --git a/app/assets/aEmpty.png b/app/assets/aEmpty.png new file mode 100644 index 0000000..bfcd527 Binary files /dev/null and b/app/assets/aEmpty.png differ diff --git a/app/assets/aFill.png b/app/assets/aFill.png new file mode 100644 index 0000000..4282496 Binary files /dev/null and b/app/assets/aFill.png differ diff --git a/app/assets/caseFav.png b/app/assets/caseFav.png new file mode 100644 index 0000000..fd9a82d Binary files /dev/null and b/app/assets/caseFav.png differ diff --git a/app/assets/close.png b/app/assets/close.png new file mode 100644 index 0000000..68362d5 Binary files /dev/null and b/app/assets/close.png differ diff --git a/app/assets/close2.png b/app/assets/close2.png new file mode 100644 index 0000000..3cf9de8 Binary files /dev/null and b/app/assets/close2.png differ diff --git a/app/assets/lawyerFav.png b/app/assets/lawyerFav.png new file mode 100644 index 0000000..fa33f40 Binary files /dev/null and b/app/assets/lawyerFav.png differ diff --git a/app/assets/myComment.png b/app/assets/myComment.png new file mode 100644 index 0000000..e99074d Binary files /dev/null and b/app/assets/myComment.png differ diff --git a/app/assets/myPost.png b/app/assets/myPost.png new file mode 100644 index 0000000..eddcc20 Binary files /dev/null and b/app/assets/myPost.png differ diff --git a/app/assets/qEmpty.png b/app/assets/qEmpty.png new file mode 100644 index 0000000..0298499 Binary files /dev/null and b/app/assets/qEmpty.png differ diff --git a/app/assets/qFill.png b/app/assets/qFill.png new file mode 100644 index 0000000..5586dad Binary files /dev/null and b/app/assets/qFill.png differ diff --git a/app/assets/qnaFav.png b/app/assets/qnaFav.png new file mode 100644 index 0000000..57666b6 Binary files /dev/null and b/app/assets/qnaFav.png differ diff --git a/app/assets/qnaFav2.png b/app/assets/qnaFav2.png new file mode 100644 index 0000000..3338e0b Binary files /dev/null and b/app/assets/qnaFav2.png differ diff --git a/app/assets/scrap.png b/app/assets/scrap.png new file mode 100644 index 0000000..684bb83 Binary files /dev/null and b/app/assets/scrap.png differ diff --git a/app/screens/CaseBefore.js b/app/screens/CaseBefore.js deleted file mode 100644 index 06313ca..0000000 --- a/app/screens/CaseBefore.js +++ /dev/null @@ -1,123 +0,0 @@ -import React, { Component } from "react"; -import { - Text, - View, - StyleSheet, - Image, - TouchableOpacity, -} from "react-native"; -import * as Font from "expo-font"; - -export default class DocumentInterpret extends Component { - state = { - fontsLoaded: false, - caseID: 64738, - caseHTML: '', - caseURL:'', - }; - - async _loadFonts(){ - await Font.loadAsync({ - SCDream8: require("../assets/fonts/SCDream8.otf"), - KPWDBold: require("../assets/fonts/KPWDBold.ttf"), - }); - this.setState({ fontsLoaded: true }); - } - - componentDidMount() { - this._loadFonts(); - } - - getHTML(){ - var main = { - 'OC': 'ICTPoolC', - 'target': 'prec', - 'ID': this.state.caseID, - 'type': 'HTML', - 'mobileYn':'Y' - }; - var url = 'http://www.law.go.kr/DRF/lawService.do?OC='+ main.OC+'&target='+main.target+ - '&ID='+main.ID+'&type='+main.type+'&mobileYn='+main.mobileYn; - - fetch(url, { - method: "GET", - headers: { - // "Content-Type": "application/json", - }, - }).then((response) => { - this.state.caseURL = response.url; - this.props.navigation.navigate('CaseView', { - caseURL: this.state.caseURL, - }); - }).catch((error) => { - console.error(error); - }); - } - render(){ - if (!this.state.fontsLoaded) { - return ; - } - - return ( - - - - LAWBOT - - - - this.getHTML()}> - - - - ); - } - -} - -const styles = StyleSheet.create({ - body: { - flex: 12, - overflow: "scroll", - }, - container: { - flex: 1, - marginTop: Platform.OS === `ios` ? 1 : Expo.Constants.statusBarHeight, - backgroundColor: "#fff", - }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, - fieldButton: { - width: 60, - height: 60, - backgroundColor: "#E7E7E7", - borderRadius: 30, - justifyContent: "center", - alignItems: "center" - }, - fieldImage: { - width: "60%", - height: "60%" - }, -}) \ No newline at end of file diff --git a/app/screens/CaseView.js b/app/screens/CaseView.js index 402e6a5..0c7c1af 100644 --- a/app/screens/CaseView.js +++ b/app/screens/CaseView.js @@ -18,6 +18,7 @@ import WebView from "react-native-webview"; import { parse } from 'node-html-parser'; import colors from "../config/colors"; +import Header from "./Header.js"; export default class CaseView extends Component { state = { @@ -115,14 +116,7 @@ export default class CaseView extends Component { return ( - - - {this.props.navigation.navigate("Home")}}>LAWBOT - - +
; + } + return ( + + {this.props.navigation.openDrawer()}}> + + + {this.props.navigation.navigate("Home")}} >LAWBOT + + + ) + }; +} + +const styles=StyleSheet.create({ + header: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + paddingLeft: "5%", + paddingRight: "5%", + minHeight: 50, + backgroundColor: "#fff", + zIndex: 1, + }, + logoTitle: { + fontSize: 20, + fontFamily: "SCDream8", + }, + menu: { + width: 20, + height: 20, + }, + profile: { + width: 20, + height: 20, + }, +}); \ No newline at end of file diff --git a/app/screens/Home.js b/app/screens/Home.js index 9858e46..b958391 100644 --- a/app/screens/Home.js +++ b/app/screens/Home.js @@ -8,14 +8,13 @@ import { KeyboardAvoidingView, TouchableOpacity, } from "react-native"; -import {Picker} from '@react-native-community/picker'; import * as Font from "expo-font"; import Constants from "expo-constants"; import * as DocumentPicker from 'expo-document-picker'; import { MyContext } from '../../context.js'; import colors from "../config/colors"; - +import Header from "./Header.js"; export default class Home extends Component { state = { @@ -63,14 +62,7 @@ export default class Home extends Component { } return ( - - - {this.props.navigation.navigate("Home")}} >LAWBOT - - +
{/* QA bar */} @@ -215,15 +207,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, searchSection:{ alignItems:"center" }, @@ -252,18 +235,6 @@ const styles=StyleSheet.create({ marginLeft: 10, marginTop: -7 }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, selectSection: { justifyContent: "space-evenly", marginTop: "10%", diff --git a/app/screens/MyPage.js b/app/screens/MyPage.js new file mode 100644 index 0000000..0c3efc2 --- /dev/null +++ b/app/screens/MyPage.js @@ -0,0 +1,100 @@ +import React, { Component } from "react"; +import { + Text, + View, + StyleSheet, + Image, + TouchableOpacity, + Platform, + AsyncStorage +} from "react-native"; +import * as Font from "expo-font"; +import Constants from "expo-constants"; + +import colors from "../config/colors"; +import { ScrollView } from "react-native-gesture-handler"; +import { MyContext } from '../../context.js'; + +export default class MyPage extends Component { + state = { + fontsLoaded: false, + token: '', + user: {}, + }; + + async _loadFonts() { + await Font.loadAsync({ + SCDream8: require("../assets/fonts/SCDream8.otf"), + KPWDBold: require("../assets/fonts/KPWDBold.ttf"), + KPWDMedium: require("../assets/fonts/KPWDMedium.ttf") + }); + this.setState({ fontsLoaded: true }); + } + + async componentDidMount() { + this._loadFonts(); + + const ctx = this.context; + await fetch(`${ctx.API_URL}/user`, { + method: "GET", + headers: { + // 'Content-Type': 'multipart/form-data', + // 'Accept': 'application/json', + 'token': ctx.token, + }, + }).then((result) => { + return result.json(); + }).then((result) => { + this.setState({ token: ctx.token, user: result }); + }); + } + + async componentDidUpdate() { + const ctx = this.context; + if(this.state.token != ctx.token && ctx.token != '') { + await fetch(`${ctx.API_URL}/user`, { + method: "GET", + headers: { + // 'Content-Type': 'multipart/form-data', + // 'Accept': 'application/json', + 'token': ctx.token, + }, + }).then((result) => { + return result.json(); + }).then((result) => { + this.setState({ token: ctx.token, user: result }); + }); + } + } + + async logout() { + await AsyncStorage.clear(); + const ctx = this.context; + ctx.updateToken(""); + this.props.navigation.navigate("WelcomeScreen"); + } + + render() { + if (!this.state.fontsLoaded) { + return ; + } + + return ( + + + + ); + } +} +SideMenu.contextType = MyContext; + +const styles = StyleSheet.create({ + container: { + flex: 1, + marginTop: Platform.OS === `ios` ? 1 : Constants.statusBarHeight, + backgroundColor: "#fff", + }, + + + +}); diff --git a/app/screens/QaAnswer.js b/app/screens/QaAnswer.js index a47983f..ad36ef2 100644 --- a/app/screens/QaAnswer.js +++ b/app/screens/QaAnswer.js @@ -10,13 +10,11 @@ import { ScrollView, Alert } from "react-native"; -import {Picker} from '@react-native-community/picker'; import * as Font from "expo-font"; import Constants from "expo-constants"; -import * as DocumentPicker from 'expo-document-picker'; -import { MyContext } from '../../context.js'; import colors from "../config/colors"; +import Header from "./Header.js"; const question = { field: ["교통사고/범죄", "명예훼손/모욕", "폭행/협박"], @@ -26,7 +24,6 @@ const question = { content: "제가 운전 중이었는데 어쩌고 저쩌고 갑자기 저보고 개새끼야라고 욕을 했는데 저도 같이 욕을 했습니다. 에바밥바밥ㅂ라리릴리리ㅣ 안녕 클레오파트라. 세상에서 제일가는 포테이토 칩. 그래서 제가 물을 마셨어요. 근데 물이 맛이 없어. 물이름은 평창수. 내 자취방 물도 맛이 없어ㅠㅠ 맛있는 물 먹고싶어" } - const answers = [ { name: "박지수", @@ -80,25 +77,13 @@ export default class QaAnswer extends Component { this._loadFonts(); } - - - render() { - - + render() { if (!this.state.fontsLoaded) { return ; } return ( - - - {this.props.navigation.navigate('Home')}} >LAWBOT - - - +
this.props.navigation.navigate('QaWrite')} > @@ -186,29 +171,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, - - - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, bottom: { flex: 1, diff --git a/app/screens/QaLawyer.js b/app/screens/QaLawyer.js index a8a57f0..ae54e34 100644 --- a/app/screens/QaLawyer.js +++ b/app/screens/QaLawyer.js @@ -17,7 +17,9 @@ import * as MediaLibrary from "expo-media-library"; import * as ImageManipulator from "expo-image-manipulator"; import Constants from "expo-constants"; import * as DocumentPicker from 'expo-document-picker'; + import colors from "../config/colors"; +import Header from "./Header.js"; const questions = [ { @@ -105,14 +107,7 @@ export default class QaLawyer extends Component { } return ( - - - {this.props.navigation.navigate('Home')}} >LAWBOT - - +
{/* body */} @@ -254,15 +249,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, searchSection:{ alignItems:"center", @@ -298,20 +284,6 @@ const styles=StyleSheet.create({ marginTop: -7, borderRadius: 30 }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, - - // News myNews: { diff --git a/app/screens/QaUser.js b/app/screens/QaUser.js index ca44628..55f15e5 100644 --- a/app/screens/QaUser.js +++ b/app/screens/QaUser.js @@ -20,7 +20,9 @@ import * as MediaLibrary from "expo-media-library"; import * as ImageManipulator from "expo-image-manipulator"; import Constants from "expo-constants"; import * as DocumentPicker from 'expo-document-picker'; + import colors from "../config/colors"; +import Header from "./Header.js"; import { MyContext } from '../../context.js'; @@ -206,14 +208,7 @@ export default class QaUser extends Component { } return ( - - - {this.props.navigation.navigate('Home')}} >LAWBOT - - +
{/* 글쓰기 버튼!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */} @@ -422,15 +417,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, searchSection:{ alignItems:"center" @@ -462,19 +448,6 @@ const styles=StyleSheet.create({ borderRadius: 30 }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, - writingButton: { position: "absolute", bottom: 0, diff --git a/app/screens/QaWrite.js b/app/screens/QaWrite.js index 03633cd..75ec2ad 100644 --- a/app/screens/QaWrite.js +++ b/app/screens/QaWrite.js @@ -17,6 +17,7 @@ import * as DocumentPicker from 'expo-document-picker'; import { MyContext } from '../../context.js'; import colors from "../config/colors"; +import Header from "./Header.js"; import { ScrollView } from 'react-native-gesture-handler'; const categories=[ @@ -76,14 +77,7 @@ export default class QaWrite extends Component { } return ( - - - {this.props.navigation.navigate("Home")}} >LAWBOT - - +
@@ -171,28 +165,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, - - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, title: { fontSize: 18, diff --git a/app/screens/QnA.js b/app/screens/QnA.js deleted file mode 100644 index 2d8644f..0000000 --- a/app/screens/QnA.js +++ /dev/null @@ -1,469 +0,0 @@ -import React, { Component } from "react"; -import { - View, - StyleSheet, - TextInput, - KeyboardAvoidingView, - TouchableOpacity, - Text, - Dimensions, - ScrollView, - Keyboard, - Image, - Platform, - Modal -} from "react-native"; -import * as Font from "expo-font"; -import * as DocumentPicker from 'expo-document-picker'; -import colors from "../config/colors"; -import PDFReader from 'rn-pdf-reader-js'; -import Constants from "expo-constants"; -import * as Permissions from "expo-permissions"; -import { Camera } from "expo-camera"; -import * as MediaLibrary from "expo-media-library"; -import * as ImageManipulator from "expo-image-manipulator"; - -export default class QnA extends Component { - state = { - fontsLoaded: false, - word: "", - content:"", - section: "", - file: null, - field: "손해배상(자)", - purpose: "", - cause: "", - cameraPermission: false, - cameraRollPermission: false, - filename: "", - fieldSelectVisible: false, - - }; - - async _loadFonts() { - await Font.loadAsync({ - SCDream8: require("../assets/fonts/SCDream8.otf"), - KPWDBold: require("../assets/fonts/KPWDBold.ttf"), - KPBRegular: require("../assets/fonts/KoPubBatang-Regular.ttf"), - }); - this.setState({ fontsLoaded: true }); - } - - componentDidMount() { - this._loadFonts(); - } - - async selectfile() { - let result = await DocumentPicker.getDocumentAsync({ type: "application/pdf" }); - this.setState({ file: result }); - this.setState({filename: result.name}); - console.log(this.state.filename) - } - - - componentDidMount() { - this._loadFonts(); - BackHandler.addEventListener('hardwareBackPress', this.handleBackButton); - } - - - - register(){ - Keyboard.dismiss(); - console.log(this.state.word); - } - - section(){ - - } - - overlayClose() { - this.setState({fieldSelectVisible: false}); - } - - componentDidMount() { - this._loadFonts(); - } - - render() { - if (!this.state.fontsLoaded) { - return ; - } - - return ( - - - - LAWBOT - - - - this.setState({ word })} - value={this.state.word} - /> - - - - - - this.setState({ content })} - value={this.state.content}/> - - - - - - this.setState({fieldSelectVisible: true})}> - 분야 설정 - - - - - - {this.state.field} - - - - - - - - - this.selectfile()} - > - 파일 첨부 - - - - {this.state.filename} - - - - - - - - - - this.register()} - > - 질문 등록하기 - - - this.overlayClose()} transparent={true} animationType={"fade"}> - - - - 분야선택 - {this.setState({field: "손해배상(기)"}); this.overlayClose();}}> - 기타 분야 - - - - - {this.setState({field: "손해배상(자)"}); this.overlayClose();}}> - - - 자동차 - - - {this.setState({field: "손해배상(산)"}); this.overlayClose();}}> - - - 산업재해 - - - {this.setState({field: "손해배상(환)"}); this.overlayClose();}}> - - - 환경 - - - {this.setState({field: "손해배상(언)"}); this.overlayClose();}}> - - - 언론보도 - - - - - {this.setState({field: "손해배상(지)"}); this.overlayClose();}}> - - - 지식재산권 - - - {this.setState({field: "손해배상(의)"}); this.overlayClose();}}> - - - 의료 - - - {this.setState({field: "손해배상(건)"}); this.overlayClose();}}> - - - 건설 - - - {this.setState({field: "손해배상(국)"}); this.overlayClose();}}> - - - 국가 - - - - this.overlayClose()}> - 취소 - - - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - marginTop: Platform.OS === `ios` ? 0 : Expo.Constants.statusBarHeight, - overflow: "hidden", - backgroundColor: "#fff", - }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, - - QnAButton: { - alignItems: "center", - backgroundColor: "#fff", - borderRadius: 5, - padding: 5, - marginBottom: 20, - width: "20%", - borderColor: colors.primary, - borderWidth: 2, - minHeight: 5, - marginHorizontal:20, - marginLeft:50 - }, - QnAButtonText: { - color: colors.primary, - fontFamily: "KPWDBold", - }, - QnAButtonContainer: { - flexDirection: "row", - justifyContent: "flex-start", - alignItems: "center", - }, - - registerButton: { - alignItems: "center", - backgroundColor: "#fff", - borderRadius: 5, - padding: 5, - marginBottom: 70, - width: "77%", - borderColor: colors.primary, - borderWidth: 2, - minHeight: 5 - }, - registerButtonText: { - color: colors.primary, - fontFamily: "KPWDBold", - }, - registerButtonContainer: { - flexDirection: "row", - justifyContent: "center", - alignItems: "center", - }, - - - word: { - backgroundColor: "#F6F6F6", - borderRadius: 8, - padding: "3%", - marginHorizontal: 10, - alignSelf: "center", - width: "80%", - minHeight: 50, - }, - wordContainer: { - flex: 1, - flexDirection: "row", - justifyContent: "center", - alignItems: "center", - minHeight: 10, - padding: 5, - marginVertical:30 - }, - content: { - backgroundColor: "#F6F6F6", - width: "90%", - borderRadius: 8, - marginBottom: 5, - maxHeight: "100%", - padding: 5, - }, - contentContainer: { - flex: 1, - width: "100%", - padding: 30, - backgroundColor: "#fff", - justifyContent: "flex-start", - alignItems: "center", - }, - contentText: { - fontSize: 15, - textAlign: "center" - }, - - - field: { - fontFamily: "KPWDBold", - fontSize: 14, - marginLeft: "5%", - }, - fieldButton: { - width: 60, - height: 60, - backgroundColor: "#E7E7E7", - borderRadius: 30, - justifyContent: "center", - alignItems: "center" - }, - fieldButtonContainer: { - justifyContent: "center", - alignItems: "center" - }, - fieldContatiner: { - backgroundColor: "#F6F6F6", - flex: 1, - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingBottom: "3%", - height:"80", - width: "40", - marginRight:50, - borderRadius: 8, - - }, - fieldExcButton: { - position: "absolute", - top: 5, - right: 5, - width: "25%", - height: "55%", - justifyContent: "center", - alignItems: "center", - backgroundColor: colors.secondary - }, - fieldExcText: { - color: "#fff", - fontSize: 15, - fontFamily: "KPWDBold" - }, - fieldRow: { - flex: 5, - backgroundColor: "#fff", - width: "100%", - flexDirection: "row", - justifyContent: "space-around", - alignItems: "center" - }, - fieldImage: { - width: "60%", - height: "60%" - }, - fieldSelectCancel: { - backgroundColor: colors.primary, - justifyContent: "center", - alignItems: "center", - width: "80%", - height: "6%", - alignSelf: "center" - }, - fieldSelectCancelText: { - color: "#fff", - fontSize: 15, - fontFamily: "KPWDBold", - }, - fieldSelectContainer: { - height: "35%", - width: "80%", - backgroundColor: "#fff", - alignItems: "center", - alignSelf: "center", - paddingHorizontal: "2%", - paddingVertical: "3%" - }, - fieldSelectHeader: - { - flex: 2, - flexDirection: "row", - width: "100%", - justifyContent: "center" - }, - fieldSelectModal: { - flex: 1, - backgroundColor: 'rgba(52, 52, 52, 0.8)', - justifyContent: "center", - }, - fieldModalText: { - fontSize: 20, - fontFamily: "KPWDBold", - }, - fieldText: { - fontSize: 15, - fontFamily: "KPWDBold", - marginTop: 8 - }, - fileUpload: { - backgroundColor: colors.primary, - borderRadius: 6, - margin: "4%", - paddingVertical: 3, - paddingHorizontal: 5, - }, - fileUploadContainer: { - flexDirection: "row", - alignItems: "center", - }, - fileUploadGuide: { - margin: "5%", - fontSize: 12, - color: "#959595", - margin: "4%", - }, - fileUploadText: { - color: "#fff", - fontSize: 10, - }, - -}); \ No newline at end of file diff --git a/app/screens/QnaList.js b/app/screens/QnaList.js index fa7e958..5a0601d 100644 --- a/app/screens/QnaList.js +++ b/app/screens/QnaList.js @@ -16,6 +16,7 @@ import Constants from "expo-constants"; import { MyContext } from '../../context.js'; import colors from "../config/colors"; +import Header from "./Header.js"; export default class QnaList extends Component { state = { @@ -157,14 +158,7 @@ export default class QnaList extends Component { } return ( - - - {this.props.navigation.navigate("Home")}} >LAWBOT - - +
{/* QA bar */} 법률 QNA @@ -242,15 +236,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff", - }, searchSection:{ alignItems:"center" }, @@ -287,19 +272,6 @@ const styles=StyleSheet.create({ borderRadius: 30 }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, - nolist: { marginTop: 250, justifyContent: "center", diff --git a/app/screens/QnaView.js b/app/screens/QnaView.js index 6097607..8106990 100644 --- a/app/screens/QnaView.js +++ b/app/screens/QnaView.js @@ -17,6 +17,7 @@ import * as DocumentPicker from 'expo-document-picker'; import { MyContext } from '../../context.js'; import colors from "../config/colors"; +import Header from "./Header.js"; const question = { field: ["교통사고/범죄", "명예훼손/모욕", "폭행/협박"], @@ -90,14 +91,7 @@ export default class QaAnswer extends Component { } return ( - - - {this.props.navigation.navigate('Home')}} >LAWBOT - - +
this.props.navigation.navigate('QaWrite')} > @@ -186,29 +180,6 @@ const styles=StyleSheet.create({ marginTop: Platform.OS === `ios` ? 0 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, - - - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, bottom: { flex: 1, diff --git a/app/screens/SideMenu.js b/app/screens/SideMenu.js index e1d119e..c5e3249 100644 --- a/app/screens/SideMenu.js +++ b/app/screens/SideMenu.js @@ -4,35 +4,74 @@ import { View, StyleSheet, Image, - TextInput, - KeyboardAvoidingView, TouchableOpacity, - SafeAreaView, - Alert, - ToastAndroid, Platform, - AsyncStorage, + AsyncStorage } from "react-native"; import * as Font from "expo-font"; import Constants from "expo-constants"; import colors from "../config/colors"; +import { ScrollView } from "react-native-gesture-handler"; +import { MyContext } from '../../context.js'; export default class SideMenu extends Component { state = { fontsLoaded: false, + token: '', + user: {}, }; async _loadFonts() { await Font.loadAsync({ SCDream8: require("../assets/fonts/SCDream8.otf"), KPWDBold: require("../assets/fonts/KPWDBold.ttf"), + KPWDMedium: require("../assets/fonts/KPWDMedium.ttf") }); this.setState({ fontsLoaded: true }); } - componentDidMount() { + async componentDidMount() { this._loadFonts(); + + const ctx = this.context; + await fetch(`${ctx.API_URL}/user`, { + method: "GET", + headers: { + // 'Content-Type': 'multipart/form-data', + // 'Accept': 'application/json', + 'token': ctx.token, + }, + }).then((result) => { + return result.json(); + }).then((result) => { + this.setState({ token: ctx.token, user: result }); + }); + } + + async componentDidUpdate() { + const ctx = this.context; + if(this.state.token != ctx.token && ctx.token != '') { + await fetch(`${ctx.API_URL}/user`, { + method: "GET", + headers: { + // 'Content-Type': 'multipart/form-data', + // 'Accept': 'application/json', + 'token': ctx.token, + }, + }).then((result) => { + return result.json(); + }).then((result) => { + this.setState({ token: ctx.token, user: result }); + }); + } + } + + async logout() { + await AsyncStorage.clear(); + const ctx = this.context; + ctx.updateToken(""); + this.props.navigation.navigate("WelcomeScreen"); } render() { @@ -42,16 +81,173 @@ export default class SideMenu extends Component { return ( - + + this.props.navigation.closeDrawer()}> + + + + + + {this.state.user.name} + + {this.state.user.lawyer == 0 ? 일반회원 : 변호사} + {'\u2B24'} + this.logout()}> + 로그아웃 + + + + + + + + 즐겨찾기 + this.props.navigation.navigate("Home")}> + + 판례 즐겨찾기 + + this.props.navigation.navigate("Home")}> + + 변호사 즐겨찾기 + + this.props.navigation.navigate("Home")}> + + Q&A 즐겨찾기 + + + + + 게시판 관리 + this.props.navigation.navigate("Home")}> + + 내가 쓴 글 + + this.props.navigation.navigate("Home")}> + + 댓글 단 글 + + this.props.navigation.navigate("Home")}> + + 스크랩 + + + + + Q&A 관리 + {this.state.user.lawyer == 0 ? + this.props.navigation.navigate("Home")}> + + 내가 업로드한 질문 + : + this.props.navigation.navigate("Home")}> + + 내가 답변한 질문 + + } + + ); } } +SideMenu.contextType = MyContext; const styles = StyleSheet.create({ container: { - flex: 1, - marginTop: Platform.OS === `ios` ? 1 : Constants.statusBarHeight, - backgroundColor: "#fff", - }, + flex: 1, + marginTop: Platform.OS === `ios` ? 1 : Constants.statusBarHeight, + backgroundColor: "#fff", + }, + + userContainer: { + height: "20%", + backgroundColor: "#F6F6F6", + padding: 20 + }, + close: { + width: 20, + height: 20, + }, + user: { + // paddingHorizontal: 30, + flexDirection: "row", + justifyContent: "center", + alignItems: "center", + marginTop: 10, + }, + userImage: { + width: 80, + height: 80, + borderRadius: 40, + }, + userProfile: { + marginLeft: 20, + }, + userName: { + fontSize: 25, + fontFamily: "KPWDBold", + }, + userProfileCont: { + flexDirection: "row", + }, + userCert: { + fontSize: 12, + fontFamily: "KPWDMedium", + color: "#8D8D8D", + }, + boardContentBullet: { + fontSize: 4, + alignSelf:"center", + marginHorizontal: 10, + color: "#8D8D8D" + }, + logoutButton: { + backgroundColor: colors.primary, + paddingVertical: 2, + paddingHorizontal: 5, + borderRadius: 15, + }, + logoutButtonText: { + fontSize: 10, + fontFamily: "KPWDMedium", + color: "#fff" + }, + + title: { + fontFamily: "KPWDBold", + fontSize: 16, + }, + subTitle: { + fontFamily: "KPWDBold", + fontSize: 14, + marginLeft: 20, + }, + favImage: { + width: 20, + height: 20, + }, + bar: { + marginTop: 20, + borderWidth: 1, + borderColor: "#ECECEC", + width: "98%", + alignSelf: "center" + }, + naviContainer: { + marginTop: 10, + marginLeft: 30, + flexDirection: "row", + }, + contentContainer: { + }, + favoriteContainer: { + padding: 30, + paddingBottom: 0, + }, + + boardContainer: { + padding: 30, + paddingBottom: 0, + } + }); diff --git a/app/screens/SimilarCaseAnalysis.js b/app/screens/SimilarCaseAnalysis.js index d4c8e2e..e100c83 100644 --- a/app/screens/SimilarCaseAnalysis.js +++ b/app/screens/SimilarCaseAnalysis.js @@ -11,7 +11,9 @@ import { import * as Font from "expo-font"; import Constants from "expo-constants"; + import colors from "../config/colors"; +import Header from "./Header.js"; export default class SimilarCaseAnalysis extends Component { state = { @@ -79,14 +81,7 @@ export default class SimilarCaseAnalysis extends Component { return ( - - - {this.props.navigation.navigate("Home")}}>LAWBOT - - +
유사 판례 분석 @@ -234,27 +229,6 @@ const styles = StyleSheet.create({ marginTop: Platform.OS === `ios` ? 1 : Constants.statusBarHeight, backgroundColor: "#fff", }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff", - }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, title:{ fontFamily: "KPWDBold", fontSize: 18, diff --git a/app/screens/TerminologyExplanation.js b/app/screens/TerminologyExplanation.js index 4123e74..0bc64c5 100644 --- a/app/screens/TerminologyExplanation.js +++ b/app/screens/TerminologyExplanation.js @@ -18,7 +18,7 @@ import PDFReader from 'rn-pdf-reader-js'; import { parse } from 'node-html-parser'; import colors from "../config/colors"; -import { DrawerContentScrollView } from "@react-navigation/drawer"; +import Header from "./Header.js"; export default class TerminologyExplanation extends Component { state = { @@ -174,14 +174,7 @@ export default class TerminologyExplanation extends Component { return ( - - - {this.props.navigation.navigate("Home")}}>LAWBOT - - +
@@ -243,27 +236,6 @@ const styles = StyleSheet.create({ width: "100%", height: "100%", }, - header: { - backgroundColor: "#fff", - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, - profile: { - width: 20, - height: 20, - }, terminologyButton: { alignItems: "center", backgroundColor: "#fff", diff --git a/app/screens/WelcomeScreen.js b/app/screens/WelcomeScreen.js index dc359d6..1171f01 100644 --- a/app/screens/WelcomeScreen.js +++ b/app/screens/WelcomeScreen.js @@ -105,6 +105,7 @@ export default class WelcomeScreen extends Component { ref={(input) => { this.secondTextInput = input; }} onSubmitEditing={() => this.loginEvent()} returnKeyType="done" + secureTextEntry={true} /> - - - {this.props.navigation.navigate("Home")}}>LAWBOT - - +
{this.state.field} @@ -560,23 +558,6 @@ const styles = StyleSheet.create({ color: "#fff", fontSize: 10, }, - header: { - flexDirection: "row", - justifyContent: "space-between", - alignItems: "center", - paddingLeft: "5%", - paddingRight: "5%", - minHeight: 50, - backgroundColor: "#fff" - }, - logoTitle: { - fontSize: 20, - fontFamily: "SCDream8", - }, - menu: { - width: 20, - height: 20, - }, // person: { // fontSize: 15, // fontFamily: "KPBRegular", @@ -635,10 +616,6 @@ const styles = StyleSheet.create({ paddingVertical: "0.5%", marginHorizontal: 20, }, - profile: { - width: 20, - height: 20, - }, purpose: { backgroundColor: "#F6F6F6", borderRadius: 8, diff --git a/context.js b/context.js index 141a467..286ceae 100644 --- a/context.js +++ b/context.js @@ -1,7 +1,7 @@ import React from 'react'; export const LOCAL_URL = 'http://localhost:8080'; -export const PRODUCTION_URL = `http://api.lawbotc.kr`; +export const PRODUCTION_URL = `https://api.lawbotc.kr`; export const MyContext = React.createContext({ API_URL: PRODUCTION_URL, diff --git a/package-lock.json b/package-lock.json index 838de30..968541d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4060,6 +4060,16 @@ "resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz", "integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=" }, + "iamport-react-native": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/iamport-react-native/-/iamport-react-native-1.5.2.tgz", + "integrity": "sha512-b2F3qqp/5lnzjgS+kS4ub1veYqiL9+2SU+b6zXBWIder3k9szhzY+insQM9v3yBHXVOGUs52cArclvTvIXI+GQ==", + "requires": { + "prop-types": "^15.6.2", + "query-string": "^6.1.0", + "react-native-webview": ">=7.4.0" + } + }, "iconv-lite": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz", @@ -7053,6 +7063,11 @@ } } }, + "react-navigation-drawer": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-2.6.0.tgz", + "integrity": "sha512-GvHHqH8Aw9yRpJ0xc/7sPxRoGs0CZu/01THRfwY+qzrP3mP/V0GeFnL5Y2+EFd5SLrKjbQho8GmP9SEX7xVrig==" + }, "react-redux": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.1.tgz", diff --git a/package.json b/package.json index 409828a..0856c15 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "expo-permissions": "^9.3.0", "expo-print": "^9.1.0", "expo-status-bar": "~1.0.2", + "iamport-react-native": "^1.5.2", "node-html-parser": "^1.3.1", "react": "16.13.1", "react-dom": "16.13.1", @@ -45,6 +46,7 @@ "react-native-web": "~0.13.12", "react-native-webview": "^10.9.2", "react-navigation": "^4.4.2", + "react-navigation-drawer": "^2.6.0", "react-redux": "^7.2.1", "rn-fetch-blob": "^0.12.0", "rn-pdf-reader-js": "^4.1.1",