You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
RN: Better UI to handle conflicts
This commit is contained in:
15
ReactNativeClient/lib/components/screens/folders-utils.js
Normal file
15
ReactNativeClient/lib/components/screens/folders-utils.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Folder } from 'lib/models/folder.js'
|
||||
|
||||
class FoldersScreenUtils {
|
||||
|
||||
static async refreshFolders() {
|
||||
let initialFolders = await Folder.all({ includeConflictFolder: true });
|
||||
this.dispatch({
|
||||
type: 'FOLDERS_UPDATE_ALL',
|
||||
folders: initialFolders,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { FoldersScreenUtils }
|
||||
@@ -41,22 +41,25 @@ class NotesScreenComponent extends BaseScreenComponent {
|
||||
}
|
||||
|
||||
menuOptions() {
|
||||
if (this.props.selectedFolderId == Folder.conflictFolderId()) return [];
|
||||
|
||||
return [
|
||||
{ title: _('Delete folder'), onPress: () => { this.deleteFolder_onPress(this.props.selectedFolderId); } },
|
||||
{ title: _('Edit folder'), onPress: () => { this.editFolder_onPress(this.props.selectedFolderId); } },
|
||||
{ title: _('Delete notebook'), onPress: () => { this.deleteFolder_onPress(this.props.selectedFolderId); } },
|
||||
{ title: _('Edit notebook'), onPress: () => { this.editFolder_onPress(this.props.selectedFolderId); } },
|
||||
];
|
||||
}
|
||||
|
||||
render() {
|
||||
let folder = Folder.byId(this.props.folders, this.props.selectedFolderId);
|
||||
let title = folder ? folder.title : null;
|
||||
const addFolderNoteButtons = folder.id != Folder.conflictFolderId();
|
||||
|
||||
const { navigate } = this.props.navigation;
|
||||
return (
|
||||
<View style={this.styles().screen}>
|
||||
<ScreenHeader title={title} navState={this.props.navigation.state} menuOptions={this.menuOptions()} />
|
||||
<NoteList noItemMessage={_('There are currently no notes. Create one by clicking on the (+) button.')} style={{flex: 1}}/>
|
||||
<ActionButton addFolderNoteButtons={true} parentFolderId={this.props.selectedFolderId}></ActionButton>
|
||||
<ActionButton addFolderNoteButtons={addFolderNoteButtons} parentFolderId={this.props.selectedFolderId}></ActionButton>
|
||||
<DialogBox ref={dialogbox => { this.dialogbox = dialogbox }}/>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -63,7 +63,13 @@ class SideMenuContentComponent extends Component {
|
||||
};
|
||||
|
||||
try {
|
||||
sync.start(options);
|
||||
sync.start(options).then(async () => {
|
||||
let initialFolders = await Folder.all({ includeConflictFolder: true });
|
||||
dispatch({
|
||||
type: 'FOLDERS_UPDATE_ALL',
|
||||
folders: initialFolders,
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
Log.error(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user