ElektraInitiative / PermaplanT

https://www.permaplant.net
BSD 3-Clause "New" or "Revised" License
16 stars 13 forks source link

frontend layer refactoring #1152

Open markus2330 opened 8 months ago

markus2330 commented 8 months ago

Tasks

Common operations of elements:

Use case

shade and drawing layer

Related Pull request

No response

markus2330 commented 8 months ago

As first step, please collect which operations might be sharable between layers.

Bushuo commented 8 months ago

I would strongly agree to a refactor of the MapStore into a more narrow layer specific store. Also maybe a Stage and Transformer store. This way more logic can be pulled from components into the respective stores and makes it easier to track where what happens.

A design pattern I would strongly encourage then is grouping actions under a actions namespace inside the store.

Bushuo commented 8 months ago

@badnames Can you please also explain, why a stage listeners functionality was needed? https://github.com/ElektraInitiative/PermaplanT/blob/9f142c507d329f56aa77d505a188463ad4e65725/frontend/src/features/map_planning/components/BaseStage.tsx#L34 Currently it seems a bit convoluted this way. If you look at the plant layer https://github.com/ElektraInitiative/PermaplanT/blob/9f142c507d329f56aa77d505a188463ad4e65725/frontend/src/features/map_planning/layers/plant/PlantsLayer.tsx#L215 there is a backed-in functionality to listen to native Stage events. Maybe I am missing something?

markus2330 commented 8 months ago

@Bushuo thx for your great input!

A design pattern I would strongly encourage then is grouping actions under a actions namespace inside the store.

Can you maybe describe what you have in mind in our architecture documentation as a separate PR?

Can you please also explain

I created a separate issue #1155 as @badnames sometimes does not get all the notification. The extra issue will pop up in the sprint and I can ask him in the meeting.

I suggest that we should have a dedicated meeting together to discuss the frontend layer refactoring. But first we should have a PR that proposes an architecture. I think they (@badnames and @danielsteinkogler) will be very happy if you (@Bushuo) make specific suggestions.