Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions frontend/src/components/Ai.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
// headers: { 'Content-Type': 'application/json' },
// body: JSON.stringify({ message }),
// });
// const data = await res.json();
// if (!res.ok) throw new Error("Request failed");
const data = await res.json();

Check failure on line 102 in frontend/src/components/Ai.jsx

View workflow job for this annotation

GitHub Actions / Lint Frontend

'res' is not defined

Check failure on line 102 in frontend/src/components/Ai.jsx

View workflow job for this annotation

GitHub Actions / Lint Frontend

'data' is assigned a value but never used. Allowed unused vars must match /^_/u
// setIsTyping(false);
// speak(data.reply || "Sorry, I couldn't get a response.");
// } catch (err) {
Expand Down Expand Up @@ -208,7 +209,7 @@
if (results.length > 0) {
navigate('/collection');
setShowSearch(true);
return `Found ${results.length} result(s) for "${words}": ${results.map((p) => p.name).join(', ')}. Taking you to the collection!`;
return `Found ${results.length} result(s) for "${words}": ${(results ?? []).map((p) => p.name).join(', ')}. Taking you to the collection!`;
}
return null;
};
Expand Down Expand Up @@ -461,7 +462,7 @@
</p>
</div>
) : (
chatMessages.map((msg, i) => (
(chatMessages ?? []).map((msg, i) => (
<div
key={i}
className={`flex ${msg.sender === 'user' ? 'justify-end' : 'justify-start'}`}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/Collections.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const FilterContent = ({
max={maxPrice}
value={priceRange[1]}
onChange={(e) =>
setPriceRange([priceRange[0], parseInt(e.target.value)])
setPriceRange([priceRange[0], parseInt(e.target.value, 10)])
}
className="w-full h-2 bg-slate-300 dark:bg-gray-700 rounded-lg appearance-none cursor-pointer slider-thumb"
aria-valuemin={minPrice}
Expand All @@ -106,7 +106,7 @@ const FilterContent = ({
Category
</h3>
<div className="space-y-2">
{categories.map((cat, i) => (
{(categories ?? []).map((cat, i) => (
<button
key={i}
type="button"
Expand All @@ -130,7 +130,7 @@ const FilterContent = ({
Sub Categories
</h3>
<div className="flex flex-wrap gap-2">
{subCategories.map((sub, i) => (
{(subCategories ?? []).map((sub, i) => (
<button
key={i}
type="button"
Expand Down
2 changes: 1 addition & 1 deletion frontend/utils/Firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (missingFirebaseEnv.length > 0) {

// React hasn't mounted yet at this point, so we write directly to the DOM
// to avoid leaving the user with a silent blank white screen.
document.body.innerHTML = `
document.body.textContent = `
<div style="font-family: sans-serif; max-width: 480px; margin: 80px auto; padding: 24px; text-align: center; color: #333;">
<h2 style="color:#c0392b;">We're currently unavailable</h2>
<p>This application is temporarily unavailable due to a configuration issue. Please try again later or contact support.</p>
Expand Down
Loading