11import 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' ;
33import { CatalogItemWithName , CatalogItemCard , CatalogItem } from './PromptCard' ;
44import AddIcon from '@mui/icons-material/Add' ;
55import { Ref } from '../Refs' ;
@@ -37,6 +37,7 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
3737 const [ showUnregistered , setShowUnregistered ] = useState < boolean > ( true ) ;
3838 const [ showReloadModal , setShowReloadModal ] = useState < boolean > ( false ) ;
3939 const [ search , setSearch ] = useState < string > ( '' ) ;
40+ const [ tab , setTab ] = useState < number > ( 0 ) ;
4041
4142 const filteredCatalogItems = filterCatalog ( catalogItems , registryItems , showRegistered , showUnregistered , search ) ;
4243
@@ -47,7 +48,7 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
4748 const catalog = await response . text ( ) ;
4849 const items = parse ( catalog ) [ 'registry' ] as { [ key : string ] : CatalogItem }
4950 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 ) ;
5152 setCatalogItems ( filteredItems ) ;
5253 localStorage . setItem ( 'catalog' , JSON . stringify ( filteredItems ) ) ;
5354 if ( showNotification ) {
@@ -141,25 +142,32 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
141142 } } > registry.yaml</ Button > } severity = "info" >
142143 < Typography sx = { { width : '100%' } } > You have some prompts registered which are not available in the catalog.</ Typography >
143144 </ 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 = { ( ) => {
150157 client . host . openExternal ( 'https://vonwig.github.io/prompts.docs/tools/docs/' ) ;
151158 } } > ⇱ 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 = { ( ) => {
153160 client . host . openExternal ( 'https://github.com/docker/labs-ai-tools-for-devs' ) ;
154161 } } > ⇱ 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 } >
156163 < Badge { ...settingsBadgeProps } >
157164 < Settings sx = { { fontSize : '1.5em' } } />
158165 </ Badge >
159166 </ IconButton >
160167 </ Stack >
161168 </ FormGroup >
162- < Grid2 container spacing = { 2 } width = '100%' maxWidth = { 1000 } >
169+
170+ { tab === 0 && < Grid2 container spacing = { 2 } width = '100%' maxWidth = { 1000 } >
163171 { filteredCatalogItems . map ( ( item ) => (
164172 < Grid2 size = { { xs : 12 , sm : 6 , md : 4 } } key = { item . name } >
165173 < CatalogItemCard
@@ -185,7 +193,16 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
185193 </ CardContent >
186194 </ Card >
187195 </ 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 > }
189206 </ Stack >
190207 ) ;
191208} ;
0 commit comments