diff --git a/react-native/components/BottomDrawer.tsx b/react-native/components/BottomDrawer.tsx index 41d77e4..7bc113a 100644 --- a/react-native/components/BottomDrawer.tsx +++ b/react-native/components/BottomDrawer.tsx @@ -1,6 +1,6 @@ -import React, { useState, useEffect, useRef } from 'react'; +import React, { useState, useEffect } from 'react'; import { StyleSheet, Dimensions, View, TouchableOpacity, TouchableHighlight, ScrollView, Alert, Linking } from 'react-native'; -import { MaterialIcons, FontAwesome } from '@expo/vector-icons'; +import { MaterialIcons } from '@expo/vector-icons'; import { Popover, Button, Text, Modal, FormControl, Input, VStack, Select, CheckIcon, AlertDialog } from 'native-base'; import { theme } from '../core/theme'; import type { BottomDrawerProps, EventForm, ResultsForm, UserData } from '../types'; @@ -128,63 +128,11 @@ function BottomDrawer(props: BottomDrawerProps) { - {props.showKorean ? i18n.t('korean') : i18n.t('results')} + {props.showKorean ? i18n.t('korean') : i18n.t('translation')} - + - {props.isTranslateScreen && props.handleOpenSaveForm && - <> - - - - - - - {i18n.t('saveResults')} - - - - {i18n.t('child')} - - - - Title - setResultsForm({...resultsForm, ['title']: text})} - /> - - {i18n.t('helpertext')} - - - - - - - - - - - - - - } @@ -331,13 +279,62 @@ function BottomDrawer(props: BottomDrawerProps) { {props.isTranslateScreen && - - {i18n.t('close')} + + {i18n.t('retake')} - - {i18n.t('tryAgain')} - + {props.handleOpenSaveForm && + <> + + {i18n.t('save')} + + + + + {i18n.t('saveResults')} + + + + {i18n.t('child')} + + + + Title + setResultsForm({...resultsForm, ['title']: text})} + /> + + {i18n.t('helpertext')} + + + + + + + + + + + + + + } } @@ -392,9 +389,6 @@ const styles = StyleSheet.create({ highlighted: { backgroundColor: theme.colors.skyblue }, - rightSpace: { - paddingRight: 8 - }, full: { paddingBottom: 96 }, diff --git a/react-native/locales/en.js b/react-native/locales/en.js index 57a26f0..9237d88 100644 --- a/react-native/locales/en.js +++ b/react-native/locales/en.js @@ -8,6 +8,7 @@ export default { start: 'Start NotiNote', /* Home */ translate: 'Translate', + translation: 'Translation', translateDesc: 'Translation and calendar registration are all possible just by taking a picture of the notice.', search: 'Search', searchDesc: 'You can find notices you have translated.', @@ -68,7 +69,7 @@ export default { tip_1: 'You can save the results and check them on the search screen!', registerFailed: 'Failed to add event. Please try again.', authFailed: "Authentication failed. Please try again.", - tryAgain: 'Try Again', + retake: 'Retake', join: 'Join', searchResult: "Search Result", noEvent: "There is no event today!" diff --git a/react-native/locales/ja.js b/react-native/locales/ja.js index 13bf367..4f1e25c 100644 --- a/react-native/locales/ja.js +++ b/react-native/locales/ja.js @@ -6,6 +6,7 @@ export default { swipe: 'スワイプして続行します ≫', start: 'NotiNoteを起動します', translate: '翻訳', + translation: '翻訳文', translateDesc: '通知の写真を撮るだけで、翻訳やカレンダー登録が可能です。', search: '検索', searchDesc: 'あなたが翻訳した通知を見つけることができます。', @@ -62,7 +63,7 @@ export default { gotIt: '了解しました', registerFailed: 'イベントの追加に失敗しました。 もう一度やり直してください。', authFailed: "認証に失敗しました。もう一度やり直してください。", - tryAgain: '再試行', + retake: '再撮影', join: '参加', searchResult: "検索結果", noEvent: "今日はイベントはありません!" diff --git a/react-native/locales/km.js b/react-native/locales/km.js index 04dd827..dcea50c 100644 --- a/react-native/locales/km.js +++ b/react-native/locales/km.js @@ -6,6 +6,7 @@ export default { swipe: 'អូសដើម្បីបន្ត ≫', start: 'ចាប់ផ្តើម NotiNote', translate: 'បកប្រែ', + translation: 'ការបកប្រែ', translateDesc: 'ការបកប្រែ និងការចុះឈ្មោះប្រតិទិនគឺអាចធ្វើទៅបានដោយគ្រាន់តែថតរូបការជូនដំណឹង។', search: 'ស្វែងរក', searchDesc: 'អ្នកអាចស្វែងរកការជូនដំណឹងដែលអ្នកបានបកប្រែ។', @@ -62,7 +63,7 @@ export default { gotIt: 'យល់ហើយ', registerFailed: 'បានបរាជ័យក្នុងការបន្ថែមព្រឹត្តិការណ៍។ សូម​ព្យាយាម​ម្តង​ទៀត។', authFailed: "ការផ្ទៀងផ្ទាត់បានបរាជ័យ។ សូមព្យាយាមម្តងទៀត", - tryAgain: 'ព្យាយាមម្តងទៀត', + retake: 'បាញ់ឡើងវិញ', join: 'ចូលរួម', searchResult: "លទ្ធផលស្វែងរក", noEvent: "មិនមានព្រឹត្តិការណ៍ថ្ងៃនេះទេ!" diff --git a/react-native/locales/ko.js b/react-native/locales/ko.js index 46cc752..477ca6e 100644 --- a/react-native/locales/ko.js +++ b/react-native/locales/ko.js @@ -6,6 +6,7 @@ export default { swipe: '계속하려면 넘겨주세요 ≫', start: 'NotiNote 시작하기', translate: '번역', + translation: '번역문', translateDesc: '가정통신문을 사진으로 찍기만 하면 번역부터 캘린더 등록까지 모두 가능합니다.', search: '검색', searchDesc: '이전에 번역한 가정통신문을 검색할 수 있습니다.', @@ -61,7 +62,7 @@ export default { gotIt: '확인', registerFailed: '이벤트를 추가하지 못했습니다. 다시 시도해 주세요.', authFailed: "인증에 실패했습니다. 다시 시도하십시오.", - tryAgain: '다시 시도', + retake: '다시 촬영', join: '가입', searchResult: "검색 결과", noEvent: "오늘은 이벤트가 없어요!" diff --git a/react-native/locales/th.js b/react-native/locales/th.js index 50e880f..e03c82a 100644 --- a/react-native/locales/th.js +++ b/react-native/locales/th.js @@ -6,6 +6,7 @@ export default { swipe: 'ปัดเพื่อดำเนินการต่อ ≫', start: 'เริ่ม NotiNote', translate: 'แปล', + translation: 'การแปล', translateDesc: 'การแปลและการลงทะเบียนปฏิทินทำได้เพียงแค่ถ่ายรูปประกาศ', ค้นหา: 'ค้นหา', searchDesc: 'คุณสามารถค้นหาประกาศที่คุณแปลได้', @@ -62,7 +63,7 @@ export default { gotIt: 'เข้าใจแล้ว', registerFailed: 'ไม่สามารถเพิ่มเหตุการณ์ได้ กรุณาลองอีกครั้ง.', authFailed: "การตรวจสอบสิทธิ์ล้มเหลว โปรดลองอีกครั้ง", - tryAgain: 'ลองอีกครั้ง', + retake: 'ถ่ายใหม่', join: 'เข้าร่วม', searchResult: "ผลการค้นหา", noEvent: "วันนี้ไม่มีกิจกรรม!" diff --git a/react-native/locales/vn.js b/react-native/locales/vn.js index f650bbd..9772815 100644 --- a/react-native/locales/vn.js +++ b/react-native/locales/vn.js @@ -6,6 +6,7 @@ export default { swipe: 'Vuốt để tiếp tục ≫', start: 'Bắt ​​đầu NotiNote', translate: 'dịch', + translation: 'dịch', translateDesc: 'Bạn có thể làm mọi thứ từ dịch thuật đến đăng ký lịch chỉ bằng cách chụp ảnh thư từ tại nhà.', search: 'tìm kiếm', searchDesc: 'Bạn có thể tìm kiếm thư từ trong gia đình đã được dịch trước đây.', @@ -61,7 +62,7 @@ export default { gotIt: 'Đã hiểu', registerFailed: 'Không thêm được sự kiện. Vui lòng thử lại.', authFailed: "Xác thực không thành công. Vui lòng thử lại.", - tryAgain: 'Thử lại', + retake: 'chụp lại', join: 'Tham gia', searchResult: "Kết quả tìm kiếm", noEvent: "Không có sự kiện hôm nay!" diff --git a/react-native/locales/zh.js b/react-native/locales/zh.js index 66a7b99..f4b8e96 100644 --- a/react-native/locales/zh.js +++ b/react-native/locales/zh.js @@ -6,6 +6,7 @@ export default { swipe: '滑动继续≫', start: '启动 NotiNote', translate: '翻译', + translation: '翻译', translateDesc: '您只需拍摄家庭信件的照片即可完成从翻译到日历登记的所有工作。', search: '搜索', searchDesc: '您可以搜索以前翻译的家庭信件。', @@ -61,7 +62,7 @@ export default { gotIt: '得到它', registerFailed: '添加事件失败。 请再试一次。', authFailed: "验证失败,请重试。", - tryAgain: '再试一次', + retake: '重拍', join: '加入', searchResult: "搜索结果", noEvent: "今天没有活动!" diff --git a/react-native/screens/TranslateScreen.tsx b/react-native/screens/TranslateScreen.tsx index 7d79b05..d84e173 100644 --- a/react-native/screens/TranslateScreen.tsx +++ b/react-native/screens/TranslateScreen.tsx @@ -111,6 +111,7 @@ export default function TranslateScreen({ navigation }: Navigation) { const extractText = async(): Promise => { if (imageUri) { + // console.log(imageUri); let FormData = require('form-data'); const formdata = new FormData(); formdata.append("uploadfile", { @@ -119,6 +120,8 @@ export default function TranslateScreen({ navigation }: Navigation) { name: imageUri.split("/").pop() }); + console.log('ocr',formdata); + setLoading(true); if (auth?.authData?.jwt_token) { @@ -147,25 +150,6 @@ export default function TranslateScreen({ navigation }: Navigation) { } }); } - // TEST: mockup data -// setResults({ -// fullText: [ -// {id: 1, content: "1. Schedule of the closing ceremony and diploma presentation ceremony: Friday, January 4, 2019 at 9 o'clock for students to go to school.\n1) ", date: "", highlight: false, registered: false}, -// {id: 2, content: "Closing ceremony", date: "2022-01-04", highlight: true, registered: false}, -// {id: 3, content: ": 1st and 2nd graders, each classroom, 9:00-10:50 (no meals)\n2) ", date: "", highlight: false, registered: false}, -// {id: 4, content: "Diploma representation ceremony", date: "2022-01-04", highlight: true, registered: true}, -// {id: 5, content: ": 3rd grade, multi-purpose auditorium (2nd floor), 10:30-12:20\n2. School opening and entrance ceremony for new students: March 4th (Mon), 2019 at 9 o'clock for students to go to school.", date: "", highlight: false, registered: false}, -// ], -// korean: "가정통신문\n예당중학교\n8053-8388\n꿈은 크게. 마음은 넘게·\n행동은 바르게\n학부모님께\n희망찬 새해를 맞이하며 학부모님 가정에 건강과 행운이 함께 하시기를 기원 드립니다.\n드릴 말씀은, 2018학년도 종업식 및 졸업장 수여식과 2019학년도 개학 및 신입생 입학식을 다음과 같이 안내드리오니, 이후 3월 개학 때까지 학생들이 자기주도 학습 능력을 배양하고 다양한 체험 활동을 통하여 심신이 건강해지며 각종 유해 환경에 노출되지 않고 안전하고 줄거운 시간이 되도록 지도해 주시기 바랍니다.\n\ -// 1. 종업식 및 졸업장 수여식 일정 : 2019년 1월 4일(금), 학생 등교 9시\n\ -// 1) 종업식 : 1· 2학년, 각 교실, 9:00-10:50 (급식 없음)\n\ -// 2) 졸업장 수여식 : 3학년, 다목적 강당(2층), 10:30~12:20\n\ -// 2. 개학 및 신입생 입학식 : 2019년 3월 4일(월), 학생 등교 9시\n\ -// 1) 3월 4일 일정 : 월요일 정상수업 (급식 실시)\n\ -// (준비물: 교과서, 노트, 필기도구. 학생용 실내화(흰색) 등)\n\ -// 2) 신입생 입학식 : 다목적 강당(2층) 10시 30분, 신입생 등교 9시(신반 교실로 입장)\n", -// trans_full: '' -// }) } } @@ -193,14 +177,23 @@ export default function TranslateScreen({ navigation }: Navigation) { type: mime.getType(imageUri), name: imageUri.split("/").pop() }); - // formdata.append('noticeRequestDTO', new Blob([JSON.stringify(data)], {type: 'application/json'})); - formdata.append('cid', form?.cid); - formdata.append('title', form?.title); - formdata.append('date', new Date().toISOString().slice(0, 10)); - formdata.append('korean', results?.korean); - formdata.append('trans_full', results?.trans_full); + let data = { + cid: form?.cid, + title: form?.title, + date: new Date().toISOString().slice(0, 10), + korean: results?.korean, + fullText: results?.trans_full + } + formdata.append("noticeRequestDto", JSON.stringify(data)); + // formdata.append('noticeRequestDto', new Blob([JSON.stringify(data)], {type: 'application/json'})); + + // formdata.append('cid', form?.cid); + // formdata.append('title', form?.title); + // formdata.append('date', new Date().toISOString().slice(0, 10)); + // formdata.append('korean', results?.korean); + // formdata.append('trans_full', results?.trans_full); - console.log(formdata); + // console.log(formdata); if (auth?.authData?.jwt_token) { fetch('http://localhost:8080/notice/save', { @@ -247,43 +240,46 @@ export default function TranslateScreen({ navigation }: Navigation) { {imageUri ? ( /* After taking a picture and press the check button */ results?.fullText && results?.korean ? ( - - - } - itemFull={ - - } - onShowMini={() => setFullDrawer(false)} - onShowFull={() => setFullDrawer(true)} - animation="easeInEaseOut" - disableSwipeIcon - extraMarginTop={10} - swipeHeight={Dimensions.get('window').height*0.5} - /> + + + + } + itemFull={ + + } + onShowMini={() => setFullDrawer(false)} + onShowFull={() => setFullDrawer(true)} + animation="easeInEaseOut" + disableSwipeIcon + extraMarginTop={10} + swipeHeight={Dimensions.get('window').height*0.65} + /> + + ) : ( /* After taking a picture, before OCR(pressing the check button) */ @@ -324,6 +320,7 @@ export default function TranslateScreen({ navigation }: Navigation) { + )} @@ -373,5 +370,9 @@ const styles = StyleSheet.create({ height: 56, width: 56, borderWidth: 2 + }, + backdrop: { + flex: 1, + backgroundColor: 'rgba(0,0,0, 0.60)' } });