Open fdelayen opened 5 years ago
Hi florent,
This is something we have in mind since a few months, but this feature is not in our current backlog ATM.
You're right, Photos and Drive are both applications. Let me see if the product team has something specific in mind about this feature and I'll come back with a few leads. (We can imagine giving to Drive the rights to create an album, and in this case, it can be pretty straightforward to implement. Or maybe we want to keep separate both, and calling Photos with a few args can be the solution).
Hey @Crash-- any insight about this one ? As I'm done with the thumbnail, I'd like to work on this one if your team isn't and that's something doable :)
Florent
Hey @fdelayen you'll be contacted by @joel-costa on the email you used to sign your commit. He has a few questions for you ;)
Hi @fdelayen, are you still motivated to add this feature to Drive? I can help you with the implementation.
Hey !
Yep of course, if I can help you on this one I will :)
Florent
@Crash-- Any updates / insights on which strategy you would prefer to do this ? :)
Hello @fdelayen !
First Drive should have access to the creation of an album. ATM Drive has only the right to edit one. (https://github.com/cozy/cozy-drive/blob/master/src/drive/targets/manifest.webapp#L113) So we need to add the POST method
Then, we need to configure CozyClient (our internal client to query our API) to give it access to the Album doctype
(what is a doctype?. CozyClient will help use with the creation. We should probably add here https://github.com/cozy/cozy-drive/blob/master/src/drive/lib/doctypes.js#L10 something like :
albums: {
doctype: DOCTYPE_ALBUMS,
attributes: {
name: {
type: 'string'
}
},
relationships: {
photos: {
type: 'has-many',
doctype: DOCTYPE_FILES
}
}
}
After that, I think we are good for the configuration, and we can start coding. As @joel-costa told you, we'll add this action in the selection bar
. (This is not the best part of Drive
sorry about that).
To add an action there, we need to edit our Container
file and add here https://github.com/cozy/cozy-drive/blob/master/src/drive/web/modules/drive/Container.jsx#L80 our new action album-create
or something.
This action will result in : opening a Modale asking for the album's name with a confirm button. Let's use a Modal
component from cozy-ui https://docs.cozy.io/cozy-ui/react/#modal
Then we should call cozy-client to create the entry in the DB. Here is an exemple : https://docs.cozy.io/en/cozy-client/react-integration/#3-mutating-data
We already have this request here : https://github.com/cozy/cozy-drive/blob/master/src/photos/ducks/albums/index.jsx#L71 . We can use the same and even deleting the updateQueries
callback since we do not need it here :)
If you have any question, don't hesitate ;). You can join us on IRC if you want
Hello,
That would be nice if we could add pictures to albums from the drive app. I have too many photos (50 000+) to be able to easily select those from the photos app so I organized my photos into many folders in drive but then I can't use albums which is a very nice feature :)
In case it's not on your roadmap I could help, I'm a react/redux dev at ovh ;)
Any clue on how you would like to achieve this ? I'm new to cozy, and it seems drive and photos are 2 very separate apps. A simple solution could be to select a few photos from the drive app and have an "Add to Album" button which would redirect to the photos app with parameters to trigger the Album selection ?
Florent