mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
This commit is contained in:
parent
6aca77a0ae
commit
65c47189f9
@ -796,6 +796,7 @@ packages/lib/commands/index.js
|
|||||||
packages/lib/commands/openMasterPasswordDialog.js
|
packages/lib/commands/openMasterPasswordDialog.js
|
||||||
packages/lib/commands/synchronize.js
|
packages/lib/commands/synchronize.js
|
||||||
packages/lib/components/EncryptionConfigScreen/utils.js
|
packages/lib/components/EncryptionConfigScreen/utils.js
|
||||||
|
packages/lib/components/shared/NoteList/getEmptyFolderMessage.js
|
||||||
packages/lib/components/shared/config/config-shared.js
|
packages/lib/components/shared/config/config-shared.js
|
||||||
packages/lib/components/shared/config/plugins/types.js
|
packages/lib/components/shared/config/plugins/types.js
|
||||||
packages/lib/components/shared/config/plugins/useOnDeleteHandler.js
|
packages/lib/components/shared/config/plugins/useOnDeleteHandler.js
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -776,6 +776,7 @@ packages/lib/commands/index.js
|
|||||||
packages/lib/commands/openMasterPasswordDialog.js
|
packages/lib/commands/openMasterPasswordDialog.js
|
||||||
packages/lib/commands/synchronize.js
|
packages/lib/commands/synchronize.js
|
||||||
packages/lib/components/EncryptionConfigScreen/utils.js
|
packages/lib/components/EncryptionConfigScreen/utils.js
|
||||||
|
packages/lib/components/shared/NoteList/getEmptyFolderMessage.js
|
||||||
packages/lib/components/shared/config/config-shared.js
|
packages/lib/components/shared/config/config-shared.js
|
||||||
packages/lib/components/shared/config/plugins/types.js
|
packages/lib/components/shared/config/plugins/types.js
|
||||||
packages/lib/components/shared/config/plugins/useOnDeleteHandler.js
|
packages/lib/components/shared/config/plugins/useOnDeleteHandler.js
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { _ } from '@joplin/lib/locale';
|
|
||||||
import { useMemo, useRef, useEffect } from 'react';
|
import { useMemo, useRef, useEffect } from 'react';
|
||||||
import { AppState } from '../../app.reducer';
|
import { AppState } from '../../app.reducer';
|
||||||
import BaseModel, { ModelType } from '@joplin/lib/BaseModel';
|
import BaseModel, { ModelType } from '@joplin/lib/BaseModel';
|
||||||
@ -22,6 +21,7 @@ import * as focusElementNoteList from './commands/focusElementNoteList';
|
|||||||
import CommandService from '@joplin/lib/services/CommandService';
|
import CommandService from '@joplin/lib/services/CommandService';
|
||||||
import useDragAndDrop from './utils/useDragAndDrop';
|
import useDragAndDrop from './utils/useDragAndDrop';
|
||||||
import { itemIsInTrash } from '@joplin/lib/services/trash';
|
import { itemIsInTrash } from '@joplin/lib/services/trash';
|
||||||
|
import getEmptyFolderMessage from '@joplin/lib/components/shared/NoteList/getEmptyFolderMessage';
|
||||||
import Folder from '@joplin/lib/models/Folder';
|
import Folder from '@joplin/lib/models/Folder';
|
||||||
const { connect } = require('react-redux');
|
const { connect } = require('react-redux');
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ const NoteList = (props: Props) => {
|
|||||||
|
|
||||||
const renderEmptyList = () => {
|
const renderEmptyList = () => {
|
||||||
if (props.notes.length) return null;
|
if (props.notes.length) return null;
|
||||||
return <div className="emptylist">{props.folders.length ? _('No notes in here. Create one by clicking on "New note".') : _('There is currently no notebook. Create one by clicking on "New notebook".')}</div>;
|
return <div className="emptylist">{getEmptyFolderMessage(props.folders, props.selectedFolderId)}</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderFiller = (key: string, style: React.CSSProperties) => {
|
const renderFiller = (key: string, style: React.CSSProperties) => {
|
||||||
|
@ -6,6 +6,7 @@ import { connect } from 'react-redux';
|
|||||||
import { FlatList, Text, StyleSheet, Button, View } from 'react-native';
|
import { FlatList, Text, StyleSheet, Button, View } from 'react-native';
|
||||||
import { FolderEntity, NoteEntity } from '@joplin/lib/services/database/types';
|
import { FolderEntity, NoteEntity } from '@joplin/lib/services/database/types';
|
||||||
import { AppState } from '../utils/types';
|
import { AppState } from '../utils/types';
|
||||||
|
import getEmptyFolderMessage from '@joplin/lib/components/shared/NoteList/getEmptyFolderMessage';
|
||||||
import Folder from '@joplin/lib/models/Folder';
|
import Folder from '@joplin/lib/models/Folder';
|
||||||
|
|
||||||
const { _ } = require('@joplin/lib/locale');
|
const { _ } = require('@joplin/lib/locale');
|
||||||
@ -20,7 +21,7 @@ interface NoteListProps {
|
|||||||
items: NoteEntity[];
|
items: NoteEntity[];
|
||||||
folders: FolderEntity[];
|
folders: FolderEntity[];
|
||||||
noteSelectionEnabled?: boolean;
|
noteSelectionEnabled?: boolean;
|
||||||
selectedFolderId?: string;
|
selectedFolderId: string|null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoteListComponent extends Component<NoteListProps> {
|
class NoteListComponent extends Component<NoteListProps> {
|
||||||
@ -102,8 +103,9 @@ class NoteListComponent extends Component<NoteListProps> {
|
|||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const noItemMessage = _('There are currently no notes. Create one by clicking on the (+) button.');
|
return <Text style={this.styles().noItemMessage}>
|
||||||
return <Text style={this.styles().noItemMessage}>{noItemMessage}</Text>;
|
{getEmptyFolderMessage(this.props.folders, this.props.selectedFolderId)}
|
||||||
|
</Text>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,6 +119,7 @@ const NoteList = connect((state: AppState) => {
|
|||||||
notesSource: state.notesSource,
|
notesSource: state.notesSource,
|
||||||
themeId: state.settings.theme,
|
themeId: state.settings.theme,
|
||||||
noteSelectionEnabled: state.noteSelectionEnabled,
|
noteSelectionEnabled: state.noteSelectionEnabled,
|
||||||
|
selectedFolderId: state.selectedFolderId,
|
||||||
};
|
};
|
||||||
})(NoteListComponent);
|
})(NoteListComponent);
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
import { _ } from '../../../locale';
|
||||||
|
import Folder from '../../../models/Folder';
|
||||||
|
import Setting from '../../../models/Setting';
|
||||||
|
import { FolderEntity } from '../../../services/database/types';
|
||||||
|
import { getTrashFolderId, itemIsInTrash } from '../../../services/trash';
|
||||||
|
|
||||||
|
const getEmptyFolderMessage = (folders: FolderEntity[], selectedFolderId: string|null) => {
|
||||||
|
if (selectedFolderId === getTrashFolderId()) {
|
||||||
|
return _('There are no notes in the trash folder.');
|
||||||
|
} else if (selectedFolderId && itemIsInTrash(Folder.byId(folders, selectedFolderId))) {
|
||||||
|
return _('This subfolder of the trash has no notes.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Setting.value('appType') === 'desktop') {
|
||||||
|
return _('No notes in here. Create one by clicking on "New note".');
|
||||||
|
} else {
|
||||||
|
return _('There are currently no notes. Create one by clicking on the (+) button.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getEmptyFolderMessage;
|
Loading…
Reference in New Issue
Block a user