mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-25 01:21:14 +08:00
Switch from creating a separate column to scoping ThreadList to split+list modes
This commit is contained in:
parent
5b7f323217
commit
944eeeb1cc
3 changed files with 37 additions and 24 deletions
|
@ -16,10 +16,12 @@ export function activate() {
|
|||
|
||||
ComponentRegistry.register(ThreadList, {
|
||||
location: WorkspaceStore.Location.ThreadList,
|
||||
modes: ['split', 'list'],
|
||||
});
|
||||
|
||||
ComponentRegistry.register(ThreadListVertical, {
|
||||
location: WorkspaceStore.Location.ThreadListVertical,
|
||||
location: WorkspaceStore.Location.ThreadList,
|
||||
modes: ['splitVertical'],
|
||||
});
|
||||
|
||||
ComponentRegistry.register(SelectedItemsStack, {
|
||||
|
|
|
@ -3,24 +3,30 @@ import { InjectedComponentSet } from 'mailspring-component-kit';
|
|||
import { WorkspaceStore } from 'mailspring-exports';
|
||||
|
||||
class ThreadListVertical extends React.Component<{}, { style: string; syncing: boolean }> {
|
||||
static displayName = 'ThreadListVertical';
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ height: '50%', width: '100%', boxShadow: '0 0.5px 0 #dddddd' }}>
|
||||
<InjectedComponentSet
|
||||
matching={{ location: WorkspaceStore.Location.ThreadList }} />
|
||||
</div>
|
||||
<div style={{ height: '50%', width: '100%' }}>
|
||||
<InjectedComponentSet
|
||||
matching={{ location: WorkspaceStore.Location.MessageList }} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
static displayName = 'ThreadListVertical';
|
||||
static containerRequired = false;
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<div style={{ height: '50%', width: '100%', boxShadow: '0 0.5px 0 #dddddd' }}>
|
||||
<InjectedComponentSet
|
||||
matching={{ location: WorkspaceStore.Location.ThreadList, modes: ['split'] }}
|
||||
/>
|
||||
</div>
|
||||
<div className="sheet-toolbar">
|
||||
<InjectedComponentSet
|
||||
matching={{ location: WorkspaceStore.Location.MessageList.Toolbar, modes: ['split'] }}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ height: '50%', width: '100%' }}>
|
||||
<InjectedComponentSet
|
||||
matching={{ location: WorkspaceStore.Location.MessageList, modes: ['split'] }}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ThreadListVertical;
|
||||
export default ThreadListVertical;
|
||||
|
|
|
@ -119,7 +119,7 @@ class WorkspaceStore extends MailspringStore {
|
|||
{
|
||||
list: ['RootSidebar', 'ThreadList'],
|
||||
split: ['RootSidebar', 'ThreadList', 'MessageList', 'MessageListSidebar'],
|
||||
splitVertical: ['RootSidebar', 'ThreadListVertical', 'MessageListSidebar'],
|
||||
splitVertical: ['RootSidebar', 'ThreadList', 'MessageListSidebar'],
|
||||
}
|
||||
);
|
||||
this.defineSheet('Thread', {}, { list: ['MessageList', 'MessageListSidebar'] });
|
||||
|
@ -196,7 +196,6 @@ class WorkspaceStore extends MailspringStore {
|
|||
};
|
||||
|
||||
_onSelectLayoutMode = mode => {
|
||||
|
||||
if (mode === this._preferredLayoutMode) {
|
||||
return;
|
||||
}
|
||||
|
@ -223,9 +222,15 @@ class WorkspaceStore extends MailspringStore {
|
|||
{
|
||||
'core:pop-sheet': () => this.popSheet(),
|
||||
},
|
||||
this._preferredLayoutMode === 'list' ? { 'navigation:list-mode-on': () => this._onSelectLayoutMode('list') } : { 'navigation:list-mode-off': () => this._onSelectLayoutMode('list') },
|
||||
this._preferredLayoutMode === 'split' ? { 'navigation:split-mode-on': () => this._onSelectLayoutMode('split') } : { 'navigation:split-mode-off': () => this._onSelectLayoutMode('split') },
|
||||
this._preferredLayoutMode === 'splitVertical' ? { 'navigation:splitVertical-mode-on': () => this._onSelectLayoutMode('splitVertical') } : { 'navigation:splitVertical-mode-off': () => this._onSelectLayoutMode('splitVertical') },
|
||||
this._preferredLayoutMode === 'list'
|
||||
? { 'navigation:list-mode-on': () => this._onSelectLayoutMode('list') }
|
||||
: { 'navigation:list-mode-off': () => this._onSelectLayoutMode('list') },
|
||||
this._preferredLayoutMode === 'split'
|
||||
? { 'navigation:split-mode-on': () => this._onSelectLayoutMode('split') }
|
||||
: { 'navigation:split-mode-off': () => this._onSelectLayoutMode('split') },
|
||||
this._preferredLayoutMode === 'splitVertical'
|
||||
? { 'navigation:splitVertical-mode-on': () => this._onSelectLayoutMode('splitVertical') }
|
||||
: { 'navigation:splitVertical-mode-off': () => this._onSelectLayoutMode('splitVertical') }
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue