aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/store.js
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-03-21 15:04:31 +0100
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-03-21 15:04:31 +0100
commita9734f24bf15ab322c8244fbb8e86c37caf30f4a (patch)
treeace7e455e817df831bf571aa4851a99b0e37e145 /src/features/workspaces/store.js
parentadd workspace drawer toggle menu item and shortcut (diff)
downloadferdium-app-a9734f24bf15ab322c8244fbb8e86c37caf30f4a.tar.gz
ferdium-app-a9734f24bf15ab322c8244fbb8e86c37caf30f4a.tar.zst
ferdium-app-a9734f24bf15ab322c8244fbb8e86c37caf30f4a.zip
improve workspace switching ux
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r--src/features/workspaces/store.js25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index 1b57ba2da..f6b9b2ff4 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -31,7 +31,7 @@ export default class WorkspacesStore extends Store {
31 */ 31 */
32 reaction( 32 reaction(
33 () => this.allWorkspacesRequest.isExecuting, 33 () => this.allWorkspacesRequest.isExecuting,
34 isExecuting => this._setIsLoading(isExecuting), 34 isExecuting => this._setIsLoadingWorkspaces(isExecuting),
35 ); 35 );
36 /** 36 /**
37 * Update the state with the workspace to be edited when route matches. 37 * Update the state with the workspace to be edited when route matches.
@@ -66,8 +66,8 @@ export default class WorkspacesStore extends Store {
66 this.state.workspaces = workspaces.map(data => new Workspace(data)); 66 this.state.workspaces = workspaces.map(data => new Workspace(data));
67 }; 67 };
68 68
69 @action _setIsLoading = (isLoading) => { 69 @action _setIsLoadingWorkspaces = (isLoading) => {
70 this.state.isLoading = isLoading; 70 this.state.isLoadingWorkspaces = isLoading;
71 }; 71 };
72 72
73 @action _edit = ({ workspace }) => { 73 @action _edit = ({ workspace }) => {
@@ -107,11 +107,26 @@ export default class WorkspacesStore extends Store {
107 }; 107 };
108 108
109 @action _setActiveWorkspace = ({ workspace }) => { 109 @action _setActiveWorkspace = ({ workspace }) => {
110 this.state.activeWorkspace = workspace; 110 Object.assign(this.state, {
111 isSwitchingWorkspace: true,
112 nextWorkspace: workspace,
113 });
114 setTimeout(() => { this.state.activeWorkspace = workspace; }, 100);
115 setTimeout(() => {
116 Object.assign(this.state, {
117 isSwitchingWorkspace: false,
118 nextWorkspace: null,
119 });
120 }, 1000);
111 }; 121 };
112 122
113 @action _deactivateActiveWorkspace = () => { 123 @action _deactivateActiveWorkspace = () => {
114 this.state.activeWorkspace = null; 124 Object.assign(this.state, {
125 isSwitchingWorkspace: true,
126 nextWorkspace: null,
127 });
128 setTimeout(() => { this.state.activeWorkspace = null; }, 100);
129 setTimeout(() => { this.state.isSwitchingWorkspace = false; }, 1000);
115 }; 130 };
116 131
117 @action _toggleWorkspaceDrawer = () => { 132 @action _toggleWorkspaceDrawer = () => {