-
-
Notifications
You must be signed in to change notification settings - Fork 102
[WIP] Rewrite UI in Vue.js #510
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
Conversation
tacruc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely Done 👍
paulschwoerer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! That looks like it has been a ton of work. I left a few comments, but couldn't dive deeper, yet. Maybe it would make sense to leverage the vuex store for data loading as has been done for the public favorites?
| ::v-deep .icon-hand { | ||
| opacity: 1; | ||
| background-color: var(--color-main-text); | ||
| padding: 0 !important; | ||
| mask: url('../../img/hand.svg') no-repeat; | ||
| mask-size: 16px auto; | ||
| mask-position: center; | ||
| -webkit-mask: url('../../img/hand.svg') no-repeat; | ||
| -webkit-mask-size: 16px auto; | ||
| -webkit-mask-position: center; | ||
| min-width: 38px !important; | ||
| min-height: 36px !important; | ||
| } | ||
|
|
||
| ::v-deep .icon-hand-slash { | ||
| opacity: 1; | ||
| background-color: var(--color-main-text); | ||
| padding: 0 !important; | ||
| mask: url('../../img/hand-slash.svg') no-repeat; | ||
| mask-size: 16px auto; | ||
| mask-position: center; | ||
| -webkit-mask: url('../../img/hand-slash.svg') no-repeat; | ||
| -webkit-mask-size: 16px auto; | ||
| -webkit-mask-position: center; | ||
| min-width: 38px !important; | ||
| min-height: 36px !important; | ||
| } | ||
|
|
||
| ::v-deep .icon-save { | ||
| background-color: var(--color-main-text); | ||
| mask: url('../../img/save.svg') no-repeat; | ||
| mask-size: 16px auto; | ||
| mask-position: center; | ||
| -webkit-mask: url('../../img/save.svg') no-repeat; | ||
| -webkit-mask-size: 16px auto; | ||
| -webkit-mask-position: center; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of repeated rules here, wouldn't it be nice to only set the values once for all icons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed. I just struggled a bit with style rules range and stopped touching them when it worked 😁. There sure is a lot of room for factorization.
| map: { | ||
| type: Object, | ||
| required: true, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while since I've worked with Vue, so please correct me if I'm mistaken here. My understanding is, that Vue will set up watchers for all fields of a prop. A change on one of the fields would then trigger a rerender of the component. Do you think this could get quite costly when passing in the whole Leaflet Map instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it re-renders PhotoLayers when a map attribute changes. The mechanism operates at a finer level. It will only re-render what is affected, what uses the changed values.
| export default { | ||
| name: 'RoutingMachine', | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you implemented the RoutingMachine as a Vue component, even though it has no associated template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the reason is it's now easy to plug it in a Leaflet-Vue based map application. Also it can now be treated as a classic component. It has a reactive visible prop. Stuff like that.
|
@paulschwoerer Thanks for the review. I never got interested in Vuex. If you convince me I'll probably see how it can be done with Vuex.
The color generation is supposed to be the same as before. The 2 first category name letters are used to determine the color. Anyway we need to improve this. What stops us to make a move here is that categories are not really stored in the DB, they are just a string field of the favorite table. It would be way better to have a category table and to use its ID as a foreign key in favorites table. I'm going to first implement everything like it was before. That's one of the first things to do after that. |
|
Sorry for not getting back to this, I'll try to do a more in-depth review today or tomorrow, if desired. |
|
So, just had a look at it. A few things:
Other than that LGTM! |
|
@paulschwoerer Thanks a lot for the review! I agree and acknowledge everything you said 😁. I'll get back to Maps development once I manage to get less busy... |
|
@eneiluj any update on this? :) |
|
Please make this PR a reality 😄 |
d5f8801 to
ca9d4e4
Compare
…ain component, all configs ok (webpack, eslint, stylelint etc...) Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
Signed-off-by: Julien Veyssier <[email protected]>
|
@tacruc In this branch. I'll check the others later. |
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Don't open sidebar, when opening the viewer Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Clear sidebar if sidebar is closed (onSidebarClose; big X button top right of sidebar) Signed-off-by: Arne Hamann <[email protected]>
Signed-off-by: Arne Hamann <[email protected]>
Enh/vue image sidebar
Signed-off-by: Arne Hamann <[email protected]>
|
🎉🎉🎉🎉🎉 |
Hey there!
Why not fully rewriting Maps UI 😁?
Sorry in advance for the size of this text. It's also a memo.
How to try it
There isn't any DB migration steps involved. It's safe to switch to this branch and then get back to master. Just run
make devto build.Immediate goals:
Long term goals:
Downsides:
While this banch is incompatible with some of the pending PRs, I think it won't be too hard to adapt them and benefit from using Vue.
Todo
Choices
Map library
Vue2Leaflet has been chosen over mapbox-gl-vue and vuelayers (OpenLayers) for various reasons.
Overall structure
The code structure is quite different than before. It used to be grouped by topic (photos, favorites...) and each controller took care of everything (display stuff on the map, manipulate the data, make network requests etc...). Communication between controllers was mostly done by method calls.
All the data is now managed by the
Apptop component and then passed down to navigation menu and Map stuff. UI Entities are now more independent from each other. Almost all communication is now done via events.News
Action history
Photo and favorite actions are now stored and it's possible to cancel and redo them. There's a new map control (top right) with cancel and redo buttons.
SearchField
The new SearchField component is used in the search bar and in each routing step. Routing steps used to be "augmented" with JQuery autocompletion.
Multiselect(from nextcloud-vue) is now used everywhere. As it was not possible to inject a Vue component in the leaflet-routing-machine control, things have changed there. Integrated step management is now hidden and replaced by a RoutingSteps component which works in parallel of the routing machine. The routing machine itself has been abstracted in a RoutingMachine component.Moving favorites and photos
Before: Context menu -> click move -> the move cursor changes to a crosshair -> click on target location to move the favorite/photo
After: Enable dragging in navigation menu -> drag'n'drop favorites/photos