2019-07-29 15:43:53 +02:00
|
|
|
const React = require('react');
|
|
|
|
const Component = React.Component;
|
2019-07-29 15:58:33 +02:00
|
|
|
const { Easing, Animated, TouchableOpacity, Text, StyleSheet, ScrollView, View, Alert } = require('react-native');
|
2018-03-09 22:59:12 +02:00
|
|
|
const { connect } = require('react-redux');
|
|
|
|
const Icon = require('react-native-vector-icons/Ionicons').default;
|
|
|
|
const Folder = require('lib/models/Folder.js');
|
2020-10-09 19:35:46 +02:00
|
|
|
const Synchronizer = require('lib/Synchronizer').default;
|
2019-06-26 01:35:26 +02:00
|
|
|
const NavService = require('lib/services/NavService.js');
|
2020-10-09 19:35:46 +02:00
|
|
|
const { _ } = require('lib/locale');
|
2020-06-10 23:08:59 +02:00
|
|
|
const { themeStyle } = require('lib/components/global-style.js');
|
2018-03-09 22:59:12 +02:00
|
|
|
const shared = require('lib/components/shared/side-menu-shared.js');
|
2017-05-24 21:27:13 +02:00
|
|
|
|
2020-02-09 16:51:12 +02:00
|
|
|
Icon.loadFont();
|
|
|
|
|
2017-05-24 21:27:13 +02:00
|
|
|
class SideMenuContentComponent extends Component {
|
2017-07-06 21:48:17 +02:00
|
|
|
constructor() {
|
|
|
|
super();
|
2019-06-26 02:10:15 +02:00
|
|
|
this.state = {
|
|
|
|
syncReportText: '',
|
2017-07-25 20:36:52 +02:00
|
|
|
};
|
2017-08-01 19:59:01 +02:00
|
|
|
this.styles_ = {};
|
2019-03-14 00:42:16 +02:00
|
|
|
|
|
|
|
this.tagButton_press = this.tagButton_press.bind(this);
|
2019-06-26 02:10:15 +02:00
|
|
|
this.newFolderButton_press = this.newFolderButton_press.bind(this);
|
2019-06-26 20:05:37 +02:00
|
|
|
this.synchronize_press = this.synchronize_press.bind(this);
|
|
|
|
this.configButton_press = this.configButton_press.bind(this);
|
2019-07-11 19:44:26 +02:00
|
|
|
this.allNotesButton_press = this.allNotesButton_press.bind(this);
|
2019-06-26 19:28:09 +02:00
|
|
|
this.renderFolderItem = this.renderFolderItem.bind(this);
|
2019-07-12 19:07:47 +02:00
|
|
|
|
|
|
|
this.syncIconRotationValue = new Animated.Value(0);
|
|
|
|
this.syncIconRotation = this.syncIconRotationValue.interpolate({
|
|
|
|
inputRange: [0, 1],
|
|
|
|
outputRange: ['360deg', '0deg'],
|
|
|
|
});
|
2017-08-01 19:59:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
styles() {
|
2020-09-15 15:01:07 +02:00
|
|
|
const theme = themeStyle(this.props.themeId);
|
2017-08-01 19:59:01 +02:00
|
|
|
|
2020-09-15 15:01:07 +02:00
|
|
|
if (this.styles_[this.props.themeId]) return this.styles_[this.props.themeId];
|
2017-08-01 19:59:01 +02:00
|
|
|
this.styles_ = {};
|
|
|
|
|
2020-03-14 01:46:14 +02:00
|
|
|
const styles = {
|
2017-08-01 19:59:01 +02:00
|
|
|
menu: {
|
|
|
|
flex: 1,
|
2019-07-29 15:43:53 +02:00
|
|
|
backgroundColor: theme.backgroundColor,
|
2017-08-01 19:59:01 +02:00
|
|
|
},
|
|
|
|
button: {
|
|
|
|
flex: 1,
|
2018-03-09 22:59:12 +02:00
|
|
|
flexDirection: 'row',
|
2017-08-01 19:59:01 +02:00
|
|
|
height: 36,
|
2018-03-09 22:59:12 +02:00
|
|
|
alignItems: 'center',
|
2017-08-01 19:59:01 +02:00
|
|
|
paddingLeft: theme.marginLeft,
|
|
|
|
paddingRight: theme.marginRight,
|
|
|
|
},
|
|
|
|
buttonText: {
|
|
|
|
flex: 1,
|
|
|
|
color: theme.color,
|
|
|
|
paddingLeft: 10,
|
|
|
|
fontSize: theme.fontSize,
|
|
|
|
},
|
|
|
|
syncStatus: {
|
|
|
|
paddingLeft: theme.marginLeft,
|
|
|
|
paddingRight: theme.marginRight,
|
|
|
|
color: theme.colorFaded,
|
|
|
|
fontSize: theme.fontSizeSmaller,
|
2019-06-26 20:05:37 +02:00
|
|
|
flex: 0,
|
2017-08-01 19:59:01 +02:00
|
|
|
},
|
2019-06-26 02:10:15 +02:00
|
|
|
sidebarIcon: {
|
|
|
|
fontSize: 22,
|
|
|
|
color: theme.color,
|
|
|
|
},
|
2017-08-01 19:59:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
styles.folderButton = Object.assign({}, styles.button);
|
2018-05-09 13:39:17 +02:00
|
|
|
styles.folderButton.paddingLeft = 0;
|
2017-08-01 19:59:01 +02:00
|
|
|
styles.folderButtonText = Object.assign({}, styles.buttonText);
|
|
|
|
styles.folderButtonSelected = Object.assign({}, styles.folderButton);
|
|
|
|
styles.folderButtonSelected.backgroundColor = theme.selectedColor;
|
|
|
|
styles.folderIcon = Object.assign({}, theme.icon);
|
2019-10-09 21:35:13 +02:00
|
|
|
styles.folderIcon.color = theme.colorFaded; // '#0072d5';
|
2018-05-09 13:39:17 +02:00
|
|
|
styles.folderIcon.paddingTop = 3;
|
2017-08-01 19:59:01 +02:00
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
styles.sideButton = Object.assign({}, styles.button, { flex: 0 });
|
2019-07-11 19:44:26 +02:00
|
|
|
styles.sideButtonSelected = Object.assign({}, styles.sideButton, { backgroundColor: theme.selectedColor });
|
2019-03-14 00:42:16 +02:00
|
|
|
styles.sideButtonText = Object.assign({}, styles.buttonText);
|
2017-08-01 19:59:01 +02:00
|
|
|
|
2020-09-15 15:01:07 +02:00
|
|
|
this.styles_[this.props.themeId] = StyleSheet.create(styles);
|
|
|
|
return this.styles_[this.props.themeId];
|
2017-07-06 21:48:17 +02:00
|
|
|
}
|
|
|
|
|
2019-07-12 19:07:47 +02:00
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
if (this.props.syncStarted !== prevProps.syncStarted) {
|
|
|
|
if (this.props.syncStarted) {
|
2019-07-29 15:43:53 +02:00
|
|
|
this.syncIconAnimation = Animated.loop(
|
|
|
|
Animated.timing(this.syncIconRotationValue, {
|
|
|
|
toValue: 1,
|
|
|
|
duration: 3000,
|
|
|
|
easing: Easing.linear,
|
|
|
|
})
|
|
|
|
);
|
2019-07-12 19:07:47 +02:00
|
|
|
|
|
|
|
this.syncIconAnimation.start();
|
|
|
|
} else {
|
|
|
|
if (this.syncIconAnimation) this.syncIconAnimation.stop();
|
|
|
|
this.syncIconAnimation = null;
|
|
|
|
}
|
2019-07-29 15:43:53 +02:00
|
|
|
}
|
2019-07-12 19:07:47 +02:00
|
|
|
}
|
|
|
|
|
2017-05-24 21:27:13 +02:00
|
|
|
folder_press(folder) {
|
2019-07-11 19:44:26 +02:00
|
|
|
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
|
|
|
|
|
|
|
this.props.dispatch({
|
|
|
|
type: 'NAV_GO',
|
|
|
|
routeName: 'Notes',
|
|
|
|
folderId: folder.id,
|
|
|
|
});
|
2017-05-24 21:27:13 +02:00
|
|
|
}
|
|
|
|
|
2019-06-26 19:28:09 +02:00
|
|
|
async folder_longPress(folder) {
|
2019-06-28 01:51:02 +02:00
|
|
|
if (folder === 'all') return;
|
|
|
|
|
2019-06-26 19:28:09 +02:00
|
|
|
Alert.alert(
|
|
|
|
'',
|
2019-07-29 15:43:53 +02:00
|
|
|
_('Notebook: %s', folder.title),
|
|
|
|
[
|
2019-06-26 19:28:09 +02:00
|
|
|
{
|
|
|
|
text: _('Rename'),
|
|
|
|
onPress: () => {
|
|
|
|
if (folder.encryption_applied) {
|
|
|
|
alert(_('Encrypted notebooks cannot be renamed'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
|
|
|
|
|
|
|
this.props.dispatch({
|
|
|
|
type: 'NAV_GO',
|
|
|
|
routeName: 'Folder',
|
|
|
|
folderId: folder.id,
|
|
|
|
});
|
2019-07-29 15:43:53 +02:00
|
|
|
},
|
2019-06-26 19:28:09 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: _('Delete'),
|
|
|
|
onPress: () => {
|
|
|
|
Alert.alert('', _('Delete notebook "%s"?\n\nAll notes and sub-notebooks within this notebook will also be deleted.', folder.title), [
|
|
|
|
{
|
|
|
|
text: _('OK'),
|
|
|
|
onPress: () => {
|
|
|
|
Folder.delete(folder.id);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: _('Cancel'),
|
|
|
|
onPress: () => {},
|
|
|
|
style: 'cancel',
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
style: 'destructive',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: _('Cancel'),
|
|
|
|
onPress: () => {},
|
|
|
|
style: 'cancel',
|
2019-07-29 15:43:53 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
{
|
|
|
|
cancelable: false,
|
2019-06-26 19:28:09 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-05-09 13:39:17 +02:00
|
|
|
folder_togglePress(folder) {
|
|
|
|
this.props.dispatch({
|
|
|
|
type: 'FOLDER_TOGGLE',
|
|
|
|
id: folder.id,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-03-14 00:42:16 +02:00
|
|
|
tagButton_press() {
|
2018-03-09 22:59:12 +02:00
|
|
|
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
2017-07-25 20:36:52 +02:00
|
|
|
|
|
|
|
this.props.dispatch({
|
2018-03-09 22:59:12 +02:00
|
|
|
type: 'NAV_GO',
|
2019-03-14 00:42:16 +02:00
|
|
|
routeName: 'Tags',
|
2017-07-25 20:36:52 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
configButton_press() {
|
|
|
|
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
|
|
|
NavService.go('Config');
|
|
|
|
}
|
|
|
|
|
2019-07-11 19:44:26 +02:00
|
|
|
allNotesButton_press() {
|
|
|
|
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
|
|
|
|
|
|
|
this.props.dispatch({
|
|
|
|
type: 'NAV_GO',
|
|
|
|
routeName: 'Notes',
|
|
|
|
smartFilterId: 'c3176726992c11e9ac940492261af972',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-26 02:10:15 +02:00
|
|
|
newFolderButton_press() {
|
|
|
|
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
|
|
|
|
|
|
|
this.props.dispatch({
|
|
|
|
type: 'NAV_GO',
|
|
|
|
routeName: 'Folder',
|
|
|
|
folderId: null,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-06 21:48:17 +02:00
|
|
|
async synchronize_press() {
|
2017-11-06 23:11:15 +02:00
|
|
|
const actionDone = await shared.synchronize_press(this);
|
2018-03-09 22:59:12 +02:00
|
|
|
if (actionDone === 'auth') this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
2017-07-06 21:48:17 +02:00
|
|
|
}
|
|
|
|
|
2019-06-26 19:28:09 +02:00
|
|
|
renderFolderItem(folder, selected, hasChildren, depth) {
|
2020-09-15 15:01:07 +02:00
|
|
|
const theme = themeStyle(this.props.themeId);
|
2017-07-22 17:55:09 +02:00
|
|
|
|
2018-05-09 13:39:17 +02:00
|
|
|
const folderButtonStyle = {
|
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
height: 36,
|
|
|
|
alignItems: 'center',
|
|
|
|
paddingRight: theme.marginRight,
|
|
|
|
};
|
|
|
|
if (selected) folderButtonStyle.backgroundColor = theme.selectedColor;
|
2019-07-12 19:07:47 +02:00
|
|
|
folderButtonStyle.paddingLeft = depth * 10 + theme.marginLeft;
|
2018-05-09 13:39:17 +02:00
|
|
|
|
|
|
|
const iconWrapperStyle = { paddingLeft: 10, paddingRight: 10 };
|
|
|
|
if (selected) iconWrapperStyle.backgroundColor = theme.selectedColor;
|
|
|
|
|
2019-06-28 01:51:02 +02:00
|
|
|
let iconWrapper = null;
|
2018-05-09 13:39:17 +02:00
|
|
|
|
2020-10-16 22:52:17 +02:00
|
|
|
const iconName = this.props.collapsedFolderIds.indexOf(folder.id) >= 0 ? 'chevron-down' : 'chevron-up';
|
2019-07-29 15:43:53 +02:00
|
|
|
const iconComp = <Icon name={iconName} style={this.styles().folderIcon} />;
|
2019-06-28 01:51:02 +02:00
|
|
|
|
2019-07-11 19:44:26 +02:00
|
|
|
iconWrapper = !hasChildren ? null : (
|
2019-07-29 15:43:53 +02:00
|
|
|
<TouchableOpacity
|
|
|
|
style={iconWrapperStyle}
|
|
|
|
folderid={folder.id}
|
|
|
|
onPress={() => {
|
|
|
|
if (hasChildren) this.folder_togglePress(folder);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{iconComp}
|
2019-07-11 19:44:26 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
2018-05-09 13:39:17 +02:00
|
|
|
|
|
|
|
return (
|
2019-07-11 19:44:26 +02:00
|
|
|
<View key={folder.id} style={{ flex: 1, flexDirection: 'row' }}>
|
2019-07-29 15:43:53 +02:00
|
|
|
<TouchableOpacity
|
|
|
|
style={{ flex: 1 }}
|
|
|
|
onPress={() => {
|
|
|
|
this.folder_press(folder);
|
|
|
|
}}
|
|
|
|
onLongPress={() => {
|
|
|
|
this.folder_longPress(folder);
|
|
|
|
}}
|
|
|
|
>
|
2018-05-09 13:39:17 +02:00
|
|
|
<View style={folderButtonStyle}>
|
2019-07-29 15:43:53 +02:00
|
|
|
<Text numberOfLines={1} style={this.styles().folderButtonText}>
|
|
|
|
{Folder.displayTitle(folder)}
|
|
|
|
</Text>
|
2018-05-09 13:39:17 +02:00
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
2019-07-29 15:43:53 +02:00
|
|
|
{iconWrapper}
|
2018-05-09 13:39:17 +02:00
|
|
|
</View>
|
|
|
|
);
|
2017-07-22 17:55:09 +02:00
|
|
|
}
|
|
|
|
|
2019-07-11 19:44:26 +02:00
|
|
|
renderSideBarButton(key, title, iconName, onPressHandler = null, selected = false) {
|
2019-07-29 15:43:53 +02:00
|
|
|
let icon = <Icon name={iconName} style={this.styles().sidebarIcon} />;
|
2019-07-12 19:07:47 +02:00
|
|
|
|
|
|
|
if (key === 'synchronize_button') {
|
2019-07-29 15:43:53 +02:00
|
|
|
icon = <Animated.View style={{ transform: [{ rotate: this.syncIconRotation }] }}>{icon}</Animated.View>;
|
2019-07-12 19:07:47 +02:00
|
|
|
}
|
|
|
|
|
2019-07-11 19:44:26 +02:00
|
|
|
const content = (
|
|
|
|
<View key={key} style={selected ? this.styles().sideButtonSelected : this.styles().sideButton}>
|
2019-07-12 19:07:47 +02:00
|
|
|
{icon}
|
2019-07-11 19:44:26 +02:00
|
|
|
<Text style={this.styles().sideButtonText}>{title}</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
|
|
|
if (!onPressHandler) return content;
|
|
|
|
|
2017-07-22 17:55:09 +02:00
|
|
|
return (
|
2019-06-26 02:10:15 +02:00
|
|
|
<TouchableOpacity key={key} onPress={onPressHandler}>
|
2019-07-11 19:44:26 +02:00
|
|
|
{content}
|
2017-07-22 17:55:09 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-07-25 20:36:52 +02:00
|
|
|
makeDivider(key) {
|
2020-09-15 15:01:07 +02:00
|
|
|
const theme = themeStyle(this.props.themeId);
|
2020-06-10 23:08:59 +02:00
|
|
|
return <View style={{ marginTop: 15, marginBottom: 15, flex: -1, borderBottomWidth: 1, borderBottomColor: theme.dividerColor }} key={key}></View>;
|
2017-07-25 20:36:52 +02:00
|
|
|
}
|
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
renderBottomPanel() {
|
2020-09-15 15:01:07 +02:00
|
|
|
const theme = themeStyle(this.props.themeId);
|
2017-10-30 20:27:51 +02:00
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
const items = [];
|
2017-05-24 21:27:13 +02:00
|
|
|
|
2019-03-14 00:42:16 +02:00
|
|
|
items.push(this.makeDivider('divider_1'));
|
2017-07-28 19:57:01 +02:00
|
|
|
|
2019-06-26 02:10:15 +02:00
|
|
|
items.push(this.renderSideBarButton('newFolder_button', _('New Notebook'), 'md-folder-open', this.newFolderButton_press));
|
|
|
|
|
|
|
|
items.push(this.renderSideBarButton('tag_button', _('Tags'), 'md-pricetag', this.tagButton_press));
|
2017-07-06 21:48:17 +02:00
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
items.push(this.renderSideBarButton('config_button', _('Configuration'), 'md-settings', this.configButton_press));
|
|
|
|
|
|
|
|
items.push(this.makeDivider('divider_2'));
|
|
|
|
|
2020-03-14 01:46:14 +02:00
|
|
|
const lines = Synchronizer.reportToLines(this.props.syncReport);
|
2019-07-29 15:43:53 +02:00
|
|
|
const syncReportText = lines.join('\n');
|
2017-07-18 00:43:29 +02:00
|
|
|
|
2018-06-10 18:43:24 +02:00
|
|
|
let decryptionReportText = '';
|
|
|
|
if (this.props.decryptionWorker && this.props.decryptionWorker.state !== 'idle' && this.props.decryptionWorker.itemCount) {
|
|
|
|
decryptionReportText = _('Decrypting items: %d/%d', this.props.decryptionWorker.itemIndex + 1, this.props.decryptionWorker.itemCount);
|
|
|
|
}
|
|
|
|
|
2018-11-14 00:27:58 +02:00
|
|
|
let resourceFetcherText = '';
|
|
|
|
if (this.props.resourceFetcher && this.props.resourceFetcher.toFetchCount) {
|
2019-05-22 16:56:07 +02:00
|
|
|
resourceFetcherText = _('Fetching resources: %d/%d', this.props.resourceFetcher.fetchingCount, this.props.resourceFetcher.toFetchCount);
|
2018-11-14 00:27:58 +02:00
|
|
|
}
|
|
|
|
|
2020-03-14 01:46:14 +02:00
|
|
|
const fullReport = [];
|
2018-06-10 18:43:24 +02:00
|
|
|
if (syncReportText) fullReport.push(syncReportText);
|
2019-05-22 16:56:07 +02:00
|
|
|
if (resourceFetcherText) fullReport.push(resourceFetcherText);
|
2018-06-10 18:43:24 +02:00
|
|
|
if (decryptionReportText) fullReport.push(decryptionReportText);
|
|
|
|
|
2019-07-29 15:43:53 +02:00
|
|
|
items.push(this.renderSideBarButton('synchronize_button', !this.props.syncStarted ? _('Synchronise') : _('Cancel'), 'md-sync', this.synchronize_press));
|
2019-06-26 20:05:37 +02:00
|
|
|
|
2020-03-14 01:57:34 +02:00
|
|
|
if (fullReport.length) {
|
2019-07-29 15:43:53 +02:00
|
|
|
items.push(
|
|
|
|
<Text key="sync_report" style={this.styles().syncStatus}>
|
|
|
|
{fullReport.join('\n')}
|
|
|
|
</Text>
|
|
|
|
);
|
2020-03-14 01:57:34 +02:00
|
|
|
}
|
2019-06-26 20:05:37 +02:00
|
|
|
|
2019-07-29 15:43:53 +02:00
|
|
|
return <View style={{ flex: 0, flexDirection: 'column', paddingBottom: theme.marginBottom }}>{items}</View>;
|
2019-06-26 20:05:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let items = [];
|
2018-06-10 18:43:24 +02:00
|
|
|
|
2020-09-15 15:01:07 +02:00
|
|
|
const theme = themeStyle(this.props.themeId);
|
2017-07-22 17:55:09 +02:00
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
// HACK: inner height of ScrollView doesn't appear to be calculated correctly when
|
|
|
|
// using padding. So instead creating blank elements for padding bottom and top.
|
2020-06-10 23:08:59 +02:00
|
|
|
items.push(<View style={{ height: theme.marginTop }} key="bottom_top_hack" />);
|
2017-07-06 21:48:17 +02:00
|
|
|
|
2019-07-11 19:44:26 +02:00
|
|
|
items.push(this.renderSideBarButton('all_notes', _('All notes'), 'md-document', this.allNotesButton_press, this.props.notesParentType === 'SmartFilter'));
|
2019-06-28 01:51:02 +02:00
|
|
|
|
|
|
|
items.push(this.makeDivider('divider_all'));
|
|
|
|
|
2019-07-12 19:07:47 +02:00
|
|
|
items.push(this.renderSideBarButton('folder_header', _('Notebooks'), 'md-folder'));
|
2019-07-11 19:44:26 +02:00
|
|
|
|
2019-06-26 20:05:37 +02:00
|
|
|
if (this.props.folders.length) {
|
2019-06-26 19:28:09 +02:00
|
|
|
const result = shared.renderFolders(this.props, this.renderFolderItem);
|
2019-06-26 20:05:37 +02:00
|
|
|
const folderItems = result.items;
|
|
|
|
items = items.concat(folderItems);
|
|
|
|
}
|
2017-07-06 21:48:17 +02:00
|
|
|
|
2020-03-14 01:46:14 +02:00
|
|
|
const style = {
|
2019-07-29 15:43:53 +02:00
|
|
|
flex: 1,
|
2017-10-30 20:27:51 +02:00
|
|
|
borderRightWidth: 1,
|
2020-06-10 23:08:59 +02:00
|
|
|
borderRightColor: theme.dividerColor,
|
2017-10-30 20:27:51 +02:00
|
|
|
backgroundColor: theme.backgroundColor,
|
|
|
|
};
|
|
|
|
|
2017-05-24 21:27:13 +02:00
|
|
|
return (
|
2017-10-30 20:27:51 +02:00
|
|
|
<View style={style}>
|
2019-07-29 15:43:53 +02:00
|
|
|
<View style={{ flex: 1, opacity: this.props.opacity }}>
|
2017-10-30 20:27:51 +02:00
|
|
|
<ScrollView scrollsToTop={false} style={this.styles().menu}>
|
2019-07-29 15:43:53 +02:00
|
|
|
{items}
|
2017-10-30 20:27:51 +02:00
|
|
|
</ScrollView>
|
2019-07-29 15:43:53 +02:00
|
|
|
{this.renderBottomPanel()}
|
2017-07-22 17:55:09 +02:00
|
|
|
</View>
|
|
|
|
</View>
|
2017-05-24 21:27:13 +02:00
|
|
|
);
|
|
|
|
}
|
2019-07-29 15:43:53 +02:00
|
|
|
}
|
|
|
|
|
2020-05-21 10:14:33 +02:00
|
|
|
const SideMenuContent = connect(state => {
|
2019-07-29 15:43:53 +02:00
|
|
|
return {
|
|
|
|
folders: state.folders,
|
|
|
|
syncStarted: state.syncStarted,
|
|
|
|
syncReport: state.syncReport,
|
|
|
|
selectedFolderId: state.selectedFolderId,
|
|
|
|
selectedTagId: state.selectedTagId,
|
|
|
|
notesParentType: state.notesParentType,
|
|
|
|
locale: state.settings.locale,
|
2020-09-15 15:01:07 +02:00
|
|
|
themeId: state.settings.theme,
|
2019-07-29 15:43:53 +02:00
|
|
|
// Don't do the opacity animation as it means re-rendering the list multiple times
|
|
|
|
// opacity: state.sideMenuOpenPercent,
|
|
|
|
collapsedFolderIds: state.collapsedFolderIds,
|
|
|
|
decryptionWorker: state.decryptionWorker,
|
|
|
|
resourceFetcher: state.resourceFetcher,
|
|
|
|
};
|
|
|
|
})(SideMenuContentComponent);
|
|
|
|
|
|
|
|
module.exports = { SideMenuContent };
|