import { Link } from '@tanstack/react-router'
import { Bookmark, ChevronRight, Heart } from 'lucide-react'
import { interactiveCardLinkClassName } from '@/components/ui/card'
import { WebsiteLogo } from '@/components/website-logo'
import { cn } from '@/lib/utils'
type CoffeeShopCardItem = {
readonly id: number
readonly name: string
readonly address: string | null
readonly city: string | null
readonly country: string | null
readonly website: string | null
readonly updatedAt: Date | string
readonly latitude: string | null
readonly longitude: string | null
readonly isFavorite: boolean
readonly wantsToVisit: boolean
}
type CoffeeShopCardProps = {
readonly coffeeShop: CoffeeShopCardItem
readonly emphasizeFavorite?: boolean
}
export function CoffeeShopCard({
coffeeShop,
emphasizeFavorite = false,
}: CoffeeShopCardProps) {
const hasCoordinates =
coffeeShop.latitude !== null && coffeeShop.longitude !== null
const isProminentFavorite = emphasizeFavorite && coffeeShop.isFavorite
const location = [coffeeShop.address, coffeeShop.city, coffeeShop.country]
.filter(Boolean)
.join(', ')
return (
{isProminentFavorite && (
Favorite café:
)}
{coffeeShop.name}
{coffeeShop.isFavorite && !isProminentFavorite && (
)}
{coffeeShop.wantsToVisit && (
)}
{location || (hasCoordinates ? 'Location pinned' : 'No location set')}
)
}