1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Improved init sequence

This commit is contained in:
Laurent Cozic
2017-07-08 23:57:09 +01:00
parent a9f7b0d531
commit e9f0d38a80
4 changed files with 79 additions and 22 deletions

View File

@@ -44,21 +44,31 @@ class ActionButtonComponent extends React.Component {
}
render() {
return (
<ReactNativeActionButton buttonColor="rgba(231,76,60,1)">
let buttons = [];
<ReactNativeActionButton.Item buttonColor='#9b59b6' title="New todo" onPress={() => { this.newTodo_press() }}>
if (this.props.folders.length) {
buttons.push(
<ReactNativeActionButton.Item key="ab_todo" buttonColor='#9b59b6' title="New todo" onPress={() => { this.newTodo_press() }}>
<Icon name="md-checkbox-outline" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
);
<ReactNativeActionButton.Item buttonColor='#9b59b6' title="New note" onPress={() => { this.newNote_press() }}>
buttons.push(
<ReactNativeActionButton.Item key="ab_note" buttonColor='#9b59b6' title="New note" onPress={() => { this.newNote_press() }}>
<Icon name="md-document" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
);
}
<ReactNativeActionButton.Item buttonColor='#3498db' title="New folder" onPress={() => { this.newFolder_press() }}>
<Icon name="md-folder" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
buttons.push(
<ReactNativeActionButton.Item key="ab_folder" buttonColor='#3498db' title="New folder" onPress={() => { this.newFolder_press() }}>
<Icon name="md-folder" style={styles.actionButtonIcon} />
</ReactNativeActionButton.Item>
);
return (
<ReactNativeActionButton buttonColor="rgba(231,76,60,1)">
{ buttons }
</ReactNativeActionButton>
);
}
@@ -66,7 +76,9 @@ class ActionButtonComponent extends React.Component {
const ActionButton = connect(
(state) => {
return {};
return {
folders: state.folders,
};
}
)(ActionButtonComponent)

View File

@@ -50,6 +50,12 @@ class FolderScreenComponent extends React.Component {
this.originalFolder = await Folder.save(toSave);
this.setState({ folder: this.originalFolder });
this.props.dispatch({
type: 'Navigation/NAVIGATE',
routeName: 'Notes',
params: toSave.id,
});
}
render() {

View File

@@ -2,8 +2,8 @@ import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { connect } from 'react-redux'
import { Log } from 'lib/log.js'
import { Folder } from 'lib/models/folder.js'
import { ScreenHeader } from 'lib/components/screen-header.js';
import { ActionButton } from 'lib/components/action-button.js';
class LoadingScreenComponent extends React.Component {
@@ -12,18 +12,30 @@ class LoadingScreenComponent extends React.Component {
}
render() {
return (
<View style={{flex: 1}}>
<Text>Loading...</Text>
</View>
);
if (this.props.loading) {
return (
<View style={{flex: 1}}>
<Text>Loading...</Text>
</View>
);
} else {
return (
<View style={{flex: 1}}>
<ScreenHeader navState={this.props.navigation.state} />
<Text>You currently have no notebook. Create one by clicking on (+) button.</Text>
<ActionButton></ActionButton>
</View>
);
}
}
}
const LoadingScreen = connect(
(state) => {
return {};
return {
loading: state.loading,
};
}
)(LoadingScreenComponent)