Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactor

ammarahm-ed928e8debefc2
diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js
index 127ec3443..a4052ee0c 100644
--- a/apps/mobile/src/components/AddNotebookDialog/index.js
+++ b/apps/mobile/src/components/AddNotebookDialog/index.js
@@ -10,7 +10,7 @@ import {db} from '../../utils/database';
import {ph, pv, SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils';
import {ActionIcon} from '../ActionIcon';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header';
import Input from '../Input';
@@ -254,7 +254,7 @@ export class AddNotebookDialog extends React.Component {
const {topics, visible, topicInputFocused} = this.state;
if (!visible) return null;
return (
- <ActionSheetWrapper
+ <SheetWrapper
onOpen={async () => {
this.topicsToDelete = [];
await sleep(300);
@@ -408,7 +408,7 @@ export class AddNotebookDialog extends React.Component {
</View>
<Toast context="local" />
- </ActionSheetWrapper>
+ </SheetWrapper>
);
}
}
diff --git a/apps/mobile/src/components/AttachmentDialog/index.js b/apps/mobile/src/components/AttachmentDialog/index.js
index 3b11314e8..3e0254928 100644
--- a/apps/mobile/src/components/AttachmentDialog/index.js
+++ b/apps/mobile/src/components/AttachmentDialog/index.js
@@ -17,7 +17,7 @@ import {
import filesystem from '../../utils/filesystem';
import { SIZE } from '../../utils/SizeUtils';
import { ActionIcon } from '../ActionIcon';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import DialogHeader from '../Dialog/dialog-header';
import GeneralSheet from '../GeneralSheet';
import Paragraph from '../Typography/Paragraph';
@@ -57,7 +57,7 @@ export const AttachmentDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
centered={false}
fwdRef={actionSheetRef}
onClose={async () => {
@@ -107,7 +107,7 @@ export const AttachmentDialog = () => {
{' '}All attachments are end-to-end encrypted.
</Paragraph>
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/Dialog/BaseDialog.js b/apps/mobile/src/components/Dialog/BaseDialog.js
index 649ea14a2..669a46b36 100644
--- a/apps/mobile/src/components/Dialog/BaseDialog.js
+++ b/apps/mobile/src/components/Dialog/BaseDialog.js
@@ -8,7 +8,7 @@ import {
TouchableOpacity
} from 'react-native';
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
-import { BouncingView } from '../ActionSheetComponent/BouncingView';
+import { BouncingView } from '../Transitions/bouncing-view';
const BaseDialog = ({
visible,
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index 2c1e72652..d91a10ea0 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -21,8 +21,8 @@ import {
eThemeUpdated
} from '../../utils/Events';
import { EditorSettings } from '../../views/Editor/EditorSettings';
-import { ActionSheetComponent } from '../ActionSheetComponent';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import { Properties } from '../Properties';
+import SheetWrapper from '../sheet';
import { AddNotebookDialog } from '../AddNotebookDialog';
import { AddTopicDialog } from '../AddTopicDialog';
import { AnnouncementDialog } from '../Announcements';
@@ -237,7 +237,7 @@ export class DialogManager extends Component {
return (
<>
{!this.state.actionSheetVisible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
fwdRef={this.actionSheet}
onClose={() => {
eSendEvent(eShowGetPremium, null);
@@ -246,15 +246,11 @@ export class DialogManager extends Component {
actionSheetVisible: false
});
}}>
- <ActionSheetComponent
+ <Properties
item={item}
- setWillRefresh={value => {
- this.willRefresh = true;
- }}
getRef={() => this.actionSheet}
hasColors={actionSheetData.colors}
hasTags={actionSheetData.colors}
- overlayColor="rgba(0,0,0,0.3)"
rowItems={actionSheetData.rowItems}
columnItems={actionSheetData.columnItems}
close={value => {
@@ -264,7 +260,7 @@ export class DialogManager extends Component {
this.actionSheet.current?.setModalVisible();
}}
/>
- </ActionSheetWrapper>
+ </SheetWrapper>
)}
<Dialog context="global" />
<AddTopicDialog
diff --git a/apps/mobile/src/components/ExportDialog/index.js b/apps/mobile/src/components/ExportDialog/index.js
index 54547c570..b2c4bed68 100644
--- a/apps/mobile/src/components/ExportDialog/index.js
+++ b/apps/mobile/src/components/ExportDialog/index.js
@@ -10,7 +10,7 @@ import Exporter from '../../services/Exporter';
import { getElevation } from '../../utils';
import { ph, pv, SIZE } from '../../utils/SizeUtils';
import { sleep } from '../../utils/TimeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import { Button } from '../Button';
import DialogHeader from '../Dialog/dialog-header';
import { PressableButton } from '../PressableButton';
@@ -132,7 +132,7 @@ const ExportDialog = () => {
];
return !visible ? null : (
- <ActionSheetWrapper fwdRef={actionSheetRef} onClose={close} visible={true}>
+ <SheetWrapper fwdRef={actionSheetRef} onClose={close} visible={true}>
<View>
<View
style={{
@@ -269,7 +269,7 @@ const ExportDialog = () => {
</View>
</View>
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/GeneralSheet/index.js b/apps/mobile/src/components/GeneralSheet/index.js
index 2fbd755df..2f2b9bc19 100644
--- a/apps/mobile/src/components/GeneralSheet/index.js
+++ b/apps/mobile/src/components/GeneralSheet/index.js
@@ -6,7 +6,7 @@ import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {eCloseProgressDialog, eOpenProgressDialog} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -50,7 +50,7 @@ const GeneralSheet = ({context}) => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
fwdRef={actionSheetRef}
gestureEnabled={dialogData?.noProgress}
closeOnTouchBackdrop={dialogData?.noProgress}
@@ -166,7 +166,7 @@ const GeneralSheet = ({context}) => {
/>
))}
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.js
index 65e173803..73bdd0b37 100644
--- a/apps/mobile/src/components/LoginDialog/index.js
+++ b/apps/mobile/src/components/LoginDialog/index.js
@@ -25,7 +25,7 @@ import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils';
import Storage from '../../utils/storage';
import {sleep} from '../../utils/TimeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import BaseDialog from '../Dialog/base-dialog';
import DialogButtons from '../Dialog/dialog-buttons';
import DialogContainer from '../Dialog/dialog-container';
@@ -410,7 +410,7 @@ const LoginDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
fwdRef={actionSheetRef}
animation={DDS.isTab ? 'fade' : 'slide'}
statusBarTranslucent={false}
@@ -755,7 +755,7 @@ const LoginDialog = () => {
}}
/>
</ScrollView>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.js
index 81eb81ae4..9af1d518b 100644
--- a/apps/mobile/src/components/Menu/TagsSection.js
+++ b/apps/mobile/src/components/Menu/TagsSection.js
@@ -12,7 +12,7 @@ import Navigation from '../../services/Navigation';
import {db} from '../../utils/database';
import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';
import {normalize, SIZE} from '../../utils/SizeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import {ActionSheetEvent} from '../DialogManager/recievers';
import {PressableButton} from '../PressableButton';
@@ -126,7 +126,7 @@ const PinItem = ({item, index, onPress}) => {
return (
<>
{visible && (
- <ActionSheetWrapper
+ <SheetWrapper
onClose={() => {
setVisible(false);
}}
@@ -149,7 +149,7 @@ const PinItem = ({item, index, onPress}) => {
marginBottom: 30
}}
/>
- </ActionSheetWrapper>
+ </SheetWrapper>
)}
<PressableButton
type={headerTextState?.id === item.id ? 'grayBg' : 'gray'}
diff --git a/apps/mobile/src/components/MoveNoteDialog/index.js b/apps/mobile/src/components/MoveNoteDialog/index.js
index a856bbd8f..456671856 100644
--- a/apps/mobile/src/components/MoveNoteDialog/index.js
+++ b/apps/mobile/src/components/MoveNoteDialog/index.js
@@ -17,7 +17,7 @@ import {getTotalNotes} from '../../utils';
import {db} from '../../utils/database';
import {eOpenMoveNoteDialog} from '../../utils/Events';
import {pv, SIZE} from '../../utils/SizeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header';
import {PressableButton} from '../PressableButton';
@@ -68,9 +68,9 @@ const MoveNoteDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper fwdRef={actionSheetRef} onClose={_onClose}>
+ <SheetWrapper fwdRef={actionSheetRef} onClose={_onClose}>
<MoveNoteComponent close={close} note={note} setNote={update} />
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/ActionSheetComponent/colortags.js b/apps/mobile/src/components/Properties/colortags.js
similarity index 100%
rename from apps/mobile/src/components/ActionSheetComponent/colortags.js
rename to apps/mobile/src/components/Properties/colortags.js
diff --git a/apps/mobile/src/components/ActionSheetComponent/datemeta.js b/apps/mobile/src/components/Properties/datemeta.js
similarity index 100%
rename from apps/mobile/src/components/ActionSheetComponent/datemeta.js
rename to apps/mobile/src/components/Properties/datemeta.js
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/Properties/index.js
similarity index 99%
rename from apps/mobile/src/components/ActionSheetComponent/index.js
rename to apps/mobile/src/components/Properties/index.js
index f2057f447..9f645de3f 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/Properties/index.js
@@ -65,7 +65,7 @@ import {Topics} from './topics';
const w = Dimensions.get('window').width;
let htmlToText;
-export const ActionSheetComponent = ({
+export const Properties = ({
close = () => {},
item,
hasColors = false,
diff --git a/apps/mobile/src/components/ActionSheetComponent/tags.js b/apps/mobile/src/components/Properties/tags.js
similarity index 100%
rename from apps/mobile/src/components/ActionSheetComponent/tags.js
rename to apps/mobile/src/components/Properties/tags.js
diff --git a/apps/mobile/src/components/ActionSheetComponent/topics.js b/apps/mobile/src/components/Properties/topics.js
similarity index 100%
rename from apps/mobile/src/components/ActionSheetComponent/topics.js
rename to apps/mobile/src/components/Properties/topics.js
diff --git a/apps/mobile/src/components/PublishNoteDialog/index.js b/apps/mobile/src/components/PublishNoteDialog/index.js
index 085eb892d..dd75bca1b 100644
--- a/apps/mobile/src/components/PublishNoteDialog/index.js
+++ b/apps/mobile/src/components/PublishNoteDialog/index.js
@@ -17,7 +17,7 @@ import {
import {openLinkInBrowser} from '../../utils/functions';
import {SIZE} from '../../utils/SizeUtils';
import {ActionIcon} from '../ActionIcon';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header';
import Input from '../Input';
@@ -129,7 +129,7 @@ const PublishNoteDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
centered={false}
fwdRef={actionSheetRef}
closeOnTouchBackdrop={!publishing}
@@ -366,7 +366,7 @@ const PublishNoteDialog = () => {
Learn more about Notesnook Monograph
</Paragraph>
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/RateDialog/index.js b/apps/mobile/src/components/RateDialog/index.js
index b87d08f2c..71c778fc0 100644
--- a/apps/mobile/src/components/RateDialog/index.js
+++ b/apps/mobile/src/components/RateDialog/index.js
@@ -4,7 +4,7 @@ import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
import {eCloseRateDialog, eOpenRateDialog} from '../../utils/Events';
import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import Seperator from '../Seperator';
import Heading from '../Typography/Heading';
@@ -37,7 +37,7 @@ const RateDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
centered={false}
fwdRef={actionSheetRef}
onClose={async () => {
@@ -117,7 +117,7 @@ const RateDialog = () => {
/>
</View>
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/RecoveryKeyDialog/index.js b/apps/mobile/src/components/RecoveryKeyDialog/index.js
index ab0f16d05..cdba7479f 100644
--- a/apps/mobile/src/components/RecoveryKeyDialog/index.js
+++ b/apps/mobile/src/components/RecoveryKeyDialog/index.js
@@ -16,7 +16,7 @@ import {sanitizeFilename} from '../../utils/filename';
import {SIZE} from '../../utils/SizeUtils';
import Storage from '../../utils/storage';
import {sleep} from '../../utils/TimeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header';
import Seperator from '../Seperator';
@@ -185,7 +185,7 @@ class RecoveryKeyDialog extends React.Component {
const {colors} = this.props;
if (!this.state.visible) return null;
return (
- <ActionSheetWrapper
+ <SheetWrapper
closeOnTouchBackdrop={false}
gestureEnabled={false}
onOpen={this.onOpen}
@@ -317,7 +317,7 @@ class RecoveryKeyDialog extends React.Component {
onPress={this.close}
/>
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
}
}
diff --git a/apps/mobile/src/components/RestoreDialog/index.js b/apps/mobile/src/components/RestoreDialog/index.js
index 97db117aa..840c91ffd 100644
--- a/apps/mobile/src/components/RestoreDialog/index.js
+++ b/apps/mobile/src/components/RestoreDialog/index.js
@@ -15,7 +15,7 @@ import {MMKV} from '../../utils/mmkv';
import {SIZE} from '../../utils/SizeUtils';
import storage from '../../utils/storage';
import {sleep, timeConverter} from '../../utils/TimeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import {Button} from '../Button';
import DialogHeader from '../Dialog/dialog-header';
import Seperator from '../Seperator';
@@ -60,7 +60,7 @@ const RestoreDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
fwdRef={actionSheetRef}
gestureEnabled={!restoring}
closeOnTouchBackdrop={!restoring}
@@ -70,7 +70,7 @@ const RestoreDialog = () => {
restoring={restoring}
setRestoring={setRestoring}
/>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/TagsDialog/index.js b/apps/mobile/src/components/TagsDialog/index.js
index af14ba500..e84c8d182 100644
--- a/apps/mobile/src/components/TagsDialog/index.js
+++ b/apps/mobile/src/components/TagsDialog/index.js
@@ -8,7 +8,7 @@ import Navigation from '../../services/Navigation';
import {db} from '../../utils/database';
import {eCloseTagsDialog, eOpenTagsDialog, refreshNotesPage} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
-import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../sheet';
import Input from '../Input';
import {PressableButton} from '../PressableButton';
import Paragraph from '../Typography/Paragraph';
@@ -117,7 +117,7 @@ const TagsDialog = () => {
};
return !visible ? null : (
- <ActionSheetWrapper
+ <SheetWrapper
centered={false}
fwdRef={actionSheetRef}
onOpen={async () => {
@@ -203,7 +203,7 @@ const TagsDialog = () => {
))}
</ScrollView>
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
);
};
diff --git a/apps/mobile/src/components/ActionSheetComponent/BouncingView.js b/apps/mobile/src/components/Transitions/bouncingview.js
similarity index 100%
rename from apps/mobile/src/components/ActionSheetComponent/BouncingView.js
rename to apps/mobile/src/components/Transitions/bouncingview.js
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js b/apps/mobile/src/components/sheet/index.js
similarity index 83%
rename from apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
rename to apps/mobile/src/components/sheet/index.js
index bb6d04da0..407da1560 100644
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
+++ b/apps/mobile/src/components/sheet/index.js
@@ -1,14 +1,14 @@
import React from 'react';
-import { Platform, View } from 'react-native';
+import {Platform, View} from 'react-native';
import ActionSheet from 'react-native-actions-sheet';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useTracked } from '../../provider';
-import { useSettingStore } from '../../provider/stores';
-import { PremiumToast } from '../Premium/premium-toast';
-import { Toast } from '../Toast';
-import { BouncingView } from './BouncingView';
+import {useSafeAreaInsets} from 'react-native-safe-area-context';
+import {useTracked} from '../../provider';
+import {useSettingStore} from '../../provider/stores';
+import {PremiumToast} from '../Premium/premium-toast';
+import {Toast} from '../Toast';
+import {BouncingView} from '../Transitions/bouncing-view';
-const ActionSheetWrapper = ({
+const SheetWrapper = ({
children,
fwdRef,
gestureEnabled = true,
@@ -48,7 +48,6 @@ const ActionSheetWrapper = ({
};
const _onClose = async () => {
- //await reFocusEditor();
if (onClose) {
onClose();
}
@@ -96,4 +95,4 @@ const ActionSheetWrapper = ({
);
};
-export default ActionSheetWrapper;
+export default SheetWrapper;
diff --git a/apps/mobile/src/views/Editor/EditorSettings.js b/apps/mobile/src/views/Editor/EditorSettings.js
index 0ffe2b970..969b53445 100644
--- a/apps/mobile/src/views/Editor/EditorSettings.js
+++ b/apps/mobile/src/views/Editor/EditorSettings.js
@@ -2,7 +2,7 @@ import React, {createRef, useEffect, useRef, useState} from 'react';
import {View} from 'react-native';
import Menu, {MenuItem} from 'react-native-reanimated-material-menu';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import ActionSheetWrapper from '../../components/ActionSheetComponent/ActionSheetWrapper';
+import SheetWrapper from '../../components/sheet';
import {Button} from '../../components/Button';
import BaseDialog from '../../components/Dialog/base-dialog';
import DialogButtons from '../../components/Dialog/dialog-buttons';
@@ -161,7 +161,7 @@ export const EditorSettings = () => {
return (
visible && (
- <ActionSheetWrapper
+ <SheetWrapper
fwdRef={actionSheetRef}
onClose={() => {
setVisible(false);
@@ -209,7 +209,7 @@ export const EditorSettings = () => {
<SettingsButton {...item} />
))}
</View>
- </ActionSheetWrapper>
+ </SheetWrapper>
)
);
};