Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/llms-txt-hub / apps/web/components/ui/favorites-link.tsx |
| Date | Not specified in source |
| Repository | Janady13/llms-txt-hub |
| Revision | e0f4bf978d4df168369c7601d9c5f5ea89e84377 |
| Branch | main |
| Path or archive member | apps/web/components/ui/favorites-link.tsx |
| Original SHA-256 | 7bed423b0c2eb3cd8a23287f14e107e1bb5775aba93da08509f09593631ed73c |
| Git blob SHA | 60cdae0327bb3372fbab5c8ee6d3bea86bdefa53 |
| Reading-copy SHA-256 | 7bed423b0c2eb3cd8a23287f14e107e1bb5775aba93da08509f09593631ed73c |
Recovered source transcript
Download complete source text ↓46 lines · 1.3 KB
'use client'
import { cn } from '@thedaviddias/design-system/lib/utils'
import { Heart } from 'lucide-react'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import { useFavorites } from '@/contexts/favorites-context'
import { getRoute } from '@/lib/routes'
interface FavoritesLinkProps {
className?: string
isMobile?: boolean
}
/**
* Renders a link to the favorites page with a count badge
*/
export function FavoritesLink({ className, isMobile = false }: FavoritesLinkProps) {
const { favorites } = useFavorites()
const pathname = usePathname()
const isFavoritesPage = pathname === '/favorites'
const baseClasses = cn(
'flex items-center justify-between gap-2 text-sm rounded-md transition-colors',
{
'px-2 py-1': !isMobile,
'px-2 py-1.5': isMobile,
'text-foreground font-medium bg-accent': isFavoritesPage,
'text-muted-foreground hover:text-foreground hover:bg-muted/50': !isFavoritesPage
},
className
)
return (
<Link href={getRoute('favorites')} className={baseClasses}>
<div className="flex items-center gap-2">
<Heart className="h-4 w-4" />
<span>Favorites</span>
</div>
{favorites.length > 0 && (
<span className="text-xs bg-muted px-1.5 py-0.5 rounded-full">{favorites.length}</span>
)}
</Link>
)
}