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 | 1x 1x | 'use client';
import { useState } from 'react';
import Image from 'next/image';
import Link from 'next/link';
import { ExternalLink, Play, Palette, Sparkles } from 'lucide-react';
import { Card } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog';
import type { DesignerProfile, GalleryItem } from '@/types/database';
interface DesignerSectionProps {
designerProfile: DesignerProfile;
galleryItems: GalleryItem[];
}
export function DesignerSection({ designerProfile, galleryItems }: DesignerSectionProps) {
const [selectedItem, setSelectedItem] = useState<GalleryItem | null>(null);
const featuredItems = galleryItems.filter((item) => item.is_featured);
const otherItems = galleryItems.filter((item) => !item.is_featured);
const displayItems = [...featuredItems, ...otherItems].slice(0, 9);
return (
<div className="space-y-8">
{/* Skills & Tools */}
<div className="space-y-4">
{designerProfile.design_specialties && designerProfile.design_specialties.length > 0 && (
<div>
<h3 className="mb-2 text-sm font-medium text-muted-foreground">Specialties</h3>
<div className="flex flex-wrap gap-2">
{designerProfile.design_specialties.map((specialty: string) => (
<Badge key={specialty} variant="secondary">
{specialty}
</Badge>
))}
</div>
</div>
)}
{designerProfile.tools && designerProfile.tools.length > 0 && (
<div>
<h3 className="mb-2 text-sm font-medium text-muted-foreground">Tools</h3>
<div className="flex flex-wrap gap-2">
{designerProfile.tools.map((tool: string) => (
<Badge key={tool} variant="outline">
{tool}
</Badge>
))}
</div>
</div>
)}
{designerProfile.style_tags && designerProfile.style_tags.length > 0 && (
<div>
<h3 className="mb-2 text-sm font-medium text-muted-foreground">Style</h3>
<div className="flex flex-wrap gap-2">
{designerProfile.style_tags.map((style: string) => (
<Badge key={style} variant="outline">
{style}
</Badge>
))}
</div>
</div>
)}
</div>
{/* Info & Links */}
<div className="flex flex-wrap items-center gap-4">
{designerProfile.years_experience && designerProfile.years_experience > 0 && (
<Badge variant="secondary">{designerProfile.years_experience}+ years experience</Badge>
)}
{designerProfile.accepting_projects && (
<Badge className="bg-green-500/10 text-green-600">
<Palette className="mr-1 h-3 w-3" />
Available for Projects
</Badge>
)}
{designerProfile.dribbble_url && (
<Button variant="outline" size="sm" asChild>
<Link href={designerProfile.dribbble_url} target="_blank" rel="noopener noreferrer">
Dribbble
<ExternalLink className="ml-1 h-3 w-3" />
</Link>
</Button>
)}
{designerProfile.behance_url && (
<Button variant="outline" size="sm" asChild>
<Link href={designerProfile.behance_url} target="_blank" rel="noopener noreferrer">
Behance
<ExternalLink className="ml-1 h-3 w-3" />
</Link>
</Button>
)}
</div>
{/* Gallery Grid */}
{displayItems.length > 0 && (
<div>
<h3 className="mb-4 text-lg font-semibold">Portfolio</h3>
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3">
{displayItems.map((item) => (
<Card
key={item.id}
className="group cursor-pointer overflow-hidden"
onClick={() => setSelectedItem(item)}
>
<div className="relative aspect-square overflow-hidden bg-muted">
{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">
<Palette className="h-8 w-8 text-muted-foreground" />
</div>
)}
{/* Type indicator */}
{item.type === 'video' && (
<div className="absolute left-2 top-2 rounded bg-black/50 p-1">
<Play className="h-3 w-3 text-white" />
</div>
)}
{/* Featured indicator */}
{item.is_featured && (
<div className="absolute right-2 top-2">
<Sparkles className="h-4 w-4 text-yellow-400 drop-shadow-lg" />
</div>
)}
{/* Hover overlay */}
<div className="absolute inset-0 flex items-end bg-gradient-to-t from-black/60 to-transparent opacity-0 transition-opacity group-hover:opacity-100">
<div className="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>
</div>
</Card>
))}
</div>
</div>
)}
{/* Gallery Item Modal */}
<Dialog open={!!selectedItem} onOpenChange={() => setSelectedItem(null)}>
<DialogContent className="max-w-3xl">
{selectedItem && (
<>
<DialogHeader>
<DialogTitle>{selectedItem.title}</DialogTitle>
{selectedItem.description && (
<DialogDescription>{selectedItem.description}</DialogDescription>
)}
</DialogHeader>
<div className="relative aspect-video overflow-hidden rounded-lg bg-muted">
{selectedItem.type === 'video' && selectedItem.url.includes('youtube') ? (
<iframe
src={selectedItem.url.replace('watch?v=', 'embed/')}
className="h-full w-full"
allowFullScreen
/>
) : selectedItem.type === 'video' && selectedItem.url.includes('vimeo') ? (
<iframe
src={`https://player.vimeo.com/video/${selectedItem.url.split('/').pop()}`}
className="h-full w-full"
allowFullScreen
/>
) : (
<Image
src={selectedItem.url}
alt={selectedItem.title}
fill
className="object-contain"
/>
)}
</div>
<div className="flex flex-wrap gap-2">
{selectedItem.project_type && (
<Badge variant="secondary">{selectedItem.project_type}</Badge>
)}
{selectedItem.client_name && (
<Badge variant="outline">Client: {selectedItem.client_name}</Badge>
)}
{selectedItem.project_year && (
<Badge variant="outline">{selectedItem.project_year}</Badge>
)}
{selectedItem.is_case_study && <Badge>Case Study</Badge>}
</div>
</>
)}
</DialogContent>
</Dialog>
</div>
);
}
|