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: Open modals with route instead pushModal #2978

Merged
merged 9 commits into from
Aug 31, 2023
Merged

Conversation

cballevre
Copy link
Contributor

@cballevre cballevre commented Aug 29, 2023

This aims to make easier to navigate into the Flagship application

### ✨ Features

* Use a route instead pushModal to open MoveModal
* Use a route instead pushModal to open qualification modal
* Use a route instead pushModal to open a ShareModal

### 🐛 Bug Fixes

* Center the spinner before OnlyOffice editor is ready

@cballevre cballevre requested a review from Crash-- August 29, 2023 17:08
@cballevre cballevre requested a review from zatteo as a code owner August 29, 2023 17:08
@bundlemon
Copy link

bundlemon bot commented Aug 29, 2023

BundleMon

Files updated (5)
Status Path Size Limits
drive/vendors/drive.(hash).js
1.28MB (+1.13KB +0.09%) 1.6MB
drive/app-drive.(hash).min.css
55.72KB (-275B -0.48%) 56KB
drive/public/drive.(hash).min.css
92.62KB (-297B -0.31%) 100KB
drive/app/drive.(hash).js
242.6KB (-721B -0.29%) 255KB
drive/public/drive.(hash).js
1.49MB (-3.75KB -0.24%) 1.65MB
Unchanged files (14)
Status Path Size Limits
drive/public/pdf.worker.entry.(hash).worker.j
s
343.37KB 345KB
drive/services/dacc/drive.js
253.91KB 500KB
drive/services/qualificationMigration/drive.j
s
248.95KB 500KB
drive/public/cozy-client-js.js
158.97KB 160KB
drive/intents/drive.(hash).js
148.69KB 171KB
drive/intents-drive.(hash).min.css
37.06KB 40KB
drive/onlyOffice/slide.pptx
24.82KB 25KB
drive/onlyOffice/text.docx
5.84KB 6KB
drive/onlyOffice/spreadsheet.xlsx
5.01KB 6KB
drive/manifest.webapp
1.77KB 2KB
drive/index.html
532B 1KB
drive/intents/index.html
515B 1KB
drive/img/app-icon.(hash).svg
419B 1KB
drive/manifest.json
184B 1KB

Total files change -3.87KB -0.09%

Groups updated (3)
Status Path Size Limits
drive/vendors/**
1.28MB (+1.13KB +0.09%) +6%
drive/app/**
242.6KB (-721B -0.29%) +1%
drive/public/**
2.09MB (-4.04KB -0.19%) +7%
Unchanged groups (5)
Status Path Size Limits
drive/screenshots/**
2.13MB +0.4%
drive/services/**
502.86KB +1%
drive/intents/**
149.19KB +6%
drive/onlyOffice/**
35.68KB +0.4%
drive/img/**
419B +0.4%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

.fil-mobileactionmenu-header
font-weight bold
max-width 100%
display flex
Copy link
Contributor

Choose a reason for hiding this comment

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

popopop \o/ 🎉

<Icon icon={ShareIcon} />
</ListItemIcon>
<ListItemText primary={t('Files.share.cta')} />
{isMobile && props.doc ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you add props.doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, we obtained a files property but only used the first element. With MenuActions, only the document linked to the action is shared with the doc property. I use it to get the identifier to display the recipients

)
}
})
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't understand why you have to check isArray() everywhere and then [files]. Can you explain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your comment makes me think that I haven't documented this point.

Actions are used in two places in a file's drop-down menu and in the selection bar. Before the migration to ActionsMenu, we always received an array in both case. The ActionsMenu now sends the document directly to the action, while the SelectionBar sends an array of documents. This code seeks to manage the two cases.

I'm going to add a comment in the commit for the future me

Copy link
Contributor

@Crash-- Crash-- left a comment

Choose a reason for hiding this comment

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

Nice work.

A remark for later since I don't have a strong opinion on it yet:

You added a route for every possible action on every level. Now there is a lof of declared routes. And each time we'll add an action, we'll have to add 3 routes. I love the "declarative" approach, but I don't know if it's suitable.

Maybe we can create 3 routes :
/files/:id/action/:action

And then, the action component linked to these route will do the job to check the action param to display the right modal. In that case, if we had an action, we'll not have to add new routes, but just editing this action component

@cballevre
Copy link
Contributor Author

This would really make sense to simplify the routes and share the file request logic.

We could do something similar with another route for actions related to multiple files, such as moving or deleting.

I'll ask myself this question again when I migrate the last remaining modals using pushModal

Actions are interpreted in two places, in ActionsMenu and in  SelectionBar. Before migration, action function always received an array of documents in both case. After migration, ActionsMenu now sends the document directly, while the SelectionBar sends an array of documents. To manage the two cases, I used an verification on if the params was an Array or not. In the case, we expected a single file if its an array I take the first element otherwise I put the single file into an array.
@cballevre cballevre force-pushed the feat/modal-as-route branch 3 times, most recently from c8d1eb2 to 2ae0aeb Compare August 30, 2023 09:37
@cballevre cballevre force-pushed the feat/modal-as-route branch from 2ae0aeb to 1533bbc Compare August 30, 2023 09:38
@cballevre cballevre merged commit 0834e1f into master Aug 31, 2023
3 checks passed
@cballevre cballevre deleted the feat/modal-as-route branch August 31, 2023 11:55
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