wavesinaroom / my_odin_project_photo_tag

0 stars 0 forks source link

Item Picker #2

Closed wavesinaroom closed 1 year ago

wavesinaroom commented 1 year ago

Description

While image is mainly in charge of getting user's click coordinates, the character picker lifts up user's character choice to complete the selection state object. It's quite important to bear in mind that the position of the modal will appear on mouse pointer coordinates by setting the position in the component style sheet.

Tests

wavesinaroom commented 1 year ago

Ideally decoupled components are preffered in the app production process. However, it turns out that <Picker/ and <Image/> should be together in one script. Reasons behind that are based that at this point I'm passin all <Image/> states as <Picker/> props. Aside from that <Picker/> only renders a dialog and its behaviour completely relies on <Image/>, so again having them as two different components doesn't make much sense. Lastly, popping up and closing a dialog is far easier from envent handlers in the same component rather than passing props down reduntantly

wavesinaroom commented 1 year ago

Just forgot to mention that this issue won't continue, thus it's gonna be closed now. All development related to the previously coded <Picker/> will be continued in <Image/>. picker.js and picker.test.js will be removed whereas 2-item-picker local and remote branches will be kept for tracking purposes.

wavesinaroom commented 1 year ago

Reopened issue. See issue 1 to understand why

wavesinaroom commented 1 year ago

Here I am again dealing with bugs.<Picker/> turned out to be a living nightmare to test but a learned lots from it. I'm gonna implement it again inside <Image/> because I've just come up with a simple yet effective way to doing without getting bugs I hope. This issue is gonna be closed again now, hopefully I won't come back to separate components again

wavesinaroom commented 1 year ago

I'd rather take the items fetch code to game.js. Image shouldn't be in charge on checking players action against item coordinates but just set the players selection prop to avoid unrelated tasks handling