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
add function to get totalNotes
ammarahm-edc9aff39e547e
diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.jsindex 465f39865..4d61b0849 100644--- a/apps/mobile/src/components/NotebookItem/index.js+++ b/apps/mobile/src/components/NotebookItem/index.js@@ -1,11 +1,11 @@import React from 'react';-import { useWindowDimensions } from 'react-native';+import {useWindowDimensions} from 'react-native';import {TouchableOpacity, View} from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {notesnook} from '../../../e2e/test.ids';import {useTracked} from '../../provider';import Navigation from '../../services/Navigation';-import { history } from '../../utils';+import {getTotalNotes, history} from '../../utils';import {pv, SIZE} from '../../utils/SizeUtils';import {ActionIcon} from '../ActionIcon';import {ActionSheetEvent} from '../DialogManager/recievers';@@ -22,6 +22,7 @@ export const NotebookItem = ({const [state] = useTracked();const {colors} = state;const {fontScale} = useWindowDimensions();+ const totalNotes = getTotalNotes(item);const showActionSheet = () => {let rowItems = isTrash? ['Restore', 'Remove']@@ -192,10 +193,10 @@ export const NotebookItem = ({style={{marginRight: 10,}}>- {item && item.totalNotes && item.totalNotes > 1- ? item.totalNotes + ' Notes'- : item.totalNotes === 1- ? item.totalNotes + ' Note'+ {item && totalNotes > 1+ ? totalNotes + ' Notes'+ : totalNotes === 1+ ? totalNotes + ' Note': '0 Notes'}</Paragraph>diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.jsindex 6e4237143..d09432415 100755--- a/apps/mobile/src/utils/index.js+++ b/apps/mobile/src/utils/index.js@@ -11,7 +11,7 @@ import {tabBarRef} from './Refs';import {SIZE} from './SizeUtils';export const InteractionManager = {- runAfterInteractions: (func, time = 500) => setTimeout(func, time),+ runAfterInteractions: (func, time = 150) => setTimeout(func, time),};export const APP_VERSION = 1300;@@ -108,6 +108,15 @@ export function setWidthHeight(size) {dHeight = size.height;}+export function getTotalNotes(notebook) {+ if (notebook.type === 'topic') {+ return notebook.notes.length;+ }+ return notebook.topics.reduce((sum, topic) => {+ return sum + topic.notes.length;+ }, 0);+}+export const itemSkus = Platform.select({ios: ['com.streetwriters.notesnook.sub.mo'],android: ['com.streetwriters.notesnook.sub.mo'],@@ -152,7 +161,7 @@ export const SUBSCRIPTION_STATUS = {export const SUBSCRIPTION_STATUS_STRINGS = {0: 'Basic',1: 'Trial',- 2: Platform.OS === "ios" ? "Pro" : 'Beta',+ 2: Platform.OS === 'ios' ? 'Pro' : 'Beta',5: 'Pro',6: 'Expired',7: 'Pro',