Skip to content

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

add context support in dialog

ammarahm-edc7ffcb8fde27
diff --git a/apps/mobile/src/components/Dialog/functions.ts b/apps/mobile/src/components/Dialog/functions.ts
index 645127dfc..2ce3be094 100644
--- a/apps/mobile/src/components/Dialog/functions.ts
+++ b/apps/mobile/src/components/Dialog/functions.ts
@@ -13,7 +13,8 @@ type DialogInfo = {
paragraphColor: string,
input:boolean,
inputPlaceholder:string,
- defaultValue:string
+ defaultValue:string,
+ context:"global" | "local"
}
export function presentDialog(data: DialogInfo): void {
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.js
index dc56eac77..a0a5b3fbc 100644
--- a/apps/mobile/src/components/Dialog/index.js
+++ b/apps/mobile/src/components/Dialog/index.js
@@ -13,7 +13,7 @@ import BaseDialog from './base-dialog';
import DialogButtons from './dialog-buttons';
import DialogHeader from './dialog-header';
-export const Dialog = () => {
+export const Dialog = ({context = 'global'}) => {
const [state] = useTracked();
const colors = state.colors;
const [visible, setVisible] = useState(false);
@@ -31,7 +31,7 @@ export const Dialog = () => {
paragraphColor: colors.pri,
input: false,
inputPlaceholder: 'Enter some text',
- defaultValue: '',
+ defaultValue: ''
});
useEffect(() => {
@@ -53,8 +53,10 @@ export const Dialog = () => {
};
const show = data => {
- setDialogInfo(data);
- setVisible(true);
+ if (data.context && data.context === context) {
+ setDialogInfo(data);
+ setVisible(true);
+ }
};
const hide = () => {
@@ -76,7 +78,7 @@ export const Dialog = () => {
borderRadius: 5,
backgroundColor: colors.bg,
paddingHorizontal: ph,
- paddingVertical: pv,
+ paddingVertical: pv
};
return (