memories icon indicating copy to clipboard operation
memories copied to clipboard

Add copy and "move and organise" features

Open AiroPi opened this issue 10 months ago • 2 comments

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 avatar Apr 16 '24 13:04 AiroPi

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

AiroPi avatar Apr 16 '24 16:04 AiroPi

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.

pulsejet avatar Apr 30 '24 21:04 pulsejet