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 dialog loading & completion status
ammarahm-ede5cc6ba81b99
diff --git a/apps/mobile/src/components/Dialog/DialogButtons.js b/apps/mobile/src/components/Dialog/DialogButtons.jsindex bed33e061..62aa32baa 100644--- a/apps/mobile/src/components/Dialog/DialogButtons.js+++ b/apps/mobile/src/components/Dialog/DialogButtons.js@@ -3,6 +3,8 @@ import {ActivityIndicator, StyleSheet, View} from 'react-native';import {useTracked} from '../../provider';import {SIZE} from '../../utils/SizeUtils';import {Button} from '../Button';+import Paragraph from '../Typography/Paragraph';+import Icon from 'react-native-vector-icons/MaterialCommunityIcons';const DialogButtons = ({onPressPositive,@@ -10,6 +12,7 @@ const DialogButtons = ({positiveTitle,negativeTitle = 'Cancel',loading,+ doneText,}) => {const [state] = useTracked();const {colors} = state;@@ -18,7 +21,22 @@ const DialogButtons = ({<View style={styles.container}>{loading ? (<ActivityIndicator color={colors.accent} size={SIZE.lg} />- ) : <View/>}+ ) : doneText ? (+ <View+ style={{+ flexDirection: 'row',+ alignItems: 'center',+ }}>+ <Icon+ color={colors.accent}+ name="check-circle-outline"+ size={SIZE.md}+ />+ <Paragraph color={colors.accent}>{' ' + doneText}</Paragraph>+ </View>+ ) : (+ <View />+ )}<Viewstyle={{diff --git a/apps/mobile/src/components/ExportDialog/index.js b/apps/mobile/src/components/ExportDialog/index.jsindex a30527aff..fcb733d2c 100644--- a/apps/mobile/src/components/ExportDialog/index.js+++ b/apps/mobile/src/components/ExportDialog/index.js@@ -1,6 +1,7 @@import React, {Fragment, useEffect, useState} from 'react';import {Platform, StyleSheet, TouchableOpacity, View} from 'react-native';import FileViewer from 'react-native-file-viewer';+import {exp} from 'react-native-reanimated';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {useTracked} from '../../provider';import {DDS} from '../../services/DeviceDetection';@@ -13,6 +14,7 @@ import {sleep} from '../../utils/TimeUtils';import {GetPremium} from '../ActionSheetComponent/GetPremium';import {Button} from '../Button/index';import BaseDialog from '../Dialog/base-dialog';+import DialogButtons from '../Dialog/dialog-buttons';import DialogHeader from '../Dialog/dialog-header';import {Loading} from '../Loading';import Seperator from '../Seperator';@@ -61,6 +63,7 @@ const ExportDialog = () => {};const save = async (func, name) => {+ if (exporting) return;setExporting(true);let res;for (var i = 0; i < notes.length; i++) {@@ -178,88 +181,79 @@ const ExportDialog = () => {/><Seperator half />- {exporting ? (- <Loading- done={complete}- doneText={doneText}- onDone={async () => {- close();- await sleep(500);- FileViewer.open(result.filePath, {- showOpenWithDialog: true,- showAppsSuggestions: true,- }).catch((e) => {- console.log(e);- ToastEvent.show(- `No application found to open ${result.name} file`,- );- });- }}- tagline="Exporting notes"- />- ) : (- <>- <View style={styles.buttonContainer}>- {actions.map((item) => (- <Fragment key={item.title}>- <Seperator half />-- <TouchableOpacity- onPress={item.func}- activeOpacity={1}- style={{- width: '100%',- alignItems: 'center',- flexDirection: 'row',- paddingRight: 12,- paddingVertical: 10,- }}>- <View- style={{- backgroundColor: colors.shade,- borderRadius: 5,- height: 40,- width: 40,- justifyContent: 'center',- alignItems: 'center',- }}>- <Icon- name={item.icon}- color={colors.accent}- size={SIZE.xxxl}- />- </View>- <Heading- style={{marginLeft: 5, maxWidth: '90%'}}- size={SIZE.md}>- {item.title}- {'\n'}- <Paragraph size={SIZE.sm} color={colors.icon}>- {item.desc}- </Paragraph>- </Heading>- </TouchableOpacity>- </Fragment>- ))}- <Seperator />- <View+ <View style={styles.buttonContainer}>+ {actions.map((item) => (+ <Fragment key={item.title}>+ <Seperator half />+ <TouchableOpacity+ onPress={item.func}+ activeOpacity={1}style={{- justifyContent: 'flex-end',width: '100%',+ alignItems: 'center',flexDirection: 'row',+ paddingRight: 12,+ paddingVertical: 10,}}>- <View />- <Button- onPress={close}- width="30%"- type="gray"- title="Cancel"- fontSize={SIZE.md}- />- </View>- </View>- </>- )}+ <View+ style={{+ backgroundColor: colors.shade,+ borderRadius: 5,+ height: 40,+ width: 40,+ justifyContent: 'center',+ alignItems: 'center',+ }}>+ <Icon+ name={item.icon}+ color={colors.accent}+ size={SIZE.xxxl}+ />+ </View>+ <Heading+ style={{marginLeft: 5, maxWidth: '90%'}}+ size={SIZE.md}>+ {item.title}+ {'\n'}+ <Paragraph size={SIZE.sm} color={colors.icon}>+ {item.desc}+ </Paragraph>+ </Heading>+ </TouchableOpacity>+ </Fragment>+ ))}+ <Seperator />++ <View+ style={{+ width: '100%',+ }}>+ <DialogButtons+ onPressNegative={close}+ negativeTitle="Cancel"+ positiveTitle={complete && 'Open File'}+ onPressPositive={+ complete+ ? async () => {+ close();+ await sleep(500);+ FileViewer.open(result.filePath, {+ showOpenWithDialog: true,+ showAppsSuggestions: true,+ }).catch((e) => {+ console.log(e);+ ToastEvent.show(+ `No application found to open ${result.name} file`,+ );+ });+ }+ : null+ }+ loading={exporting && !complete}+ doneText={complete && 'Note Exported!'}+ />+ </View>+ </View></View></BaseDialog>);diff --git a/apps/mobile/src/components/RestoreDialog/index.js b/apps/mobile/src/components/RestoreDialog/index.jsindex 281ee5e52..b73ac4227 100644--- a/apps/mobile/src/components/RestoreDialog/index.js+++ b/apps/mobile/src/components/RestoreDialog/index.js@@ -20,8 +20,7 @@ import {Button} from '../Button';import BaseDialog from '../Dialog/base-dialog';import DialogButtons from '../Dialog/dialog-buttons';import DialogHeader from '../Dialog/dialog-header';-import {Loading} from '../Loading';-import { Toast } from '../Toast';+import {Toast} from '../Toast';import Paragraph from '../Typography/Paragraph';const RestoreDialog = () => {@@ -46,7 +45,11 @@ const RestoreDialog = () => {const close = () => {if (restoring) {- ToastEvent.show('Please wait, we are restoring your data.','error','local');+ ToastEvent.show(+ 'Please wait, we are restoring your data.',+ 'error',+ 'local',+ );return;}@@ -57,7 +60,11 @@ const RestoreDialog = () => {if (Platform.OS === 'android') {let granted = storage.requestPermission();if (!granted) {- ToastEvent.show('Restore Failed! Storage access denied',"error","local");+ ToastEvent.show(+ 'Restore Failed! Storage access denied',+ 'error',+ 'local',+ );return;}}@@ -67,7 +74,7 @@ const RestoreDialog = () => {await sleep(2000);setRestoring(false);dispatch({type: Actions.ALL});- ToastEvent.show('Restore Complete!', 'success',"local");+ ToastEvent.show('Restore Complete!', 'success', 'local');setVisible(false);};@@ -154,7 +161,6 @@ const RestoreDialog = () => {/><DialogButtons loading={restoring} onPressNegative={close} />-</View><Toast context="local" /></BaseDialog>