Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…olutionChallenge into feature/search
  • Loading branch information
hee-suh committed May 30, 2022
2 parents fe6a681 + b14d463 commit a07a734
Show file tree
Hide file tree
Showing 55 changed files with 1,193 additions and 777 deletions.
37 changes: 37 additions & 0 deletions fastapi/translated_events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
event_list = ["졸업식", "종업식", "소풍", "입학식", "수학여행", "현장체험학습", "방학식", "겨울방학", "여름방학", "봄방학", "개학", "전시회", "실기대회",
"미술대회", "수학올림피아드", "과학올림피아드", "신체검사", "예방접종", "수련회", "운동회", "견학", "답사", "민방위", "소방훈련", "개교기념일", "축제",
"졸업장 수여식"]
event_list_en = ["Graduation Ceremony", "Closing Ceremony", "Excursion", "Entrance Ceremony", "School Trip",
"Field Experience Study", "Vacation", "Winter Vacation", "Summer Vacation", "Spring Break",
"Opening Ceremony", "Exhibition", "Practical Competition", "Art Competition",
"Mathematics Olympiad", "Science Olympiad", "Physical Examination", "Vaccination", "Retreat",
"Sports Day", "Field Trip", "Exploration", "Civil defense", "Fire drill", "Anniversary of school",
"Festival", "Diploma Award Ceremony"]
event_list_th = ["พิธีสำเร็จการศึกษา", "พิธีปิด", "ทัศนศึกษา", "พิธีรับเข้าเรียน", "ทัศนศึกษา",
"การศึกษาประสบการณ์ภาคสนาม",
"พิธีเช้า", "วันหยุดฤดูหนาว", "วันหยุดฤดูร้อน", "วันหยุดฤดูใบไม้ผลิ", "โรงเรียนเริ่มต้น", "นิทรรศการ",
"การแข่งขันภาคปฏิบัติ", "การประกวดศิลปะ", "คณิตศาสตร์โอลิมปิก", "วิทยาศาสตร์โอลิมปิก",
"การตรวจร่างกาย",
"การฉีดวัคซีน", "หนี", "วันกีฬาสี", "ทัศนศึกษา", "สำรวจ", "ป้องกันภัยพลเรือน", "ซ้อมดับเพลิง",
"ครบรอบโรงเรียน",
"เทศกาล", "พิธีรับปริญญา"]
event_list_km = ["ពិធីចែកសញ្ញាបត្រ", "ពិធីបិទ", "ដំណើរកំសាន្ត", "ពិធីចូលរៀន", "ការធ្វើដំណើរសាលា", "ការសិក្សាបទពិសោធន៍",
"ពិធីអាហារពេលព្រឹក", "វិស្សមកាលរដូវរងារ", "វិស្សមកាលរដូវក្តៅ", "សម្រាកនិទាឃរដូវ", "សាលាចាប់ផ្តើម",
"ការតាំងពិព័រណ៍",
"ការប្រកួតប្រជែងជាក់ស្តែង", "ការប្រកួតសិល្បៈ", "គណិតវិទ្យាអូឡាំពិក", "វិទ្យាសាស្ត្រអូឡាំព្យាដ",
"ការប្រឡងរាងកាយ",
"ការចាក់វ៉ាក់សាំង", "សម្រាក", "ទិវាកីឡា", "ការធ្វើដំណើរវាល។ ", "ការរុករក", "ការការពារស៊ីវិល",
"សមយុទ្ធអគ្គីភ័យ",
"ខួបនៃសាលារៀន", "ពិធីបុណ្យ", "ពិធីបញ្ចប់ការសិក្សា"]
event_list_vi = ["Lễ tốt nghiệp", "Lễ tổng kết", "Chuyến tham quan", "Lễ nhập học", "Chuyến đi học",
"Nghiên cứu trải nghiệm thực tế", "Lễ ăn sáng", "Kỳ nghỉ đông", "Kỳ nghỉ hè", "Kỳ nghỉ xuân",
"Khai giảng", "Triển lãm", "Cuộc thi thực hành", "Cuộc thi nghệ thuật", "Olympic Toán học",
"Olympic Khoa học", "Kiểm tra thể chất", "Tiêm phòng", "Khóa tu", "Ngày hội thể thao",
"Chuyến dã ngoại ", " Khám phá ", " Phòng thủ dân sự ", " Diễn tập chữa cháy ",
" Lễ kỷ niệm thành lập trường ", " Lễ hội ", " Lễ tốt nghiệp "]
event_list_ja = ["卒業式", "従業式", "ピクニック", "入学式", "修学旅行", "現場体験学習", "方程式", "冬休み", "夏休み", "春休み",
"開校", "展示会", "実技大会", "美術大会", "数学オリンピアード", "科学オリンピアド", "身体検査", "予防接種",
"修練会", "運動会", "見学", "回答", "民防衛", "消防訓練", "開校記念日", "祭り", "卒業場授与式"]
event_list_zh = ["毕业典礼", "结业典礼", "远足", "入学典礼", "学校旅行", "实地体验学习", "早餐仪式", "寒假", "暑假", "春假",
"开学", "展览", "实践比赛", "艺术竞赛", "数学奥林匹克", "科学奥林匹克", "体格检查", "疫苗接种", "撤退",
"运动项目", "实地考察", "探索", "民防", "消防演习", "奠基日", "节日", "毕业典礼"]
19 changes: 15 additions & 4 deletions react-native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import JoinScreen from './screens/JoinScreen';
import HomeScreen from './screens/HomeScreen';
import TranslateScreen from './screens/TranslateScreen';
import SearchScreen from './screens/SearchScreen';
import LogoutButton from './components/LogoutButton';
import SearchResultScreen from './screens/SearchResultScreen';
import IntrodcutionScreen from './screens/IntroductionScreen'

