Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat(rule): rules filter (#672)

Paulo Henriquebf426a0114ac
diff --git a/frontend/src/lib/rule-match-utils.test.ts b/frontend/src/lib/rule-match-utils.test.ts
index 6ed048c7..71103711 100644
--- a/frontend/src/lib/rule-match-utils.test.ts
+++ b/frontend/src/lib/rule-match-utils.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest'
-import { normalizeRuleMatchValue } from './rule-match-utils'
+import { normalizeRuleMatchValue, ruleSearchText } from './rule-match-utils'
+import type { Category, Rule } from '../types'
describe('normalizeRuleMatchValue', () => {
it('normalizes case, whitespace, and accents for duplicate checks', () => {
@@ -8,3 +9,50 @@ describe('normalizeRuleMatchValue', () => {
expect(normalizeRuleMatchValue('Niño')).toBe(normalizeRuleMatchValue('nino'))
})
})
+
+const category: Category = {
+ id: 'cat-1',
+ user_id: 'user-1',
+ group_id: null,
+ name: 'Alimentação',
+ icon: '🍔',
+ color: '#F59E0B',
+ is_system: false,
+ is_hidden: false,
+ treat_as_transfer: false,
+ is_ignored: false,
+}
+
+const rule: Rule = {
+ id: 'rule-1',
+ user_id: 'user-1',
+ name: 'Delivery',
+ conditions_op: 'or',
+ conditions: [
+ { field: 'description', op: 'contains', value: 'IFOOD' },
+ { op: 'or', conditions: [{ field: 'description', op: 'contains', value: 'Rappi' }] },
+ ],
+ actions: [{ op: 'set_category', value: 'cat-1' }],
+ priority: 0,
+ is_active: true,
+}
+
+describe('ruleSearchText', () => {
+ it('covers the name, condition values inside groups, and the assigned category', () => {
+ const text = ruleSearchText(rule, [category])
+ expect(text).toContain('DELIVERY')
+ expect(text).toContain('IFOOD')
+ // Values nested in an AND/OR group are searchable too.
+ expect(text).toContain('RAPPI')
+ // Accents are stripped, so "alimentacao" finds it.
+ expect(text).toContain('ALIMENTACAO')
+ })
+
+ it('ignores actions other than set_category and unknown category ids', () => {
+ const noisy: Rule = {
+ ...rule,
+ actions: [{ op: 'append_notes', value: '#tag' }, { op: 'set_category', value: 'missing' }],
+ }
+ expect(ruleSearchText(noisy, [category])).toBe('DELIVERY IFOOD RAPPI ')
+ })
+})
diff --git a/frontend/src/lib/rule-match-utils.ts b/frontend/src/lib/rule-match-utils.ts
index 70722cda..d94eeccf 100644
--- a/frontend/src/lib/rule-match-utils.ts
+++ b/frontend/src/lib/rule-match-utils.ts
@@ -1,3 +1,6 @@
+import { flattenConditions } from './rule-conditions'
+import type { Category, Rule } from '../types'
+
export function normalizeRuleMatchValue(value: string | number): string {
return String(value ?? '')
.trim()
@@ -5,3 +8,19 @@ export function normalizeRuleMatchValue(value: string | number): string {
.normalize('NFKD')
.replace(/[\u0300-\u036f]/g, '')
}
+
+/** The text a rule is searchable by: its name, the values it matches on, and
+ * the categories it assigns — so typing "uber" finds the rule whose condition
+ * value is UBER, not just one named after it. Normalized the same way as
+ * {@link normalizeRuleMatchValue}, so the query can be compared against it
+ * case- and accent-insensitively. */
+export function ruleSearchText(rule: Rule, categories: Category[]): string {
+ const categoryNames = rule.actions
+ .filter(a => a.op === 'set_category')
+ .map(a => categories.find(c => c.id === a.value)?.name ?? '')
+ return [
+ rule.name,
+ ...flattenConditions(rule.conditions).map(c => String(c.value ?? '')),
+ ...categoryNames,
+ ].map(normalizeRuleMatchValue).join(' ')
+}
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index fd2bf087..5f3e8f45 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -1106,6 +1106,13 @@
"confirmDeleteDescription": "Die wiederkehrende Transaktion \"{{description}}\" wird dauerhaft gelöscht. Vorhandene Transaktionen bleiben bestehen, verlieren jedoch ihre Verknüpfung zur wiederkehrenden Transaktion. Diese Aktion kann nicht rückgängig gemacht werden."
},
"rules": {
+ "searchPlaceholder": "Regeln suchen...",
+ "filterAllCategories": "Alle Kategorien",
+ "filterAllStatuses": "Alle Status",
+ "filterActiveOnly": "Nur aktive",
+ "filterInactiveOnly": "Nur inaktive",
+ "filterAllActions": "Alle Aktionen",
+ "noFilterResults": "Keine Regel entspricht diesen Filtern",
"preview": "Vorschau",
"previewMatched": "{{matched}} Treffer",
"previewSummary": "{{matched}} passende Transaktionen · {{changed}} würden geändert",
diff --git a/frontend/src/locales/el.json b/frontend/src/locales/el.json
index a773a1b6..b110f451 100644
--- a/frontend/src/locales/el.json
+++ b/frontend/src/locales/el.json
@@ -1105,6 +1105,13 @@
"confirmDeleteDescription": "Ο ορισμός της επαναλαμβανόμενης συναλλαγής \"{{description}}\" θα διαγραφεί οριστικά. Οι υπάρχουσες συναλλαγές θα παραμείνουν αλλά θα χάσουν τη σύνδεσή τους. Αυτή η ενέργεια δεν μπορεί να αναιρεθεί."
},
"rules": {
+ "searchPlaceholder": "Αναζήτηση κανόνων...",
+ "filterAllCategories": "Όλες οι κατηγορίες",
+ "filterAllStatuses": "Όλες οι καταστάσεις",
+ "filterActiveOnly": "Μόνο ενεργοί",
+ "filterInactiveOnly": "Μόνο ανενεργοί",
+ "filterAllActions": "Όλες οι ενέργειες",
+ "noFilterResults": "Κανένας κανόνας δεν ταιριάζει με αυτά τα φίλτρα",
"preview": "Προεπισκόπηση",
"previewMatched": "{{matched}} αντιστοιχίσεις",
"previewSummary": "{{matched}} αντίστοιχες συναλλαγές · {{changed}} θα άλλαζαν",
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index e414800c..13de2664 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -1105,6 +1105,13 @@
"confirmDeleteDescription": "The recurring definition \"{{description}}\" will be permanently deleted. Existing transactions will remain but lose their recurring link. This action cannot be undone."
},
"rules": {
+ "searchPlaceholder": "Search rules...",
+ "filterAllCategories": "All categories",
+ "filterAllStatuses": "All statuses",
+ "filterActiveOnly": "Active only",
+ "filterInactiveOnly": "Inactive only",
+ "filterAllActions": "All actions",
+ "noFilterResults": "No rule matches these filters",
"preview": "Preview",
"previewMatched": "{{matched}} matches",
"previewSummary": "{{matched}} matching transactions · {{changed}} would change",
diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json
index dcf76370..0862748c 100644
--- a/frontend/src/locales/es.json
+++ b/frontend/src/locales/es.json
@@ -1106,6 +1106,13 @@
"confirmDeleteDescription": "La definición recurrente \"{{description}}\" se eliminará permanentemente. Las transacciones existentes permanecerán, pero perderán su vínculo recurrente. Esta acción no se puede deshacer."
},
"rules": {
+ "searchPlaceholder": "Buscar reglas...",
+ "filterAllCategories": "Todas las categorías",
+ "filterAllStatuses": "Todos los estados",
+ "filterActiveOnly": "Solo activas",
+ "filterInactiveOnly": "Solo inactivas",
+ "filterAllActions": "Todas las acciones",
+ "noFilterResults": "Ninguna regla coincide con estos filtros",
"preview": "Vista previa",
"previewMatched": "{{matched}} coincidencias",
"previewSummary": "{{matched}} transacciones coinciden · {{changed}} cambiarían",
diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json
index 5b4226d1..63caf1b4 100644
--- a/frontend/src/locales/fr.json
+++ b/frontend/src/locales/fr.json
@@ -1106,6 +1106,13 @@
"confirmDeleteDescription": "La définition récurrente « {{description}} » sera définitivement supprimée. Les transactions existantes resteront, mais perdront leur lien récurrent. Cette action est irréversible."
},
"rules": {
+ "searchPlaceholder": "Rechercher des règles...",
+ "filterAllCategories": "Toutes les catégories",
+ "filterAllStatuses": "Tous les statuts",
+ "filterActiveOnly": "Actives uniquement",
+ "filterInactiveOnly": "Inactives uniquement",
+ "filterAllActions": "Toutes les actions",
+ "noFilterResults": "Aucune règle ne correspond à ces filtres",
"preview": "Aperçu",
"previewMatched": "{{matched}} correspondances",
"previewSummary": "{{matched}} transactions correspondent · {{changed}} seraient modifiées",
diff --git a/frontend/src/locales/it.json b/frontend/src/locales/it.json
index 298a0c93..65821329 100644
--- a/frontend/src/locales/it.json
+++ b/frontend/src/locales/it.json
@@ -1106,6 +1106,13 @@
"confirmDeleteDescription": "La definizione ricorrente \"{{description}}\" verrà eliminata definitivamente. Le transazioni esistenti rimarranno, ma perderanno il collegamento ricorrente. Questa azione non può essere annullata."
},
"rules": {
+ "searchPlaceholder": "Cerca regole...",
+ "filterAllCategories": "Tutte le categorie",
+ "filterAllStatuses": "Tutti gli stati",
+ "filterActiveOnly": "Solo attive",
+ "filterInactiveOnly": "Solo inattive",
+ "filterAllActions": "Tutte le azioni",
+ "noFilterResults": "Nessuna regola corrisponde a questi filtri",
"preview": "Anteprima",
"previewMatched": "{{matched}} corrispondenze",
"previewSummary": "{{matched}} transazioni corrispondono · {{changed}} verrebbero modificate",
diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json
index 22d05d29..c2ddd357 100644
--- a/frontend/src/locales/nl.json
+++ b/frontend/src/locales/nl.json
@@ -1107,6 +1107,13 @@
"confirmDeleteDescription": "De terugkerende definitie \"{{description}}\" wordt permanent verwijderd. Bestaande transacties blijven bestaan, maar verliezen hun koppeling met de terugkerende transactie. Deze actie kan niet ongedaan worden gemaakt."
},
"rules": {
+ "searchPlaceholder": "Regels zoeken...",
+ "filterAllCategories": "Alle categorieën",
+ "filterAllStatuses": "Alle statussen",
+ "filterActiveOnly": "Alleen actief",
+ "filterInactiveOnly": "Alleen inactief",
+ "filterAllActions": "Alle acties",
+ "noFilterResults": "Geen regel voldoet aan deze filters",
"preview": "Voorbeeld",
"previewMatched": "{{matched}} overeenkomsten",
"previewSummary": "{{matched}} overeenkomende transacties · {{changed}} zouden wijzigen",
diff --git a/frontend/src/locales/pl.json b/frontend/src/locales/pl.json
index a157e7be..23df1958 100644
--- a/frontend/src/locales/pl.json
+++ b/frontend/src/locales/pl.json
@@ -1159,6 +1159,13 @@
"confirmDeleteDescription": "Definicja transakcji cyklicznej „{{description}}” zostanie trwale usunięta. Istniejące transakcje pozostaną, ale utracą powiązanie z transakcją cykliczną. Tej operacji nie można cofnąć."
},
"rules": {
+ "searchPlaceholder": "Szukaj reguł...",
+ "filterAllCategories": "Wszystkie kategorie",
+ "filterAllStatuses": "Wszystkie statusy",
+ "filterActiveOnly": "Tylko aktywne",
+ "filterInactiveOnly": "Tylko nieaktywne",
+ "filterAllActions": "Wszystkie akcje",
+ "noFilterResults": "Żadna reguła nie pasuje do tych filtrów",
"preview": "Podgląd",
"previewMatched": "dopasowania: {{matched}}",
"previewSummary": "pasujące transakcje: {{matched}} · zmieniłoby się: {{changed}}",
diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.json
index 53e5d88a..fe89d08b 100644
--- a/frontend/src/locales/pt-BR.json
+++ b/frontend/src/locales/pt-BR.json
@@ -1106,6 +1106,13 @@
"confirmDeleteDescription": "A definição recorrente \"{{description}}\" será excluída permanentemente. As transações existentes permanecerão, mas perderão o vínculo recorrente. Esta ação não pode ser desfeita."
},
"rules": {
+ "searchPlaceholder": "Buscar regras...",
+ "filterAllCategories": "Todas as categorias",
+ "filterAllStatuses": "Todos os status",
+ "filterActiveOnly": "Somente ativas",
+ "filterInactiveOnly": "Somente inativas",
+ "filterAllActions": "Todas as ações",
+ "noFilterResults": "Nenhuma regra corresponde a estes filtros",
"preview": "Pré-visualizar",
"previewMatched": "{{matched}} correspondências",
"previewSummary": "{{matched}} transações correspondem · {{changed}} seriam alteradas",
diff --git a/frontend/src/locales/pt-PT.json b/frontend/src/locales/pt-PT.json
index 30a65718..73ed9065 100644
--- a/frontend/src/locales/pt-PT.json
+++ b/frontend/src/locales/pt-PT.json
@@ -1106,6 +1106,13 @@
"confirmDeleteDescription": "A definição recorrente \"{{description}}\" será eliminada permanentemente. As transações existentes manter-se-ão, mas perderão a ligação recorrente. Esta ação não pode ser desfeita."
},
"rules": {
+ "searchPlaceholder": "Procurar regras...",
+ "filterAllCategories": "Todas as categorias",
+ "filterAllStatuses": "Todos os estados",
+ "filterActiveOnly": "Apenas ativas",
+ "filterInactiveOnly": "Apenas inativas",
+ "filterAllActions": "Todas as ações",
+ "noFilterResults": "Nenhuma regra corresponde a estes filtros",
"preview": "Pré-visualizar",
"previewMatched": "{{matched}} correspondências",
"previewSummary": "{{matched}} transações correspondem · {{changed}} seriam alteradas",
diff --git a/frontend/src/locales/ru.json b/frontend/src/locales/ru.json
index d0fb6d36..6b9594b5 100644
--- a/frontend/src/locales/ru.json
+++ b/frontend/src/locales/ru.json
@@ -1114,6 +1114,13 @@
"confirmDeleteDescription": "Определение регулярной транзакции «{{description}}» будет удалено навсегда. Существующие транзакции останутся, но потеряют связь с регулярной транзакцией. Это действие нельзя отменить."
},
"rules": {
+ "searchPlaceholder": "Поиск правил...",
+ "filterAllCategories": "Все категории",
+ "filterAllStatuses": "Все статусы",
+ "filterActiveOnly": "Только активные",
+ "filterInactiveOnly": "Только неактивные",
+ "filterAllActions": "Все действия",
+ "noFilterResults": "Ни одно правило не соответствует этим фильтрам",
"preview": "Предпросмотр",
"previewMatched": "совпадений: {{matched}}",
"previewSummary": "подходящих транзакций: {{matched}} · изменится: {{changed}}",
diff --git a/frontend/src/locales/sk.json b/frontend/src/locales/sk.json
index 30269495..149ba8ec 100644
--- a/frontend/src/locales/sk.json
+++ b/frontend/src/locales/sk.json
@@ -1177,6 +1177,13 @@
"confirmDeleteDescription": "Opakovaná definícia „{{description}}“ bude natrvalo vymazaná. Existujúce transakcie zostanú, ale stratia prepojenie na opakovanie. Túto akciu nie je možné vrátiť späť."
},
"rules": {
+ "searchPlaceholder": "Hľadať pravidlá...",
+ "filterAllCategories": "Všetky kategórie",
+ "filterAllStatuses": "Všetky stavy",
+ "filterActiveOnly": "Iba aktívne",
+ "filterInactiveOnly": "Iba neaktívne",
+ "filterAllActions": "Všetky akcie",
+ "noFilterResults": "Žiadne pravidlo nezodpovedá týmto filtrom",
"preview": "Náhľad",
"previewMatched": "Zhody: {{matched}}",
"previewSummary": "Zhodných transakcií: {{matched}} · zmenilo by sa: {{changed}}",
diff --git a/frontend/src/locales/uk.json b/frontend/src/locales/uk.json
index ff9d1ed2..81be511f 100644
--- a/frontend/src/locales/uk.json
+++ b/frontend/src/locales/uk.json
@@ -1114,6 +1114,13 @@
"confirmDeleteDescription": "Визначення регулярної транзакції «{{description}}» буде видалено назавжди. Наявні транзакції залишаться, але втратять зв’язок із регулярною транзакцією. Цю дію не можна скасувати."
},
"rules": {
+ "searchPlaceholder": "Пошук правил...",
+ "filterAllCategories": "Усі категорії",
+ "filterAllStatuses": "Усі статуси",
+ "filterActiveOnly": "Лише активні",
+ "filterInactiveOnly": "Лише неактивні",
+ "filterAllActions": "Усі дії",
+ "noFilterResults": "Жодне правило не відповідає цим фільтрам",
"preview": "Попередній перегляд",
"previewMatched": "збігів: {{matched}}",
"previewSummary": "відповідних транзакцій: {{matched}} · зміниться: {{changed}}",
diff --git a/frontend/src/pages/rules.tsx b/frontend/src/pages/rules.tsx
index 6426cfad..82b65e45 100644
--- a/frontend/src/pages/rules.tsx
+++ b/frontend/src/pages/rules.tsx
@@ -16,7 +16,8 @@ import {
} from '@/components/ui/dialog'
import type { Category, Payee, Rule, RuleAction, RuleCondition, RuleConditionNode, RuleExportPayload } from '@/types'
import { isConditionGroup } from '@/lib/rule-conditions'
-import { Trash2, Plus, RefreshCw, Package, Check, ArrowUpDown, ArrowUp, ArrowDown, Download, Upload } from 'lucide-react'
+import { normalizeRuleMatchValue, ruleSearchText } from '@/lib/rule-match-utils'
+import { Trash2, Plus, RefreshCw, Package, Check, ArrowUpDown, ArrowUp, ArrowDown, Download, Upload, Search } from 'lucide-react'
import { cn } from '@/lib/utils'
import { PageHeader } from '@/components/page-header'
import { useWorkspace } from '@/contexts/workspace-context'
@@ -125,6 +126,16 @@ function actionSummary(actions: RuleAction[], categories: Category[], payeesList
}).join(' ') || t('rules.noActions')
}
+const ACTION_FILTERS = [
+ { value: 'set_category', label: 'rules.setCategory' },
+ { value: 'set_description', label: 'rules.setDescription' },
+ { value: 'set_payee', label: 'rules.setPayee' },
+ { value: 'append_notes', label: 'rules.appendNotes' },
+ { value: 'ignore', label: 'rules.ignoreAction' },
+] as const
+
+const FILTER_CONTROL_CLASS = 'h-7 rounded-md border border-border bg-background px-2 text-xs text-foreground focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]'
+
export default function RulesPage() {
const { t } = useTranslation()
const queryClient = useQueryClient()
@@ -304,9 +315,38 @@ export default function RulesPage() {
const [sortBy, setSortBy] = useState<'priority' | 'name' | 'category'>('priority')
const [sortDir, setSortDir] = useState<'asc' | 'desc'>('asc')
+ const [search, setSearch] = useState('')
+ const [filterCategory, setFilterCategory] = useState('')
+ const [filterStatus, setFilterStatus] = useState<'' | 'active' | 'inactive'>('')
+ const [filterAction, setFilterAction] = useState('')
+
+ const hasFilters = !!(search || filterCategory || filterStatus || filterAction)
+
+ function clearFilters() {
+ setSearch('')
+ setFilterCategory('')
+ setFilterStatus('')
+ setFilterAction('')
+ }
+
+ const filteredRules = useMemo(() => {
+ const query = normalizeRuleMatchValue(search)
+ return (rulesList ?? []).filter(rule => {
+ // displayCategories, not categories: the row and the sort already read
+ // from it, so a rule assigning a hidden category shows that name.
+ // Searching over the visible-only list made that rule unfindable by the
+ // very name on screen.
+ if (query && !ruleSearchText(rule, displayCategories).includes(query)) return false
+ if (filterCategory && !rule.actions.some(a => a.op === 'set_category' && a.value === filterCategory)) return false
+ if (filterStatus === 'active' && !rule.is_active) return false
+ if (filterStatus === 'inactive' && rule.is_active) return false
+ if (filterAction && !rule.actions.some(a => a.op === filterAction)) return false
+ return true
+ })
+ }, [rulesList, displayCategories, search, filterCategory, filterStatus, filterAction])
const sortedRules = useMemo(() => {
- const list = [...(rulesList ?? [])]
+ const list = [...filteredRules]
const dir = sortDir === 'asc' ? 1 : -1
if (sortBy === 'name') {
return list.sort((a, b) => dir * a.name.localeCompare(b.name))
@@ -318,7 +358,7 @@ export default function RulesPage() {
return list.sort((a, b) => dir * getCategoryName(a).localeCompare(getCategoryName(b)))
}
return list.sort((a, b) => dir * (a.priority - b.priority))
- }, [rulesList, displayCategories, sortBy, sortDir])
+ }, [filteredRules, displayCategories, sortBy, sortDir])
return (
<div>
@@ -390,7 +430,57 @@ export default function RulesPage() {
) : undefined
}
/>
- <div className="px-4 sm:px-5 py-2 bg-muted/50 border-b border-border flex items-center gap-2">
+ <div className="px-4 sm:px-5 py-2 bg-muted/50 border-b border-border flex flex-wrap items-center gap-2">
+ <div className="flex min-w-[10rem] flex-1 items-center gap-1.5">
+ <Search size={14} className="pointer-events-none shrink-0 text-muted-foreground/70" />
+ <input
+ type="text"
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder={t('rules.searchPlaceholder')}
+ className="w-full min-w-0 rounded-sm bg-transparent text-xs text-foreground focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px] placeholder:text-muted-foreground/75"
+ />
+ </div>
+ <select
+ className={FILTER_CONTROL_CLASS}
+ value={filterCategory}
+ onChange={(e) => setFilterCategory(e.target.value)}
+ >
+ <option value="">{t('rules.filterAllCategories')}</option>
+ {/* displayCategories so a rule assigning a hidden category is
+ still filterable by it, matching what the row displays. */}
+ {displayCategories.map(cat => (
+ <option key={cat.id} value={cat.id}>{cat.name}</option>
+ ))}
+ </select>
+ <select
+ className={FILTER_CONTROL_CLASS}
+ value={filterStatus}
+ onChange={(e) => setFilterStatus(e.target.value as '' | 'active' | 'inactive')}
+ >
+ <option value="">{t('rules.filterAllStatuses')}</option>
+ <option value="active">{t('rules.filterActiveOnly')}</option>
+ <option value="inactive">{t('rules.filterInactiveOnly')}</option>
+ </select>
+ <select
+ className={FILTER_CONTROL_CLASS}
+ value={filterAction}
+ onChange={(e) => setFilterAction(e.target.value)}
+ >
+ <option value="">{t('rules.filterAllActions')}</option>
+ {ACTION_FILTERS.map(a => (
+ <option key={a.value} value={a.value}>{t(a.label)}</option>
+ ))}
+ </select>
+ {hasFilters && (
+ <button
+ type="button"
+ onClick={clearFilters}
+ className="h-7 rounded-md px-2 text-xs font-medium text-muted-foreground transition-colors hover:bg-background hover:text-foreground"
+ >
+ {t('transactions.clearFilters')}
+ </button>
+ )}
<span className="text-xs text-muted-foreground">{t('rules.sortLabel')}</span>
{(['priority', 'name', 'category'] as const).map(opt => (
<button
@@ -413,7 +503,7 @@ export default function RulesPage() {
</button>
))}
</div>
- {rulesList && rulesList.length > 0 ? (
+ {sortedRules.length > 0 ? (
<div className="divide-y divide-border">
{sortedRules.map((rule) => (
<div
@@ -461,7 +551,9 @@ export default function RulesPage() {
))}
</div>
) : (
- <p className="text-sm text-muted-foreground text-center py-10">{t('rules.empty')}</p>
+ <p className="text-sm text-muted-foreground text-center py-10">
+ {hasFilters ? t('rules.noFilterResults') : t('rules.empty')}
+ </p>
)}
</SectionCard>