Skip to content

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

change dialog

ammarahm-ed8eb10e29a9e1
diff --git a/apps/mobile/src/components/Dialog/DialogButtons.js b/apps/mobile/src/components/Dialog/DialogButtons.js
index 6bc778dc9..a2de38767 100644
--- a/apps/mobile/src/components/Dialog/DialogButtons.js
+++ b/apps/mobile/src/components/Dialog/DialogButtons.js
@@ -18,13 +18,15 @@ const DialogButtons = ({
width="30%"
title={negativeTitle}
/>
- <Button
- onPress={onPressPositive}
- fontSize={SIZE.md}
- width="30%"
- type="transparent"
- title={positiveTitle}
- />
+ {onPressPositive && (
+ <Button
+ onPress={onPressPositive}
+ fontSize={SIZE.md}
+ width="30%"
+ type="transparent"
+ title={positiveTitle}
+ />
+ )}
</View>
);
};
@@ -37,6 +39,5 @@ const styles = StyleSheet.create({
alignItems: 'center',
flexDirection: 'row',
marginTop: 20,
-
},
});
diff --git a/apps/mobile/src/components/RestoreDialog/index.js b/apps/mobile/src/components/RestoreDialog/index.js
index d297ce796..906030852 100644
--- a/apps/mobile/src/components/RestoreDialog/index.js
+++ b/apps/mobile/src/components/RestoreDialog/index.js
@@ -20,6 +20,8 @@ import {sleep} from '../../utils/TimeUtils';
import {ph, SIZE, WEIGHT} from '../../utils/SizeUtils';
import {db} from '../../utils/DB';
import {DDS} from '../../services/DeviceDetection';
+import DialogHeader from '../Dialog/dialog-header';
+import DialogButtons from '../Dialog/dialog-buttons';
const RestoreDialog = () => {
const [state, dispatch] = useTracked();
@@ -88,13 +90,12 @@ const RestoreDialog = () => {
<View
style={{
...getElevation(5),
- width: DDS.isTab ? 500 : '100%',
- height: DDS.isTab ? 500 : '100%',
+ width: DDS.isTab ? 500 : '80%',
+ height: DDS.isTab ? 500 : null,
+ maxHeight: '90%',
borderRadius: 5,
backgroundColor: colors.bg,
- paddingHorizontal: 12,
- paddingVertical: 20,
- paddingTop: 0,
+ padding: 12,
}}>
<BaseDialog visible={restoring}>
<View
@@ -121,123 +122,53 @@ const RestoreDialog = () => {
</View>
</BaseDialog>
+ <DialogHeader
+ title="Choose a Backup"
+ paragraph="All backups are stored in 'Phone Storage/Notesnook/backups'
+ folder."
+ />
+
<View
style={{
- justifyContent: 'space-between',
- alignItems: 'center',
- height: 50,
- marginTop: DDS.isTab ? 0 : insets.top,
- flexDirection: 'row',
+ maxHeight: '85%',
}}>
- <ActionIcon
- name="arrow-left"
- size={SIZE.xxl}
- onPress={close}
- customStyle={{
- width: 40,
- height: 40,
- textAlignVertical: 'center',
- left: 0,
- marginLeft: -5,
- marginRight: 5,
- }}
- color={colors.heading}
- />
- <Text
- style={{
- color: colors.accent,
- fontFamily: WEIGHT.bold,
- fontSize: SIZE.xl,
- textAlign: 'center',
- }}>
- Choose a Backup
- </Text>
-
- <View
- style={{
- width: 40,
- height: 40,
- }}
- />
- </View>
-
- <FlatList
- data={files}
- style={{
- height: '100%',
- }}
- contentContainerStyle={{
- height: '100%',
- }}
- ListEmptyComponent={
- <View
- style={{
- width: '90%',
- height: '100%',
- justifyContent: 'center',
- alignItems: 'center',
- alignSelf: 'center',
- }}>
- <Text
- style={{
- color: colors.pri,
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.sm,
- textAlign: 'center',
- marginBottom: 10,
- }}>
- No Backups Found
- </Text>
- <Text
- style={{
- color: colors.icon,
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.xs + 1,
- textAlign: 'center',
- }}>
- All backups are stored in 'Phone Storage/Notesnook/backups'
- folder. If you have migrated to a new device, move your backups
- to{' '}
- <Text style={{color: colors.accent}}>
- 'Phone Storage/Notesnook/backups'
- </Text>{' '}
- so they can be restored.
- </Text>
- </View>
- }
- keyExtractor={(item, index) => item.filename}
- renderItem={({item, index}) => (
- <View
- style={{
- minHeight: 50,
- justifyContent: 'space-between',
- alignItems: 'center',
- width: '100%',
- borderRadius: 0,
- flexDirection: 'row',
- borderBottomWidth: 0.5,
- borderBottomColor: colors.nav,
- }}>
- <Text
+ <FlatList
+ data={files}
+ keyExtractor={(item, index) => item.filename}
+ renderItem={({item, index}) => (
+ <View
style={{
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.xs + 1,
- color: colors.pri,
+ minHeight: 50,
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ width: '100%',
+ borderRadius: 0,
+ flexDirection: 'row',
+ borderBottomWidth: 0.5,
+ borderBottomColor: colors.nav,
}}>
- {item.filename
- .replace('notesnook_backup_', '')
- .replace('.nnbackup', '')}
- </Text>
+ <Text
+ style={{
+ fontFamily: WEIGHT.regular,
+ fontSize: SIZE.xs + 1,
+ color: colors.pri,
+ }}>
+ {item.filename
+ .replace('notesnook_backup_', '')
+ .replace('.nnbackup', '')}
+ </Text>
- <Button
- title="Restore"
- width={80}
- height={30}
- onPress={() => restore(item, index)}
- />
- </View>
- )}
- />
+ <Button
+ title="Restore"
+ width={80}
+ height={30}
+ onPress={() => restore(item, index)}
+ />
+ </View>
+ )}
+ />
+ </View>
+ <DialogButtons onPressNegative={close} />
</View>
</BaseDialog>
);