feat(market): add low-friction new-seller safety note

This commit is contained in:
SkateSpots 2026-10-31 10:37:23 +07:00
parent 99f04edf5d
commit 4392df3202

View file

@ -23,6 +23,7 @@ import { useMarkListingSold } from '@/hooks/useMarkListingSold';
import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useCurrentUser } from '@/hooks/useCurrentUser';
import { useAuthor } from '@/hooks/useAuthor'; import { useAuthor } from '@/hooks/useAuthor';
import { useSellerInfo } from '@/hooks/useSellerInfo'; import { useSellerInfo } from '@/hooks/useSellerInfo';
import { useTradeReputation } from '@/hooks/useTradeAttestations';
import { useToast } from '@/hooks/useToast'; import { useToast } from '@/hooks/useToast';
import { ErrorState } from '@/components/ErrorState'; import { ErrorState } from '@/components/ErrorState';
import { formatPrice, GEAR_CONDITIONS, GEAR_CATEGORIES, isValidNoffer } from '@/lib/types'; import { formatPrice, GEAR_CONDITIONS, GEAR_CATEGORIES, isValidNoffer } from '@/lib/types';
@ -40,6 +41,7 @@ import {
Tag, Tag,
Handshake, Handshake,
Share2, Share2,
ShieldAlert,
} from 'lucide-react'; } from 'lucide-react';
import { useTranslation } from '@/contexts/language'; import { useTranslation } from '@/contexts/language';
@ -61,6 +63,7 @@ export default function ListingDetailPage() {
const author = useAuthor(pubkey); const author = useAuthor(pubkey);
const metadata = author.data?.metadata; const metadata = author.data?.metadata;
const { data: sellerInfo } = useSellerInfo(pubkey); const { data: sellerInfo } = useSellerInfo(pubkey);
const { data: sellerReputation } = useTradeReputation(pubkey);
const { relist, isPending: isUpdatingStatus } = useMarkListingSold(); const { relist, isPending: isUpdatingStatus } = useMarkListingSold();
const [lightboxIndex, setLightboxIndex] = useState<number | null>(null); const [lightboxIndex, setLightboxIndex] = useState<number | null>(null);
@ -340,6 +343,17 @@ export default function ListingDetailPage() {
) : ( ) : (
<Card className="bg-black/90 border-white/10"> <Card className="bg-black/90 border-white/10">
<CardContent className="p-4"> <CardContent className="p-4">
{(sellerInfo?.accountAge !== undefined && sellerInfo.accountAge < 30) ||
(sellerReputation && sellerReputation.verifiedCounterparties === 0) ? (
<div className="mb-3 space-y-1.5 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3">
<p className="flex items-center gap-1.5 text-xs font-bold uppercase tracking-wide text-amber-300">
<ShieldAlert className="h-3.5 w-3.5" /> {t('marketUi.card.newSeller')}
</p>
<p className="text-xs leading-relaxed text-gray-400">
{t('marketTerms.safetyBody')}
</p>
</div>
) : null}
<ListingTradeActions item={item} /> <ListingTradeActions item={item} />
{isValidNoffer(sellerNoffer) && ( {isValidNoffer(sellerNoffer) && (
<ClinkPayButton <ClinkPayButton