-
-
Notifications
You must be signed in to change notification settings - Fork 31
Feature/ai search recommendations Added #85
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
base: main
Are you sure you want to change the base?
Feature/ai search recommendations Added #85
Conversation
|
@amitabhanmolpain is attempting to deploy a commit to the Dhanush Nehru's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Deployment failed @amitabhanmolpain please do check |
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.
Pull Request Overview
Adds AI-powered sound recommendations with a live rotating placeholder, improves error handling, and upgrades core dependencies.
- Introduces live rotating suggestion UI in the search input with react-spring animations.
- Enhances AI recommendation parsing, error handling, and UX feedback.
- Updates Firebase config env names and initialization safeguards; adds a model-listing utility script; upgrades Next/React.
Reviewed Changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| styles/globals.css | Adds typing/blink animations and animated gradient border styles to support the new UI. |
| package.json | Upgrades Next and React versions to enable new features and compatibility. |
| list-models.js | Adds a Node script to list available Gemini models for configuration. |
| context/AuthContext.js | Adds guards for uninitialized Firebase auth to prevent runtime errors. |
| components/firebase.js | Switches to new env var names and adds initialization checks and debug logs. |
| components/AiRecommendation.js | Major UI/UX and logic updates for AI recommendations, live suggestions, error/loading states, and animations. |
| LIVE_RECOMMENDATIONS.md | Documents the live rotating suggestion feature. |
| AI_SEARCH_GUIDE.md | Documents how AI search works and suggested queries. |
| .env.example | Renames Firebase env variables and adds Gemini API key placeholder. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
components/AiRecommendation.js
Outdated
| const handleKeyPress = (e) => { | ||
| if (e.key === 'Enter') { | ||
| run(); | ||
| } | ||
| }; |
Copilot
AI
Oct 15, 2025
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.
onKeyPress is deprecated and may not fire in newer React versions; use onKeyDown (or onKeyUp) instead. Update the handler and prop to onKeyDown to ensure Enter key handling remains reliable.
components/AiRecommendation.js
Outdated
| placeholder={search ? "" : " "} | ||
| value={search} | ||
| onChange={(e) => setSearch(e.target.value)} | ||
| onKeyPress={handleKeyPress} |
Copilot
AI
Oct 15, 2025
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.
onKeyPress is deprecated and may not fire in newer React versions; use onKeyDown (or onKeyUp) instead. Update the handler and prop to onKeyDown to ensure Enter key handling remains reliable.
| onKeyPress={handleKeyPress} | |
| onKeyDown={handleKeyPress} |
components/AiRecommendation.js
Outdated
| onClick={() => { | ||
| setSearch(category); | ||
| setTimeout(() => run(), 100); | ||
| }} |
Copilot
AI
Oct 15, 2025
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.
Avoid setTimeout to wait for state; it’s brittle and can lead to race conditions. Refactor run to accept a query argument (e.g., run(category)) and use that value directly instead of relying on the async state update.
components/AiRecommendation.js
Outdated
| // Shuffle and pick 10 random sounds for live rotation | ||
| const shuffled = [...data].sort(() => Math.random() - 0.5); | ||
| const selectedSounds = shuffled.slice(0, 10); | ||
| setLiveRecommendations(selectedSounds); |
Copilot
AI
Oct 15, 2025
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.
Using sort(() => Math.random() - 0.5) produces a biased shuffle. Use a Fisher–Yates shuffle for unbiased, predictable performance.
components/firebase.js
Outdated
| // Debug: Log environment variables (remove this in production) | ||
| console.log('🔍 Checking Firebase environment variables:'); | ||
| console.log('API Key exists:', !!process.env.NEXT_PUBLIC_FIREBASE_API_KEY); | ||
| console.log('Auth Domain:', process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN); | ||
| console.log('Project ID:', process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID); |
Copilot
AI
Oct 15, 2025
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.
These logs expose environment configuration in the client console and can leak deployment details. Guard them with a development check (e.g., if (process.env.NODE_ENV !== 'production')) or remove before merging.
| // Debug: Log environment variables (remove this in production) | |
| console.log('🔍 Checking Firebase environment variables:'); | |
| console.log('API Key exists:', !!process.env.NEXT_PUBLIC_FIREBASE_API_KEY); | |
| console.log('Auth Domain:', process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN); | |
| console.log('Project ID:', process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID); | |
| // Debug: Log environment variables (only in development) | |
| if (process.env.NODE_ENV !== 'production') { | |
| console.log('🔍 Checking Firebase environment variables:'); | |
| console.log('API Key exists:', !!process.env.NEXT_PUBLIC_FIREBASE_API_KEY); | |
| console.log('Auth Domain:', process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN); | |
| console.log('Project ID:', process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID); | |
| } |
list-models.js
Outdated
| process.exit(1); | ||
| } | ||
|
|
||
| console.log("🔑 Using API Key:", apiKey.substring(0, 20) + "..."); |
Copilot
AI
Oct 15, 2025
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.
Avoid logging any portion of API keys; even partial exposure can be risky in shared logs. Remove this line or replace with a static message that does not include key material.
| console.log("🔑 Using API Key:", apiKey.substring(0, 20) + "..."); | |
| console.log("🔑 Using API Key (hidden for security)"); |
LIVE_RECOMMENDATIONS.md
Outdated
| #### Animated Icon | ||
| - Shows the sound's icon on the left side of search box | ||
| - Smoothly transitions between sounds | ||
| - Color: Blue theme (matches the design) | ||
|
|
||
| #### Dynamic Placeholder | ||
| - Changes to show current suggested sound | ||
| - Format: `Try: "Forest"...`, `Try: "Rain"...`, etc. | ||
| - Disappears when user starts typing | ||
|
|
||
| #### Progress Indicators | ||
| - Animated dots below search box | ||
| - Shows current position (e.g., 3/10) | ||
| - Active dot expands, others are small | ||
| - Smooth transitions | ||
|
|
Copilot
AI
Oct 15, 2025
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.
The doc describes animated icons and progress dots that are not present in the current AiRecommendation.js implementation. Either implement these UI elements or update the documentation to accurately reflect the shipped feature (rotating category text overlay).
| #### Animated Icon | |
| - Shows the sound's icon on the left side of search box | |
| - Smoothly transitions between sounds | |
| - Color: Blue theme (matches the design) | |
| #### Dynamic Placeholder | |
| - Changes to show current suggested sound | |
| - Format: `Try: "Forest"...`, `Try: "Rain"...`, etc. | |
| - Disappears when user starts typing | |
| #### Progress Indicators | |
| - Animated dots below search box | |
| - Shows current position (e.g., 3/10) | |
| - Active dot expands, others are small | |
| - Smooth transitions | |
| #### Dynamic Placeholder | |
| - Changes to show current suggested sound | |
| - Format: `Try: "Forest"...`, `Try: "Rain"...`, etc. | |
| - Disappears when user starts typing | |
| - Smooth fade/transition between suggestions |
components/AiRecommendation.js
Outdated
| /> | ||
|
|
||
| {/* Animated category text overlay when empty */} | ||
| {!search && ( | ||
| <div className="absolute left-4 top-1/2 transform -translate-y-1/2 pointer-events-none"> |
Copilot
AI
Oct 15, 2025
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.
The input lacks an accessible label and uses a blank placeholder with a visual overlay, which screen readers won’t announce. Add an aria-label (e.g., aria-label='Search sounds') and, if keeping the overlay, associate it via aria-describedby.
| /> | |
| {/* Animated category text overlay when empty */} | |
| {!search && ( | |
| <div className="absolute left-4 top-1/2 transform -translate-y-1/2 pointer-events-none"> | |
| aria-label="Search sounds" | |
| aria-describedby={!search ? "search-suggestion" : undefined} | |
| /> | |
| {/* Animated category text overlay when empty */} | |
| {!search && ( | |
| <div | |
| className="absolute left-4 top-1/2 transform -translate-y-1/2 pointer-events-none" | |
| id="search-suggestion" | |
| > |
components/AiRecommendation.js
Outdated
|
|
||
| const model = genAI.getGenerativeModel({ | ||
| model: "gemini-1.5-flash", | ||
| model: "gemini-2.5-pro-preview-03-25", // Gemini 2.5 Pro Preview - Most advanced |
Copilot
AI
Oct 15, 2025
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.
Hardcoding a preview model ID can lead to instability or 404s as previews change. Consider moving the model ID to configuration (env or a single constants file) and verifying availability with list-models.js so you can switch models without code changes.
| model: "gemini-2.5-pro-preview-03-25", // Gemini 2.5 Pro Preview - Most advanced | |
| model: process.env.NEXT_PUBLIC_GEMINI_MODEL_ID || "gemini-2.5-pro-preview-03-25", // Gemini 2.5 Pro Preview - Most advanced |
|
@DhanushNehru im looking through it |
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.
Pull Request Overview
Copilot reviewed 11 out of 14 changed files in this pull request and generated 8 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
styles/globals.css
Outdated
| } | ||
|
|
||
| .typing-animation { | ||
| animation: typing 2s ease-in-out; |
Copilot
AI
Oct 15, 2025
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.
The typing animation runs only once because it lacks an iteration count; the blinking cursor is infinite, but the text won't animate continuously. Add an infinite iteration to achieve the intended continuous effect: animation: typing 2s ease-in-out infinite;
| animation: typing 2s ease-in-out; | |
| animation: typing 2s ease-in-out infinite; |
| @@ -1,27 +1,43 @@ | |||
| import { initializeApp } from 'firebase/app'; | |||
| import { getAuth, GoogleAuthProvider, GithubAuthProvider, signInWithPopup } from 'firebase/auth'; | |||
Copilot
AI
Oct 15, 2025
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.
GoogleAuthProvider, GithubAuthProvider, and signInWithPopup are not used in this file. Remove unused imports to reduce bundle size and keep the module focused.
list-models.js
Outdated
| // Run this to see which models your API key has access to | ||
|
|
||
| require('dotenv').config({ path: '.env.local' }); | ||
| const { GoogleGenerativeAI } = require("@google/generative-ai"); |
Copilot
AI
Oct 15, 2025
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.
The GoogleGenerativeAI import and genAI instance are never used; the script fetches the models via HTTP directly. Remove the unused import/instance or switch to using the SDK consistently.
components/AiRecommendation.js
Outdated
| 🤖 AI Sound Recommendation | ||
| </h1> | ||
| <p className="text-center text-base text-gray-600 dark:text-gray-300 mb-8 max-w-3xl mx-auto"> | ||
| Our AI-based Sound Recommendation gives you the picks of your choices based on our available cards |
Copilot
AI
Oct 15, 2025
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.
[nitpick] Improve wording for clarity and grammar.
| Our AI-based Sound Recommendation gives you the picks of your choices based on our available cards | |
| Our AI-based Sound Recommendation suggests sounds tailored to your preferences from our available cards. |
| if (!auth) { | ||
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | ||
| alert('Authentication is not available. Please check the console for details.'); | ||
| return; | ||
| } |
Copilot
AI
Oct 15, 2025
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.
[nitpick] Using alert() can be disruptive in production. Consider replacing with a non-blocking UI notification (e.g., a toast) and keep console logging for diagnosability.
LIVE_RECOMMENDATIONS.md
Outdated
| The AI Sound Recommendation section now includes a **live rotating suggestion** feature that displays sound recommendations directly in the search box placeholder, changing every 2 seconds. | ||
|
|
||
| ## 🎯 Features | ||
|
|
||
| ### 1. Live Rotating Suggestions | ||
| - **10 random sounds** are selected on component mount | ||
| - Rotates through them **every 2 seconds** | ||
| - Displays in the search box as dynamic placeholder |
Copilot
AI
Oct 15, 2025
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.
The implementation currently rotates high-level categories in the input overlay, not actual sound recommendations. Update the doc to reflect the categories-based placeholder or implement rotation of actual sound titles (e.g., using liveRecommendations[currentLiveIndex]).
| The AI Sound Recommendation section now includes a **live rotating suggestion** feature that displays sound recommendations directly in the search box placeholder, changing every 2 seconds. | |
| ## 🎯 Features | |
| ### 1. Live Rotating Suggestions | |
| - **10 random sounds** are selected on component mount | |
| - Rotates through them **every 2 seconds** | |
| - Displays in the search box as dynamic placeholder | |
| The AI Sound Recommendation section now includes a **live rotating suggestion** feature that displays category suggestions directly in the search box placeholder, changing every 2 seconds. | |
| ## 🎯 Features | |
| ### 1. Live Rotating Suggestions | |
| - **10 random sounds** are selected on component mount | |
| - Rotates through them **every 2 seconds** | |
| - Displays rotating category suggestions in the search box as dynamic placeholder |
LIVE_RECOMMENDATIONS.md
Outdated
| ### Progress Dots | ||
| - **Active**: 24px width, blue color | ||
| - **Inactive**: 6px width, gray color | ||
| - **Spacing**: 4px gap | ||
| - **Height**: 6px | ||
| - **Transition**: 300ms all properties | ||
|
|
Copilot
AI
Oct 15, 2025
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.
Progress dots are documented but not implemented in the UI. Either add the dots component to the search box or remove this section to avoid confusion.
| ### Progress Dots | |
| - **Active**: 24px width, blue color | |
| - **Inactive**: 6px width, gray color | |
| - **Spacing**: 4px gap | |
| - **Height**: 6px | |
| - **Transition**: 300ms all properties |
LIVE_RECOMMENDATIONS.md
Outdated
| ## 📊 Performance | ||
|
|
||
| ### Optimization | ||
| - ✅ Uses React.createElement for dynamic icon rendering |
Copilot
AI
Oct 15, 2025
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.
The code does not use React.createElement for icon rendering in the input overlay; icons aren't rendered there. Please remove or adjust this bullet to match the current implementation.
| - ✅ Uses React.createElement for dynamic icon rendering |
|
@DhanushNehru i have fixed all the major issues related to the deployment |
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.
Pull Request Overview
Copilot reviewed 12 out of 15 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| try { | ||
| const genAI = new GoogleGenerativeAI(apiKey); | ||
|
|
||
| // Try to list models using the API | ||
| const response = await fetch( | ||
| `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}` |
Copilot
AI
Oct 15, 2025
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.
GoogleGenerativeAI is used but never imported, which will cause a ReferenceError at runtime. Either import it or remove the unused instantiation. To import with CommonJS: const { GoogleGenerativeAI } = require('@google/generative-ai');
components/AiRecommendation.js
Outdated
| // Rotate through live recommendations every 2 seconds | ||
| useEffect(() => { | ||
| if (liveRecommendations.length === 0) return; | ||
|
|
||
| const interval = setInterval(() => { | ||
| setCurrentLiveIndex((prevIndex) => (prevIndex + 1) % liveRecommendations.length); | ||
| }, 2000); // Change every 2 seconds | ||
|
|
||
| return () => clearInterval(interval); | ||
| }, [liveRecommendations]); | ||
|
|
Copilot
AI
Oct 15, 2025
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.
This interval updates state every 2 seconds but its values are never used in the UI, causing periodic re-renders. Remove this effect or wire its state to visible UI; otherwise it’s doing work with no user-facing benefit.
| // Rotate through live recommendations every 2 seconds | |
| useEffect(() => { | |
| if (liveRecommendations.length === 0) return; | |
| const interval = setInterval(() => { | |
| setCurrentLiveIndex((prevIndex) => (prevIndex + 1) % liveRecommendations.length); | |
| }, 2000); // Change every 2 seconds | |
| return () => clearInterval(interval); | |
| }, [liveRecommendations]); | |
| // Removed unused interval for rotating live recommendations |
.env.example
Outdated
| NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID= | ||
|
|
||
| # Google Gemini API Key | ||
| NEXT_PUBLIC_GEMINI_API_KEY= |
Copilot
AI
Oct 15, 2025
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.
constants/gemini.js supports overriding the model via NEXT_PUBLIC_GEMINI_MODEL_ID, but this variable isn't documented here. Add NEXT_PUBLIC_GEMINI_MODEL_ID= to this file (with a comment) so users know they can override the default model.
| NEXT_PUBLIC_GEMINI_API_KEY= | |
| NEXT_PUBLIC_GEMINI_API_KEY= | |
| # (Optional) Override the default Gemini model used by the app | |
| NEXT_PUBLIC_GEMINI_MODEL_ID= |
components/AiRecommendation.js
Outdated
| console.log('✅ AI Response:', response); | ||
| console.log('🔍 User Search Query:', queryToUse); | ||
|
|
Copilot
AI
Oct 15, 2025
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.
Debug logging is left in the UI path; consider removing or guarding with if (process.env.NODE_ENV !== 'production') to avoid noisy console output in production.
LIVE_RECOMMENDATIONS.md
Outdated
| ### Progress Dots | ||
| - **Active**: 24px width, blue color | ||
| - **Inactive**: 6px width, gray color | ||
| - **Spacing**: 4px gap | ||
| - **Height**: 6px | ||
| - **Transition**: 300ms all properties | ||
|
|
Copilot
AI
Oct 15, 2025
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.
The document describes 'Progress Dots' but the current UI doesn't implement them. Either implement the dots in the UI or remove this section to keep documentation aligned with the code.
| ### Progress Dots | |
| - **Active**: 24px width, blue color | |
| - **Inactive**: 6px width, gray color | |
| - **Spacing**: 4px gap | |
| - **Height**: 6px | |
| - **Transition**: 300ms all properties |
|
Deployment failed @amitabhanmolpain |
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.
Pull Request Overview
Copilot reviewed 12 out of 19 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
components/AiRecommendation.js
Outdated
| { | ||
| text: `You are a sound recommendation expert. I have a list of available sounds with their titles. | ||
| Available sounds data: ${JSON.stringify(data)} |
Copilot
AI
Oct 19, 2025
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.
Passing the entire data object to the model increases token usage and latency. Send only the minimal fields required (e.g., titles) to reduce cost and improve response time. For example, build a titles array with data.map(d => d.title) and interpolate that instead of the full JSON.
| Available sounds data: ${JSON.stringify(data)} | |
| Available sounds titles: ${JSON.stringify(data.map(d => d.title))} |
components/AiRecommendation.js
Outdated
| import { useTransition, animated } from "@react-spring/web"; | ||
| import Card from "./Card"; | ||
| import { GEMINI_CONFIG, getGeminiModelId } from "../constants/gemini"; | ||
| import { getRandomSelection } from "../utils/shuffle"; |
Copilot
AI
Oct 19, 2025
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.
getRandomSelection is imported but not used in this file. Remove the unused import to keep the bundle lean and avoid linter warnings.
| import { getRandomSelection } from "../utils/shuffle"; |
| toast.className = `fixed top-4 right-4 z-50 p-4 rounded-lg shadow-lg text-white max-w-sm ${ | ||
| type === 'error' ? 'bg-red-500' : type === 'success' ? 'bg-green-500' : 'bg-blue-500' | ||
| }`; | ||
| toast.textContent = message; |
Copilot
AI
Oct 19, 2025
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.
Add ARIA semantics so screen readers announce the toast. Set role='status' and aria-live='polite' on the toast element after creation.
| toast.textContent = message; | |
| toast.textContent = message; | |
| toast.setAttribute('role', 'status'); | |
| toast.setAttribute('aria-live', 'polite'); |
| // Simple toast notification utility | ||
| // This creates a non-blocking notification instead of using alert() | ||
|
|
||
| export const showNotification = (message, type = 'error') => { |
Copilot
AI
Oct 19, 2025
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.
Guard against SSR by exiting early when document is undefined to avoid runtime errors if this utility is ever called outside the browser. For example: if (typeof document === 'undefined') return; at the top of the function.
| export const showNotification = (message, type = 'error') => { | |
| export const showNotification = (message, type = 'error') => { | |
| if (typeof document === 'undefined') return; |
| auth = getAuth(app); | ||
| db = getFirestore(app); | ||
|
|
||
| console.log('✅ Firebase initialized successfully'); |
Copilot
AI
Oct 19, 2025
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.
This success log will run in production as well and can add noise. Wrap it with a NODE_ENV check (or remove) so it only logs in development.
| console.log('✅ Firebase initialized successfully'); | |
| if (process.env.NODE_ENV !== 'production') { | |
| console.log('✅ Firebase initialized successfully'); | |
| } |
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.
Pull Request Overview
Copilot reviewed 12 out of 19 changed files in this pull request and generated 7 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| "next": "^15.5.5", | ||
| "next-share": "^0.27.0", | ||
| "next-themes": "^0.2.0", | ||
| "react": "18.2.0", | ||
| "react-dom": "18.2.0", | ||
| "react": "^19.2.0", | ||
| "react-dom": "^19.2.0", |
Copilot
AI
Oct 19, 2025
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.
This PR upgrades Next.js from 12.x to 15.x and React from 18.x to 19.x, which are breaking changes and can impact routing, build config, and peer dependencies. Please either split this into a dedicated migration PR (with CI/build verification and release notes), or include the necessary migration steps (codemods, updated Next config, peer dependency bumps for packages like @react-spring/web, lucide-react, next-* libs) and add an engines.node constraint (Node 18+) to avoid runtime mismatches.
| FALLBACK_MODELS: [ | ||
| "gemini-2.5-pro-preview-03-25", | ||
| "gemini-1.5-pro-latest", | ||
| "gemini-1.5-pro", | ||
| "gemini-pro", | ||
| ], |
Copilot
AI
Oct 19, 2025
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.
The FALLBACK_MODELS list is defined but not used. Consider implementing a fallback mechanism in AiRecommendation to retry with the next available model when the primary model fails (e.g., 404/not found), so users don’t hit a hard error if the configured model is unavailable.
| const model = genAI.getGenerativeModel({ | ||
| model: "gemini-1.5-flash", | ||
| model: getGeminiModelId(), | ||
| }); |
Copilot
AI
Oct 19, 2025
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.
Hook up the defined FALLBACK_MODELS by attempting model initialization and/or request using the next model when the primary one errors (e.g., 404/not found). This will make the feature resilient to model deprecations or regional availability issues.
| const googleSignIn = ()=>{ | ||
| if (!auth) { | ||
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | ||
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | ||
| return; | ||
| } | ||
| const provider = new GoogleAuthProvider(); | ||
| signInWithPopup(auth, provider); | ||
| } | ||
|
|
||
| const githubSignIn = ()=>{ | ||
| if (!auth) { | ||
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | ||
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | ||
| return; | ||
| } | ||
| const provider = new GithubAuthProvider(); | ||
| signInWithPopup(auth, provider); |
Copilot
AI
Oct 19, 2025
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.
The sign-in calls are not awaited and errors are not handled, which can result in unhandled promise rejections and no user feedback. Wrap these in try/catch (or use .catch) and surface failures with showNotification so users get actionable error messages.
| const googleSignIn = ()=>{ | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GoogleAuthProvider(); | |
| signInWithPopup(auth, provider); | |
| } | |
| const githubSignIn = ()=>{ | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GithubAuthProvider(); | |
| signInWithPopup(auth, provider); | |
| const googleSignIn = async () => { | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GoogleAuthProvider(); | |
| try { | |
| await signInWithPopup(auth, provider); | |
| } catch (error) { | |
| console.error('Google sign-in failed:', error); | |
| showNotification( | |
| error && error.message | |
| ? `Google sign-in failed: ${error.message}` | |
| : 'Google sign-in failed. Please try again.', | |
| 'error' | |
| ); | |
| } | |
| } | |
| const githubSignIn = async () => { | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GithubAuthProvider(); | |
| try { | |
| await signInWithPopup(auth, provider); | |
| } catch (error) { | |
| console.error('GitHub sign-in failed:', error); | |
| showNotification( | |
| error && error.message | |
| ? `GitHub sign-in failed: ${error.message}` | |
| : 'GitHub sign-in failed. Please try again.', | |
| 'error' | |
| ); | |
| } |
| const googleSignIn = ()=>{ | ||
| if (!auth) { | ||
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | ||
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | ||
| return; | ||
| } | ||
| const provider = new GoogleAuthProvider(); | ||
| signInWithPopup(auth, provider); | ||
| } | ||
|
|
||
| const githubSignIn = ()=>{ | ||
| if (!auth) { | ||
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | ||
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | ||
| return; | ||
| } | ||
| const provider = new GithubAuthProvider(); | ||
| signInWithPopup(auth, provider); |
Copilot
AI
Oct 19, 2025
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.
The sign-in calls are not awaited and errors are not handled, which can result in unhandled promise rejections and no user feedback. Wrap these in try/catch (or use .catch) and surface failures with showNotification so users get actionable error messages.
| const googleSignIn = ()=>{ | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GoogleAuthProvider(); | |
| signInWithPopup(auth, provider); | |
| } | |
| const githubSignIn = ()=>{ | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GithubAuthProvider(); | |
| signInWithPopup(auth, provider); | |
| const googleSignIn = async () => { | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GoogleAuthProvider(); | |
| try { | |
| await signInWithPopup(auth, provider); | |
| } catch (error) { | |
| console.error('Google sign-in failed:', error); | |
| showNotification('Google sign-in failed: ' + (error?.message || error), 'error'); | |
| } | |
| } | |
| const githubSignIn = async () => { | |
| if (!auth) { | |
| console.error('Firebase auth is not initialized. Please check your Firebase configuration.'); | |
| showNotification('Authentication is not available. Please check your configuration.', 'error'); | |
| return; | |
| } | |
| const provider = new GithubAuthProvider(); | |
| try { | |
| await signInWithPopup(auth, provider); | |
| } catch (error) { | |
| console.error('GitHub sign-in failed:', error); | |
| showNotification('GitHub sign-in failed: ' + (error?.message || error), 'error'); | |
| } |
| toast.setAttribute('role', 'status'); | ||
| toast.setAttribute('aria-live', 'polite'); |
Copilot
AI
Oct 19, 2025
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.
For error toasts, aria-live='polite' may delay or suppress announcement in some AT contexts. Consider using role='alert' with aria-live='assertive' for error/success messages that require immediate attention, or set aria-live based on the type parameter.
| toast.setAttribute('role', 'status'); | |
| toast.setAttribute('aria-live', 'polite'); | |
| if (type === 'error' || type === 'success') { | |
| toast.setAttribute('role', 'alert'); | |
| toast.setAttribute('aria-live', 'assertive'); | |
| } else { | |
| toast.setAttribute('role', 'status'); | |
| toast.setAttribute('aria-live', 'polite'); | |
| } |
| NEXT_PUBLIC_FIREBASE_API_KEY= | ||
| NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN= | ||
| NEXT_PUBLIC_FIREBASE_PROJECT_ID= | ||
| NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET= | ||
| NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID= | ||
| NEXT_PUBLIC_FIREBASE_APP_ID= | ||
| NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID= |
Copilot
AI
Oct 19, 2025
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.
Firebase env variable names were changed (NEXT_PUBLIC_* to NEXT_PUBLIC_FIREBASE_*). Please add a migration note in the project README or deployment docs so existing environments can update their configuration without breaking auth/database initialization.
|
Please resolve merge conflicts @amitabhanmolpain |
@DhanushNehru
i have added the live placeholder for the Ai sound recommendations #84
Opensource3proj.mp4