Skip to content

Commit e4ec22e

Browse files
authored
Merge pull request #157 from docker/remove-sorting-component
Remove sorting component
2 parents a886301 + a8d8781 commit e4ec22e

File tree

1 file changed

+5
-49
lines changed

1 file changed

+5
-49
lines changed

src/extension/ui/src/components/CatalogGrid.tsx

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React, { Suspense, useEffect, useState } from 'react';
2-
import { IconButton, Alert, AlertTitle, Stack, Button, Typography, FormGroup, FormControlLabel, Dialog, DialogTitle, DialogContent, Checkbox, Badge, TextField, Tabs, Tab, CircularProgress, Box, Menu, Divider, Switch, MenuItem } from '@mui/material';
3-
import { SwapVert, FolderOpenRounded } from '@mui/icons-material';
41
import { createDockerDesktopClient } from '@docker/extension-api-client';
52
import { ExecResult } from '@docker/extension-api-client-types/dist/v0';
6-
import YourClients from './tabs/YourClients';
7-
import { CatalogItemRichened } from '../types/catalog';
3+
import { FolderOpenRounded } from '@mui/icons-material';
4+
import { Alert, AlertTitle, Badge, Box, Button, Checkbox, CircularProgress, Dialog, DialogContent, DialogTitle, FormControlLabel, FormGroup, Stack, Switch, Tab, Tabs, TextField, Typography } from '@mui/material';
5+
import React, { Suspense, useEffect, useState } from 'react';
86
import { CATALOG_LAYOUT_SX } from '../Constants';
97
import { MCPClientState } from '../MCPClients';
8+
import { CatalogItemRichened } from '../types/catalog';
9+
import YourClients from './tabs/YourClients';
1010

1111
const ToolCatalog = React.lazy(() => import('./tabs/ToolCatalog'));
1212

@@ -42,11 +42,6 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
4242
const [search, setSearch] = useState<string>('');
4343
const [tab, setTab] = useState<number>(0);
4444
const [ddVersion, setDdVersion] = useState<{ version: string, build: number } | null>(null);
45-
const [openMenus, setOpenMenus] = useState<{ [key: string]: { anchorEl: HTMLElement | null, open: boolean } }>({
46-
'demo-customized-menu': { anchorEl: null, open: false }
47-
});
48-
49-
const [sort, setSort] = useState<'name-asc' | 'name-desc' | 'date-asc' | 'date-desc'>('date-desc');
5045
const [showMine, setShowMine] = useState<boolean>(localStorage.getItem('showMine') === 'true');
5146

5247
const loadDDVersion = async () => {
@@ -134,51 +129,12 @@ export const CatalogGrid: React.FC<CatalogGridProps> = ({
134129
<FormGroup>
135130
<Stack direction="row" spacing={1} alignItems='center' justifyContent="space-evenly">
136131
<TextField label="Search" sx={{ width: 380 }} value={search} onChange={(e) => setSearch(e.target.value)} />
137-
<IconButton
138-
id="demo-customized-button"
139-
aria-controls={openMenus['demo-customized-menu'] ? 'demo-customized-menu' : undefined}
140-
aria-haspopup="true"
141-
aria-expanded={openMenus['demo-customized-menu'] ? 'true' : undefined}
142-
onClick={(e) => setOpenMenus({ ...openMenus, 'demo-customized-menu': { anchorEl: e.currentTarget, open: !openMenus['demo-customized-menu'].open } })}
143-
>
144-
<SwapVert />
145-
</IconButton>
146132
<FormControlLabel control={<Switch checked={showMine} onChange={(e) => {
147133
setShowMine(e.target.checked)
148134
localStorage.setItem('showMine', e.target.checked.toString())
149135
}} />} label="Show only enabled tools" />
150136
</Stack>
151137
</FormGroup>
152-
153-
<Menu
154-
id="demo-customized-menu"
155-
MenuListProps={{
156-
'aria-labelledby': 'demo-customized-button',
157-
}}
158-
anchorEl={openMenus['demo-customized-menu'].anchorEl || undefined}
159-
open={openMenus['demo-customized-menu'].open}
160-
onClose={() => setOpenMenus({ ...openMenus, 'demo-customized-menu': { anchorEl: null, open: false } })}
161-
>
162-
<MenuItem sx={{ fontWeight: sort === 'date-desc' ? 'bold' : 'normal' }} onClick={() => {
163-
setOpenMenus({ ...openMenus, 'demo-customized-menu': { anchorEl: null, open: false } })
164-
setSort('date-desc')
165-
}} disableRipple>
166-
⏰ Most Recent
167-
</MenuItem>
168-
<Divider sx={{ my: 0.5 }} />
169-
<MenuItem sx={{ fontWeight: sort === 'name-asc' ? 'bold' : 'normal' }} onClick={() => {
170-
setOpenMenus({ ...openMenus, 'demo-customized-menu': { anchorEl: null, open: false } })
171-
setSort('name-asc')
172-
}} disableRipple>
173-
Name (A-Z)
174-
</MenuItem>
175-
<MenuItem sx={{ fontWeight: sort === 'name-desc' ? 'bold' : 'normal' }} onClick={() => {
176-
setOpenMenus({ ...openMenus, 'demo-customized-menu': { anchorEl: null, open: false } })
177-
setSort('name-desc')
178-
}} disableRipple>
179-
Name (Z-A)
180-
</MenuItem>
181-
</Menu>
182138
</Stack>
183139
}
184140

0 commit comments

Comments
 (0)