Material-Specific UI Components
This document describes the material-specific UI components implemented in the platform. These components ensure consistent filtering of metadata fields by material type and provide visual indicators for material types.
Overview
The material-specific UI components consist of the following:
- MaterialTypeSelector: A dropdown selector for material types with icons and descriptions
- MaterialTypeIndicator: A chip component that indicates the material type with an icon and color
- MetadataFieldFilter: A filter component for metadata fields with material type filtering
- Enhanced MetadataFieldManager: An updated manager component that uses material-specific filtering
Material Type Selector
The MaterialTypeSelector
component provides a consistent way to select material types across the platform.
Features
- Material type options with icons and descriptions
- Consistent styling and behavior
- Support for required/optional states
- Support for disabled state
- Support for different sizes
Usage
import MaterialTypeSelector, from '../../components/common/MaterialTypeSelector';
// In your component
const [materialType, setMaterialType] = useState<MaterialType>('all');
// In your JSX
<MaterialTypeSelector
value=
onChange=
label="Material Type"
required
showDescription
/>
Material Type Indicator
The MaterialTypeIndicator
component provides a visual indicator for material types.
Features
- Consistent color coding for different material types
- Icons that represent each material type
- Tooltips with descriptions
- Support for different sizes
Usage
import MaterialTypeIndicator, from './MaterialTypeIndicator';
// In your JSX
<MaterialTypeIndicator
materialType=
size="small"
/>
Metadata Field Filter
The MetadataFieldFilter
component provides a consistent way to filter metadata fields by material type, field type, and search term.
Features
- Search by name or description
- Filter by field type
- Filter by material type
- Consistent styling and behavior
Usage
import MetadataFieldFilter, from './MetadataFieldFilter';
// In your component
const [filterOptions, setFilterOptions] = useState<MetadataFieldFilterOptions>({
searchTerm: '',
fieldType: 'all',
materialType: 'all',
isActive: true
});
// In your JSX
<MetadataFieldFilter
filterOptions=
onFilterChange=
/>
Enhanced Metadata Field Manager
The MetadataFieldManager
component has been enhanced to use material-specific filtering and indicators.
Features
- Filter metadata fields by material type
- Visual indicators for material types
- Consistent material type selection in the edit dialog
- Improved user experience with clear filtering options
Material Type Categories
The platform supports the following material types:
- Tile: Ceramic, porcelain, mosaic, and other tile materials
- Wood: Hardwood, engineered wood, laminate, and other wood materials
- Lighting: Lamps, fixtures, and other lighting products
- Furniture: Chairs, tables, sofas, and other furniture
- Decoration: Decorative items like vases, artwork, and rugs
- All: Common fields applicable to all material types
Each material type has a specific color and icon for consistent visual identification across the platform.
Integration with Other Components
The material-specific UI components are designed to integrate with other components in the platform:
- OCR Processing: The material type detection in OCR processing uses the same material types as the UI components
- ML Training: The material-specific ML training uses the same material types for filtering metadata fields
- Admin Dashboard: The admin dashboard uses material type indicators to show which material type each field belongs to
This integration ensures a consistent user experience across the platform.
Future Enhancements
Planned enhancements for the material-specific UI components:
- Material Type Management: Add a UI for managing material types and their properties
- Material Type Hierarchy: Implement a hierarchical structure for material types
- Material Type Relationships: Add support for relationships between material types
- Material Type Statistics: Add statistics about metadata fields by material type
- Material Type Validation: Add validation rules specific to each material type