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

Add copy and "move and organise" features #1143

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

AiroPi
Copy link

@AiroPi AiroPi commented Apr 16, 2024

This implements features #595 and #1111. It's my first time working with TypeScript, PHP, and Vue, so this is still a draft. I'm aware there are many things that need refactoring.

This adds two new buttons to the "move" modal called “Move and Organize” and "Copy".

To implement these features, I needed to make a few changes:

  • To accommodate adding multiple buttons, I refactored the chooseNcFolder function slightly. It now takes a buttonFactory instead of type as the third argument. setTypewas deprecated anyway in getFilePickerBuilder. The default value still behaves the same (providing the "Choose" option) so it doesn't break anything. Other types need to be defined manually.

Another approach could have been to keep a memories-defined type enum, and have button implementations defined based on the type passed. However, determining which button was pressed would be trickier with multiple buttons. The current approach however needs more work in order to have different buttons than "Choose".

I didn't implement the "Move to x" when a folder is selected, since with 3 buttons this can add a lot of text.

  • To optimize the movement of files to different folders, I also created a movePhotosByDate function for dav. This function first creates the required directories, then moves the files.

Initially, I considered a more general movePhotosToDestinations function that takes a Map<Path, IPhotos[]>, but this would require additional calls to create all the directories, check if they exist, and then create them. However, this approach could also allow for user-defined structures.

By the way, the new copyPhotos and movePhotos functions are very similar and could be merged.

@AiroPi
Copy link
Author

AiroPi commented Apr 16, 2024

By the way, here is how it looks like:
image

@pulsejet
Copy link
Owner

I intended to get to this before the 7.3 release but a hotfix came up that'll need an immediate release. Moving this ahead but 7.4 can come earlier.

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