Skip to content
This repository was archived by the owner on Sep 28, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions App/frontend-app/src/components/filter/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ interface FilterProps {
onFilterCleared: () => void; // New prop to notify parent that filters have been cleared
}

const formatLabel = (label: string): string => {
return label
.replace(/_/g, ' ')
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
.replace(/\s+/g, ' ')
.trim()
.replace(/^./, str => str.toUpperCase());
}

export function Filter({
className,
keywordFilterInfo = {},
Expand Down Expand Up @@ -142,9 +152,9 @@ export function Filter({
openItems={openItems}
onToggle={handleAccordionToggle}
>
{keywordFilterInfo && Object.entries(keywordFilterInfo).slice(0,10).map(([category, keywords], index) => (
{keywordFilterInfo && Object.entries(keywordFilterInfo).map(([category, keywords], index) => (
Comment thread
Ayaz-Microsoft marked this conversation as resolved.
<AccordionItem key={index} value={index.toString()}>
<AccordionHeader inline>{category}</AccordionHeader>
<AccordionHeader inline>{formatLabel(category)}</AccordionHeader>
<AccordionPanel className={classes.accordionPanel}>
{keywords.map((keyword, keywordIndex) => {
const isChecked = selectedKeywords[category]?.includes(keyword) || false;
Expand Down