Files
goodgo-platform/apps/web/components/chuyen-nhuong/transfer-listing-card.tsx
Ho Ngoc Hai 593d1594bd
Some checks failed
Deploy / Build API Image (push) Failing after 19s
Deploy / Build Web Image (push) Failing after 11s
Security Scanning / Trivy Filesystem Scan (push) Failing after 27s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 11s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 37s
Deploy / Build AI Services Image (push) Failing after 10s
E2E Tests / Playwright E2E (push) Failing after 10s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 3s
Security Scanning / Trivy Scan — API Image (push) Failing after 47s
Security Scanning / Trivy Scan — Web Image (push) Failing after 31s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 32s
Deploy / Smoke Test Staging (push) Has been skipped
Security Scanning / Security Gate (push) Failing after 1s
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
refactor(web): replace emoji icons with lucide-react across the app
User directive: avoid emojis for UI chrome; keep the icon language
consistent with the rest of the design system (shadcn + lucide-react).

Swaps
-----
- lib/listing-personas.ts — Persona emojis (👨‍👩‍👧🏡🚇🧑‍💻🌳📈🛡️🏥)
  → Lucide icons (Baby, Home, TrainFront, Laptop, Trees, TrendingUp,
  Shield, HeartPulse). Persona type now carries `icon: LucideIcon`.
- components/neighborhood/types.ts — POI_CATEGORY_CONFIG emojis
  (🏫🏥🚇🛒🍽️🌳) → Lucide (GraduationCap, Stethoscope, TrainFront,
  ShoppingBag, UtensilsCrossed, Trees). Config type tightened to
  `icon: LucideIcon`.
- components/neighborhood/neighborhood-poi-map.tsx — filter pills
  now render <config.icon h-3.5 w-3.5>. Map markers were text-emoji
  (el.textContent = config.icon); replaced with hard-coded inline
  SVG strings per category (POI_MARKER_SVG) since lucide-static
  isn't installed. Marker bumped 28px → 32px for larger hit target.
  Popup now shows only the property name + category label (no
  emoji prefix). closeButton: true + closeOnClick: true for
  better dismissibility.
- listing-detail-client.tsx — PersonaFitCard now renders
  <p.icon h-4 w-4 aria-hidden>.
- transfer / chuyen-nhuong files — category icons (🛋️🧊🖥️🍳🛍️🏠)
  migrated to Lucide (Sofa, Refrigerator, Monitor, ChefHat, Store,
  Home) with type `icon: LucideIcon`.
- Small replacements: inquiries page 📭 → Inbox; kyc page ✓ → Check.

POI popup click fix
-------------------
The inner SVG inside each POI marker was capturing pointer events
before Mapbox's marker-click handler saw them, so clicking a marker
did nothing. Explicit `innerSvg.style.pointerEvents = 'none'` lets
clicks reach the wrapping .poi-marker div that setPopup() is bound
to. Verified via DOM dispatch: click → popup opens with property
name + category + distance + × close.

Verification
------------
- Grep across the 4 scoped files for emoji code points → 0 hits.
- pnpm -w test: 624/624 green.
- Typecheck: no new errors in touched files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 16:01:13 +07:00

107 lines
3.8 KiB
TypeScript

'use client';
import { Eye, MapPin, Package } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
import { Card, CardContent } from '@/components/ui/card';
import { Link } from '@/i18n/navigation';
import {
type TransferListingListItem,
CATEGORY_ICONS,
CATEGORY_LABELS,
STATUS_LABELS,
} from '@/lib/chuyen-nhuong-api';
interface TransferListingCardProps {
listing: TransferListingListItem;
}
function formatVND(value: string): string {
return new Intl.NumberFormat('vi-VN').format(Number(value)) + ' \u20ab';
}
export function TransferListingCard({ listing }: TransferListingCardProps) {
const statusColor =
listing.status === 'ACTIVE' ? 'bg-green-100 text-green-800' :
listing.status === 'RESERVED' ? 'bg-amber-100 text-amber-800' :
listing.status === 'SOLD' ? 'bg-red-100 text-red-800' :
'bg-gray-100 text-gray-800';
return (
<Link href={`/chuyen-nhuong/${listing.id}`}>
<Card className="group h-full transition-shadow hover:shadow-lg">
<CardContent className="p-5">
{/* Header */}
<div className="mb-3 flex items-start justify-between gap-2">
<div className="min-w-0 flex-1">
<h3 className="line-clamp-2 font-semibold text-foreground group-hover:text-primary">
{listing.title}
</h3>
</div>
<Badge className={statusColor} variant="secondary">
{STATUS_LABELS[listing.status]}
</Badge>
</div>
{/* Category */}
<div className="mb-3">
<Badge variant="outline" className="inline-flex items-center gap-1 text-xs">
{(() => {
const Icon = CATEGORY_ICONS[listing.category];
return <Icon className="h-3.5 w-3.5" aria-hidden="true" />;
})()}
{CATEGORY_LABELS[listing.category]}
</Badge>
</div>
{/* Location */}
<div className="mb-3 flex items-center gap-1 text-sm text-muted-foreground">
<MapPin className="h-3.5 w-3.5 shrink-0" />
<span className="line-clamp-1">{listing.district}, {listing.city}</span>
</div>
{/* Price */}
<div className="mb-3">
<p className="text-lg font-bold text-primary">
{formatVND(listing.askingPriceVND)}
</p>
{listing.isNegotiable && (
<span className="text-xs text-muted-foreground">Thương lượng</span>
)}
</div>
{/* Stats grid */}
<div className="mb-3 grid grid-cols-3 gap-2">
<div className="rounded-md bg-muted p-2 text-center">
<div className="text-xs text-muted-foreground">Món</div>
<div className="flex items-center justify-center gap-1 font-semibold">
<Package className="h-3 w-3" />
{listing.itemCount}
</div>
</div>
<div className="rounded-md bg-muted p-2 text-center">
<div className="text-xs text-muted-foreground">Lượt xem</div>
<div className="flex items-center justify-center gap-1 font-semibold">
<Eye className="h-3 w-3" />
{listing.viewCount}
</div>
</div>
{listing.areaM2 && (
<div className="rounded-md bg-muted p-2 text-center">
<div className="text-xs text-muted-foreground">Diện tích</div>
<div className="font-semibold">{listing.areaM2} m&sup2;</div>
</div>
)}
</div>
{/* Footer */}
{listing.publishedAt && (
<div className="border-t pt-3 text-xs text-muted-foreground">
Đăng {new Date(listing.publishedAt).toLocaleDateString('vi-VN')}
</div>
)}
</CardContent>
</Card>
</Link>
);
}