feat: Split Sidebar into Discover + Manage sections
SIDEBAR RESTRUCTURE: Section 1 - DISCOVER (External Market Data): - Auctions → Live auction feed - Marketplace → Browse /buy (public) - TLD Intelligence → Market insights Section 2 - MANAGE (Your Assets & Tools): - Dashboard → Overview - Watchlist → Tracked domains - Portfolio → Owned domains - My Listings → Sell domains (manage) - Sniper Alerts → Custom notifications - SEO Juice → Backlink analysis (Tycoon) LISTINGS PAGE: - Simplified to 'My Listings' only (management) - Added 'Browse Marketplace' button linking to /buy - Cleaner separation of concerns This creates a clear distinction: - Discover = Looking at external data - Manage = Managing your own stuff
This commit is contained in:
@ -18,13 +18,10 @@ import {
|
||||
Copy,
|
||||
RefreshCw,
|
||||
DollarSign,
|
||||
Globe,
|
||||
X,
|
||||
Sparkles,
|
||||
Store,
|
||||
List,
|
||||
Search,
|
||||
Tag,
|
||||
Store,
|
||||
} from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import clsx from 'clsx'
|
||||
@ -53,22 +50,6 @@ 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
|
||||
@ -78,22 +59,11 @@ interface VerificationInfo {
|
||||
status: string
|
||||
}
|
||||
|
||||
type TabType = 'browse' | 'my-listings'
|
||||
|
||||
export default function ListingsPage() {
|
||||
export default function MyListingsPage() {
|
||||
const { subscription } = useStore()
|
||||
|
||||
// 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('')
|
||||
const [listings, setListings] = useState<Listing[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
// Modals
|
||||
const [showCreateModal, setShowCreateModal] = useState(false)
|
||||
@ -116,31 +86,18 @@ export default function ListingsPage() {
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
loadMyListings()
|
||||
loadPublicListings()
|
||||
loadListings()
|
||||
}, [])
|
||||
|
||||
const loadMyListings = async () => {
|
||||
setLoadingMy(true)
|
||||
const loadListings = async () => {
|
||||
setLoading(true)
|
||||
try {
|
||||
const data = await api.request<Listing[]>('/listings/my')
|
||||
setMyListings(data)
|
||||
setListings(data)
|
||||
} catch (err: any) {
|
||||
console.error('Failed to load my listings:', err)
|
||||
console.error('Failed to load listings:', err)
|
||||
} finally {
|
||||
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)
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,8 +121,7 @@ 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 })
|
||||
loadMyListings()
|
||||
setActiveTab('my-listings')
|
||||
loadListings()
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@ -202,7 +158,7 @@ export default function ListingsPage() {
|
||||
if (result.verified) {
|
||||
setSuccess('Domain verified! You can now publish your listing.')
|
||||
setShowVerifyModal(false)
|
||||
loadMyListings()
|
||||
loadListings()
|
||||
} else {
|
||||
setError(result.message)
|
||||
}
|
||||
@ -220,8 +176,7 @@ export default function ListingsPage() {
|
||||
body: JSON.stringify({ status: 'active' }),
|
||||
})
|
||||
setSuccess('Listing published!')
|
||||
loadMyListings()
|
||||
loadPublicListings()
|
||||
loadListings()
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
}
|
||||
@ -233,7 +188,7 @@ export default function ListingsPage() {
|
||||
try {
|
||||
await api.request(`/listings/${listing.id}`, { method: 'DELETE' })
|
||||
setSuccess('Listing deleted')
|
||||
loadMyListings()
|
||||
loadListings()
|
||||
} catch (err: any) {
|
||||
setError(err.message)
|
||||
}
|
||||
@ -261,34 +216,34 @@ 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="Marketplace"
|
||||
subtitle="Buy and sell premium domains"
|
||||
title="My Listings"
|
||||
subtitle={`Manage your domains for sale • ${listings.length}/${maxListings} slots used`}
|
||||
actions={
|
||||
<button
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
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" />
|
||||
List Domain
|
||||
</button>
|
||||
<div className="flex items-center gap-3">
|
||||
<Link
|
||||
href="/buy"
|
||||
className="flex items-center gap-2 px-4 py-2 text-foreground-muted text-sm font-medium
|
||||
border border-border rounded-lg hover:bg-foreground/5 transition-all"
|
||||
>
|
||||
<Store className="w-4 h-4" />
|
||||
Browse Marketplace
|
||||
</Link>
|
||||
<button
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
disabled={listings.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" />
|
||||
List Domain
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<PageContainer>
|
||||
@ -309,252 +264,135 @@ export default function ListingsPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 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>
|
||||
))}
|
||||
{/* Stats */}
|
||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<StatCard title="My Listings" value={`${listings.length}/${maxListings}`} icon={Tag} />
|
||||
<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}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 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="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>
|
||||
|
||||
<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>
|
||||
)}
|
||||
{/* Listings */}
|
||||
{loading ? (
|
||||
<div className="flex items-center justify-center py-20">
|
||||
<Loader2 className="w-6 h-6 text-accent animate-spin" />
|
||||
</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>
|
||||
)}
|
||||
) : 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)}
|
||||
{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>
|
||||
{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>
|
||||
{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>
|
||||
)}
|
||||
</PageContainer>
|
||||
|
||||
@ -72,8 +72,30 @@ export function Sidebar({ collapsed: controlledCollapsed, onCollapsedChange }: S
|
||||
// Count available domains for notification badge
|
||||
const availableCount = domains?.filter(d => d.is_available).length || 0
|
||||
|
||||
// Navigation items - all point to /command/* routes
|
||||
const navItems = [
|
||||
// SECTION 1: Discover - External market data
|
||||
const discoverItems = [
|
||||
{
|
||||
href: '/command/auctions',
|
||||
label: 'Auctions',
|
||||
icon: Gavel,
|
||||
badge: null,
|
||||
},
|
||||
{
|
||||
href: '/buy',
|
||||
label: 'Marketplace',
|
||||
icon: Tag,
|
||||
badge: null,
|
||||
},
|
||||
{
|
||||
href: '/command/intelligence',
|
||||
label: 'TLD Intelligence',
|
||||
icon: TrendingUp,
|
||||
badge: null,
|
||||
},
|
||||
]
|
||||
|
||||
// SECTION 2: Manage - Your own assets and tools
|
||||
const manageItems = [
|
||||
{
|
||||
href: '/command/dashboard',
|
||||
label: 'Dashboard',
|
||||
@ -92,21 +114,9 @@ export function Sidebar({ collapsed: controlledCollapsed, onCollapsedChange }: S
|
||||
icon: Briefcase,
|
||||
badge: null,
|
||||
},
|
||||
{
|
||||
href: '/command/auctions',
|
||||
label: 'Auctions',
|
||||
icon: Gavel,
|
||||
badge: null,
|
||||
},
|
||||
{
|
||||
href: '/command/intelligence',
|
||||
label: 'Intelligence',
|
||||
icon: TrendingUp,
|
||||
badge: null,
|
||||
},
|
||||
{
|
||||
href: '/command/listings',
|
||||
label: 'Marketplace',
|
||||
label: 'My Listings',
|
||||
icon: Tag,
|
||||
badge: null,
|
||||
},
|
||||
@ -175,64 +185,119 @@ export function Sidebar({ collapsed: controlledCollapsed, onCollapsedChange }: S
|
||||
</div>
|
||||
|
||||
{/* Main Navigation */}
|
||||
<nav className="flex-1 py-6 px-3 space-y-1.5 overflow-y-auto">
|
||||
<div className={clsx("mb-4", collapsed ? "px-1" : "px-2")}>
|
||||
<nav className="flex-1 py-6 px-3 overflow-y-auto">
|
||||
{/* SECTION 1: Discover */}
|
||||
<div className={clsx("mb-6", collapsed ? "px-1" : "px-2")}>
|
||||
{!collapsed && (
|
||||
<p className="text-[10px] font-semibold text-foreground-subtle/60 uppercase tracking-[0.15em] mb-3">
|
||||
Navigation
|
||||
Discover
|
||||
</p>
|
||||
)}
|
||||
{collapsed && <div className="h-px bg-border/50 mb-3" />}
|
||||
|
||||
<div className="space-y-1.5">
|
||||
{discoverItems.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
onClick={() => setMobileOpen(false)}
|
||||
className={clsx(
|
||||
"group relative flex items-center gap-3 px-3 py-3 rounded-xl transition-all duration-300",
|
||||
isActive(item.href)
|
||||
? "bg-gradient-to-r from-accent/20 to-accent/5 text-foreground border border-accent/20 shadow-[0_0_20px_-5px_rgba(16,185,129,0.2)]"
|
||||
: "text-foreground-muted hover:text-foreground hover:bg-foreground/5 border border-transparent"
|
||||
)}
|
||||
title={collapsed ? item.label : undefined}
|
||||
>
|
||||
{isActive(item.href) && (
|
||||
<div className="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-accent rounded-r-full shadow-[0_0_10px_rgba(16,185,129,0.5)]" />
|
||||
)}
|
||||
<div className="relative">
|
||||
<item.icon className={clsx(
|
||||
"w-5 h-5 transition-all duration-300",
|
||||
isActive(item.href)
|
||||
? "text-accent drop-shadow-[0_0_8px_rgba(16,185,129,0.5)]"
|
||||
: "group-hover:text-foreground"
|
||||
)} />
|
||||
</div>
|
||||
{!collapsed && (
|
||||
<span className={clsx(
|
||||
"text-sm font-medium transition-colors",
|
||||
isActive(item.href) && "text-foreground"
|
||||
)}>
|
||||
{item.label}
|
||||
</span>
|
||||
)}
|
||||
{!isActive(item.href) && (
|
||||
<div className="absolute inset-0 rounded-xl bg-accent/5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" />
|
||||
)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* SECTION 2: Manage */}
|
||||
<div className={clsx("", collapsed ? "px-1" : "px-2")}>
|
||||
{!collapsed && (
|
||||
<p className="text-[10px] font-semibold text-foreground-subtle/60 uppercase tracking-[0.15em] mb-3">
|
||||
Manage
|
||||
</p>
|
||||
)}
|
||||
{collapsed && <div className="h-px bg-border/50 mb-3" />}
|
||||
|
||||
<div className="space-y-1.5">
|
||||
{manageItems.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
onClick={() => setMobileOpen(false)}
|
||||
className={clsx(
|
||||
"group relative flex items-center gap-3 px-3 py-3 rounded-xl transition-all duration-300",
|
||||
isActive(item.href)
|
||||
? "bg-gradient-to-r from-accent/20 to-accent/5 text-foreground border border-accent/20 shadow-[0_0_20px_-5px_rgba(16,185,129,0.2)]"
|
||||
: "text-foreground-muted hover:text-foreground hover:bg-foreground/5 border border-transparent"
|
||||
)}
|
||||
title={collapsed ? item.label : undefined}
|
||||
>
|
||||
{isActive(item.href) && (
|
||||
<div className="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-accent rounded-r-full shadow-[0_0_10px_rgba(16,185,129,0.5)]" />
|
||||
)}
|
||||
<div className="relative">
|
||||
<item.icon className={clsx(
|
||||
"w-5 h-5 transition-all duration-300",
|
||||
isActive(item.href)
|
||||
? "text-accent drop-shadow-[0_0_8px_rgba(16,185,129,0.5)]"
|
||||
: "group-hover:text-foreground"
|
||||
)} />
|
||||
{item.badge && typeof item.badge === 'number' && (
|
||||
<span className="absolute -top-2 -right-2 w-5 h-5 bg-accent text-background
|
||||
text-[10px] font-bold rounded-full flex items-center justify-center
|
||||
shadow-[0_0_10px_rgba(16,185,129,0.4)] animate-pulse">
|
||||
{item.badge > 9 ? '9+' : item.badge}
|
||||
</span>
|
||||
)}
|
||||
{item.badge && typeof item.badge === 'string' && !collapsed && (
|
||||
<span className="absolute -top-1 -right-10 px-1.5 py-0.5 bg-amber-500/20 text-amber-400
|
||||
text-[9px] font-bold rounded uppercase">
|
||||
{item.badge}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{!collapsed && (
|
||||
<span className={clsx(
|
||||
"text-sm font-medium transition-colors",
|
||||
isActive(item.href) && "text-foreground"
|
||||
)}>
|
||||
{item.label}
|
||||
</span>
|
||||
)}
|
||||
{!isActive(item.href) && (
|
||||
<div className="absolute inset-0 rounded-xl bg-accent/5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" />
|
||||
)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{navItems.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
onClick={() => setMobileOpen(false)}
|
||||
className={clsx(
|
||||
"group relative flex items-center gap-3 px-3 py-3 rounded-xl transition-all duration-300",
|
||||
isActive(item.href)
|
||||
? "bg-gradient-to-r from-accent/20 to-accent/5 text-foreground border border-accent/20 shadow-[0_0_20px_-5px_rgba(16,185,129,0.2)]"
|
||||
: "text-foreground-muted hover:text-foreground hover:bg-foreground/5 border border-transparent"
|
||||
)}
|
||||
title={collapsed ? item.label : undefined}
|
||||
>
|
||||
{/* Active indicator line */}
|
||||
{isActive(item.href) && (
|
||||
<div className="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-accent rounded-r-full shadow-[0_0_10px_rgba(16,185,129,0.5)]" />
|
||||
)}
|
||||
|
||||
<div className="relative">
|
||||
<item.icon className={clsx(
|
||||
"w-5 h-5 transition-all duration-300",
|
||||
isActive(item.href)
|
||||
? "text-accent drop-shadow-[0_0_8px_rgba(16,185,129,0.5)]"
|
||||
: "group-hover:text-foreground"
|
||||
)} />
|
||||
{/* Badge for notifications */}
|
||||
{item.badge && (
|
||||
<span className="absolute -top-2 -right-2 w-5 h-5 bg-accent text-background
|
||||
text-[10px] font-bold rounded-full flex items-center justify-center
|
||||
shadow-[0_0_10px_rgba(16,185,129,0.4)] animate-pulse">
|
||||
{item.badge > 9 ? '9+' : item.badge}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{!collapsed && (
|
||||
<span className={clsx(
|
||||
"text-sm font-medium transition-colors",
|
||||
isActive(item.href) && "text-foreground"
|
||||
)}>
|
||||
{item.label}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* Hover glow effect */}
|
||||
{!isActive(item.href) && (
|
||||
<div className="absolute inset-0 rounded-xl bg-accent/5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" />
|
||||
)}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{/* Bottom Section */}
|
||||
|
||||
Reference in New Issue
Block a user