Skip to content

Commit

Permalink
feat: add logic to save unsaved resources to ActionsPane
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Aug 26, 2021
1 parent 1cef72d commit c232707
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/organisms/ActionsPane/ActionsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {performResourceDiff} from '@redux/thunks/diffResource';
import {selectFromHistory} from '@redux/thunks/selectionHistory';
import {TOOLTIP_DELAY} from '@constants/constants';
import {applyFile} from '@redux/thunks/applyFile';
import {saveUnsavedResource} from '@redux/thunks/saveUnsavedResource';
import {isUnsavedResource} from '@redux/services/resource';
import FileExplorer, {useFileExplorer} from '@atoms/FileExplorer';

Expand Down Expand Up @@ -142,8 +143,15 @@ const ActionsPane = (props: {contentHeight: string}) => {
const dispatch = useAppDispatch();

const {openFileExplorer, fileExplorerProps} = useFileExplorer((files: FileList) => {
console.log(files);
// TODO: save resource to selected folder/file
if (!selectedResourceId) {
return;
}
dispatch(
saveUnsavedResource({
resourceId: selectedResourceId,
absolutePath: files[0].path,
})
);
});

const isLeftArrowEnabled =
Expand Down

0 comments on commit c232707

Please sign in to comment.