import type { DeviceModel } from '@seamapi/types/devicedb' import { useMemo } from 'react' import { SupportedDeviceManufacturerSection } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js' import { type DeviceModelFilters, useFilteredDeviceModels, } from 'lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js' import { Button } from 'lib/ui/Button.js' interface SupportedDeviceContentProps { filterValue: string resetFilterValue: () => void filters: DeviceModelFilters manufacturers: string[] | null excludedManufacturers: string[] includeIf: string[] | null excludeIf: string[] } export function SupportedDeviceContent({ resetFilterValue, filterValue, filters, manufacturers, excludedManufacturers, includeIf, excludeIf, }: SupportedDeviceContentProps): JSX.Element | null { const { deviceModels, isPending, isError, refetch } = useFilteredDeviceModels( { filterValue, filters, manufacturers, excludedManufacturers, includeIf, excludeIf, } ) const groupedDeviceModels = useMemo( () => groupDeviceModelsByManufacturer(deviceModels ?? []), [deviceModels] ) if (isPending) { return (
{t.loading}
{t.error}
{t.noMatch}
> ) return ({t.noneFound}
: noMatchingRows}