1
1
import React , { useEffect , useState } from 'react' ;
2
- import { Card , CardContent , IconButton , Alert , Stack , Button , Typography , Grid2 , Select , MenuItem , FormControl , InputLabel , Switch , FormGroup , FormControlLabel , Dialog , DialogTitle , DialogContent , Checkbox , Badge , BadgeProps , Link , TextField } from '@mui/material' ;
2
+ import { Card , CardContent , IconButton , Alert , Stack , Button , Typography , Grid2 , Select , MenuItem , FormControl , InputLabel , Switch , FormGroup , FormControlLabel , Dialog , DialogTitle , DialogContent , Checkbox , Badge , BadgeProps , Link , TextField , Tabs , Tab , Tooltip } from '@mui/material' ;
3
3
import { CatalogItemWithName , CatalogItemCard , CatalogItem } from './PromptCard' ;
4
4
import AddIcon from '@mui/icons-material/Add' ;
5
5
import { Ref } from '../Refs' ;
@@ -37,6 +37,7 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
37
37
const [ showUnregistered , setShowUnregistered ] = useState < boolean > ( true ) ;
38
38
const [ showReloadModal , setShowReloadModal ] = useState < boolean > ( false ) ;
39
39
const [ search , setSearch ] = useState < string > ( '' ) ;
40
+ const [ tab , setTab ] = useState < number > ( 0 ) ;
40
41
41
42
const filteredCatalogItems = filterCatalog ( catalogItems , registryItems , showRegistered , showUnregistered , search ) ;
42
43
@@ -47,7 +48,7 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
47
48
const catalog = await response . text ( ) ;
48
49
const items = parse ( catalog ) [ 'registry' ] as { [ key : string ] : CatalogItem }
49
50
const itemsWithName = Object . entries ( items ) . map ( ( [ name , item ] ) => ( { name, ...item } ) ) ;
50
- const filteredItems = filterCatalog ( itemsWithName , registryItems , showRegistered , showUnregistered ) ;
51
+ const filteredItems = filterCatalog ( itemsWithName , registryItems , showRegistered , showUnregistered , search ) ;
51
52
setCatalogItems ( filteredItems ) ;
52
53
localStorage . setItem ( 'catalog' , JSON . stringify ( filteredItems ) ) ;
53
54
if ( showNotification ) {
@@ -141,25 +142,32 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
141
142
} } > registry.yaml</ Button > } severity = "info" >
142
143
< Typography sx = { { width : '100%' } } > You have some prompts registered which are not available in the catalog.</ Typography >
143
144
</ Alert > }
144
- < FormGroup sx = { { width : '100%' } } >
145
- < Stack direction = "row" spacing = { 1 } alignItems = 'center' >
146
- < TextField label = "Search" value = { search } onChange = { ( e ) => setSearch ( e . target . value ) } sx = { { width : 150 } } />
147
- < FormControlLabel control = { < Switch checked = { showRegistered } onChange = { ( e ) => setShowRegistered ( e . target . checked ) } /> } label = "Show Allowed Prompts" />
148
- < FormControlLabel control = { < Switch checked = { showUnregistered } onChange = { ( e ) => setShowUnregistered ( e . target . checked ) } /> } label = "Show Blocked Prompts" />
149
- < Link sx = { { fontWeight : 'bold' } } href = "https://vonwig.github.io/prompts.docs/tools/docs/" target = "_blank" rel = "noopener noreferrer" onClick = { ( ) => {
145
+ < Tabs value = { tab } onChange = { ( e , v ) => setTab ( v ) } sx = { { mb : 0 , mt : 1 } } >
146
+ < Tooltip title = "These are all of the prompts you have available across the catalog." >
147
+ < Tab sx = { { fontSize : '1.5em' } } label = "Available" />
148
+ </ Tooltip >
149
+ < Tooltip title = "These are prompts which you have allowed MCP clients to use." >
150
+ < Tab sx = { { fontSize : '1.5em' } } label = "Allowed" />
151
+ </ Tooltip >
152
+ </ Tabs >
153
+ < FormGroup sx = { { width : '100%' , mt : 0 } } >
154
+ < Stack direction = "row" spacing = { 1 } alignItems = 'center' justifyContent = "space-evenly" >
155
+ < TextField label = "Search" value = { search } onChange = { ( e ) => setSearch ( e . target . value ) } />
156
+ < Link sx = { { fontWeight : 'bold' , justifySelf : 'flex-end' , marginLeft : 'auto' , } } href = "https://vonwig.github.io/prompts.docs/tools/docs/" target = "_blank" rel = "noopener noreferrer" onClick = { ( ) => {
150
157
client . host . openExternal ( 'https://vonwig.github.io/prompts.docs/tools/docs/' ) ;
151
158
} } > ⇱ Documentation</ Link >
152
- < Link sx = { { fontWeight : 'bold' , ml : 2 } } href = "https://github.com/docker/labs-ai-tools-for-devs" target = "_blank" rel = "noopener noreferrer" onClick = { ( ) => {
159
+ < Link sx = { { fontWeight : 'bold' , } } href = "https://github.com/docker/labs-ai-tools-for-devs" target = "_blank" rel = "noopener noreferrer" onClick = { ( ) => {
153
160
client . host . openExternal ( 'https://github.com/docker/labs-ai-tools-for-devs' ) ;
154
161
} } > ⇱ GitHub</ Link >
155
- < IconButton sx = { { marginLeft : 'auto' , marginRight : 2 , alignSelf : 'flex-end' , justifyContent : 'flex-end' } } onClick = { showSettings } >
162
+ < IconButton sx = { { ml : 2 , alignSelf : 'flex-end' , justifyContent : 'flex-end' } } onClick = { showSettings } >
156
163
< Badge { ...settingsBadgeProps } >
157
164
< Settings sx = { { fontSize : '1.5em' } } />
158
165
</ Badge >
159
166
</ IconButton >
160
167
</ Stack >
161
168
</ FormGroup >
162
- < Grid2 container spacing = { 2 } width = '100%' maxWidth = { 1000 } >
169
+
170
+ { tab === 0 && < Grid2 container spacing = { 2 } width = '100%' maxWidth = { 1000 } >
163
171
{ filteredCatalogItems . map ( ( item ) => (
164
172
< Grid2 size = { { xs : 12 , sm : 6 , md : 4 } } key = { item . name } >
165
173
< CatalogItemCard
@@ -185,7 +193,16 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
185
193
</ CardContent >
186
194
</ Card >
187
195
</ Grid2 >
188
- </ Grid2 >
196
+ </ Grid2 > }
197
+ { tab === 1 && < Grid2 container spacing = { 2 } width = '100%' maxWidth = { 1000 } >
198
+ { Object . entries ( registryItems ) . map ( ( [ name , item ] ) => (
199
+ < Grid2 size = { { xs : 12 , sm : 6 , md : 4 } } key = { name } >
200
+ < CatalogItemCard item = { catalogItems . find ( ( i ) => i . name === name ) ! } openUrl = { ( ) => {
201
+ client . host . openExternal ( Ref . fromRef ( item . ref ) . toURL ( true ) ) ;
202
+ } } canRegister = { canRegister } registered = { true } register = { registerCatalogItem } unregister = { unregisterCatalogItem } />
203
+ </ Grid2 >
204
+ ) ) }
205
+ </ Grid2 > }
189
206
</ Stack >
190
207
) ;
191
208
} ;
0 commit comments