1
- import {
2
- FileText ,
3
- PlayCircle ,
4
- ChevronRight ,
5
- AlertCircle ,
6
- RefreshCw ,
7
- } from "lucide-react" ;
1
+ import { FileText , ChevronRight , AlertCircle , RefreshCw } from "lucide-react" ;
8
2
import { Button } from "@/components/ui/button" ;
9
3
import { Alert , AlertDescription , AlertTitle } from "@/components/ui/alert" ;
10
4
import { TabsContent } from "@/components/ui/tabs" ;
5
+ import ListPane from "./ListPane" ;
11
6
12
7
export type Resource = {
13
8
uri : string ;
@@ -31,37 +26,23 @@ const ResourcesTab = ({
31
26
error : string | null ;
32
27
} ) => (
33
28
< TabsContent value = "resources" className = "grid grid-cols-2 gap-4" >
34
- < div className = "bg-white rounded-lg shadow" >
35
- < div className = "p-4 border-b border-gray-200" >
36
- < h3 className = "font-semibold" > Resources</ h3 >
37
- </ div >
38
- < div className = "p-4" >
39
- < Button
40
- variant = "outline"
41
- className = "w-full mb-4"
42
- onClick = { listResources }
43
- >
44
- < PlayCircle className = "w-4 h-4 mr-2" />
45
- List Resources
46
- </ Button >
47
- < div className = "space-y-2" >
48
- { resources . map ( ( resource , index ) => (
49
- < div
50
- key = { index }
51
- className = "flex items-center p-2 rounded hover:bg-gray-50 cursor-pointer"
52
- onClick = { ( ) => {
53
- setSelectedResource ( resource ) ;
54
- readResource ( resource . uri ) ;
55
- } }
56
- >
57
- < FileText className = "w-4 h-4 mr-2 text-gray-500" />
58
- < span className = "flex-1" > { resource . uri } </ span >
59
- < ChevronRight className = "w-4 h-4 text-gray-400" />
60
- </ div >
61
- ) ) }
62
- </ div >
63
- </ div >
64
- </ div >
29
+ < ListPane
30
+ items = { resources }
31
+ listItems = { listResources }
32
+ setSelectedItem = { ( resource ) => {
33
+ setSelectedResource ( resource ) ;
34
+ readResource ( resource . uri ) ;
35
+ } }
36
+ renderItem = { ( resource ) => (
37
+ < >
38
+ < FileText className = "w-4 h-4 mr-2 text-gray-500" />
39
+ < span className = "flex-1" > { resource . uri } </ span >
40
+ < ChevronRight className = "w-4 h-4 text-gray-400" />
41
+ </ >
42
+ ) }
43
+ title = "Resources"
44
+ buttonText = "List Resources"
45
+ />
65
46
66
47
< div className = "bg-white rounded-lg shadow" >
67
48
< div className = "p-4 border-b border-gray-200 flex justify-between items-center" >
0 commit comments