A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix selection Mode & deleting
ammarahm-ed430b2f847bb8
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.jsindex 33a4d94d9..6427818bb 100644--- a/apps/mobile/src/components/Dialog/index.js+++ b/apps/mobile/src/components/Dialog/index.js@@ -30,7 +30,8 @@ export class Dialog extends Component {switch (template.action) {case dialogActions.ACTION_DELETE: {if (item.type === 'note') {- await db.deleteNotes([item]);+ await db.deleteNotes(item.dateCreated);+ToastEvent.show('Note moved to trash', 'success', 3000);updateEvent({type: item.type});} else if (item.type === 'topic') {@@ -38,7 +39,7 @@ export class Dialog extends Component {updateEvent({type: 'notebook'});ToastEvent.show('Topic moved to trash', 'success', 3000);} else if (item.type === 'notebook') {- await db.deleteNotebooks([item]);+ await db.deleteNotebooks(item.dateCreated);updateEvent({type: item.type});ToastEvent.show('Notebook moved to trash', 'success', 3000);}diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.jsindex aa37dc2f8..0b82a9766 100644--- a/apps/mobile/src/components/ListPlaceholders/index.js+++ b/apps/mobile/src/components/ListPlaceholders/index.js@@ -121,6 +121,33 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {1: {transform: [{translateX: 2},+ {+ translateY: 2,+ },+ ],+ },+ };++ const slideLeft = {+ 0: {+ transform: [+ {translateX: 2},+ {+ translateY: 2,+ },+ ],+ },+ 0.5: {+ transform: [+ {translateX: 0},+ {+ translateY: 0,+ },+ ],+ },+ 1: {+ transform: [+ {translateX: -2},{translateY: -2,},@@ -136,7 +163,7 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {justifyContent: 'center',}}><Animatable.View- animation={slideRight}+ animation={slideLeft}iterationCount="infinite"duration={3000}iterationDelay={0}@@ -571,6 +598,55 @@ export const TrashPlaceHolder = ({colors, animation}) => {};export const FavoritesPlaceHolder = ({colors, animation}) => {+ const slideRight = {+ 0: {+ transform: [+ {scaleX: 0.5},+ {+ scaleY: 0.5,+ },+ {+ translateX: 2,+ },+ {+ translateY: 2,+ },+ ],+ opacity: 0,+ },+ 0.6: {+ transform: [+ {scaleX: 0.7},+ {+ scaleY: 0.7,+ },+ {+ translateX: 0,+ },+ {+ translateY: 0,+ },+ ],++ opacity: 1,+ },+ 1: {+ transform: [+ {scaleX: 1},+ {+ scaleY: 1,+ },+ {+ translateX: -2,+ },+ {+ translateY: -2,+ },+ ],+ opacity: 0,+ },+ };+return (<Viewstyle={{@@ -579,11 +655,11 @@ export const FavoritesPlaceHolder = ({colors, animation}) => {justifyContent: 'space-around',}}><Animatable.View- animation={slideLeft}+ animation={slideRight}iterationCount="infinite"- duration={3000}+ duration={6000}iterationDelay={0}- direction="alternate"+ direction="normal"easing="ease-in"useNativeDriver={true}style={{@@ -593,12 +669,14 @@ export const FavoritesPlaceHolder = ({colors, animation}) => {}}><Icon name="star" size={SIZE.xl} color="orange" /></Animatable.View>+<Animatable.View- animation={slideLeft}+ animation={slideRight}iterationCount="infinite"- duration={3000}- iterationDelay={0}- direction="alternate"+ duration={7000}+ delay={1500}+ iterationDelay={500}+ direction="normal"easing="ease-in"useNativeDriver={true}style={{@@ -609,12 +687,14 @@ export const FavoritesPlaceHolder = ({colors, animation}) => {}}><Icon name="star" size={SIZE.xxl} color="orange" /></Animatable.View>+<Animatable.View- animation={slideLeft}+ animation={slideRight}iterationCount="infinite"- duration={3000}- iterationDelay={0}- direction="alternate"+ duration={5000}+ delay={3000}+ iterationDelay={1000}+ direction="normal"easing="ease-in"useNativeDriver={true}style={{diff --git a/apps/mobile/src/components/SelectionWrapper/index.js b/apps/mobile/src/components/SelectionWrapper/index.jsindex 5a9284bab..870f2e7ce 100644--- a/apps/mobile/src/components/SelectionWrapper/index.js+++ b/apps/mobile/src/components/SelectionWrapper/index.js@@ -1,14 +1,29 @@-import React from 'react';-import {View, TouchableOpacity} from 'react-native';-import {SIZE} from '../../common/common';+import React, {useEffect, useState} from 'react';+import {TouchableWithoutFeedback, View} from 'react-native';+import * as Animatable from 'react-native-animatable';import Icon from 'react-native-vector-icons/Feather';-import {w} from '../../utils/utils';+import {SIZE} from '../../common/common';import {useTracked} from '../../provider';import {ACTIONS} from '../../provider/actions';-import * as Animatable from 'react-native-animatable';const SelectionWrapper = ({children, item, currentEditingNote, index}) => {const [state, dispatch] = useTracked();const {colors, selectionMode, selectedItemsList} = state;+ const [selected, setSelected] = useState(false);+ useEffect(() => {+ let exists = selectedItemsList.filter(+ o => o.dateCreated === item.dateCreated,+ );++ if (exists[0]) {+ if (!selected) {+ setSelected(true);+ }+ } else {+ if (selected) {+ setSelected(false);+ }+ }+ }, [selectedItemsList]);return (<Animatable.View@@ -28,37 +43,38 @@ const SelectionWrapper = ({children, item, currentEditingNote, index}) => {: 'transparent',}}><View- onPress={() => {- dispatch({type: ACTIONS.SELECTED_ITEMS, item: item});- }}style={{- width: '10%',- height: 70,- justifyContent: 'center',- alignItems: 'center',display: selectionMode ? 'flex' : 'none',opacity: selectionMode ? 1 : 0,- paddingRight: 10,}}>- <View+ <TouchableWithoutFeedback+ onPress={() => {+ dispatch({type: ACTIONS.SELECTED_ITEMS, item: item});+ }}style={{- borderWidth: 2,- borderColor: selectedItemsList.includes(item)- ? colors.accent- : colors.icon,- width: 30,- height: 30,+ width: '10%',+ height: 70,justifyContent: 'center',alignItems: 'center',- borderRadius: 100,- paddingTop: 4,+ paddingRight: 15,}}>- {selectedItemsList.includes(item) ? (- <Icon size={SIZE.md} color={colors.accent} name="check" />- ) : null}- </View>+ <View+ style={{+ borderWidth: 2,+ borderColor: selected ? colors.accent : colors.icon,+ width: 30,+ height: 30,+ justifyContent: 'center',+ alignItems: 'center',+ borderRadius: 100,+ paddingTop: 4,+ }}>+ {selected ? (+ <Icon size={SIZE.md} color={colors.accent} name="check" />+ ) : null}+ </View>+ </TouchableWithoutFeedback></View>-{children}</Animatable.View>);diff --git a/apps/mobile/src/components/Toast/index.js b/apps/mobile/src/components/Toast/index.jsindex 029d5dfef..6941e7361 100644--- a/apps/mobile/src/components/Toast/index.js+++ b/apps/mobile/src/components/Toast/index.js@@ -109,7 +109,7 @@ export const Toast = () => {size={SIZE.sm}/>{' '}- Email address is invalid+ {message}</Text><TouchableOpacity activeOpacity={1}>