Skip to content

Commit b283838

Browse files
committed
Contribute disabled when no directory or graphml loaded
1 parent d519fff commit b283838

5 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/component/fileBrowser.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const LocalFileBrowser = ({ superState, dispatcher }) => {
9999
}
100100
setFileState([]);
101101
setFileState(state);
102+
dispatcher({ type: T.SET_DIR_NAME, payload: state[0].key.split('/')[0] });
102103
};
103104

104105
const newFeatureFile = async () => {

src/reducer/actionType.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const actionType = {
3232
SET_NEW_GRAPH_MODAL: 'SET_NEW_GRAPH_MODAL',
3333
EDIT_TEXTFILE: 'EDIT_TEXTFILE',
3434
SET_FILE_HANDLE: 'SET_FILE_HANDLE',
35+
SET_DIR_NAME: 'SET_DIR_NAME',
3536
};
3637

3738
export default zealit(actionType);

src/reducer/initialState.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const initialState = {
2424
isWorkflowOnServer: false,
2525
curGraphInstance: null,
2626
zoomLevel: 100,
27+
uploadedDirName: null,
2728
};
2829

2930
const initialGraphState = {

src/reducer/reducer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ const reducer = (state, action) => {
183183
};
184184
}
185185

186+
case T.SET_DIR_NAME: {
187+
return { ...state, uploadedDirName: action.payload };
188+
}
189+
186190
default:
187191
return state;
188192
}

src/toolbarActions/toolbarList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ const toolbarList = (state, dispatcher) => [
219219
text: 'Contribute',
220220
icon: FiTriangle,
221221
action: () => { window.open('https://github.com/ControlCore-Project/concore', '_blank'); },
222-
active: true,
222+
active: state.curGraphInstance || state.uploadedDirName,
223223
visibility: true,
224224
},
225225
// {

0 commit comments

Comments
 (0)