import {useMemo} from 'react'; import styled from '@emotion/styled'; import ProjectBadge from 'sentry/components/idBadge/projectBadge'; import PanelTable from 'sentry/components/panels/panelTable'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {Project} from 'sentry/types'; import type {Threshold} from '../utils/types'; import {ThresholdGroupRows} from './thresholdGroupRows'; type Props = { allEnvironmentNames: string[]; isError: boolean; isLoading: boolean; project: Project; refetch: () => void; setTempError: (msg: string) => void; thresholds: Threshold[]; }; export default function ThresholdGroupTable({ allEnvironmentNames, isError, isLoading, project, refetch, setTempError, thresholds, }: Props) { const sortedThreshold: Threshold[] = useMemo(() => { return thresholds.sort((a, b) => { const keyA: string = a.environment ? a.environment.name : ''; const keyB: string = b.environment ? b.environment.name : ''; return keyA.localeCompare(keyB); }); }, [thresholds]); return (