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

Map feature #40

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

Map feature #40

wants to merge 18 commits into from

Conversation

Jonath-z
Copy link
Collaborator

I integrate mapBox to get the map view of the property and places around like hospital, markets,etc.
I used Kampala's coordinates a to show the feature's behavior

interface IMarkerProps {
latitude: number;
longitude: number;
showPopUp: () => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change this prop name to onClick as it reflects that action that has to be performed?

Comment on lines 25 to 30
<div>
<p className="w-40 font-extrabold">{property?.title}</p>
<p className="overflow-hidden break-words w-40 text-xs">
{property?.description}
</p>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to wrap the children inside the div as you have a parent component Popup.

You can remove that div or just make use of React Fragment.

Comment on lines 27 to 28
const [lng] = useState(32.58252);
const [lat] = useState(0.347596);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's better to merge the two in one state.

Comment on lines 37 to 42
const showPopUp = () => {
setDisplayPopUp(true);
};
const closePopUp = () => {
setDisplayPopUp(false);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you only create one function that toggles the popup?

Comment on lines 12 to 38
const MapButton = ({ onClick }: IProps): ReactElement => {
const [isMobile] = useResponsive();
if (!isMobile) {
return (
<>
<button
type="button"
className="w-[80%] p-1 bg-brand-bold text-sm text-white rounded-lg px-3 py-2 mt-3 "
onClick={onClick}
>
Voir sur map
</button>
</>
);
}
return (
<>
<button
type="button"
className="w-full p-3 bg-brand-bold text-white rounded-lg md:mx-auto md:px-16 mt-4 "
onClick={onClick}
>
Voir sur map
</button>
</>
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is nice but you don't need to create a component for this button as there are no extra kinds of stuff that you are handling.

There is also no need of making use of useResponsive hook.

You can handle responsiveness with just tailwind.

import RelatedProperties from './RelatedProperties';
import PropertyCarousel from './PropertyCarousel';
import PropertyDetails from './PropertyDetails';
import PropertyAgent from './PropertyAgent';
import PropertyImages from './PropertyImages';
import PropertyDetailsDesktop from './PropertyDetailsDesktop';
import MapButton from '../../__modules__/MapButton/index';
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can ignore /index

Comment on lines 120 to 129
const openMapBox = () => {
setOpenMap(true);
setShowMapButtom(false);
};

const closeMapBox = () => {
setOpenMap(false);
setShowMapButtom(true);
};

Copy link
Collaborator

Choose a reason for hiding this comment

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

Make use of one toggle function here too.

Comment on lines 27 to 31
MAPBOX_ACCESS_TOKEN:
'pk.eyJ1Ijoiam9uYXRoemloaW5kdWxhIiwiYSI6ImNreW4wZXBwbTNsd2EydW4wamJ1aTdidHgifQ.zVkgrvMk02fZiJFaV_jkDQ',
MAPBOX_CUSTOM_STYLE_URL:
process.env.MAPBOX_CUSTOM_STYLE_URL ||
'mapbox://styles/jonathzihindula/ckynaitbt8tyh14qpylblnbwp',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Read these keys from .env file.

@Jonath-z
Copy link
Collaborator Author

Thanks for the review !

I made already all the correction suggested in the review.
May you check it out please.

Comment on lines 39 to 43
const togglePopUp = () => {
if (displayPupUp) setDisplayPopUp(false);
else {
setDisplayPopUp(true);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to make use of if statement here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can i use switch ? cause i don't understand why the is should be removed !

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nope. I was meaning I have to use it like the following:
setDisplayPopup(!displayPopup)
Which will be toggling the value of displayPopup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mean why the if statement should be removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahhh okey ! i get it ! thanks

Comment on lines 119 to 126
const toggleMap = () => {
if (!openMap && showMapButton) {
setOpenMap(true);
setShowMapButtom(false);
} else {
setOpenMap(false);
setShowMapButtom(true);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need for the if statement here either.

You can also rename the function to onClick

@Jonath-z
Copy link
Collaborator Author

I made already all the correction suggested in the second review.

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