feat: Marketplace navigation + SEO fix + tab-based listings
MARKETPLACE INTEGRATION: - Added 'Marketplace' (/buy) to public Header navigation - Renamed 'For Sale' to 'Marketplace' in Command Center Sidebar LISTINGS PAGE REDESIGN: - Added tab-based layout: 'Browse Marketplace' / 'My Listings' - Browse tab: Search + grid view of all public listings - My Listings tab: Full management with stats - Unified experience to view marketplace and manage own listings SEO JUICE DETECTOR FIX: - Fixed 500 error when database table doesn't exist - Added fallback: _format_dict_response for when DB is unavailable - Service now gracefully handles missing tables - Returns estimated data even on cache failures
This commit is contained in:
@ -81,22 +81,37 @@ class SEOAnalyzerService:
|
||||
"""
|
||||
domain = domain.lower().strip()
|
||||
|
||||
# Check cache first
|
||||
if not force_refresh:
|
||||
cached = await self._get_cached(domain, db)
|
||||
if cached and not cached.is_expired:
|
||||
try:
|
||||
# Check cache first
|
||||
if not force_refresh:
|
||||
try:
|
||||
cached = await self._get_cached(domain, db)
|
||||
if cached and not cached.is_expired:
|
||||
return self._format_response(cached)
|
||||
except Exception as e:
|
||||
# Table might not exist yet
|
||||
logger.warning(f"Cache check failed (table may not exist): {e}")
|
||||
|
||||
# Fetch fresh data
|
||||
if self.has_moz:
|
||||
seo_data = await self._fetch_moz_data(domain)
|
||||
else:
|
||||
seo_data = await self._estimate_seo_data(domain)
|
||||
|
||||
# Try to save to cache (may fail if table doesn't exist)
|
||||
try:
|
||||
cached = await self._save_to_cache(domain, seo_data, db)
|
||||
return self._format_response(cached)
|
||||
|
||||
# Fetch fresh data
|
||||
if self.has_moz:
|
||||
seo_data = await self._fetch_moz_data(domain)
|
||||
else:
|
||||
except Exception as e:
|
||||
logger.warning(f"Cache save failed (table may not exist): {e}")
|
||||
# Return data directly without caching
|
||||
return self._format_dict_response(domain, seo_data)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"SEO analysis failed for {domain}: {e}")
|
||||
# Return estimated data on any error
|
||||
seo_data = await self._estimate_seo_data(domain)
|
||||
|
||||
# Save to cache
|
||||
cached = await self._save_to_cache(domain, seo_data, db)
|
||||
|
||||
return self._format_response(cached)
|
||||
return self._format_dict_response(domain, seo_data)
|
||||
|
||||
async def _get_cached(self, domain: str, db: AsyncSession) -> Optional[DomainSEOData]:
|
||||
"""Get cached SEO data for a domain."""
|
||||
@ -374,6 +389,56 @@ class SEOAnalyzerService:
|
||||
'last_updated': data.last_updated.isoformat() if data.last_updated else None,
|
||||
'is_estimated': data.data_source == 'estimated',
|
||||
}
|
||||
|
||||
def _format_dict_response(self, domain: str, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""Format SEO data from dict (when DB is not available)."""
|
||||
da = data.get('domain_authority', 0) or 0
|
||||
|
||||
# Calculate SEO score
|
||||
seo_score = da
|
||||
if data.get('has_wikipedia_link'):
|
||||
seo_score = min(100, seo_score + 10)
|
||||
if data.get('has_gov_link'):
|
||||
seo_score = min(100, seo_score + 5)
|
||||
if data.get('has_edu_link'):
|
||||
seo_score = min(100, seo_score + 5)
|
||||
if data.get('has_news_link'):
|
||||
seo_score = min(100, seo_score + 3)
|
||||
|
||||
# Determine value category
|
||||
if seo_score >= 60:
|
||||
value_category = "High Value"
|
||||
elif seo_score >= 40:
|
||||
value_category = "Medium Value"
|
||||
elif seo_score >= 20:
|
||||
value_category = "Low Value"
|
||||
else:
|
||||
value_category = "Minimal"
|
||||
|
||||
return {
|
||||
'domain': domain,
|
||||
'seo_score': seo_score,
|
||||
'value_category': value_category,
|
||||
'metrics': {
|
||||
'domain_authority': data.get('domain_authority'),
|
||||
'page_authority': data.get('page_authority'),
|
||||
'spam_score': data.get('spam_score'),
|
||||
'total_backlinks': data.get('total_backlinks'),
|
||||
'referring_domains': data.get('referring_domains'),
|
||||
},
|
||||
'notable_links': {
|
||||
'has_wikipedia': data.get('has_wikipedia_link', False),
|
||||
'has_gov': data.get('has_gov_link', False),
|
||||
'has_edu': data.get('has_edu_link', False),
|
||||
'has_news': data.get('has_news_link', False),
|
||||
'notable_domains': data.get('notable_backlinks', '').split(',') if data.get('notable_backlinks') else [],
|
||||
},
|
||||
'top_backlinks': data.get('top_backlinks', []),
|
||||
'estimated_value': data.get('seo_value_estimate'),
|
||||
'data_source': data.get('data_source', 'estimated'),
|
||||
'last_updated': datetime.utcnow().isoformat(),
|
||||
'is_estimated': data.get('data_source') == 'estimated',
|
||||
}
|
||||
|
||||
|
||||
# Singleton instance
|
||||
|
||||
@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'
|
||||
import { useStore } from '@/lib/store'
|
||||
import { api } from '@/lib/api'
|
||||
import { CommandCenterLayout } from '@/components/CommandCenterLayout'
|
||||
import { PageContainer, StatCard, PremiumTable, Badge } from '@/components/PremiumTable'
|
||||
import { PageContainer, StatCard, Badge } from '@/components/PremiumTable'
|
||||
import {
|
||||
Plus,
|
||||
Shield,
|
||||
@ -13,9 +13,7 @@ import {
|
||||
ExternalLink,
|
||||
Loader2,
|
||||
Trash2,
|
||||
Edit2,
|
||||
CheckCircle,
|
||||
Clock,
|
||||
AlertCircle,
|
||||
Copy,
|
||||
RefreshCw,
|
||||
@ -23,6 +21,10 @@ import {
|
||||
Globe,
|
||||
X,
|
||||
Sparkles,
|
||||
Store,
|
||||
List,
|
||||
Search,
|
||||
Tag,
|
||||
} from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import clsx from 'clsx'
|
||||
@ -51,6 +53,22 @@ interface Listing {
|
||||
published_at: string | null
|
||||
}
|
||||
|
||||
interface PublicListing {
|
||||
domain: string
|
||||
slug: string
|
||||
title: string | null
|
||||
description: string | null
|
||||
asking_price: number | null
|
||||
currency: string
|
||||
price_type: string
|
||||
pounce_score: number | null
|
||||
estimated_value: number | null
|
||||
is_verified: boolean
|
||||
allow_offers: boolean
|
||||
public_url: string
|
||||
seller_verified: boolean
|
||||
}
|
||||
|
||||
interface VerificationInfo {
|
||||
verification_code: string
|
||||
dns_record_type: string
|
||||
@ -60,11 +78,24 @@ interface VerificationInfo {
|
||||
status: string
|
||||
}
|
||||
|
||||
type TabType = 'browse' | 'my-listings'
|
||||
|
||||
export default function ListingsPage() {
|
||||
const { subscription } = useStore()
|
||||
|
||||
const [listings, setListings] = useState<Listing[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
// Tab state
|
||||
const [activeTab, setActiveTab] = useState<TabType>('browse')
|
||||
|
||||
// My Listings state
|
||||
const [myListings, setMyListings] = useState<Listing[]>([])
|
||||
const [loadingMy, setLoadingMy] = useState(true)
|
||||
|
||||
// Browse state
|
||||
const [publicListings, setPublicListings] = useState<PublicListing[]>([])
|
||||
const [loadingPublic, setLoadingPublic] = useState(true)
|
||||
const [searchQuery, setSearchQuery] = useState('')
|
||||
|
||||
// Modals
|
||||
const [showCreateModal, setShowCreateModal] = useState(false)
|
||||
const [showVerifyModal, setShowVerifyModal] = useState(false)
|
||||
const [selectedListing, setSelectedListing] = useState<Listing | null>(null)
|
||||
@ -85,18 +116,31 @@ export default function ListingsPage() {
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
loadListings()
|
||||
loadMyListings()
|
||||
loadPublicListings()
|
||||
}, [])
|
||||
|
||||
const loadListings = async () => {
|
||||
setLoading(true)
|
||||
const loadMyListings = async () => {
|
||||
setLoadingMy(true)
|
||||
try {
|
||||
const data = await api.request<Listing[]>('/listings/my')
|
||||
setListings(data)
|
||||
setMyListings(data)
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
console.error('Failed to load my listings:', err)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setLoadingMy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const loadPublicListings = async () => {
|
||||
setLoadingPublic(true)
|
||||
try {
|
||||
const data = await api.request<PublicListing[]>('/listings?limit=50')
|
||||
setPublicListings(data)
|
||||
} catch (err: any) {
|
||||
console.error('Failed to load public listings:', err)
|
||||
} finally {
|
||||
setLoadingPublic(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +164,8 @@ export default function ListingsPage() {
|
||||
setSuccess('Listing created! Now verify ownership to publish.')
|
||||
setShowCreateModal(false)
|
||||
setNewListing({ domain: '', title: '', description: '', asking_price: '', price_type: 'negotiable', allow_offers: true })
|
||||
loadListings()
|
||||
loadMyListings()
|
||||
setActiveTab('my-listings')
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@ -157,7 +202,7 @@ export default function ListingsPage() {
|
||||
if (result.verified) {
|
||||
setSuccess('Domain verified! You can now publish your listing.')
|
||||
setShowVerifyModal(false)
|
||||
loadListings()
|
||||
loadMyListings()
|
||||
} else {
|
||||
setError(result.message)
|
||||
}
|
||||
@ -175,7 +220,8 @@ export default function ListingsPage() {
|
||||
body: JSON.stringify({ status: 'active' }),
|
||||
})
|
||||
setSuccess('Listing published!')
|
||||
loadListings()
|
||||
loadMyListings()
|
||||
loadPublicListings()
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
}
|
||||
@ -187,7 +233,7 @@ export default function ListingsPage() {
|
||||
try {
|
||||
await api.request(`/listings/${listing.id}`, { method: 'DELETE' })
|
||||
setSuccess('Listing deleted')
|
||||
loadListings()
|
||||
loadMyListings()
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
}
|
||||
@ -215,23 +261,33 @@ export default function ListingsPage() {
|
||||
return <Badge>{status}</Badge>
|
||||
}
|
||||
|
||||
const filteredPublicListings = publicListings.filter(listing => {
|
||||
if (!searchQuery) return true
|
||||
return listing.domain.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
})
|
||||
|
||||
const tier = subscription?.tier || 'scout'
|
||||
const limits = { scout: 2, trader: 10, tycoon: 50 }
|
||||
const maxListings = limits[tier as keyof typeof limits] || 2
|
||||
|
||||
const tabs = [
|
||||
{ id: 'browse' as TabType, label: 'Browse Marketplace', icon: Store, count: publicListings.length },
|
||||
{ id: 'my-listings' as TabType, label: 'My Listings', icon: List, count: myListings.length },
|
||||
]
|
||||
|
||||
return (
|
||||
<CommandCenterLayout
|
||||
title="My Listings"
|
||||
subtitle={`Manage your domain marketplace listings (${listings.length}/${maxListings})`}
|
||||
title="Marketplace"
|
||||
subtitle="Buy and sell premium domains"
|
||||
actions={
|
||||
<button
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
disabled={listings.length >= maxListings}
|
||||
disabled={myListings.length >= maxListings}
|
||||
className="flex items-center gap-2 px-4 py-2 bg-accent text-background text-sm font-medium rounded-lg
|
||||
hover:bg-accent-hover transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
New Listing
|
||||
List Domain
|
||||
</button>
|
||||
}
|
||||
>
|
||||
@ -253,135 +309,252 @@ export default function ListingsPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Stats */}
|
||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<StatCard title="Total Listings" value={listings.length} icon={Globe} />
|
||||
<StatCard
|
||||
title="Published"
|
||||
value={listings.filter(l => l.status === 'active').length}
|
||||
icon={CheckCircle}
|
||||
accent
|
||||
/>
|
||||
<StatCard
|
||||
title="Total Views"
|
||||
value={listings.reduce((sum, l) => sum + l.view_count, 0)}
|
||||
icon={Eye}
|
||||
/>
|
||||
<StatCard
|
||||
title="Inquiries"
|
||||
value={listings.reduce((sum, l) => sum + l.inquiry_count, 0)}
|
||||
icon={MessageSquare}
|
||||
/>
|
||||
{/* Tabs */}
|
||||
<div className="flex gap-2 p-1 bg-background-secondary/50 rounded-xl border border-border">
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={clsx(
|
||||
"flex-1 flex items-center justify-center gap-2 px-4 py-3 rounded-lg font-medium transition-all",
|
||||
activeTab === tab.id
|
||||
? "bg-foreground text-background"
|
||||
: "text-foreground-muted hover:text-foreground hover:bg-foreground/5"
|
||||
)}
|
||||
>
|
||||
<tab.icon className="w-4 h-4" />
|
||||
{tab.label}
|
||||
<span className={clsx(
|
||||
"px-2 py-0.5 text-xs rounded-full",
|
||||
activeTab === tab.id ? "bg-background/20 text-background" : "bg-foreground/10"
|
||||
)}>
|
||||
{tab.count}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Listings Table */}
|
||||
{loading ? (
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<Loader2 className="w-6 h-6 text-accent animate-spin" />
|
||||
</div>
|
||||
) : listings.length === 0 ? (
|
||||
<div className="text-center py-16 bg-background-secondary/30 border border-border rounded-2xl">
|
||||
<Sparkles className="w-16 h-16 text-foreground-subtle mx-auto mb-6" />
|
||||
<h2 className="text-xl font-medium text-foreground mb-2">No Listings Yet</h2>
|
||||
<p className="text-foreground-muted mb-6 max-w-md mx-auto">
|
||||
Create your first listing to sell a domain on the Pounce marketplace.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
className="inline-flex items-center gap-2 px-6 py-3 bg-accent text-background font-medium rounded-xl hover:bg-accent-hover transition-all"
|
||||
>
|
||||
<Plus className="w-5 h-5" />
|
||||
Create Listing
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{listings.map((listing) => (
|
||||
<div
|
||||
key={listing.id}
|
||||
className="p-5 bg-background-secondary/30 border border-border rounded-2xl hover:border-border-hover transition-all"
|
||||
>
|
||||
<div className="flex flex-wrap items-start gap-4">
|
||||
{/* Domain Info */}
|
||||
<div className="flex-1 min-w-[200px]">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<h3 className="font-mono text-lg font-medium text-foreground">{listing.domain}</h3>
|
||||
{getStatusBadge(listing.status, listing.is_verified)}
|
||||
{/* Browse Tab */}
|
||||
{activeTab === 'browse' && (
|
||||
<div className="space-y-6">
|
||||
{/* Search */}
|
||||
<div className="relative">
|
||||
<Search className="absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-foreground-subtle" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search domains for sale..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
className="w-full pl-12 pr-4 py-3 bg-background-secondary/50 border border-border rounded-xl
|
||||
text-foreground placeholder:text-foreground-subtle
|
||||
focus:outline-none focus:ring-2 focus:ring-accent/30 focus:border-accent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Listings Grid */}
|
||||
{loadingPublic ? (
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<Loader2 className="w-6 h-6 text-accent animate-spin" />
|
||||
</div>
|
||||
) : filteredPublicListings.length === 0 ? (
|
||||
<div className="text-center py-16 bg-background-secondary/30 border border-border rounded-2xl">
|
||||
<Store className="w-16 h-16 text-foreground-subtle mx-auto mb-6" />
|
||||
<h2 className="text-xl font-medium text-foreground mb-2">No Domains Listed</h2>
|
||||
<p className="text-foreground-muted mb-6">
|
||||
{searchQuery ? `No domains match "${searchQuery}"` : 'Be the first to list your domain!'}
|
||||
</p>
|
||||
<button
|
||||
onClick={() => {
|
||||
setActiveTab('my-listings')
|
||||
setShowCreateModal(true)
|
||||
}}
|
||||
className="inline-flex items-center gap-2 px-6 py-3 bg-accent text-background font-medium rounded-xl hover:bg-accent-hover transition-all"
|
||||
>
|
||||
<Plus className="w-5 h-5" />
|
||||
List Your Domain
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{filteredPublicListings.map((listing) => (
|
||||
<Link
|
||||
key={listing.slug}
|
||||
href={`/buy/${listing.slug}`}
|
||||
className="group p-5 bg-background-secondary/30 border border-border rounded-2xl
|
||||
hover:border-accent/50 hover:bg-background-secondary/50 transition-all duration-300"
|
||||
>
|
||||
<div className="flex items-start justify-between mb-3">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-mono text-lg font-medium text-foreground group-hover:text-accent transition-colors truncate">
|
||||
{listing.domain}
|
||||
</h3>
|
||||
{listing.title && (
|
||||
<p className="text-sm text-foreground-muted truncate mt-1">{listing.title}</p>
|
||||
)}
|
||||
</div>
|
||||
{listing.is_verified && (
|
||||
<div className="w-6 h-6 bg-accent/10 rounded flex items-center justify-center" title="Verified">
|
||||
<Shield className="w-3 h-3 text-accent" />
|
||||
<div className="shrink-0 ml-2 w-8 h-8 bg-accent/10 rounded-lg flex items-center justify-center">
|
||||
<Shield className="w-4 h-4 text-accent" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{listing.title && (
|
||||
<p className="text-sm text-foreground-muted">{listing.title}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="text-right">
|
||||
<p className="text-xl font-display text-foreground">
|
||||
{formatPrice(listing.asking_price, listing.currency)}
|
||||
</p>
|
||||
{listing.pounce_score && (
|
||||
<p className="text-xs text-foreground-muted">Score: {listing.pounce_score}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="flex items-center gap-4 text-sm text-foreground-muted">
|
||||
<span className="flex items-center gap-1">
|
||||
<Eye className="w-4 h-4" /> {listing.view_count}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<MessageSquare className="w-4 h-4" /> {listing.inquiry_count}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Actions */}
|
||||
<div className="flex items-center gap-2">
|
||||
{!listing.is_verified && (
|
||||
<button
|
||||
onClick={() => handleStartVerification(listing)}
|
||||
disabled={verifying}
|
||||
className="flex items-center gap-1.5 px-3 py-2 bg-amber-500/10 text-amber-400 text-sm font-medium rounded-lg hover:bg-amber-500/20 transition-all"
|
||||
>
|
||||
<Shield className="w-4 h-4" />
|
||||
Verify
|
||||
</button>
|
||||
)}
|
||||
|
||||
{listing.is_verified && listing.status === 'draft' && (
|
||||
<button
|
||||
onClick={() => handlePublish(listing)}
|
||||
className="flex items-center gap-1.5 px-3 py-2 bg-accent text-background text-sm font-medium rounded-lg hover:bg-accent-hover transition-all"
|
||||
>
|
||||
<CheckCircle className="w-4 h-4" />
|
||||
Publish
|
||||
</button>
|
||||
)}
|
||||
|
||||
{listing.status === 'active' && (
|
||||
<Link
|
||||
href={`/buy/${listing.slug}`}
|
||||
target="_blank"
|
||||
className="flex items-center gap-1.5 px-3 py-2 bg-foreground/5 text-foreground-muted text-sm font-medium rounded-lg hover:bg-foreground/10 transition-all"
|
||||
>
|
||||
<ExternalLink className="w-4 h-4" />
|
||||
View
|
||||
</Link>
|
||||
)}
|
||||
|
||||
<button
|
||||
onClick={() => handleDelete(listing)}
|
||||
className="p-2 text-foreground-subtle hover:text-red-400 transition-colors"
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-end justify-between">
|
||||
{listing.pounce_score && (
|
||||
<div className="px-2 py-1 bg-accent/10 text-accent rounded text-sm font-medium">
|
||||
Score: {listing.pounce_score}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-right">
|
||||
<p className="text-xl font-display text-foreground">
|
||||
{formatPrice(listing.asking_price, listing.currency)}
|
||||
</p>
|
||||
{listing.price_type === 'negotiable' && (
|
||||
<p className="text-xs text-accent">Negotiable</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* My Listings Tab */}
|
||||
{activeTab === 'my-listings' && (
|
||||
<div className="space-y-6">
|
||||
{/* Stats */}
|
||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<StatCard title="My Listings" value={`${myListings.length}/${maxListings}`} icon={Tag} />
|
||||
<StatCard
|
||||
title="Published"
|
||||
value={myListings.filter(l => l.status === 'active').length}
|
||||
icon={CheckCircle}
|
||||
accent
|
||||
/>
|
||||
<StatCard
|
||||
title="Total Views"
|
||||
value={myListings.reduce((sum, l) => sum + l.view_count, 0)}
|
||||
icon={Eye}
|
||||
/>
|
||||
<StatCard
|
||||
title="Inquiries"
|
||||
value={myListings.reduce((sum, l) => sum + l.inquiry_count, 0)}
|
||||
icon={MessageSquare}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* My Listings */}
|
||||
{loadingMy ? (
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<Loader2 className="w-6 h-6 text-accent animate-spin" />
|
||||
</div>
|
||||
) : myListings.length === 0 ? (
|
||||
<div className="text-center py-16 bg-background-secondary/30 border border-border rounded-2xl">
|
||||
<Sparkles className="w-16 h-16 text-foreground-subtle mx-auto mb-6" />
|
||||
<h2 className="text-xl font-medium text-foreground mb-2">No Listings Yet</h2>
|
||||
<p className="text-foreground-muted mb-6 max-w-md mx-auto">
|
||||
Create your first listing to sell a domain on the Pounce marketplace.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
className="inline-flex items-center gap-2 px-6 py-3 bg-accent text-background font-medium rounded-xl hover:bg-accent-hover transition-all"
|
||||
>
|
||||
<Plus className="w-5 h-5" />
|
||||
Create Listing
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{myListings.map((listing) => (
|
||||
<div
|
||||
key={listing.id}
|
||||
className="p-5 bg-background-secondary/30 border border-border rounded-2xl hover:border-border-hover transition-all"
|
||||
>
|
||||
<div className="flex flex-wrap items-start gap-4">
|
||||
{/* Domain Info */}
|
||||
<div className="flex-1 min-w-[200px]">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<h3 className="font-mono text-lg font-medium text-foreground">{listing.domain}</h3>
|
||||
{getStatusBadge(listing.status, listing.is_verified)}
|
||||
{listing.is_verified && (
|
||||
<div className="w-6 h-6 bg-accent/10 rounded flex items-center justify-center" title="Verified">
|
||||
<Shield className="w-3 h-3 text-accent" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{listing.title && (
|
||||
<p className="text-sm text-foreground-muted">{listing.title}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="text-right">
|
||||
<p className="text-xl font-display text-foreground">
|
||||
{formatPrice(listing.asking_price, listing.currency)}
|
||||
</p>
|
||||
{listing.pounce_score && (
|
||||
<p className="text-xs text-foreground-muted">Score: {listing.pounce_score}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="flex items-center gap-4 text-sm text-foreground-muted">
|
||||
<span className="flex items-center gap-1">
|
||||
<Eye className="w-4 h-4" /> {listing.view_count}
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<MessageSquare className="w-4 h-4" /> {listing.inquiry_count}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Actions */}
|
||||
<div className="flex items-center gap-2">
|
||||
{!listing.is_verified && (
|
||||
<button
|
||||
onClick={() => handleStartVerification(listing)}
|
||||
disabled={verifying}
|
||||
className="flex items-center gap-1.5 px-3 py-2 bg-amber-500/10 text-amber-400 text-sm font-medium rounded-lg hover:bg-amber-500/20 transition-all"
|
||||
>
|
||||
<Shield className="w-4 h-4" />
|
||||
Verify
|
||||
</button>
|
||||
)}
|
||||
|
||||
{listing.is_verified && listing.status === 'draft' && (
|
||||
<button
|
||||
onClick={() => handlePublish(listing)}
|
||||
className="flex items-center gap-1.5 px-3 py-2 bg-accent text-background text-sm font-medium rounded-lg hover:bg-accent-hover transition-all"
|
||||
>
|
||||
<CheckCircle className="w-4 h-4" />
|
||||
Publish
|
||||
</button>
|
||||
)}
|
||||
|
||||
{listing.status === 'active' && (
|
||||
<Link
|
||||
href={`/buy/${listing.slug}`}
|
||||
target="_blank"
|
||||
className="flex items-center gap-1.5 px-3 py-2 bg-foreground/5 text-foreground-muted text-sm font-medium rounded-lg hover:bg-foreground/10 transition-all"
|
||||
>
|
||||
<ExternalLink className="w-4 h-4" />
|
||||
View
|
||||
</Link>
|
||||
)}
|
||||
|
||||
<button
|
||||
onClick={() => handleDelete(listing)}
|
||||
className="p-2 text-foreground-subtle hover:text-red-400 transition-colors"
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</PageContainer>
|
||||
@ -390,7 +563,7 @@ export default function ListingsPage() {
|
||||
{showCreateModal && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-background/80 backdrop-blur-sm">
|
||||
<div className="w-full max-w-lg bg-background-secondary border border-border rounded-2xl p-6">
|
||||
<h2 className="text-xl font-display text-foreground mb-6">Create Listing</h2>
|
||||
<h2 className="text-xl font-display text-foreground mb-6">List Domain for Sale</h2>
|
||||
|
||||
<form onSubmit={handleCreate} className="space-y-4">
|
||||
<div>
|
||||
@ -558,4 +731,3 @@ export default function ListingsPage() {
|
||||
</CommandCenterLayout>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import {
|
||||
Gavel,
|
||||
CreditCard,
|
||||
LayoutDashboard,
|
||||
Tag,
|
||||
} from 'lucide-react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import clsx from 'clsx'
|
||||
@ -39,6 +40,7 @@ export function Header() {
|
||||
// Public navigation - same for all visitors
|
||||
const publicNavItems = [
|
||||
{ href: '/auctions', label: 'Auctions', icon: Gavel },
|
||||
{ href: '/buy', label: 'Marketplace', icon: Tag },
|
||||
{ href: '/tld-pricing', label: 'TLD Intel', icon: TrendingUp },
|
||||
{ href: '/pricing', label: 'Pricing', icon: CreditCard },
|
||||
]
|
||||
|
||||
2
frontend/src/components/Sidebar.tsx
Normal file → Executable file
2
frontend/src/components/Sidebar.tsx
Normal file → Executable file
@ -106,7 +106,7 @@ export function Sidebar({ collapsed: controlledCollapsed, onCollapsedChange }: S
|
||||
},
|
||||
{
|
||||
href: '/command/listings',
|
||||
label: 'For Sale',
|
||||
label: 'Marketplace',
|
||||
icon: Tag,
|
||||
badge: null,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user