From 2f7c29153bb9628062aa883a369f6430beddb082 Mon Sep 17 00:00:00 2001 From: Sascha Date: Tue, 30 Mar 2021 17:24:45 +0200 Subject: Fix pipeline fail and remove unused file --- webui/src/components/Label.tsx | 3 +- webui/src/pages/bug/labels/FilterDropdown.tsx | 144 -------------------------- 2 files changed, 1 insertion(+), 146 deletions(-) delete mode 100644 webui/src/pages/bug/labels/FilterDropdown.tsx diff --git a/webui/src/components/Label.tsx b/webui/src/components/Label.tsx index bbe7c158..e719eee0 100644 --- a/webui/src/components/Label.tsx +++ b/webui/src/components/Label.tsx @@ -8,8 +8,7 @@ import { } from '@material-ui/core/styles/colorManipulator'; import { Color } from '../gqlTypes'; - -import { LabelFragment } from './fragments.generated'; +import { LabelFragment } from '../graphql/fragments.generated'; const _rgb = (color: Color) => 'rgb(' + color.R + ',' + color.G + ',' + color.B + ')'; diff --git a/webui/src/pages/bug/labels/FilterDropdown.tsx b/webui/src/pages/bug/labels/FilterDropdown.tsx deleted file mode 100644 index 44874aaf..00000000 --- a/webui/src/pages/bug/labels/FilterDropdown.tsx +++ /dev/null @@ -1,144 +0,0 @@ -import React, { useEffect, useRef, useState } from 'react'; - -import { IconButton, MenuItem } from '@material-ui/core'; -import Menu from '@material-ui/core/Menu'; -import TextField from '@material-ui/core/TextField'; -import { makeStyles, withStyles } from '@material-ui/core/styles'; -import SettingsIcon from '@material-ui/icons/Settings'; - -const CustomTextField = withStyles((theme) => ({ - root: { - margin: '0 8px 12px 8px', - '& label.Mui-focused': { - margin: '0 2px', - color: theme.palette.text.secondary, - }, - '& .MuiInput-underline::before': { - borderBottomColor: theme.palette.divider, - }, - '& .MuiInput-underline::after': { - borderBottomColor: theme.palette.divider, - }, - }, -}))(TextField); - -const ITEM_HEIGHT = 48; - -const useStyles = makeStyles((theme) => ({ - element: { - ...theme.typography.body2, - color: theme.palette.text.secondary, - padding: theme.spacing(0, 1), - fontWeight: 400, - textDecoration: 'none', - display: 'flex', - background: 'none', - border: 'none', - }, - labelsheader: { - display: 'flex', - flexDirection: 'row', - }, -})); - -export type FilterMenuItem = { - render: (item: T) => React.ReactNode; -}; - -type FilterDropdownProps = { - items?: FilterMenuItem[]; - hasFilter?: boolean; - onFilterChange: (filter: string) => void; -} & React.ButtonHTMLAttributes; - -function FilterDropdown({ - items, - hasFilter, - onFilterChange, -}: FilterDropdownProps) { - const buttonRef = useRef(null); - const searchRef = useRef(null); - const classes = useStyles({ active: false }); - - const [open, setOpen] = useState(false); - const [filter, setFilter] = useState(''); - - useEffect(() => { - searchRef && searchRef.current && searchRef.current.focus(); - }, [filter]); - - /*function sortBySelection(x: FilterMenuItem, y: FilterMenuItem) { - if (x.isSelected() === y.isSelected()) { - return 0; - } else if (x.isSelected()) { - return -1; - } else { - return 1; - } - } - - const sortedItems = items.sort(sortBySelection);*/ - - return ( - <> -
- Labels - setOpen(!open)} - className={classes.element} - > - - -
- - { - setOpen(false); - //const selectedLabels = dropdown - // .map(([key]) => (itemActive(key) ? key : '')) - // .filter((entry) => entry !== ''); - //onClose(selectedLabels); - }} - onExited={() => setFilter('')} - anchorEl={buttonRef.current} - PaperProps={{ - style: { - maxHeight: ITEM_HEIGHT * 4.5, - width: '25ch', - }, - }} - > - {hasFilter && ( - { - const { value } = e.target; - setFilter(value); - onFilterChange(value); - }} - onKeyDown={(e) => e.stopPropagation()} - value={filter} - label={`Filter Labels`} - /> - )} - {items && - items.map((item, index) => { - return {item}; - })} - - - ); -} - -export default FilterDropdown; -- cgit