Skip to content

feat: added web scrapping and improved ui, part-I#4

Open
Sky-walkerX wants to merge 1 commit intomainfrom
dev
Open

feat: added web scrapping and improved ui, part-I#4
Sky-walkerX wants to merge 1 commit intomainfrom
dev

Conversation

@Sky-walkerX
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings August 4, 2025 15:33
@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
trequila-redev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 4, 2025 3:35pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds web scraping functionality and improves the UI as part of the first phase of enhancements. It introduces destination data fetching from external APIs, enhances the trip planning interface with currency support, and adds AI chat functionality for trip assistance.

Key changes include:

  • Added currency field to trip schema with USD as default
  • Integrated web scraping packages (axios, crawl4ai, ioredis) and UI components
  • Enhanced trip planning page with destination insights and AI chat
  • Improved create trip form with currency selection and custom interests

Reviewed Changes

Copilot reviewed 10 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
prisma/schema.prisma Added currency field to Trip model with USD default
package.json Added web scraping, Redis, and UI component dependencies
app/trips/[tripId]/plan/page.tsx New page displaying destination attractions and AI chat interface
app/trips/[tripId]/page.tsx Enhanced trip display with currency formatting and improved activity UI
app/create-trip/page.tsx Added currency selection and custom interests functionality
app/components/ui/select.tsx New select component for dropdowns
app/components/ui/scroll-area.tsx New scroll area component for better UX
app/api/trips/create/route.ts Added currency field support in trip creation
app/api/trips/[tripId]/generate-itinerary/route.ts Enhanced with currency-aware budget generation
app/api/chat/route.ts New AI chat endpoint for destination queries
Comments suppressed due to low confidence (1)

package.json:25

  • The package 'crawl4ai' version '^1.0.1' may not exist. This appears to be a specialized web scraping library that should be verified for availability.
    "crawl4ai": "^1.0.1",

