@devries-cameron20 / OCIU-npo Mirror · read-only
Fork 0

Mirrored from https://github.com/Camo67/OCIU-npo.git

Synced Nov 21, 04:45 UTC

1 import React, { useState } from 'react';
2 import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
3 import { Button } from "@/components/ui/button";
4 import { Input } from "@/components/ui/input";
5 import { Badge } from "@/components/ui/badge";
6 import { Bot, Link as LinkIcon, ShieldCheck } from "lucide-react";
7 import { toast } from "sonner";
8
9 export const CommunityBuddy = () => {
10 const [apiKey, setApiKey] = useState("");
11 const [isConnected, setIsConnected] = useState(false);
12
13 const handleConnect = async () => {
14 if (!apiKey) {
15 toast.error("Please enter an API key");
16 return;
17 }
18 // Simulated connection
19 setIsConnected(true);
20 setApiKey("");
21 toast.success("AI Account Connected Securely!");
22 };
23
24 return (
25 <Card className="border-primary/50 bg-primary/5">
26 <CardHeader className="flex flex-row items-center gap-4">
27 <div className="p-2 bg-primary rounded-full text-primary-foreground">
28 <Bot size={24} />
29 </div>
30 <div>
31 <CardTitle>Community Buddy</CardTitle>
32 <p className="text-sm text-muted-foreground">Your AI layer for learning and building</p>
33 </div>
34 </CardHeader>
35 <CardContent className="space-y-4">
36 {!isConnected ? (
37 <div className="space-y-2">
38 <div className="flex items-center gap-2 text-sm font-medium mb-2">
39 <LinkIcon size={14} />
40 Connect your AI account
41 </div>
42 <div className="flex gap-2">
43 <Input
44 type="password"
45 placeholder="Enter OpenAI/Anthropic/Gemini API Key"
46 value={apiKey}
47 onChange={(e) => setApiKey(e.target.value)}
48 />
49 <Button onClick={handleConnect}>Connect</Button>
50 </div>
51 <p className="text-[10px] text-muted-foreground flex items-center gap-1">
52 <ShieldCheck size={10} />
53 Your key is encrypted and never exposed in the browser.
54 </p>
55 </div>
56 ) : (
57 <div className="flex items-center justify-between bg-growth/10 p-3 rounded-md border border-growth/20">
58 <div className="flex items-center gap-2 text-sm text-growth font-medium">
59 <ShieldCheck size={16} />
60 Community Buddy Active
61 </div>
62 <Badge variant="secondary">Pro Account Connected</Badge>
63 </div>
64 )}
65 </CardContent>
66 </Card>
67 );
68 };