From 02e7cf618292e1c02941d6b359963c628da14fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Thu, 26 Sep 2019 14:46:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Switch=20SaveAllButton=20to=20us?= =?UTF-8?q?e=20useOvermind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/Header/Buttons/SaveAllButton.tsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/SaveAllButton.tsx b/packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/SaveAllButton.tsx index 3e267271d89..b77a87b162b 100644 --- a/packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/SaveAllButton.tsx +++ b/packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/SaveAllButton.tsx @@ -1,25 +1,25 @@ -import React from 'react'; -import { hooksObserver, inject } from 'app/componentConnectors'; +import React, { FunctionComponent } from 'react'; import SaveIcon from 'react-icons/lib/md/save'; + +import { useOvermind } from 'app/overmind'; import { saveAllModules } from 'app/store/modules/editor/utils'; + import { Action } from './Action'; -export const SaveAllButton = inject('store', 'signals')( - hooksObserver(({ store, signals }) => { - const { - editor: { isAllModulesSynced, changedModuleShortids }, - } = store; +const noop = () => undefined; +export const SaveAllButton: FunctionComponent = () => { + const { actions, state } = useOvermind(); + const { + editor: { isAllModulesSynced, changedModuleShortids }, + } = state; - return ( - saveAllModules(store, signals) - } - placeholder={isAllModulesSynced ? 'All modules are saved' : false} - blink={changedModuleShortids.length > 2} - title="Save" - Icon={SaveIcon} - /> - ); - }) -); + return ( + saveAllModules(state, actions)} + placeholder={isAllModulesSynced ? 'All modules are saved' : false} + blink={changedModuleShortids.length > 2} + title="Save" + Icon={SaveIcon} + /> + ); +};