Comment on lines +149 to +150
const response = await fetch(
`http://127.0.0.1:8000/tripadvisor/things-to-do?city=${encodeURIComponent(destination)}`,
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Hard-coded localhost URL creates a security risk and will fail in production. Use environment variables or relative URLs for API endpoints.

Suggested change
const response = await fetch(
`http://127.0.0.1:8000/tripadvisor/things-to-do?city=${encodeURIComponent(destination)}`,
const apiBaseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || "";
const response = await fetch(
`${apiBaseUrl}/tripadvisor/things-to-do?city=${encodeURIComponent(destination)}`,

Copilot uses AI. Check for mistakes.
Comment on lines +482 to +489
src={attraction.imageLink || "/placeholder.svg"}
alt={attraction.title}
fill
className="object-cover group-hover:scale-105 transition-transform duration-300"
onError={(e) => {
const target = e.target as HTMLImageElement
target.srcset = `/placeholder.svg?height=128&width=300&text=No+Image+Available`
target.src = `/placeholder.svg?height=128&width=300&text=No+Image+Available`
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Setting srcset property directly may not work as expected. Consider using src property only or implementing proper responsive image handling.

Suggested change
src={attraction.imageLink || "/placeholder.svg"}
alt={attraction.title}
fill
className="object-cover group-hover:scale-105 transition-transform duration-300"
onError={(e) => {
const target = e.target as HTMLImageElement
target.srcset = `/placeholder.svg?height=128&width=300&text=No+Image+Available`
target.src = `/placeholder.svg?height=128&width=300&text=No+Image+Available`
src={imgSrc}
alt={attraction.title}
fill
className="object-cover group-hover:scale-105 transition-transform duration-300"
onError={() => {
setImgSrc("/placeholder.svg?height=128&width=300&text=No+Image+Available")

Copilot uses AI. Check for mistakes.
const model = genAI.getGenerativeModel({ model: "gemini-2.0-flash" })

// Currency data for proper formatting and conversion context
const currencies = {
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Large currency mapping object should be extracted to a separate constants file to improve maintainability and enable reuse across components.

Copilot uses AI. Check for mistakes.
Comment thread app/create-trip/page.tsx
Comment on lines +41 to 67
const currencies = [
{ code: "USD", symbol: "$", name: "US Dollar" },
{ code: "EUR", symbol: "€", name: "Euro" },
{ code: "GBP", symbol: "£", name: "British Pound" },
{ code: "JPY", symbol: "¥", name: "Japanese Yen" },
{ code: "CAD", symbol: "C$", name: "Canadian Dollar" },
{ code: "AUD", symbol: "A$", name: "Australian Dollar" },
{ code: "CHF", symbol: "CHF", name: "Swiss Franc" },
{ code: "CNY", symbol: "¥", name: "Chinese Yuan" },
{ code: "INR", symbol: "₹", name: "Indian Rupee" },
{ code: "KRW", symbol: "₩", name: "South Korean Won" },
{ code: "SGD", symbol: "S$", name: "Singapore Dollar" },
{ code: "HKD", symbol: "HK$", name: "Hong Kong Dollar" },
{ code: "NOK", symbol: "kr", name: "Norwegian Krone" },
{ code: "SEK", symbol: "kr", name: "Swedish Krona" },
{ code: "DKK", symbol: "kr", name: "Danish Krone" },
{ code: "PLN", symbol: "zł", name: "Polish Zloty" },
{ code: "CZK", symbol: "Kč", name: "Czech Koruna" },
{ code: "HUF", symbol: "Ft", name: "Hungarian Forint" },
{ code: "RUB", symbol: "₽", name: "Russian Ruble" },
{ code: "BRL", symbol: "R$", name: "Brazilian Real" },
{ code: "MXN", symbol: "$", name: "Mexican Peso" },
{ code: "ZAR", symbol: "R", name: "South African Rand" },
{ code: "TRY", symbol: "₺", name: "Turkish Lira" },
{ code: "AED", symbol: "د.إ", name: "UAE Dirham" },
{ code: "SAR", symbol: "﷼", name: "Saudi Riyal" },
]
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Currency definitions are duplicated between this file and the API route. Extract to a shared constants file to maintain DRY principle.

Suggested change
const currencies = [
{ code: "USD", symbol: "$", name: "US Dollar" },
{ code: "EUR", symbol: "€", name: "Euro" },
{ code: "GBP", symbol: "£", name: "British Pound" },
{ code: "JPY", symbol: "¥", name: "Japanese Yen" },
{ code: "CAD", symbol: "C$", name: "Canadian Dollar" },
{ code: "AUD", symbol: "A$", name: "Australian Dollar" },
{ code: "CHF", symbol: "CHF", name: "Swiss Franc" },
{ code: "CNY", symbol: "¥", name: "Chinese Yuan" },
{ code: "INR", symbol: "₹", name: "Indian Rupee" },
{ code: "KRW", symbol: "₩", name: "South Korean Won" },
{ code: "SGD", symbol: "S$", name: "Singapore Dollar" },
{ code: "HKD", symbol: "HK$", name: "Hong Kong Dollar" },
{ code: "NOK", symbol: "kr", name: "Norwegian Krone" },
{ code: "SEK", symbol: "kr", name: "Swedish Krona" },
{ code: "DKK", symbol: "kr", name: "Danish Krone" },
{ code: "PLN", symbol: "zł", name: "Polish Zloty" },
{ code: "CZK", symbol: "Kč", name: "Czech Koruna" },
{ code: "HUF", symbol: "Ft", name: "Hungarian Forint" },
{ code: "RUB", symbol: "₽", name: "Russian Ruble" },
{ code: "BRL", symbol: "R$", name: "Brazilian Real" },
{ code: "MXN", symbol: "$", name: "Mexican Peso" },
{ code: "ZAR", symbol: "R", name: "South African Rand" },
{ code: "TRY", symbol: "₺", name: "Turkish Lira" },
{ code: "AED", symbol: "د.إ", name: "UAE Dirham" },
{ code: "SAR", symbol: "﷼", name: "Saudi Riyal" },
]
import { currencies } from "@/constants/currencies"

Copilot uses AI. Check for mistakes.
import { ScrollArea } from "@/app/components/ui/scroll-area"

// Currency symbols mapping
// const currencySymbols: Record<string, string> = {
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Large block of commented code should be removed to improve code cleanliness. If currency functionality is needed, implement it properly or remove entirely.

Copilot uses AI. Check for mistakes.
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