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 references
ammarahm-edc34e3a7eddab
diff --git a/apps/mobile/src/components/SimpleList/empty.js b/apps/mobile/src/components/SimpleList/empty.jsdeleted file mode 100644index 0d7d6a650..000000000--- a/apps/mobile/src/components/SimpleList/empty.js+++ /dev/null@@ -1,130 +0,0 @@-import React from 'react';-import { ActivityIndicator, useWindowDimensions, View } from 'react-native';-import { useSafeAreaInsets } from 'react-native-safe-area-context';-import { useTracked } from '../../provider';-import { useSettingStore } from '../../provider/stores';-import { useTip } from '../../services/tip-manager';-import { COLORS_NOTE } from '../../utils/color-scheme';-import { SIZE } from '../../utils/size';-import { Button } from '../ui/button';-import Seperator from '../ui/seperator';-import { Tip } from '../tip';-import Heading from '../ui/typography/heading';-import Paragraph from '../ui/typography/paragraph';--export const Empty = React.memo(- ({ loading = true, placeholderData, headerProps, type, screen }) => {- const [state] = useTracked();- const { colors } = state;- const insets = useSafeAreaInsets();- const { height } = useWindowDimensions();- const introCompleted = useSettingStore(state => state.isIntroCompleted);- const tip = useTip(- screen === 'Notes' && introCompleted ? 'first-note' : placeholderData.type || type,- screen === 'Notes' ? 'notes' : null- );- const color =- colors[COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'];- return (- <View- style={[- {- height: height - (140 + insets.top),- width: '80%',- justifyContent: 'center',- alignSelf: 'center'- }- ]}- >- {!loading ? (- <>- <Tip- color={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}- tip={tip}- style={{- backgroundColor: 'transparent',- paddingHorizontal: 0- }}- />- {placeholderData.button && (- <Button- type="grayAccent"- title={placeholderData.button}- iconPosition="right"- icon="arrow-right"- onPress={placeholderData.action}- accentColor={- COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'- }- accentText="light"- style={{- alignSelf: 'flex-start',- borderRadius: 5,- height: 40- }}- />- )}- </>- ) : (- <>- <View- style={{- alignSelf: 'center',- alignItems: 'flex-start',- width: '100%'- }}- >- <Heading>{placeholderData.heading}</Heading>- <Paragraph size={SIZE.sm} textBreakStrategy="balanced">- {placeholderData.loading}- </Paragraph>- <Seperator />- <ActivityIndicator- size={SIZE.lg}- color={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}- />- </View>- </>- )}- </View>- );- },- (prev, next) => {- if (prev.loading === next.loading) return true;- return false;- }-);--/**- * Make a tips manager.- * The tip manager stores many tips. Each tip has following values- * 1. Text- * 2. contexts: An array of context strings. // Places where the tip can be shown- * 3. Button if any.- * 4. Image/Gif asset.- *- * Tip manager adds the following methods -> get(context). Returns a random tip for the following context.- *- * Tips can be shown in a sheet or in a list. For sheets, GeneralSheet can be used to- * render tips.- *- * Where can the tips be shown and how?- * 1. When transitioning, show tips in a sheet. Make sure its useful- * 2. Replace placeholders with tips.- * 3. Show tips in editor placeholder.- * 4. Show tips between list items?- *- * Tooltips.- * Small tooltips can be shown in initial render first time.- * Especially for items that are not shown on blank page. Should be- * in places where it makes sense and does not interrupt the user.- *- * Can also be shown when first time entering a screen that- * has something that the user might not know of. Like sorting and side menu.- *- * Todo:- * 1. Make a tip manager.- * 2. Make a list of tips.- * 3. Add images for those tips.- * 4. Show tips- */diff --git a/apps/mobile/src/components/SimpleList/sectionheader.js b/apps/mobile/src/components/SimpleList/sectionheader.jsdeleted file mode 100644index 8ce468bd1..000000000--- a/apps/mobile/src/components/SimpleList/sectionheader.js+++ /dev/null@@ -1,145 +0,0 @@-import React, { useEffect, useRef, useState } from 'react';-import { TouchableOpacity, useWindowDimensions, View } from 'react-native';-import { useTracked } from '../../provider';-import { useSettingStore } from '../../provider/stores';-import {- eSendEvent,- eSubscribeEvent,- eUnSubscribeEvent,- presentSheet-} from '../../services/EventManager';-import SettingsService from '../../services/SettingsService';-import { GROUP } from '../../utils/constants';-import { COLORS_NOTE } from '../../utils/color-scheme';-import { db } from '../../utils/database';-import { eOpenJumpToDialog } from '../../utils/events';-import { SIZE } from '../../utils/size';-import { IconButton } from '../ui/icon-button';-import { Button } from '../ui/button';-import Sort from '../sort';-import Heading from '../ui/typography/heading';--export const SectionHeader = ({ item, index, type, color, screen }) => {- const [state] = useTracked();- const { colors } = state;- const { fontScale } = useWindowDimensions();- const [groupOptions, setGroupOptions] = useState(db.settings?.getGroupOptions(type));- let groupBy = Object.keys(GROUP).find(key => GROUP[key] === groupOptions.groupBy);- const jumpToRef = useRef();- const sortRef = useRef();- const compactModeRef = useRef();-- const settings = useSettingStore(state => state.settings);- const listMode = type === 'notebooks' ? settings.notebooksListMode : settings.notesListMode;-- groupBy = !groupBy- ? 'Default'- : groupBy.slice(0, 1).toUpperCase() + groupBy.slice(1, groupBy.length);-- const onUpdate = () => {- setGroupOptions({ ...db.settings?.getGroupOptions(type) });- };-- useEffect(() => {- eSubscribeEvent('groupOptionsUpdate', onUpdate);- return () => {- eUnSubscribeEvent('groupOptionsUpdate', onUpdate);- };- }, []);-- return (- <View- style={{- flexDirection: 'row',- alignItems: 'center',- width: '95%',- justifyContent: 'space-between',- paddingHorizontal: 12,- height: 35 * fontScale,- backgroundColor: colors.nav,- alignSelf: 'center',- borderRadius: 5,- marginVertical: 5- }}- >- <TouchableOpacity- onPress={() => {- eSendEvent(eOpenJumpToDialog, type);- }}- ref={jumpToRef}- activeOpacity={0.9}- hitSlop={{ top: 10, left: 10, right: 30, bottom: 15 }}- style={{- height: '100%',- justifyContent: 'center'- }}- >- <Heading- color={COLORS_NOTE[color?.toLowerCase()] || colors.accent}- size={SIZE.sm}- style={{- minWidth: 60,- alignSelf: 'center',- textAlignVertical: 'center'- }}- >- {!item.title || item.title === '' ? 'Pinned' : item.title}- </Heading>- </TouchableOpacity>-- <View- style={{- flexDirection: 'row',- alignItems: 'center'- }}- >- {index === 0 ? (- <>- <Button- onPress={() => {- presentSheet({- component: <Sort screen={screen} type={type} />- });- }}- tooltipText="Change sorting of items in list"- fwdRef={sortRef}- title={groupBy}- icon={groupOptions.sortDirection === 'asc' ? 'sort-ascending' : 'sort-descending'}- height={25}- style={{- borderRadius: 100,- paddingHorizontal: 0,- backgroundColor: 'transparent',- marginRight: type === 'notes' || type === 'home' || type === 'notebooks' ? 10 : 0- }}- type="gray"- iconPosition="right"- />-- {type === 'notes' || type === 'notebooks' || type === 'home' ? (- <IconButton- customStyle={{- width: 25,- height: 25- }}- tooltipText={- listMode == 'compact' ? 'Switch to normal mode' : 'Switch to compact mode'- }- fwdRef={compactModeRef}- color={colors.icon}- name={listMode == 'compact' ? 'view-list' : 'view-list-outline'}- onPress={() => {- SettingsService.set(- type !== 'notebooks' ? 'notesListMode' : 'notebooksListMode',- listMode === 'normal' ? 'compact' : 'normal'- );- }}- size={SIZE.lg - 2}- />- ) : null}- </>- ) : null}- </View>- </View>- );-};diff --git a/apps/mobile/src/components/list/index.js b/apps/mobile/src/components/list/index.jsindex b6ca15bc1..88befb4cd 100644--- a/apps/mobile/src/components/list/index.js+++ b/apps/mobile/src/components/list/index.js@@ -14,9 +14,9 @@ import TagItem from '../list-items/tag';import { Empty } from './empty';import { Footer } from '../list-items/footer';import { Header } from '../list-items/headers/header';-import { SectionHeader } from './section-header';+import { SectionHeader } from '../list-items/headers/section-header';-let renderItems = {+const renderItems = {note: NoteWrapper,notebook: NotebookWrapper,topic: NotebookWrapper,diff --git a/apps/mobile/src/components/listitems/headers/notebookheader.js b/apps/mobile/src/components/listitems/headers/notebookheader.jsindex 7a083d2bf..0007f5535 100644--- a/apps/mobile/src/components/listitems/headers/notebookheader.js+++ b/apps/mobile/src/components/listitems/headers/notebookheader.js@@ -1,14 +1,14 @@import React, { useRef, useState } from 'react';import { View } from 'react-native';-import { useTracked } from '../../provider';-import { useMenuStore } from '../../provider/stores';-import { ToastEvent } from '../../services/EventManager';-import { getTotalNotes } from '../../utils';-import { db } from '../../utils/database';-import { SIZE } from '../../utils/size';-import { IconButton } from '../ui/icon-button';-import Heading from '../ui/typography/heading';-import Paragraph from '../ui/typography/paragraph';+import { useTracked } from '../../../provider';+import { useMenuStore } from '../../../provider/stores';+import { ToastEvent } from '../../../services/EventManager';+import { getTotalNotes } from '../../../utils';+import { db } from '../../../utils/database';+import { SIZE } from '../../../utils/size';+import { IconButton } from '../../ui/icon-button';+import Heading from '../../ui/typography/heading';+import Paragraph from '../../ui/typography/paragraph';export const NotebookHeader = ({ notebook, onEditNotebook }) => {const [state] = useTracked();diff --git a/apps/mobile/src/components/listitems/headers/sectionheader.js b/apps/mobile/src/components/listitems/headers/sectionheader.jsindex acba767b9..a24cbedbe 100644--- a/apps/mobile/src/components/listitems/headers/sectionheader.js+++ b/apps/mobile/src/components/listitems/headers/sectionheader.js@@ -1,23 +1,23 @@import React, { useEffect, useRef, useState } from 'react';import { TouchableOpacity, useWindowDimensions, View } from 'react-native';-import { useTracked } from '../../provider';-import { useSettingStore } from '../../provider/stores';+import { useTracked } from '../../../provider';+import { useSettingStore } from '../../../provider/stores';import {eSendEvent,eSubscribeEvent,eUnSubscribeEvent,presentSheet-} from '../../services/EventManager';-import SettingsService from '../../services/SettingsService';-import { GROUP } from '../../utils/constants';-import { COLORS_NOTE } from '../../utils/color-scheme';-import { db } from '../../utils/database';-import { eOpenJumpToDialog } from '../../utils/events';-import { SIZE } from '../../utils/size';-import { IconButton } from '../ui/icon-button';-import { Button } from '../ui/button';-import Sort from '../Sort';-import Heading from '../ui/typography/heading';+} from '../../../services/EventManager';+import SettingsService from '../../../services/SettingsService';+import { GROUP } from '../../../utils/constants';+import { COLORS_NOTE } from '../../../utils/color-scheme';+import { db } from '../../../utils/database';+import { eOpenJumpToDialog } from '../../../utils/events';+import { SIZE } from '../../../utils/size';+import { IconButton } from '../../ui/icon-button';+import { Button } from '../../ui/button';+import Sort from '../../sort';+import Heading from '../../ui/typography/heading';export const SectionHeader = ({ item, index, type, color, screen }) => {const [state] = useTracked();diff --git a/apps/mobile/src/components/listitems/note/index.js b/apps/mobile/src/components/listitems/note/index.jsindex 13217facb..412f18836 100644--- a/apps/mobile/src/components/listitems/note/index.js+++ b/apps/mobile/src/components/listitems/note/index.js@@ -13,7 +13,7 @@ import { refreshNotesPage } from '../../../utils/events';import { SIZE } from '../../../utils/size';import { IconButton } from '../../ui/icon-button';import { Button } from '../../ui/button';-import { TimeSince } from '../../side-menu/TimeSince';+import { TimeSince } from '../../ui/time-since';import { Properties } from '../../properties';import Heading from '../../ui/typography/heading';import Paragraph from '../../ui/typography/paragraph';diff --git a/apps/mobile/src/components/sidemenu/userstatus.js b/apps/mobile/src/components/sidemenu/userstatus.jsindex c78e90914..6c25015f3 100644--- a/apps/mobile/src/components/sidemenu/userstatus.js+++ b/apps/mobile/src/components/sidemenu/userstatus.js@@ -11,7 +11,7 @@ import { SIZE } from '../../utils/size';import { PressableButton } from '../ui/pressable';import Heading from '../ui/typography/heading';import Paragraph from '../ui/typography/paragraph';-import { TimeSince } from './TimeSince';+import { TimeSince } from '../ui/time-since';export const UserStatus = () => {const [state] = useTracked();diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.jsindex 564982301..f6e4e97a4 100644--- a/apps/mobile/src/views/Notebook/index.js+++ b/apps/mobile/src/views/Notebook/index.js@@ -5,7 +5,7 @@ import { ContainerHeader } from '../../components/container/containerheader';import { Header } from '../../components/header';import SelectionHeader from '../../components/selection-header';import List from '../../components/list';-import { NotebookHeader } from '../../components/list/notebook-header';+import { NotebookHeader } from '../../components/list-items/headers/notebook-header';import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';import Navigation from '../../services/Navigation';import SearchService from '../../services/SearchService';