-
Notifications
You must be signed in to change notification settings - Fork 1
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
v1 #42
Open
marissa-anj
wants to merge
4
commits into
main
Choose a base branch
from
Mae/recommend
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
v1 #42
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 0 additions & 36 deletions
36
api/optimeet/groups/migrations/0003_alter_recommendations_group_id_and_more.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
|
||
|
||
function RecGoogleMap({ coordinates, recommendations }) { | ||
const mapContainerRef = useRef(null); | ||
const map = useRef(null); | ||
const markers = useRef([]); | ||
const infoWindow = useRef(null); | ||
|
||
useEffect(() => { | ||
if (!window.google) { | ||
const errorMessage = 'Error: Google Maps API not loaded.'; | ||
console.error(errorMessage); | ||
return; | ||
} | ||
|
||
if (coordinates && coordinates.length > 0) { | ||
map.current = new window.google.maps.Map(mapContainerRef.current, { | ||
center: { lat: coordinates[0].lat, lng: coordinates[0].lng }, | ||
zoom: 12, | ||
}); | ||
|
||
markers.current.forEach(marker => marker.setMap(null)); | ||
markers.current = []; | ||
|
||
infoWindow.current = new window.google.maps.InfoWindow({ | ||
maxWidth: 200, // Set max width to control the size of the InfoWindow | ||
}); | ||
|
||
coordinates.forEach(({ lat, lng }, index) => { | ||
const marker = new window.google.maps.Marker({ | ||
position: { lat, lng }, | ||
map: map.current, | ||
}); | ||
|
||
markers.current.push(marker); | ||
|
||
marker.addListener('mouseover', () => { | ||
if (recommendations && recommendations[index]) { | ||
const content = recommendations[index].place_name; | ||
console.log('Hovered Place Name:', content); | ||
|
||
infoWindow.current.setContent(`<div style="font-size: 16px; color: black;">${content}</div>`); | ||
|
||
// Disable the close button ('x') on the info window | ||
infoWindow.current.setOptions({ | ||
disableAutoPan: true, // Disable auto-panning | ||
maxWidth: 200, | ||
}); | ||
|
||
infoWindow.current.open(map.current, marker); | ||
} | ||
}); | ||
|
||
marker.addListener('mouseout', () => { | ||
infoWindow.current.close(); | ||
}); | ||
}); | ||
} | ||
}, [coordinates, recommendations]); | ||
|
||
return ( | ||
<div> | ||
<div ref={mapContainerRef} style={{ width: '1000px', height: '800px' }} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default RecGoogleMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
import React, { useState } from 'react'; | ||
|
||
const RecPopup = ({ closeModal, times, onSelect, sampleCoordinates }) => { | ||
|
||
const [selectedButton, setSelectedButton] = useState(null); | ||
|
||
|
||
const handleButtonClick = (buttonId) => { | ||
setSelectedButton(buttonId); | ||
}; | ||
|
||
|
||
return ( | ||
<div className="fixed inset-0 flex items-center justify-center"> | ||
<div className="fixed inset-0 bg-black opacity-80" onClick={closeModal}></div> | ||
|
||
<div className="bg-white p-8 rounded-lg shadow-md relative z-10"> | ||
<h2 className="text-xl font-bold mb-4 text-gray-700">Choose a time</h2> | ||
|
||
{times.map((time, index) => ( | ||
<div | ||
key={index} | ||
className={`rounded-lg p-4 mb-4 cursor-pointer ${ | ||
selectedButton === index ? 'border-2 border-green-500 text-gray-700 bg-gray-300' : 'bg-gray-300' | ||
}`} | ||
onClick={() => { | ||
handleButtonClick(index); | ||
onSelect(time); | ||
|
||
}} | ||
> | ||
<p className={selectedButton === index ? 'text-gray-700' : ''}> | ||
{time} | ||
</p> | ||
</div> | ||
))} | ||
|
||
<button | ||
className="mt-4 bg-slate-700 text-white py-2 px-4 rounded-md" | ||
onClick={closeModal} | ||
> | ||
Close | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RecPopup; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't be needed since everything is in the preferences route.