Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | 1x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 1x 1x 1x 9x 9x 9x 9x 9x 11x 1x 1x 1x 8x 8x 8x 8x 8x 11x 3x 3x 3x 3x 5x 5x 5x 5x 5x 5x 5x 5x 11x 11x 11x 11x 11x 11x 11x 6x 6x 6x 6x 6x 6x 6x 6x 11x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 3x 3x 3x 3x 3x 3x 3x 3x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 2x 1x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 2x 4x 4x 4x 2x 1x 11x 11x 11x 11x 11x 11x 2x 4x 4x 4x 2x 1x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 4x 4x 4x 4x 4x 4x 4x 2x 2x 11x 11x 11x 2x 2x 2x 2x 2x 2x 2x 2x 4x 4x 4x 2x 2x 2x 2x 11x 11x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 2x 2x 2x 4x 2x 2x 2x 4x 4x 4x | 'use client';
import { useState, useEffect } from 'react';
import Link from 'next/link';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
import { motion } from 'framer-motion';
import {
Palette,
Image as ImageIcon,
Plus,
Settings,
ExternalLink,
Grid3X3,
LayoutGrid,
Play,
Star,
Loader2,
Sparkles,
IndianRupee,
Briefcase,
} from 'lucide-react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { createClient } from '@/lib/supabase/client';
import type { DesignerProfile, GalleryItem, Profile } from '@/types/database';
interface DesignerDashboardData {
designerProfile: DesignerProfile | null;
profile: Profile | null;
galleryItems: GalleryItem[];
}
export default function DesignerDashboardPage() {
const [data, setData] = useState<DesignerDashboardData | null>(null);
const [loading, setLoading] = useState(true);
const router = useRouter();
useEffect(() => {
const supabase = createClient();
async function fetchData() {
const {
data: { user },
} = await supabase.auth.getUser();
if (!user) {
router.push('/login');
return;
}
const { data: profile } = await supabase
.from('profiles')
.select('*')
.eq('user_id', user.id)
.single();
if (!profile) {
router.push('/profile');
return;
}
const { data: designerProfile } = await supabase
.from('designer_profiles')
.select('*')
.eq('profile_id', profile.id)
.single();
if (!designerProfile) {
setData({ designerProfile: null, profile, galleryItems: [] });
setLoading(false);
return;
}
const { data: galleryItems } = await supabase
.from('gallery_items')
.select('*')
.eq('designer_profile_id', designerProfile.id)
.order('display_order', { ascending: true });
setData({
designerProfile,
profile,
galleryItems: galleryItems || [],
});
setLoading(false);
}
fetchData();
}, [router]);
if (loading) {
return (
<div className="flex min-h-[400px] items-center justify-center">
<div className="flex flex-col items-center gap-4">
<Loader2 className="h-8 w-8 animate-spin text-primary" />
<p className="text-sm text-muted-foreground">Loading designer dashboard...</p>
</div>
</div>
);
}
// No designer profile - show setup prompt
if (!data?.designerProfile) {
return (
<div className="space-y-8">
<div>
<h1 className="text-3xl font-bold">Designer Dashboard</h1>
<p className="text-muted-foreground">Showcase your visual portfolio</p>
</div>
<Card className="border-dashed">
<CardContent className="flex flex-col items-center justify-center py-16">
<div className="mb-4 rounded-full bg-primary/10 p-4">
<Palette className="h-12 w-12 text-primary" />
</div>
<h2 className="mb-2 text-xl font-semibold">Set Up Your Designer Profile</h2>
<p className="mb-6 max-w-md text-center text-muted-foreground">
Create a stunning visual gallery to showcase your design work. Add case studies,
process images, and highlight your best projects.
</p>
<Button asChild size="lg">
<Link href="/designer/setup">
<Plus className="mr-2 h-4 w-4" />
Create Designer Profile
</Link>
</Button>
</CardContent>
</Card>
</div>
);
}
const { designerProfile, galleryItems } = data;
const featuredItems = galleryItems.filter((item) => item.is_featured);
const caseStudies = galleryItems.filter((item) => item.is_case_study);
const layoutIcons: Record<string, React.ElementType> = {
grid: Grid3X3,
masonry: LayoutGrid,
slider: Play,
};
const LayoutIcon = layoutIcons[designerProfile.gallery_layout] || Grid3X3;
return (
<div className="space-y-8">
{/* Header */}
<div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
<div>
<h1 className="text-3xl font-bold">Designer Dashboard</h1>
<p className="text-muted-foreground">Manage your visual portfolio and gallery</p>
</div>
<div className="flex gap-2">
<Button variant="outline" asChild>
<Link href="/designer/settings">
<Settings className="mr-2 h-4 w-4" />
Settings
</Link>
</Button>
<Button asChild>
<Link href="/designer/gallery/new">
<Plus className="mr-2 h-4 w-4" />
Add Work
</Link>
</Button>
</div>
</div>
{/* Stats */}
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.1 }}
>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">Gallery Items</p>
<p className="text-3xl font-bold">{galleryItems.length}</p>
</div>
<ImageIcon className="h-8 w-8 text-blue-500" />
</div>
</CardContent>
</Card>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.2 }}
>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">Featured Works</p>
<p className="text-3xl font-bold">{featuredItems.length}</p>
</div>
<Star className="h-8 w-8 text-yellow-500" />
</div>
</CardContent>
</Card>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }}
>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">Case Studies</p>
<p className="text-3xl font-bold">{caseStudies.length}</p>
</div>
<Briefcase className="h-8 w-8 text-purple-500" />
</div>
</CardContent>
</Card>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.4 }}
>
<Card>
<CardContent className="pt-6">
<div className="flex items-center justify-between">
<div>
<p className="text-sm text-muted-foreground">Starting Price</p>
<p className="text-3xl font-bold">
{designerProfile.starting_price_inr
? `₹${(designerProfile.starting_price_inr / 100).toLocaleString()}`
: 'Not set'}
</p>
</div>
<IndianRupee className="h-8 w-8 text-green-500" />
</div>
</CardContent>
</Card>
</motion.div>
</div>
{/* Profile Overview */}
<Card>
<CardHeader>
<CardTitle>Profile Overview</CardTitle>
<CardDescription>Your designer profile settings</CardDescription>
</CardHeader>
<CardContent>
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
<div className="space-y-1">
<p className="text-sm text-muted-foreground">Specialties</p>
<div className="flex flex-wrap gap-1">
{designerProfile.design_specialties.length > 0 ? (
designerProfile.design_specialties.slice(0, 3).map((specialty) => (
<Badge key={specialty} variant="secondary" className="text-xs">
{specialty}
</Badge>
))
) : (
<span className="text-sm text-muted-foreground">Not set</span>
)}
</div>
</div>
<div className="space-y-1">
<p className="text-sm text-muted-foreground">Tools</p>
<div className="flex flex-wrap gap-1">
{designerProfile.tools.length > 0 ? (
designerProfile.tools.slice(0, 3).map((tool) => (
<Badge key={tool} variant="outline" className="text-xs">
{tool}
</Badge>
))
) : (
<span className="text-sm text-muted-foreground">Not set</span>
)}
</div>
</div>
<div className="space-y-1">
<p className="text-sm text-muted-foreground">Gallery Layout</p>
<div className="flex items-center gap-2">
<LayoutIcon className="h-4 w-4" />
<span className="capitalize">{designerProfile.gallery_layout}</span>
</div>
</div>
<div className="space-y-1">
<p className="text-sm text-muted-foreground">Status</p>
<Badge variant={designerProfile.accepting_projects ? 'default' : 'secondary'}>
{designerProfile.accepting_projects ? 'Accepting Projects' : 'Not Accepting'}
</Badge>
</div>
</div>
{/* External Links */}
{(designerProfile.dribbble_url ||
designerProfile.behance_url ||
designerProfile.figma_community_url) && (
<div className="mt-6 border-t pt-6">
<p className="mb-3 text-sm font-medium">Connected Portfolios</p>
<div className="flex flex-wrap gap-2">
{designerProfile.dribbble_url && (
<Button variant="outline" size="sm" asChild>
<a href={designerProfile.dribbble_url} target="_blank">
<span className="mr-2">🏀</span>
Dribbble
<ExternalLink className="ml-2 h-3 w-3" />
</a>
</Button>
)}
{designerProfile.behance_url && (
<Button variant="outline" size="sm" asChild>
<a href={designerProfile.behance_url} target="_blank">
<span className="mr-2">🔷</span>
Behance
<ExternalLink className="ml-2 h-3 w-3" />
</a>
</Button>
)}
{designerProfile.figma_community_url && (
<Button variant="outline" size="sm" asChild>
<a href={designerProfile.figma_community_url} target="_blank">
<span className="mr-2">🎨</span>
Figma
<ExternalLink className="ml-2 h-3 w-3" />
</a>
</Button>
)}
</div>
</div>
)}
</CardContent>
</Card>
{/* Gallery Preview */}
<Card>
<CardHeader>
<div className="flex items-center justify-between">
<div>
<CardTitle>Gallery</CardTitle>
<CardDescription>Your visual portfolio</CardDescription>
</div>
<Button variant="outline" size="sm" asChild>
<Link href="/designer/gallery">Manage Gallery</Link>
</Button>
</div>
</CardHeader>
<CardContent>
{galleryItems.length === 0 ? (
<div className="py-12 text-center text-muted-foreground">
<ImageIcon className="mx-auto mb-4 h-12 w-12 opacity-50" />
<p>No gallery items yet</p>
<p className="text-sm">Add your first design work to showcase</p>
<Button className="mt-4" asChild>
<Link href="/designer/gallery/new">
<Plus className="mr-2 h-4 w-4" />
Add Work
</Link>
</Button>
</div>
) : designerProfile.gallery_layout === 'masonry' ? (
<div className="columns-2 gap-4 md:columns-3 lg:columns-4">
{galleryItems.slice(0, 12).map((item, index) => (
<motion.div
key={item.id}
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: index * 0.05 }}
className="mb-4 break-inside-avoid"
>
<GalleryItemCard item={item} layout="masonry" />
</motion.div>
))}
</div>
) : designerProfile.gallery_layout === 'slider' ? (
<div className="scrollbar-thin scrollbar-thumb-muted flex snap-x snap-mandatory gap-4 overflow-x-auto pb-4">
{galleryItems.slice(0, 12).map((item, index) => (
<motion.div
key={item.id}
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: index * 0.05 }}
className="w-64 flex-shrink-0 snap-center"
>
<GalleryItemCard item={item} layout="slider" />
</motion.div>
))}
</div>
) : (
<div className="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
{galleryItems.slice(0, 8).map((item, index) => (
<motion.div
key={item.id}
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: index * 0.05 }}
>
<GalleryItemCard item={item} />
</motion.div>
))}
</div>
)}
</CardContent>
</Card>
{/* Style Tags */}
{designerProfile.style_tags.length > 0 && (
<Card>
<CardHeader>
<CardTitle>Design Style</CardTitle>
<CardDescription>Tags that describe your design aesthetic</CardDescription>
</CardHeader>
<CardContent>
<div className="flex flex-wrap gap-2">
{designerProfile.style_tags.map((tag) => (
<Badge key={tag} variant="secondary" className="px-3 py-1 text-sm">
{tag}
</Badge>
))}
</div>
</CardContent>
</Card>
)}
</div>
);
}
function GalleryItemCard({
item,
layout,
}: {
item: GalleryItem;
layout?: 'grid' | 'masonry' | 'slider';
}) {
const aspectClass =
layout === 'masonry' ? '' : layout === 'slider' ? 'aspect-[3/4]' : 'aspect-square';
return (
<Link
href={`/designer/gallery/${item.id}`}
className={`group relative overflow-hidden rounded-lg border bg-muted ${aspectClass}`}
>
{item.thumbnail_url || item.url ? (
<Image
src={item.thumbnail_url || item.url}
alt={item.title}
fill
className="object-cover transition-transform group-hover:scale-105"
/>
) : (
<div className="flex h-full items-center justify-center">
<ImageIcon className="h-8 w-8 text-muted-foreground" />
</div>
)}
{/* Overlay */}
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 transition-opacity group-hover:opacity-100">
<div className="absolute bottom-0 left-0 right-0 p-3">
<p className="truncate text-sm font-medium text-white">{item.title}</p>
{item.project_type && <p className="text-xs text-white/70">{item.project_type}</p>}
</div>
</div>
{/* Featured Badge */}
{item.is_featured && (
<div className="absolute right-2 top-2">
<Sparkles className="h-4 w-4 text-yellow-400 drop-shadow-lg" />
</div>
)}
{/* Case Study Badge */}
{item.is_case_study && (
<div className="absolute left-2 top-2">
<Badge className="px-1.5 py-0.5 text-[10px]">Case Study</Badge>
</div>
)}
{/* Video Indicator */}
{item.type === 'video' && (
<div className="absolute inset-0 flex items-center justify-center">
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-black/50">
<Play className="ml-0.5 h-5 w-5 text-white" />
</div>
</div>
)}
</Link>
);
}
|