forked from op7418/CodePilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginDetail.tsx
More file actions
70 lines (61 loc) · 2.12 KB
/
PluginDetail.tsx
File metadata and controls
70 lines (61 loc) · 2.12 KB
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
'use client';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Separator } from '@/components/ui/separator';
import { X, Lightning } from "@/components/ui/icon";
import type { SkillInfo } from './PluginCard';
interface PluginDetailProps {
plugin: SkillInfo;
onClose: () => void;
}
export function PluginDetail({ plugin, onClose }: PluginDetailProps) {
const isProject = plugin.source === 'project';
const displayName = isProject
? plugin.name.replace('project:', '')
: plugin.name;
return (
<div className="border rounded-lg p-4 bg-card">
<div className="flex items-start justify-between mb-3">
<div>
<div className="flex items-center gap-2">
<Lightning size={16} className="text-muted-foreground" />
<h3 className="text-lg font-semibold">/{displayName}</h3>
<Badge variant={isProject ? 'secondary' : 'outline'}>
{isProject ? 'Project' : 'Global'}
</Badge>
</div>
<p className="text-sm text-muted-foreground mt-1">
{plugin.description}
</p>
</div>
<Button variant="ghost" size="icon" onClick={onClose}>
<X size={16} />
</Button>
</div>
<Separator className="my-3" />
<div className="space-y-3">
<div>
<p className="text-sm font-medium mb-1">Source</p>
<p className="text-xs text-muted-foreground font-mono break-all">
{plugin.filePath}
</p>
</div>
<div>
<p className="text-sm font-medium mb-1">Type</p>
<p className="text-xs text-muted-foreground">
{isProject ? 'Project-level skill' : 'User-level skill'}
</p>
</div>
<Separator />
<div>
<p className="text-sm font-medium mb-2">Content</p>
<div className="rounded-md bg-muted p-3 max-h-80 overflow-auto">
<pre className="text-xs font-mono whitespace-pre-wrap break-words">
{plugin.content}
</pre>
</div>
</div>
</div>
</div>
);
}