Expand Down Expand Up @@ -76,10 +75,8 @@ export default function App() {
component={HomeScreen}
options={{
headerStyle: { backgroundColor: theme.colors.primary },
title: "NotiNote",
title: "Home",
headerBackVisible: false,
headerRight: () => <LogoutButton/>,

headerTitle: (props) => ( // App Logo
<Image
style={{ width: 90, height: 50 }}
Expand All @@ -96,6 +93,13 @@ export default function App() {
title: i18n.t('translate'),
headerStyle: { backgroundColor: theme.colors.primary },
headerTintColor: '#fff',
headerTitle: (props) => ( // App Logo
<Image
style={{ width: 90, height: 50 }}
source={require('./assets/images/notinote-icon-white.png')}
resizeMode='contain'
/>
),
}}
/>
<Stack.Screen
Expand All @@ -105,6 +109,13 @@ export default function App() {
title: i18n.t('search'),
headerStyle: { backgroundColor: theme.colors.primary },
headerTintColor: '#fff',
headerTitle: (props) => ( // App Logo
<Image
style={{ width: 90, height: 50 }}
source={require('./assets/images/notinote-icon-white.png')}
resizeMode='contain'
/>
),
}}
/>
<Stack.Screen
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added react-native/assets/images/no-event.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 60 additions & 66 deletions react-native/components/BottomDrawer.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -79,12 +79,12 @@ function BottomDrawer(props: BottomDrawerProps) {
}

const addEvent = () => {
if (auth?.authData?.jwt_token && eventForm) {
if (auth?.authData?.access_token && eventForm) {
console.log(eventForm, currentEvent);
fetch(`http://localhost:8080/event/register?id=${currentEvent}`, {
method: 'PUT',
headers: {
'JWT_TOKEN': auth.authData.jwt_token,
'ACCESS-TOKEN': auth.authData.access_token,
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify(eventForm),
Expand Down Expand Up @@ -128,63 +128,11 @@ function BottomDrawer(props: BottomDrawerProps) {
<View style={{ flex: 1 }}>
<View style={styles.horizontalLine} />
<View style={[styles.spaceBetween, { paddingBottom: 24 }]}>
<Text fontFamily="heading" fontWeight={700} fontStyle="normal" fontSize='2xl' color="primary.500">{props.showKorean ? i18n.t('korean') : i18n.t('results')}</Text>
<Text fontFamily="heading" fontWeight={700} fontStyle="normal" fontSize='2xl' color="primary.500">{props.showKorean ? i18n.t('korean') : i18n.t('translation')}</Text>
<View style={styles.alignRow}>
<TouchableOpacity style={styles.rightSpace} onPress={props.handleKorean}>
<TouchableOpacity onPress={props.handleKorean}>
<MaterialIcons name="translate" size={32} color="#000"/>
</TouchableOpacity>
{props.isTranslateScreen && props.handleOpenSaveForm &&
<>
<TouchableOpacity onPress={props.handleOpenSaveForm}>
<FontAwesome name="save" size={32} color='#000' />
</TouchableOpacity>
<Modal isOpen={props.openSaveForm} onClose={props.handleOpenSaveForm}>
<Modal.Content maxWidth="400px">
<Modal.CloseButton />
<Modal.Header>{i18n.t('saveResults')}</Modal.Header>
<Modal.Body>
<VStack space={2}>
<FormControl>
<FormControl.Label>{i18n.t('child')}</FormControl.Label>
<Select selectedValue={resultsForm?.cid.toString()} accessibilityLabel="Child" onValueChange={itemValue => {
setResultsForm({...resultsForm, ['cid']: Number(itemValue)})
}} _selectedItem={{
bg: "skyblue.500",
endIcon: <CheckIcon size={3} />
}}>
{/* Country code 3 digit ISO */}
{user?.uchildren?.map((child, index) =>
child?.cname && child?.cid &&
<Select.Item key={'cs_'+index} label={child?.cname} value={child?.cid.toString()} />
)}
</Select>
</FormControl>
<FormControl>
<FormControl.Label>Title</FormControl.Label>
<Input
value={resultsForm['title']}
onChangeText={(text) => setResultsForm({...resultsForm, ['title']: text})}
/>
<FormControl.HelperText>
{i18n.t('helpertext')}
</FormControl.HelperText>
</FormControl>
</VStack>
</Modal.Body>
<Modal.Footer>
<Button.Group space={2}>
<Button variant="ghost" colorScheme="blueGray" onPress={props.handleOpenSaveForm}>
{i18n.t('cancel')}
</Button>
<Button onPress={() => props?.saveResults && props.saveResults(resultsForm)}>
{i18n.t('save')}
</Button>
</Button.Group>
</Modal.Footer>
</Modal.Content>
</Modal>
</>
}
</View>
</View>

Expand Down Expand Up @@ -331,13 +279,62 @@ function BottomDrawer(props: BottomDrawerProps) {
</View>
{props.isTranslateScreen &&
<View style={[styles.spaceBetween, props.isFullDrawer && styles.full ]}>
<TouchableHighlight style={[styles.regularButton, styles.grayBackground]} onPress={props.closeResults}>
<Text color="white">{i18n.t('close')}</Text>
<TouchableHighlight style={[styles.regularButton, styles.grayBackground]} onPress={props.retakePicture}>
<Text color="white">{i18n.t('retake')}</Text>
</TouchableHighlight>
<View style={styles.gap} />
<TouchableHighlight style={[styles.regularButton, styles.primaryBackground]} onPress={props.retakePicture}>
<Text color="white">{i18n.t('tryAgain')}</Text>
</TouchableHighlight>
{props.handleOpenSaveForm &&
<>
<TouchableHighlight style={[styles.regularButton, styles.primaryBackground]} onPress={props.handleOpenSaveForm}>
<Text color="white">{i18n.t('save')}</Text>
</TouchableHighlight>
<Modal isOpen={props.openSaveForm} onClose={props.handleOpenSaveForm}>
<Modal.Content maxWidth="400px">
<Modal.CloseButton />
<Modal.Header>{i18n.t('saveResults')}</Modal.Header>
<Modal.Body>
<VStack space={2}>
<FormControl>
<FormControl.Label>{i18n.t('child')}</FormControl.Label>
<Select selectedValue={resultsForm?.cid.toString()} accessibilityLabel="Child" onValueChange={itemValue => {
setResultsForm({...resultsForm, ['cid']: Number(itemValue)})
}} _selectedItem={{
bg: "skyblue.500",
endIcon: <CheckIcon size={3} />
}}>
{/* Country code 3 digit ISO */}
{user?.uchildren?.map((child, index) =>
child?.cname && child?.cid &&
<Select.Item key={'cs_'+index} label={child?.cname} value={child?.cid.toString()} />
)}
</Select>
</FormControl>
<FormControl>
<FormControl.Label>Title</FormControl.Label>
<Input
value={resultsForm['title']}
onChangeText={(text) => setResultsForm({...resultsForm, ['title']: text})}
/>
<FormControl.HelperText>
{i18n.t('helpertext')}
</FormControl.HelperText>
</FormControl>
</VStack>
</Modal.Body>
<Modal.Footer>
<Button.Group space={2}>
<Button variant="ghost" colorScheme="blueGray" onPress={props.handleOpenSaveForm}>
{i18n.t('cancel')}
</Button>
<Button onPress={() => props?.saveResults && props.saveResults(resultsForm)}>
{i18n.t('save')}
</Button>
</Button.Group>
</Modal.Footer>
</Modal.Content>
</Modal>
</>
}
</View>
}
</View>
Expand Down Expand Up @@ -392,9 +389,6 @@ const styles = StyleSheet.create({
highlighted: {
backgroundColor: theme.colors.skyblue
},
rightSpace: {
paddingRight: 8
},
full: {
paddingBottom: 96
},
Expand Down
40 changes: 40 additions & 0 deletions react-native/components/Home/HomeMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from "react";
import { View, Text, Image, TouchableOpacity } from "react-native";
import { useAuth } from "../../contexts/Auth";
import { useNavigation, StackActions } from '@react-navigation/native';
import { Menu, MenuItem } from "react-native-material-menu";

export default function HomeMenu() {
const auth = useAuth();
const navigation = useNavigation();
const [isMenuVisible, setMenuVisibility] = React.useState(false);

const showMenu = () => {
setMenuVisibility(true);
};
const hideMenu = () => {
setMenuVisibility(false);
};

const logout = () => {
auth.signOut();
navigation.dispatch(StackActions.popToTop())
}

return (
<Menu
visible={isMenuVisible}
anchor={
<TouchableOpacity onPress={showMenu}>
<Image
style={{ width: 32, height: 32 }}
source={require(`../../assets/images/profile-images/profile-1.png`)}
/>
</TouchableOpacity>
}
onRequestClose={hideMenu}
>
<MenuItem onPress={logout}>Logout</MenuItem>
</Menu>
);
}
28 changes: 28 additions & 0 deletions react-native/components/Home/NoEventBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import { View, Image, StyleSheet } from "react-native";
import { Text } from 'native-base';
import i18n from 'i18n-js'
import '../../locales/i18n';


export default function NoEventBox() {
return (
<View style={[styles.container]}>
<Image source={require("../../assets/images/no-event.png")} style={styles.imageStyle} />
<Text color="#666" fontSize="md">{i18n.t('noEvent')}</Text>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
},
imageStyle: {
width: 180,
height: 180,
}
});
Loading

0 comments on commit a07a734

Please sign in to comment.