Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) WIP - File controls on hover #84

Closed
wants to merge 12 commits into from

Conversation

taylorham
Copy link
Contributor

Rename and delete files with buttons that only appear when the file button is hovered in Explorer.

Currently the rename operation creates a duplicate with a new name, and the delete function doesn't work at all. We can pair on that soon!

Screen Shot 2021-10-04 at 10 09 13 PM
Screen Shot 2021-10-04 at 10 09 29 PM
Screen Shot 2021-10-04 at 10 09 49 PM

@taylorham
Copy link
Contributor Author

Hello again @chenyan-dfinity! I had some flawed logic in my state updaters that was causing the aforementioned issues. All seems to be working now!

If you want to keep this PR in draft format I can work on some quick tests, but they won't be anything spectacular without whole lot of mocking and/or jumping straight to browser-based E2E tests.

I'll start on the unit tests for state reducers and conditionally rendered components this afternoon, and once those are ready I'll get a GitHub action setup to run us some CI. The rest will be good territory for a future grant.

close={() => setShowPackage(false)}
close={() => {
setShowPackage(false);
setFileToModify("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? We already clear fileToModify in onDeleteFile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user cancels the operation we still need to reset to empty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It's a bit error-prone to reset fileToModify for each event. If we only have deletion, not rename, do we still need this state?

path: fileToModify,
},
});
setFileToModify("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to call moc worker to delete the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't that only really need to happen on deploy and save, which is already happening? If I understand correctly, the workspace in the UI is controlled by the React state at this point, not the moc worker.

If it makes more sense for them to stay in sync then we can definitely add the moc call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make them in sync, otherwise, moc can still load a deleted file. In general, each reducer action needs to call moc to make them in sync.

@chenyan-dfinity
Copy link
Contributor

If you import an external canister, the close button is not aligned, because imported canister doesn't have a timer.

Screen Shot 2021-10-07 at 11 28 16 AM

@taylorham
Copy link
Contributor Author

Good catch! I haven't switched the canister buttons to have the hover features like files do yet.

Can a canister be renamed, or only removed?

@chenyan-dfinity
Copy link
Contributor

Both canister and package can be removed/renamed. For simplicity, I am thinking we can just implement deletion for all of them, and remove the rename button for file as well?

@taylorham
Copy link
Contributor Author

@chenyan-dfinity - Frontend tests are running and passing! I'm going to leave the rename functionality (can't hurt?) and finish adding the hover features to the other buttons tomorrow, along with the fix for the canister delete button when no time is displayed.

@chenyan-dfinity
Copy link
Contributor

Is it easy to move the PR to the main repo? You now have write access. It would be easier for me to collaborate on the main branch instead of a forked branch.

@taylorham
Copy link
Contributor Author

I don't think a PR can be moved, but I can close this and open another from a branch on this remote if that's easier.

@taylorham
Copy link
Contributor Author

Closed in favor of #87

@taylorham taylorham closed this Oct 19, 2021
@taylorham taylorham deleted the ham/rename branch October 19, 2021 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants