Spaces:
Sleeping
Sleeping
File size: 19,938 Bytes
f80e9b3 |
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 |
import React, { useState } from 'react';
import { motion } from 'framer-motion';
import {
Link2,
Check,
X,
ExternalLink,
Settings,
RefreshCw,
Shield,
Key,
AlertCircle,
CheckCircle,
Linkedin,
Palette,
Zap,
ArrowRight,
Info,
Save
} from 'lucide-react';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Switch } from '@/components/ui/switch';
import { Label } from '@/components/ui/label';
import { Input } from '@/components/ui/input';
import { Separator } from '@/components/ui/separator';
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
DialogDescription,
} from '@/components/ui/dialog';
import {
Alert,
AlertDescription,
AlertTitle,
} from '@/components/ui/alert';
const integrations = [
{
id: 'linkedin',
name: 'LinkedIn',
description: 'Connect your LinkedIn account to schedule and publish posts directly',
icon: Linkedin,
color: 'blue',
bgColor: 'bg-[#0A66C2]',
connected: true,
account: 'alex.business@company.com',
lastSync: '2 mins ago',
features: [
'Schedule posts up to 60 days in advance',
'Publish carousel, image, and text posts',
'Track post performance analytics',
'Manage multiple company pages'
]
},
{
id: 'canva',
name: 'Canva',
description: 'Import designs directly from your Canva workspace for post visuals',
icon: Palette,
color: 'purple',
bgColor: 'bg-gradient-to-br from-[#00C4CC] to-[#7B2FF7]',
connected: false,
account: null,
lastSync: null,
features: [
'Browse and import Canva designs',
'Access brand kit assets',
'Import templates for carousels',
'Sync design updates automatically'
]
},
];
export default function Integrations() {
const [linkedInDialogOpen, setLinkedInDialogOpen] = useState(false);
const [canvaDialogOpen, setCanvaDialogOpen] = useState(false);
const [autoPost, setAutoPost] = useState(true);
const [notifications, setNotifications] = useState(true);
return (
<div className="min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30">
<div className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
{/* Header */}
<motion.div
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
className="mb-8"
>
<div className="flex flex-col md:flex-row md:items-center md:justify-between gap-4">
<div>
<h1 className="text-3xl font-bold text-slate-900 tracking-tight">
Integrations
</h1>
<p className="text-slate-500 mt-1">
Connect your tools to streamline your content workflow
</p>
</div>
</div>
</motion.div>
{/* Integration Status Banner */}
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
className="mb-8"
>
<Alert className="border-blue-200 bg-blue-50">
<Info className="h-4 w-4 text-blue-600" />
<AlertTitle className="text-blue-800">Quick Setup</AlertTitle>
<AlertDescription className="text-blue-700">
Connect both LinkedIn and Canva to unlock the full potential of automated content scheduling. Your designs will flow seamlessly to your LinkedIn audience.
</AlertDescription>
</Alert>
</motion.div>
{/* Integration Cards */}
<div className="space-y-6">
{integrations.map((integration, index) => (
<motion.div
key={integration.id}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: index * 0.1 }}
>
<Card className="border-0 shadow-lg shadow-slate-200/50 overflow-hidden">
<CardContent className="p-0">
<div className="flex flex-col lg:flex-row">
{/* Left Section - Integration Info */}
<div className="flex-1 p-6">
<div className="flex items-start gap-4">
<div className={`w-14 h-14 rounded-xl ${integration.bgColor} flex items-center justify-center shadow-lg`}>
<integration.icon className="w-7 h-7 text-white" />
</div>
<div className="flex-1">
<div className="flex items-center gap-3">
<h3 className="text-xl font-semibold text-slate-900">
{integration.name}
</h3>
{integration.connected ? (
<Badge className="bg-emerald-100 text-emerald-700 border-0 gap-1">
<CheckCircle className="w-3 h-3" />
Connected
</Badge>
) : (
<Badge variant="outline" className="text-slate-500 border-slate-300">
Not Connected
</Badge>
)}
</div>
<p className="text-slate-500 mt-1">
{integration.description}
</p>
{integration.connected && (
<div className="flex items-center gap-4 mt-3">
<div className="flex items-center gap-2 text-sm">
<Key className="w-4 h-4 text-slate-400" />
<span className="text-slate-600">{integration.account}</span>
</div>
<div className="flex items-center gap-2 text-sm">
<RefreshCw className="w-4 h-4 text-slate-400" />
<span className="text-slate-500">Synced {integration.lastSync}</span>
</div>
</div>
)}
</div>
</div>
{/* Features */}
<div className="mt-6">
<p className="text-sm font-medium text-slate-700 mb-3">Features</p>
<div className="grid sm:grid-cols-2 gap-2">
{integration.features.map((feature, idx) => (
<div key={idx} className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500 shrink-0" />
<span>{feature}</span>
</div>
))}
</div>
</div>
</div>
{/* Right Section - Actions */}
<div className="lg:w-64 p-6 bg-slate-50 border-t lg:border-t-0 lg:border-l border-slate-100 flex flex-col justify-center">
{integration.connected ? (
<div className="space-y-4">
<Dialog>
<DialogTrigger asChild>
<Button variant="outline" className="w-full gap-2">
<Settings className="w-4 h-4" />
Settings
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle className="flex items-center gap-3">
<div className={`w-10 h-10 rounded-lg ${integration.bgColor} flex items-center justify-center`}>
<integration.icon className="w-5 h-5 text-white" />
</div>
{integration.name} Settings
</DialogTitle>
<DialogDescription>
Configure your {integration.name} integration preferences
</DialogDescription>
</DialogHeader>
<div className="space-y-6 pt-4">
<div className="flex items-center justify-between">
<div>
<Label className="text-sm font-medium">Auto-post scheduled content</Label>
<p className="text-xs text-slate-500 mt-0.5">
Automatically publish posts at scheduled times
</p>
</div>
<Switch checked={autoPost} onCheckedChange={setAutoPost} />
</div>
<Separator />
<div className="flex items-center justify-between">
<div>
<Label className="text-sm font-medium">Post notifications</Label>
<p className="text-xs text-slate-500 mt-0.5">
Get notified when posts are published
</p>
</div>
<Switch checked={notifications} onCheckedChange={setNotifications} />
</div>
<Separator />
<div>
<Label className="text-sm font-medium">Connected Account</Label>
<div className="flex items-center gap-3 mt-2 p-3 rounded-lg bg-slate-50">
<div className={`w-8 h-8 rounded-lg ${integration.bgColor} flex items-center justify-center`}>
<integration.icon className="w-4 h-4 text-white" />
</div>
<div className="flex-1">
<p className="text-sm font-medium text-slate-700">{integration.account}</p>
<p className="text-xs text-slate-500">Connected</p>
</div>
<Button variant="ghost" size="sm" className="text-red-600 hover:text-red-700 hover:bg-red-50">
Disconnect
</Button>
</div>
</div>
</div>
</DialogContent>
</Dialog>
<Button variant="ghost" className="w-full gap-2 text-red-600 hover:text-red-700 hover:bg-red-50">
<X className="w-4 h-4" />
Disconnect
</Button>
</div>
) : (
<div className="space-y-4">
<Dialog>
<DialogTrigger asChild>
<Button className={`w-full gap-2 ${
integration.id === 'linkedin'
? 'bg-[#0A66C2] hover:bg-[#004182]'
: 'bg-gradient-to-r from-[#00C4CC] to-[#7B2FF7] hover:opacity-90'
}`}>
<Link2 className="w-4 h-4" />
Connect {integration.name}
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle className="flex items-center gap-3">
<div className={`w-10 h-10 rounded-lg ${integration.bgColor} flex items-center justify-center`}>
<integration.icon className="w-5 h-5 text-white" />
</div>
Connect to {integration.name}
</DialogTitle>
<DialogDescription>
Authorize access to your {integration.name} account
</DialogDescription>
</DialogHeader>
<div className="space-y-6 pt-4">
<div className="p-4 rounded-xl bg-slate-50 border border-slate-100">
<div className="flex items-start gap-3">
<Shield className="w-5 h-5 text-blue-600 mt-0.5" />
<div>
<p className="text-sm font-medium text-slate-700">Secure Connection</p>
<p className="text-xs text-slate-500 mt-1">
Your credentials are encrypted and never stored. We only request necessary permissions.
</p>
</div>
</div>
</div>
<div>
<Label className="text-sm font-medium">Permissions Requested</Label>
<div className="mt-2 space-y-2">
{integration.id === 'linkedin' ? (
<>
<div className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500" />
Read and write posts on your behalf
</div>
<div className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500" />
Schedule posts for future publishing
</div>
<div className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500" />
Access post analytics and insights
</div>
</>
) : (
<>
<div className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500" />
View your Canva designs
</div>
<div className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500" />
Download designs as images
</div>
<div className="flex items-center gap-2 text-sm text-slate-600">
<Check className="w-4 h-4 text-emerald-500" />
Access brand kit assets
</div>
</>
)}
</div>
</div>
<Button className={`w-full gap-2 ${
integration.id === 'linkedin'
? 'bg-[#0A66C2] hover:bg-[#004182]'
: 'bg-gradient-to-r from-[#00C4CC] to-[#7B2FF7] hover:opacity-90'
}`}>
Continue with {integration.name}
<ExternalLink className="w-4 h-4" />
</Button>
</div>
</DialogContent>
</Dialog>
<p className="text-xs text-center text-slate-500">
You'll be redirected to {integration.name} to authorize
</p>
</div>
)}
</div>
</div>
</CardContent>
</Card>
</motion.div>
))}
</div>
{/* API Configuration */}
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.3 }}
className="mt-8"
>
<Card className="border-0 shadow-lg shadow-slate-200/50">
<CardHeader>
<CardTitle className="text-lg font-semibold flex items-center gap-2">
<Key className="w-5 h-5 text-amber-500" />
API Configuration
</CardTitle>
<CardDescription>
For advanced users who want to configure custom API settings
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid md:grid-cols-2 gap-4">
<div>
<Label className="text-sm text-slate-600">LinkedIn Client ID</Label>
<Input
className="mt-1.5"
placeholder="Enter your LinkedIn Client ID"
type="password"
defaultValue="••••••••••••••••"
/>
</div>
<div>
<Label className="text-sm text-slate-600">LinkedIn Client Secret</Label>
<Input
className="mt-1.5"
placeholder="Enter your LinkedIn Client Secret"
type="password"
defaultValue="••••••••••••••••"
/>
</div>
<div>
<Label className="text-sm text-slate-600">Canva API Key</Label>
<Input
className="mt-1.5"
placeholder="Enter your Canva API Key"
type="password"
/>
</div>
<div>
<Label className="text-sm text-slate-600">Webhook URL</Label>
<Input
className="mt-1.5"
placeholder="https://your-webhook-url.com"
/>
</div>
</div>
<div className="flex justify-end">
<Button variant="outline" className="gap-2">
<Save className="w-4 h-4" />
Save Configuration
</Button>
</div>
</CardContent>
</Card>
</motion.div>
</div>
</div>
);
}
|