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: issue #32 prev and next tree button #45

Closed

Conversation

VWRoli
Copy link
Member

@VWRoli VWRoli commented Dec 18, 2021

The purpose of this PR is to fix #32

@dadiorchen
Copy link
Collaborator

@VWRoli how about the mobile version for this feature?

src/Map.js Outdated
Comment on lines 165 to 179
mountButtonPanelTarget.addEventListener('click', (e) => {
if (e.target.id === 'right-arrow') {
try {
this.goNextPoint();
} catch (e) {
log.warn('go next failed', e);
}
} else if (e.target.id === 'left-arrow') {
try {
this.goPrevPoint();
} catch (e) {
log.warn('go prev failed', e);
}
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think it is good that we move these lines to the button panel and expose: onClickNext, onClickPrev,

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm considering add an option to disablePrevNextButton

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what you mean. The way I did it exposes these functions? How should I go about not exposing them? This repo is a bit advanced for me, just started working on it for fun and for the challenge.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@VWRoli no no you are doing great, I just want that you move the code above into the ButtonPanel, so the behavior of it gets encapsulated into the ButtonPanel component, I think it makes more sense, for example, I open a new option called:
new Map({disableButtonPanel})

then, in the current code, we need to take care of two places:
No1.
if(dsableButtonPanel){
new ButtonPanel()...
}

No.2:
if(disableButtonPanel){
buttonPanelTarget.addListner(....)
}

So it's getting cumbersome, in my mind, hiding the details (encapsulation) is the major benefit of using the component like ButtonPanel

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, maybe you need to expose events on the ButtonPanel:
new ButtonPanel({
onNext: this.goNextPoint,
onPrev: this.goPrevPoint,
})

Copy link
Member Author

Choose a reason for hiding this comment

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

I understand now. I will see what I can do about it.

@VWRoli
Copy link
Member Author

VWRoli commented Dec 27, 2021

@VWRoli how about the mobile version for this feature?

What do you mean exactly? Should I place them somewhere else on small screens? But this whole app does not have any mobile friendliness.

@dadiorchen
Copy link
Collaborator

@VWRoli how about the mobile version for this feature?

What do you mean exactly? Should I place them somewhere else on small screens? But this whole app does not have any mobile friendliness.

@VWRoli yes, let see what happens, let's forget it now, we can open a new issue on this if needed. so, please ignore this.

@dadiorchen
Copy link
Collaborator

@VWRoli here is the design of these two arrow button, can you implement it? https://www.figma.com/file/XdYFdjlsHvxehlrkPVYq0l/Greenstand-Webmap?node-id=6133%3A21294

@VWRoli
Copy link
Member Author

VWRoli commented Jan 7, 2022

Yes, sure.

@VWRoli VWRoli force-pushed the ISSUE_#32_prev_and_next_tree_button branch from f7360dc to 5d6ef04 Compare January 16, 2022 09:34
@VWRoli
Copy link
Member Author

VWRoli commented Jan 16, 2022

Screenshot from 2022-01-16 10-57-03
Implemented the buttons, and tried to encapsulate the code into the buttonPanel component. Without much success. I get the following error message:
Screenshot from 2022-01-16 10-50-58
The correct functions are getting called but payload in goNextPoint is undefined. Which is the same error we get when we use the goNextPoint method without selecting a Marker. So the issue is somewhere with selecting the marker and encapsulating the code. I just can't figure out what exactly the problem is.

goNextPoint() {
log.info('go next tree')
console.log('go NEXT')
const currentPoint = this.layerSelected.payload
console.log(currentPoint)
expect(currentPoint).match({
lat: expect.any(Number),
})

Could you take a look at it @dadiorchen?

@dadiorchen
Copy link
Collaborator

Good, thanks for the progress, yes, I will look into it, and I will back to you when I get any progress.

@dadiorchen dadiorchen self-assigned this Jan 17, 2022
@dadiorchen
Copy link
Collaborator

@VWRoli thanks for you meaningful work on this, I finished this feature based on you work, take a look here: https://github.com/Greenstand/treetracker-web-map-core/pull/80/files

@dadiorchen dadiorchen closed this Feb 9, 2022
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.

Add feature: previous tree and next tree button
2 participants