File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ type Props = {
17
17
isFolderModeEnabled : boolean ;
18
18
loggedInAs ?: string ;
19
19
accessToken ?: string ;
20
- currentObject ?: PersistenceFile ;
20
+ currPersistenceFile ?: PersistenceFile ;
21
21
isDirty ?: boolean ;
22
22
onClickOpen ?: ( ) => any ;
23
23
onClickSave ?: ( ) => any ;
@@ -30,14 +30,14 @@ type Props = {
30
30
31
31
export const ControlBarGoogleDriveButtons : React . FC < Props > = props => {
32
32
const { isMobileBreakpoint } = useResponsive ( ) ;
33
- const state : PersistenceState = props . currentObject
33
+ const state : PersistenceState = props . currPersistenceFile
34
34
? props . isDirty
35
35
? 'DIRTY'
36
36
: 'SAVED'
37
37
: 'INACTIVE' ;
38
38
const mainButton = (
39
39
< ControlButton
40
- label = { ( props . currentObject && props . currentObject . name ) || 'Google Drive' }
40
+ label = { ( props . currPersistenceFile && props . currPersistenceFile . name ) || 'Google Drive' }
41
41
icon = { IconNames . CLOUD }
42
42
options = { { intent : stateToIntent [ state ] } }
43
43
//isDisabled={props.isFolderModeEnabled}
Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ import { useResponsive } from 'src/commons/utils/Hooks';
7
7
8
8
import { GitHubSaveInfo } from '../../../features/github/GitHubTypes' ;
9
9
import ControlButton from '../../ControlButton' ;
10
+ import { PersistenceFile } from 'src/features/persistence/PersistenceTypes' ;
10
11
11
12
type Props = {
12
13
isFolderModeEnabled : boolean ;
14
+ currPersistenceFile ?: PersistenceFile ;
13
15
loggedInAs ?: Octokit ;
14
16
githubSaveInfo : GitHubSaveInfo ;
15
17
isDirty : boolean ;
@@ -31,14 +33,13 @@ export const ControlBarGitHubButtons: React.FC<Props> = props => {
31
33
const { isMobileBreakpoint } = useResponsive ( ) ;
32
34
33
35
const filePath = props . githubSaveInfo . filePath || '' ;
34
- const fileName = ( filePath . split ( '\\' ) . pop ( ) || '' ) . split ( '/' ) . pop ( ) || '' ;
35
36
36
37
const isLoggedIn = props . loggedInAs !== undefined ;
37
38
const shouldDisableButtons = ! isLoggedIn ;
38
39
const hasFilePath = filePath !== '' ;
39
40
const hasOpenFile = isLoggedIn && hasFilePath ;
40
41
41
- const mainButtonDisplayText = hasOpenFile ? fileName : 'GitHub' ;
42
+ const mainButtonDisplayText = ( props . currPersistenceFile && props . currPersistenceFile . name ) || 'GitHub' ;
42
43
let mainButtonIntent : Intent = Intent . NONE ;
43
44
if ( hasOpenFile ) {
44
45
mainButtonIntent = props . isDirty ? Intent . WARNING : Intent . PRIMARY ;
Original file line number Diff line number Diff line change @@ -603,7 +603,7 @@ const Playground: React.FC<PlaygroundProps> = props => {
603
603
return (
604
604
< ControlBarGoogleDriveButtons
605
605
isFolderModeEnabled = { isFolderModeEnabled }
606
- currentObject = { persistenceFile }
606
+ currPersistenceFile = { persistenceFile }
607
607
loggedInAs = { persistenceUser }
608
608
isDirty = { persistenceIsDirty }
609
609
accessToken = { googleAccessToken }
@@ -637,6 +637,7 @@ const Playground: React.FC<PlaygroundProps> = props => {
637
637
< ControlBarGitHubButtons
638
638
key = "github"
639
639
isFolderModeEnabled = { isFolderModeEnabled }
640
+ currPersistenceFile = { persistenceFile }
640
641
loggedInAs = { githubOctokitObject . octokit }
641
642
githubSaveInfo = { githubSaveInfo }
642
643
isDirty = { githubPersistenceIsDirty }
You can’t perform that action at this time.
0 commit comments