Skip to content

Directions Instructions refined and received in console; enhanced UX in drawer component and map rendering#56

Open
charlesleezhaoyi wants to merge 91 commits intorocketacademy:mainfrom
charlesleezhaoyi:directions-instructions
Open

Directions Instructions refined and received in console; enhanced UX in drawer component and map rendering#56
charlesleezhaoyi wants to merge 91 commits intorocketacademy:mainfrom
charlesleezhaoyi:directions-instructions

Conversation

@charlesleezhaoyi
Copy link

No description provided.

charlesleezhaoyi and others added 30 commits December 16, 2023 11:43
Managed Merge Conflicts and Refactored the Google Maps Rendering Function on App.js to be stored in its own component with props
ianthehamster and others added 28 commits January 15, 2024 21:45
Modified UX for new and existing users; added validation for onboarding & code cleanup in general
enlarged map and drawer. sliced Ai responses into paragraphs. able to receive discrete steps instruction
Changed key landmark pill button to red and hamburger menu icon to maroon.
@@ -13,11 +13,18 @@

# misc
Copy link

Choose a reason for hiding this comment

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

Please give your PRs a fitting title

Comment on lines +14 to +36
<script>
async function sendMessage() {
const userInput = document.getElementById("user-input").value;
const chatLog = document.getElementById("chat-log");

// Display user message in the chat log
chatLog.innerHTML += `<div>User: ${userInput}</div>`;

// Send user input to the server
const response = await fetch("/send-message", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ message: userInput }),
});

const data = await response.json();

// Display AI's response in the chat log
chatLog.innerHTML += `<div>AI: ${data.message}</div>`;
}
</script>
Copy link

Choose a reason for hiding this comment

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

Were you not able to define this within the App.js context? It is JS after all and rendering something. Usually we do not touch the index.html. Also, why is there a public1 folder alongside the public folder?

apiKey: process.env.API_KEY,
});

// app.use(cors({ origin: "http://localhost:3001" }));
Copy link

Choose a reason for hiding this comment

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

Remove comments like such


// app.use(cors({ origin: "http://localhost:3001" }));
app.use(cors());
app.use(express.static("public1"));
Copy link

Choose a reason for hiding this comment

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

Okay public1 makes sense now, but you should have a separate project folder altogether if you run a backend for your frontend

Comment on lines +1 to +6
/* .App {
display: flex;
justify-content: center;
align-items: center;
} */

Copy link

Choose a reason for hiding this comment

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

Remove

directionsRenderer.setMap(mapRef.current);
}, []);

const onDirectionsServiceLoad = useCallback((directionsService) => {
Copy link

Choose a reason for hiding this comment

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

Why did you use useCallback here?

Comment on lines +84 to +87
function () {}
);
} else {
}
Copy link

Choose a reason for hiding this comment

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

why empty func argument, also, why empty else statement?

Comment on lines +179 to +180
if (loadError) return "Error loading maps";
if (!isLoaded) return "Loading Maps";
Copy link

Choose a reason for hiding this comment

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

What to do if this happens? Does the user get some feedback? a button? something?

@@ -0,0 +1,19 @@
const OpenAI = require("openai");
Copy link

Choose a reason for hiding this comment

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

test or working? if test, why push it?

NationalMuseumofSingapore: { lat: 1.2966, lng: 103.8485 },
};

const SignInPage = () => {
Copy link

Choose a reason for hiding this comment

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

I have seen this component before. Why define it a second time?

Comment on lines +32 to +45
logoutButton,
aiResponse,
clearAIResponse,
onDrawerOpen,
sendMessage,
handleAuthStateChanged,
handleLogout,
isLoggedIn,
loading,
historicalLandmarks,
natureParks,
politicalLandmarks,
setSelectedLandmarks,
renderMapComponent,
Copy link

Choose a reason for hiding this comment

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

I would advise to try and reduce the number of props on this component. This is quite a lot of props, and very hard to maintain when working with. Especially without any type checks etc, you will run into the problem of not knowing if those props are still used or if there are undefined props

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.

3 participants