File tree Expand file tree Collapse file tree 1 file changed +20
-20
lines changed
packages/app/src/app/pages/Sandbox/Editor/Header/Buttons Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Original file line number Diff line number Diff line change 1- import React from 'react' ;
2- import { hooksObserver , inject } from 'app/componentConnectors' ;
1+ import React , { FunctionComponent } from 'react' ;
32import SaveIcon from 'react-icons/lib/md/save' ;
3+
4+ import { useOvermind } from 'app/overmind' ;
45import { saveAllModules } from 'app/store/modules/editor/utils' ;
6+
57import { Action } from './Action' ;
68
7- export const SaveAllButton = inject ( 'store' , 'signals' ) (
8- hooksObserver ( ( { store, signals } ) => {
9- const {
10- editor : { isAllModulesSynced, changedModuleShortids } ,
11- } = store ;
9+ const noop = ( ) => undefined ;
10+ export const SaveAllButton : FunctionComponent = ( ) => {
11+ const { actions, state } = useOvermind ( ) ;
12+ const {
13+ editor : { isAllModulesSynced, changedModuleShortids } ,
14+ } = state ;
1215
13- return (
14- < Action
15- onClick = {
16- isAllModulesSynced ? null : ( ) => saveAllModules ( store , signals )
17- }
18- placeholder = { isAllModulesSynced ? 'All modules are saved' : false }
19- blink = { changedModuleShortids . length > 2 }
20- title = "Save"
21- Icon = { SaveIcon }
22- />
23- ) ;
24- } )
25- ) ;
16+ return (
17+ < Action
18+ onClick = { isAllModulesSynced ? noop : ( ) => saveAllModules ( state , actions ) }
19+ placeholder = { isAllModulesSynced ? 'All modules are saved' : false }
20+ blink = { changedModuleShortids . length > 2 }
21+ title = "Save"
22+ Icon = { SaveIcon }
23+ />
24+ ) ;
25+ } ;
You can’t perform that action at this time.
0 commit comments