From 62fe6f696b58005c95e50001e972b6b1b2934cdb Mon Sep 17 00:00:00 2001 From: "alpakaka000808@gmail.com" Date: Fri, 22 Nov 2024 17:16:19 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix=20:=20settings=20=ED=99=94=EB=A9=B4,=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=A1=9C=EA=B3=A0=EB=84=A3?= =?UTF-8?q?=EA=B8=B0,=20on=20off=20=EB=B4=89=ED=95=A9=ED=95=B4=EB=86=93?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/settingsView/settingsAccountView.tsx | 117 ++++++----------------- app/settingsView/settingsView.jsx | 14 ++- components/icons/AddSubtodoIcon.tsx | 12 +++ locales/en.json | 4 +- locales/ko.json | 4 +- 5 files changed, 60 insertions(+), 91 deletions(-) create mode 100644 components/icons/AddSubtodoIcon.tsx diff --git a/app/settingsView/settingsAccountView.tsx b/app/settingsView/settingsAccountView.tsx index 24c1d31..18dc24d 100644 --- a/app/settingsView/settingsAccountView.tsx +++ b/app/settingsView/settingsAccountView.tsx @@ -1,106 +1,49 @@ -import React, { useContext, useState } from 'react'; -import { StyleSheet, View } from 'react-native'; -import { Layout, Text, Button } from '@ui-kitten/components'; -import { LoginContext } from '../../contexts/LoginContext'; -import ConfirmModal from '@/components/common/molecules/ConfirmModal'; -import { api as Api } from '@/utils/api'; +import '@/locales/index'; +import { IndexPath, Layout, Menu, MenuItem } from '@ui-kitten/components'; +import { useState } from 'react'; import { useTranslation } from 'react-i18next'; -import { useStorage } from '@/hooks/auth/useStorage'; -import { useRouter } from 'expo-router'; +import { SafeAreaView, StyleSheet } from 'react-native'; const SettingsAccountView = () => { const { t } = useTranslation(); - const { userId } = useContext(LoginContext); - const { clear: clearStorage } = useStorage(); - const router = useRouter(); - - const [isDeleteAccountModalVisible, setDeleteAccountModalVisible] = - useState(false); - - const clearStackAndNavigate = () => { - router.dismissAll(); - router.replace('/'); - }; - - const handleDeleteAccountModalConfirm = async () => { - await Api.deleteUser(); - await clearStorage(); - setDeleteAccountModalVisible(false); - clearStackAndNavigate(); - }; - - const handleDeleteAccountModalCancel = () => { - setDeleteAccountModalVisible(false); - }; + const notificationOn = 0; + // const notificationOff = 1; + const [selectedIndex, setSelectedIndex] = useState( + new IndexPath(notificationOn), + ); return ( - - {/* 유저 정보 */} - - - {t('views.settingsAccountView.userId')} - - {userId} - - {/* - 이메일 - - {email} */} - - - {/* 회원탈퇴 버튼 */} - - - + <> + + + setSelectedIndex(index)} + > + + + + + + ); }; const styles = StyleSheet.create({ container: { flex: 1, - padding: 16, - backgroundColor: '#FFFFFF', - }, - avatarContainer: { - alignItems: 'center', - marginBottom: 24, - }, - avatar: { - width: 80, - height: 80, - borderRadius: 40, - marginBottom: 8, }, - editButton: { - marginTop: 4, - }, - infoContainer: { - marginBottom: 24, + layout: { + flex: 1, + justifyContent: 'center', paddingHorizontal: 16, }, - infoSpacing: { - marginTop: 16, - }, - twoFactorButton: { - marginTop: 8, - width: '100%', + text: { + textAlign: 'center', }, - deleteButton: { - marginTop: 24, - alignSelf: 'center', + link: { + color: 'blue', + textDecorationLine: 'underline', }, }); diff --git a/app/settingsView/settingsView.jsx b/app/settingsView/settingsView.jsx index 32ebe02..25d8401 100644 --- a/app/settingsView/settingsView.jsx +++ b/app/settingsView/settingsView.jsx @@ -13,12 +13,15 @@ import { useTranslation } from 'react-i18next'; import ConfirmModal from '@/components/common/molecules/ConfirmModal'; import { api as Api } from '@/utils/api'; import { useStorage } from '@/hooks/auth/useStorage'; + +import iconSource from '../../assets/icon.png'; import { Linking, SafeAreaView, StyleSheet, Platform, View, + Image, } from 'react-native'; import { heightPercentage, widthPercentage } from '@/utils/responsiveSize'; import fontStyles from '@/theme/fontStyles'; @@ -57,6 +60,13 @@ const SettingsView = () => { return `English`; } }; + const getNotification = () => { + if (i18n.language === 'ko') { + return `켬`; + } else if (i18n.language === 'en') { + return `On`; + } + }; const [isDeleteAccountModalVisible, setDeleteAccountModalVisible] = useState(false); const handleDeleteAccountModalConfirm = async () => { @@ -83,7 +93,7 @@ const SettingsView = () => { { title: t('views.settingsView.notification'), id: 2, - currentStatus: '한국어', + currentStatus: getNotification(), handlePress: () => { router.push('settingsView/settingsAccountView'); }, @@ -159,7 +169,7 @@ const SettingsView = () => { > - 이미지 + diff --git a/components/icons/AddSubtodoIcon.tsx b/components/icons/AddSubtodoIcon.tsx new file mode 100644 index 0000000..b246874 --- /dev/null +++ b/components/icons/AddSubtodoIcon.tsx @@ -0,0 +1,12 @@ +import { View, Text } from 'react-native'; +import React from 'react'; + +const AddSubtodoIcon = () => { + return ( + + AddSubtodoIcon + + ); +}; + +export default AddSubtodoIcon; diff --git a/locales/en.json b/locales/en.json index 1bf860d..ed6264b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -37,7 +37,9 @@ "settingsAccountView": { "userId": "user ID", "deleteModalTitle": "Delete Account", - "deleteModalMessage": "Are you sure to delete account?" + "deleteModalMessage": "Are you sure to delete account?", + "on": "On", + "off": "Off" }, "categoryAddView": { "label": "category input", diff --git a/locales/ko.json b/locales/ko.json index a95e1ec..54de844 100644 --- a/locales/ko.json +++ b/locales/ko.json @@ -38,7 +38,9 @@ "settingsAccountView": { "userId": "사용자 ID", "deleteModalTitle": "계정 삭제", - "deleteModalMessage": "정말 삭제하시겠습니까?" + "deleteModalMessage": "정말 삭제하시겠습니까?", + "on": "켬", + "off": "끔" }, "categoryAddView": { "label": "카테고리 입력", From ffb23559a20c833e1dcc170a88659ab4830aef4c Mon Sep 17 00:00:00 2001 From: "alpakaka000808@gmail.com" Date: Fri, 22 Nov 2024 17:31:10 +0900 Subject: [PATCH 2/2] fix: logo style in settings --- app/settingsView/settingsView.jsx | 1 + hooks/auth/useLogin.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/settingsView/settingsView.jsx b/app/settingsView/settingsView.jsx index 25d8401..89c2c59 100644 --- a/app/settingsView/settingsView.jsx +++ b/app/settingsView/settingsView.jsx @@ -216,6 +216,7 @@ const styles = StyleSheet.create({ height: widthPercentage(64), alignItems: 'center', justifyContent: 'center', + resizeMode: 'contain', borderRadius: 100, }, userTextContainer: { diff --git a/hooks/auth/useLogin.js b/hooks/auth/useLogin.js index cf125f4..18c817d 100644 --- a/hooks/auth/useLogin.js +++ b/hooks/auth/useLogin.js @@ -44,8 +44,8 @@ const useLogin = () => { setUserId(jwtTokenData.userId); setIsLoggedIn(true); if (jwtTokenData.isNew) { - handleAddCategory({ categoryName: t('veiws.categoryAddView.init') }); - handleAddCategory({ categoryName: t('veiws.categoryAddView.init2') }); + handleAddCategory({ categoryName: t('views.categoryAddView.init') }); + handleAddCategory({ categoryName: t('views.categoryAddView.init2') }); router.push('/funnelView/funnelView'); } else { router.push('/(tabs)');