From 2d70a18465be8960da968d4932fc0b8e955d4f62 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Mon, 7 Sep 2020 21:23:38 +0500 Subject: [PATCH] update colors --- .../mobile/src/components/ActionIcon/index.js | 4 +- .../src/components/Menu/MenuListItem.js | 8 +- apps/mobile/src/components/Menu/index.js | 15 ++-- apps/mobile/src/components/NoteItem/index.js | 37 ++++----- .../src/components/NotebookItem/index.js | 4 +- .../src/components/Premium/PremiumDialog.js | 2 +- .../mobile/src/components/SimpleList/index.js | 2 +- apps/mobile/src/components/header/index.js | 6 +- apps/mobile/src/utils/hooks.js | 1 - apps/mobile/src/views/Editor/index.js | 12 +-- apps/mobile/src/views/Signup/index.js | 76 +++++++++---------- 11 files changed, 78 insertions(+), 89 deletions(-) diff --git a/apps/mobile/src/components/ActionIcon/index.js b/apps/mobile/src/components/ActionIcon/index.js index 35c0fcdf6..aa93305a6 100644 --- a/apps/mobile/src/components/ActionIcon/index.js +++ b/apps/mobile/src/components/ActionIcon/index.js @@ -8,8 +8,8 @@ export const ActionIcon = ({onPress, name, color,customStyle}) => { { +export const MenuListItem = ({item, index, noTextMode, ignore}) => { const [state, dispatch] = useTracked(); const {currentScreen, colors} = state; @@ -68,7 +68,7 @@ export const MenuListItem = ({item, index, noTextMode,ignore}) => { style={{ fontFamily: WEIGHT.regular, fontSize: SIZE.sm, - color: colors.pri, + color: colors.heading, }}> {item.name} @@ -81,9 +81,7 @@ export const MenuListItem = ({item, index, noTextMode,ignore}) => { color={item.on ? colors.accent : colors.icon} name={item.on ? 'toggle-switch' : 'toggle-switch-off'} /> - ) : ( - undefined - )} + ) : undefined} ); }; diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js index 4f148abad..3f7c1a4fd 100644 --- a/apps/mobile/src/components/Menu/index.js +++ b/apps/mobile/src/components/Menu/index.js @@ -28,7 +28,7 @@ import {ColorSection} from './ColorSection'; import {MenuListItem} from './MenuListItem'; import {TagsSection} from './TagsSection'; import {UserSection} from './UserSection'; -import { MMKV } from '../../utils/storage'; +import {MMKV} from '../../utils/storage'; const AnimatedSafeAreaView = createAnimatableComponent(SafeAreaView); @@ -42,7 +42,6 @@ export const Menu = ({ const [state, dispatch] = useTracked(); const {colors} = state; - // todo function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) { let newColors = setColorScheme(colors, accent); @@ -50,7 +49,6 @@ export const Menu = ({ dispatch({type: ACTIONS.THEME, colors: newColors}); } - const listItems = [ { name: 'Home', @@ -86,7 +84,7 @@ export const Menu = ({ icon: 'theme-light-dark', func: () => { if (!colors.night) { - MMKV .setStringAsync('theme', JSON.stringify({night: true})); + MMKV.setStringAsync('theme', JSON.stringify({night: true})); changeColorScheme(COLOR_SCHEME_DARK); } else { MMKV.setStringAsync('theme', JSON.stringify({night: false})); @@ -171,7 +169,7 @@ export const Menu = ({ index={10} item={{ name: 'Tags', - icon:'tag', + icon: 'tag', func: () => { close(); NavigationService.navigate('Tags'); @@ -196,7 +194,12 @@ export const Menu = ({ width: '100%', }}> {listItems2.map((item, index) => ( - + ))} diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js index 15a09d191..5ea9559be 100644 --- a/apps/mobile/src/components/NoteItem/index.js +++ b/apps/mobile/src/components/NoteItem/index.js @@ -160,7 +160,7 @@ export default class NoteItem extends React.Component { justifyContent: 'center', alignItems: 'center', }}> - {item.colors.map(item => ( + {item.colors.map((item) => ( - { + ActionSheetEvent( + item, + isTrash ? false : true, + isTrash ? false : true, + isTrash + ? ['Remove', 'Restore'] + : ['Add to', 'Share', 'Export', 'Delete', 'Open'], + isTrash ? [] : ['Pin', 'Favorite', 'Add to Vault'], + ); }}> - { - ActionSheetEvent( - item, - isTrash ? false : true, - isTrash ? false : true, - isTrash - ? ['Remove', 'Restore'] - : ['Add to', 'Share', 'Export', 'Delete', 'Open'], - isTrash ? [] : ['Pin', 'Favorite', 'Add to Vault'], - ); - }}> - - - + + ); } diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js index 33fb92835..de1cea8bb 100644 --- a/apps/mobile/src/components/NotebookItem/index.js +++ b/apps/mobile/src/components/NotebookItem/index.js @@ -113,7 +113,7 @@ export const NotebookItem = ({ style={{ fontFamily: WEIGHT.bold, fontSize: SIZE.sm + 1, - color: colors.pri, + color: colors.heading, maxWidth: '100%', }}> {item.title} @@ -258,7 +258,7 @@ export const NotebookItem = ({ notebookID: notebookID, }); }}> - + )} diff --git a/apps/mobile/src/components/Premium/PremiumDialog.js b/apps/mobile/src/components/Premium/PremiumDialog.js index d4dd4b154..78207cd42 100644 --- a/apps/mobile/src/components/Premium/PremiumDialog.js +++ b/apps/mobile/src/components/Premium/PremiumDialog.js @@ -79,7 +79,7 @@ class PremiumDialog extends React.Component { style={{ fontSize: SIZE.lg, fontFamily: WEIGHT.bold, - color: colors.pri, + color: colors.heading, paddingVertical: 20, }}> Unlock Premium Features diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js index 7f41d4099..1e0458fec 100644 --- a/apps/mobile/src/components/SimpleList/index.js +++ b/apps/mobile/src/components/SimpleList/index.js @@ -63,7 +63,7 @@ const SimpleList = ({ }}> diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js index 83151fcb6..32a8057eb 100644 --- a/apps/mobile/src/components/header/index.js +++ b/apps/mobile/src/components/header/index.js @@ -28,6 +28,7 @@ import {moveNoteHideEvent} from '../DialogManager/recievers'; import {HeaderMenu} from './HeaderMenu'; import {HeaderTitle} from './HeaderTitle'; import {useHideHeader, useForceUpdate} from '../../utils/hooks'; +import RNIconic from 'react-native-iconic'; export const Header = ({showSearch, root}) => { const [state, dispatch] = useTracked(); @@ -121,12 +122,13 @@ export const Header = ({showSearch, root}) => { - {headerState.menu && !DDS.isTab ? ( + {!DDS.isTab ? ( - { width: '100%', height: 50, justifyContent: 'space-between', + alignItems: 'center', }}> {noMenu ? null : ( )} @@ -191,7 +193,7 @@ const Editor = ({noMenu}) => { {DDS.isTab && !fullscreen ? ( { eSendEvent(eOpenFullscreenEditor); setFullscreen(true); @@ -208,18 +210,18 @@ const Editor = ({noMenu}) => { {}} /> {}} /> { ActionSheetEvent( getNote(), diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.js index 44f321945..fb9840713 100644 --- a/apps/mobile/src/views/Signup/index.js +++ b/apps/mobile/src/views/Signup/index.js @@ -12,9 +12,7 @@ import {TextInput} from 'react-native-gesture-handler'; import QRCode from 'react-native-qrcode-generator'; import {useIsFocused} from '@react-navigation/native'; import {opacity, pv, SIZE, WEIGHT, ph} from '../../common/common'; -import {Header} from '../../components/header'; import {useTracked} from '../../provider'; - import { eSubscribeEvent, eUnSubscribeEvent, @@ -75,7 +73,7 @@ export const Signup = ({route, navigation}) => { }; }, [isFocused]); - const validateInfo = () => { + const validateInfo = () => { if (!password || !email || !username || !passwordReEnter) { ToastEvent.show('All fields are required', 'error'); return false; @@ -88,47 +86,41 @@ export const Signup = ({route, navigation}) => { if (!invalidEmail && !invalidPassword && !invalidUsername) { ToastEvent.show('Signup information is invalid', 'error'); - return false; + return false; } - - } + }; const _signUp = async () => { if (!validateInfo) return; - - setSigningIn(true); - setStatus('Creating your account...'); - try { - await db.user.signup(username, email, password); + setSigningIn(true); + setStatus('Creating your account...'); + try { + await db.user.signup(username, email, password); + } catch (e) { + setSigningIn(false); + setFailed(true); + ToastEvent.show('Signup failed, Network Error', 'error'); + return; + } - } catch (e) { - setSigningIn(false); - setFailed(true); - ToastEvent.show('Signup failed, Network Error', 'error'); - return; - } - - let user; - try { - - - user = await db.user.user.get(); - setStatus('Logging you in...'); - let k = await db.user.key(); - setKey(k.key); - setStatus('Setting up crenditials...'); - dispatch({type: ACTIONS.USER, user: user}); - eSendEvent(eStartSyncer); - setTimeout(() => { - setModalVisible(true); - }, 500); - } catch (e) { - setSigningIn(false); - setFailed(true); - ToastEvent.show('Login Failed, try again', 'error'); - } - + let user; + try { + user = await db.user.user.get(); + setStatus('Logging you in...'); + let k = await db.user.key(); + setKey(k.key); + setStatus('Setting up crenditials...'); + dispatch({type: ACTIONS.USER, user: user}); + eSendEvent(eStartSyncer); + setTimeout(() => { + setModalVisible(true); + }, 500); + } catch (e) { + setSigningIn(false); + setFailed(true); + ToastEvent.show('Login Failed, try again', 'error'); + } }; useEffect(() => { @@ -430,7 +422,7 @@ export const Signup = ({route, navigation}) => { } }} textContentType="username" - onChangeText={value => { + onChangeText={(value) => { setUsername(value); if (invalidUsername && validateUsername(username)) { @@ -520,7 +512,7 @@ export const Signup = ({route, navigation}) => { } }} textContentType="emailAddress" - onChangeText={value => { + onChangeText={(value) => { setEmail(value); if (invalidEmail && validateEmail(email)) { setInvalidEmail(false); @@ -626,7 +618,7 @@ export const Signup = ({route, navigation}) => { }); } }} - onChangeText={value => { + onChangeText={(value) => { setPassword(value); if (invalidPassword && validatePass(password)) { setInvalidPassword(false); @@ -677,7 +669,7 @@ export const Signup = ({route, navigation}) => { ref={_passConfirm} editable={password && !invalidPassword ? true : false} defaultValue={passwordReEnter} - onChangeText={value => { + onChangeText={(value) => { setPasswordReEnter(value); if (value !== password) { setConfirmPassword(false);