memories
memories copied to clipboard
Add copy and "move and organise" features
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 abuttonFactory
instead oftype
as the third argument.setType
was deprecated anyway ingetFilePickerBuilder
. 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 fordav
. This function first creates the required directories, then moves the files.
Initially, I considered a more general
movePhotosToDestinations
function that takes aMap<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.
By the way, here is how it looks like:
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.