diff --git a/apps/mobile/src/components/ActionIcon/index.js b/apps/mobile/src/components/ActionIcon/index.js index dc364ecaa..2078336dc 100644 --- a/apps/mobile/src/components/ActionIcon/index.js +++ b/apps/mobile/src/components/ActionIcon/index.js @@ -27,15 +27,11 @@ export const ActionIcon = ({ testID={testID} onPress={onPress} hitSlop={{top: top, left: left, right: right, bottom: bottom}} - color="transparent" disabled={disabled} - selectedColor={colors.nav} - alpha={!colors.night ? -0.02 : 0.02} - opacity={1} + type="gray" customStyle={{ width: 40, height: 40, - backgroundColor: disabled ? colors.bg : null, justifyContent: 'center', alignItems: 'center', borderRadius: 100, diff --git a/apps/mobile/src/components/ActionSheet/index.js b/apps/mobile/src/components/ActionSheet/index.js index 0e1bb5ab8..b564c7872 100644 --- a/apps/mobile/src/components/ActionSheet/index.js +++ b/apps/mobile/src/components/ActionSheet/index.js @@ -72,6 +72,7 @@ export default class ActionSheet extends Component { this.isRecoiling = false; this.targetId = null; this.offsetY = 0; + this.borderRadius = new Animated.Value(10); } waitAsync = (ms) => @@ -574,6 +575,8 @@ export default class ActionSheet extends Component { translateY: this.transformValue, }, ], + borderTopRightRadius:this.borderRadius, + borderTopLeftRadius:this.borderRadius }, ]}> {gestureEnabled || headerAlwaysVisible ? ( diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js b/apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js index d93a3a762..f6f299159 100644 --- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js +++ b/apps/mobile/src/components/ActionSheetComponent/ActionSheetColorsSection.js @@ -43,13 +43,9 @@ export const ActionSheetColorsSection = ({item,close}) => { return ( { await PremiumService.verify(async () => { diff --git a/apps/mobile/src/components/Container/ContainerBottomButton.js b/apps/mobile/src/components/Container/ContainerBottomButton.js index cb76a8215..ad16535fc 100644 --- a/apps/mobile/src/components/Container/ContainerBottomButton.js +++ b/apps/mobile/src/components/Container/ContainerBottomButton.js @@ -3,6 +3,7 @@ import {Keyboard, Platform, View} from 'react-native'; import Animated, {Easing} from 'react-native-reanimated'; import {useSafeAreaInsets} from 'react-native-safe-area-context'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; +import {notesnook} from '../../../e2e/test.ids'; import {useTracked} from '../../provider'; import {DDS} from '../../services/DeviceDetection'; import {getElevation, showContext} from '../../utils'; @@ -10,7 +11,12 @@ import {normalize, SIZE} from '../../utils/SizeUtils'; import {PressableButton} from '../PressableButton'; const translateY = new Animated.Value(0); -export const ContainerBottomButton = ({title, onPress, color,shouldShow =false}) => { +export const ContainerBottomButton = ({ + title, + onPress, + color = 'accent', + shouldShow = false, +}) => { const [state] = useTracked(); const {colors} = state; const insets = useSafeAreaInsets(); @@ -59,9 +65,10 @@ export const ContainerBottomButton = ({title, onPress, color,shouldShow =false}) ], }}> { - this.actionSheet._setModalVisible(); - sleep(200).then(() => { - this.setState({ - actionSheetVisible: false, - }); - }); + this.actionSheet._setModalVisible(false); }; _showMoveNote = () => { @@ -313,10 +309,12 @@ export class DialogManager extends Component { ref={(ref) => (this.actionSheet = ref)} containerStyle={{ backgroundColor: colors.bg, - width: DDS.isTab ? 500 : '100%', + width: DDS.isLargeTablet() ? 500 : '100%', alignSelf: 'center', borderRadius: 10, - marginBottom: DDS.isTab ? 50 : 0, + marginBottom: DDS.isLargeTablet() ? 50 : 0, + borderBottomRightRadius: DDS.isLargeTablet() ? 10 : 1, + borderBottomLeftRadius: DDS.isLargeTablet() ? 10 : 1, }} extraScroll={DDS.isTab ? 50 : 0} indicatorColor={ @@ -350,6 +348,9 @@ export class DialogManager extends Component { onClose={() => { translatePrem.setValue(-800); this.onActionSheetHide(); + this.setState({ + actionSheetVisible: false, + }); }}> { { - Navigation.navigate('Search',{ - menu:false + Navigation.navigate('Search', { + menu: false, }); }} name="magnify" @@ -99,9 +99,10 @@ const styles = StyleSheet.create({ }, rightBtn: { justifyContent: 'center', - alignItems: 'flex-end', + alignItems: 'center', height: 40, - width: 50, + width: 40, + marginLeft: 10, paddingRight: 0, }, }); diff --git a/apps/mobile/src/components/JumpToDialog/index.js b/apps/mobile/src/components/JumpToDialog/index.js index 0c82af3aa..5085c3b8a 100644 --- a/apps/mobile/src/components/JumpToDialog/index.js +++ b/apps/mobile/src/components/JumpToDialog/index.js @@ -128,12 +128,7 @@ const JumpToDialog = () => { onPress(item, index)} - color={currentIndex === index ? colors.shade : 'transparent'} - selectedColor={ - currentIndex === index ? colors.accent : colors.nav - } - alpha={!colors.night ? -0.02 : 0.02} - opacity={currentIndex === index ? 0.12 : 1} + type={currentIndex === index? 'shade' : 'gray'} customStyle={{ minWidth: '20%', maxWidth: '46%', diff --git a/apps/mobile/src/components/Menu/ColorSection.js b/apps/mobile/src/components/Menu/ColorSection.js index e6fae7585..c1ec70b8c 100644 --- a/apps/mobile/src/components/Menu/ColorSection.js +++ b/apps/mobile/src/components/Menu/ColorSection.js @@ -73,12 +73,12 @@ const ColorItem = ({item, index}) => { return ( onPress(item)} diff --git a/apps/mobile/src/components/Menu/MenuListItem.js b/apps/mobile/src/components/Menu/MenuListItem.js index b92fe10c8..c02e480ef 100644 --- a/apps/mobile/src/components/Menu/MenuListItem.js +++ b/apps/mobile/src/components/Menu/MenuListItem.js @@ -53,14 +53,11 @@ export const MenuListItem = ({item, index, noTextMode, testID}) => { testID={testID} key={item.name + index} onPress={_onPress} - color={ + type={ headerTextState?.id === item.name.toLowerCase() + '_navigation' - ? colors.shade + ? 'shade' : 'transparent' } - selectedColor={colors.accent} - alpha={!colors.night ? -0.02 : 0.02} - opacity={0.12} customStyle={{ width: noTextMode ? 50 : '100%', alignSelf: 'center', diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js index 6b79fde33..f079f84a9 100644 --- a/apps/mobile/src/components/Menu/TagsSection.js +++ b/apps/mobile/src/components/Menu/TagsSection.js @@ -4,7 +4,11 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import {useTracked} from '../../provider'; import {Actions} from '../../provider/Actions'; import {DDS} from '../../services/DeviceDetection'; -import {eSendEvent, eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager'; +import { + eSendEvent, + eSubscribeEvent, + eUnSubscribeEvent, +} from '../../services/EventManager'; import Navigation from '../../services/Navigation'; import {getElevation} from '../../utils'; import {db} from '../../utils/DB'; @@ -26,7 +30,6 @@ export const TagsSection = () => { dispatch({type: Actions.MENU_PINS}); }, []); - const onPress = (item) => { let params; if (item.type === 'notebook') { @@ -42,7 +45,6 @@ export const TagsSection = () => { type: item.type, }); rootNavigatorRef.current?.setParams(params); - } else if (item.type === 'tag') { params = params = { title: item.title, @@ -118,8 +120,6 @@ const PinItem = ({item, index, onPress}) => { const [visible, setVisible] = useState(false); const [headerTextState, setHeaderTextState] = useState(null); - - const onHeaderStateChange = (event) => { if (event?.id === item.name) { setHeaderTextState(event); @@ -162,14 +162,11 @@ const PinItem = ({item, index, onPress}) => { )} setVisible(true)} onPress={() => onPress(item)} customStyle={{ @@ -226,53 +223,4 @@ const PinItem = ({item, index, onPress}) => { ); }; -/* - {tags - .filter((o) => o.noteIds.length > 1) - .slice(0, tags.length > 10 ? 10 : tags.length) - .map((item) => ( - onPress(item)} - customStyle={{ - flexDirection: 'row', - justifyContent: 'flex-start', - alignItems: 'center', - width: '100%', - borderRadius: 0, - paddingHorizontal: 10, - height: 50, - }}> - - - # - - - - {item.title} - - - - ))} -*/ diff --git a/apps/mobile/src/components/Menu/TimeSince.js b/apps/mobile/src/components/Menu/TimeSince.js index fa6646437..eda048241 100644 --- a/apps/mobile/src/components/Menu/TimeSince.js +++ b/apps/mobile/src/components/Menu/TimeSince.js @@ -1,22 +1,22 @@ import React, {useEffect, useState} from 'react'; -import {timeSince} from "../../utils/TimeUtils"; +import {timeSince} from '../../utils/TimeUtils'; import Paragraph from '../Typography/Paragraph'; -export const TimeSince = ({time}) => { +export const TimeSince = ({time, style,updateFrequency=30000}) => { const [timeAgo, setTimeAgo] = useState(null); useEffect(() => { let t = timeSince(time); - setTimeAgo(t); + setTimeAgo(t); let interval = setInterval(() => { t = timeSince(time); setTimeAgo(t); - }, 60000); + }, updateFrequency); return () => { clearInterval(interval); interval = null; }; - },[]); + }, [time,updateFrequency]); - return {timeAgo}; + return {timeAgo}; }; diff --git a/apps/mobile/src/components/Menu/UserSection.js b/apps/mobile/src/components/Menu/UserSection.js index b23de3e40..0eeab080a 100644 --- a/apps/mobile/src/components/Menu/UserSection.js +++ b/apps/mobile/src/components/Menu/UserSection.js @@ -1,16 +1,16 @@ import React from 'react'; -import { ActivityIndicator, TouchableOpacity, View } from 'react-native'; +import {ActivityIndicator, TouchableOpacity, View} from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; -import { useTracked } from '../../provider'; -import { Actions } from '../../provider/Actions'; -import { eSendEvent, ToastEvent } from '../../services/EventManager'; -import { SUBSCRIPTION_STATUS_STRINGS } from '../../utils'; -import { db } from '../../utils/DB'; -import { eOpenLoginDialog } from '../../utils/Events'; -import { pv, SIZE } from '../../utils/SizeUtils'; -import { PressableButton } from '../PressableButton'; +import {useTracked} from '../../provider'; +import {Actions} from '../../provider/Actions'; +import {eSendEvent, ToastEvent} from '../../services/EventManager'; +import {SUBSCRIPTION_STATUS_STRINGS} from '../../utils'; +import {db} from '../../utils/DB'; +import {eOpenLoginDialog} from '../../utils/Events'; +import {pv, SIZE} from '../../utils/SizeUtils'; +import {PressableButton} from '../PressableButton'; import Paragraph from '../Typography/Paragraph'; -import { TimeSince } from './TimeSince'; +import {TimeSince} from './TimeSince'; export const UserSection = ({noTextMode}) => { const [state, dispatch] = useTracked(); @@ -116,10 +116,7 @@ export const UserSection = ({noTextMode}) => { onPress={() => { eSendEvent(eOpenLoginDialog); }} - color={colors.accent} - selectedColor={colors.accent} - alpha={!colors.night ? -0.02 : 0.1} - opacity={0.12} + type="shade" customStyle={{ paddingVertical: 12, marginVertical: 5, diff --git a/apps/mobile/src/components/MoveNoteDialog/index.js b/apps/mobile/src/components/MoveNoteDialog/index.js index c7700fd4c..c9935c1b6 100644 --- a/apps/mobile/src/components/MoveNoteDialog/index.js +++ b/apps/mobile/src/components/MoveNoteDialog/index.js @@ -224,12 +224,7 @@ const MoveNoteDialog = () => { onPress={() => { setExpanded(item.id === expanded ? null : item.id); }} - color={expanded === item.id ? colors.shade : 'transparent'} - selectedColor={ - expanded === item.id ? colors.accent : colors.nav - } - alpha={colors.night ? 0.02 : -0.02} - opacity={expanded === item.id ? 0.12 : 1} + type={expanded === item.id ? 'shade' : 'transparent'} customStyle={{ height: 50, width: '100%', @@ -365,9 +360,7 @@ const MoveNoteDialog = () => { 'success', ); }} - color="transparent" - selectedColor={colors.nav} - alpha={colors.night ? 0.02 : -0.02} + type="gray" customStyle={{ height: 50, borderTopWidth: index === 0 ? 0 : 1, @@ -398,7 +391,7 @@ const MoveNoteDialog = () => { diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js index 9ab519e86..63c887c74 100644 --- a/apps/mobile/src/components/NoteItem/index.js +++ b/apps/mobile/src/components/NoteItem/index.js @@ -1,14 +1,16 @@ import React from 'react'; -import { TouchableOpacity, View } from 'react-native'; +import {TouchableOpacity, View} from 'react-native'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; -import { Actions } from '../../provider/Actions'; +import {notesnook} from '../../../e2e/test.ids'; +import {Actions} from '../../provider/Actions'; import Navigation from '../../services/Navigation'; -import { COLORS_NOTE } from '../../utils/Colors'; -import { db } from '../../utils/DB'; -import { SIZE } from '../../utils/SizeUtils'; -import { timeSince } from '../../utils/TimeUtils'; -import { ActionIcon } from '../ActionIcon'; -import { ActionSheetEvent, updateEvent } from '../DialogManager/recievers'; +import {COLORS_NOTE} from '../../utils/Colors'; +import {db} from '../../utils/DB'; +import {SIZE} from '../../utils/SizeUtils'; +import {timeSince} from '../../utils/TimeUtils'; +import {ActionIcon} from '../ActionIcon'; +import {ActionSheetEvent, updateEvent} from '../DialogManager/recievers'; +import {TimeSince} from '../Menu/TimeSince'; import Heading from '../Typography/Heading'; import Paragraph from '../Typography/Paragraph'; @@ -191,15 +193,14 @@ export default class NoteItem extends React.Component { color="orange" /> ) : null} - - {timeSince(item.dateCreated)} - + + ) : null} @@ -253,6 +254,7 @@ export default class NoteItem extends React.Component { { ActionSheetEvent( diff --git a/apps/mobile/src/components/PressableButton/index.js b/apps/mobile/src/components/PressableButton/index.js index c2c64b195..393ea1c5d 100644 --- a/apps/mobile/src/components/PressableButton/index.js +++ b/apps/mobile/src/components/PressableButton/index.js @@ -26,16 +26,18 @@ export const PressableButton = ({ noborder, accentColor = 'accent', accentText = 'light', + customColor, + customSelectedColor }) => { const [state] = useTracked(); const {colors} = state; - const selectedColor = + const selectedColor = customSelectedColor || colors[ type === 'accent' ? BUTTON_TYPES[type](accentColor, accentText).selected : BUTTON_TYPES[type].selected ]; - const primaryColor = + const primaryColor = customColor || colors[ type === 'accent' ? BUTTON_TYPES[type](accentColor, accentText).primary diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.js index f4bf466b4..0c13cded8 100644 --- a/apps/mobile/src/components/SelectionWrapper/index.js +++ b/apps/mobile/src/components/SelectionWrapper/index.js @@ -36,7 +36,7 @@ const SelectionWrapper = ({ } }, [selectedItemsList]); - const onPressPin = async () => { +/* const onPressPin = async () => { let func = async () => { if (!item.id) return; if (item.type === 'note') { @@ -61,11 +61,11 @@ const SelectionWrapper = ({ }, 'Undo', ); - }; + }; */ return ( ( ({ primary: themeColor, text: text, - selected: 'accent', + selected: themeColor, }), inverted: { primary: 'bg', diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js index 85bc6d603..4b0d6264b 100644 --- a/apps/mobile/src/views/Editor/Functions.js +++ b/apps/mobile/src/views/Editor/Functions.js @@ -1,25 +1,25 @@ -import {createRef} from 'react'; -import {Linking, Platform} from 'react-native'; +import { createRef } from 'react'; +import { Linking, Platform } from 'react-native'; import SplashScreen from 'react-native-splash-screen'; -import {updateEvent} from '../../components/DialogManager/recievers'; -import {Actions} from '../../provider/Actions'; -import {DDS} from '../../services/DeviceDetection'; -import {eSendEvent, sendNoteEditedEvent} from '../../services/EventManager'; +import { updateEvent } from '../../components/DialogManager/recievers'; +import { Actions } from '../../provider/Actions'; +import { DDS } from '../../services/DeviceDetection'; +import { eSendEvent, sendNoteEditedEvent } from '../../services/EventManager'; import IntentService from '../../services/IntentService'; -import {editing} from '../../utils'; -import {COLORS_NOTE, COLOR_SCHEME} from '../../utils/Colors'; -import {hexToRGBA} from '../../utils/ColorUtils'; -import {db} from '../../utils/DB'; +import { editing } from '../../utils'; +import { COLORS_NOTE, COLOR_SCHEME } from '../../utils/Colors'; +import { hexToRGBA } from '../../utils/ColorUtils'; +import { db } from '../../utils/DB'; import { eOnLoadNote, - eOpenPremiumDialog, + eShowGetPremium, - refreshNotesPage, + refreshNotesPage } from '../../utils/Events'; -import {MMKV} from '../../utils/mmkv'; -import {sideMenuRef, tabBarRef} from '../../utils/Refs'; -import {normalize} from '../../utils/SizeUtils'; -import {sleep, timeConverter} from '../../utils/TimeUtils'; +import { MMKV } from '../../utils/mmkv'; +import { sideMenuRef, tabBarRef } from '../../utils/Refs'; +import { normalize } from '../../utils/SizeUtils'; +import { sleep, timeConverter } from '../../utils/TimeUtils'; export const EditorWebView = createRef(); diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js index b99a7bc33..cd8fb5d73 100644 --- a/apps/mobile/src/views/Notes/index.js +++ b/apps/mobile/src/views/Notes/index.js @@ -187,7 +187,7 @@ export const Notes = ({route, navigation}) => { ); diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js index 039c820f1..e2e36ee1b 100644 --- a/apps/mobile/src/views/Settings/index.js +++ b/apps/mobile/src/views/Settings/index.js @@ -207,12 +207,8 @@ const CustomButton = ({ }) => { const [state] = useTracked(); const {colors} = state; - const [visible, setVisible] = useState(false); return ( { paddingHorizontal: 0, }}> { eSendEvent(eOpenLoginDialog); }} - activeOpacity={opacity / 2} customStyle={{ paddingVertical: 12, width: '100%', @@ -550,7 +542,7 @@ const SettingsAppearanceSection = () => { ].map((item) => ( { ) : item } - selectedColor={item} + customSelectedColor={item} alpha={!colors.night ? -0.1 : 0.1} opacity={1} onPress={async () => {