Skip to content

Commit 4111daa

Browse files
committed
feat: migrate event filtering from mode-based to allow unregistered kinds system
BREAKING CHANGE: Removes blacklist/whitelist mode selector in favor of simpler toggle - Remove mode field from EventFilteringConfig interface - Add allow_unregistered_kinds and registered_kinds fields - Replace mode selector UI with 'Allow Unregistered Kind Numbers' toggle - Add warning display when unregistered kinds are allowed - Refactor useRelaySettings hook to handle new backend structure - Simplify KindsList component (removed unused props) - Update DynamicKindsList to show registration status - Update Desktop and Mobile layouts with new toggle - Remove all mode-related logic throughout codebase - Add translations for new UI elements This aligns the frontend with backend changes that simplify event filtering by using a single toggle to control acceptance of unknown event types, while registered kinds can be individually enabled/disabled.
1 parent 04fbb12 commit 4111daa

2 files changed

Lines changed: 6 additions & 30 deletions

File tree

src/components/relay-settings/sections/KindsSection/KindsSection.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ export const KindsSection: React.FC<KindsSectionProps> = ({
5151
</div>
5252

5353
<KindsList
54-
allowUnregisteredKinds={allowUnregisteredKinds}
55-
registeredKinds={registeredKinds}
5654
selectedKinds={selectedKinds}
5755
isKindsActive={isKindsActive}
5856
onKindsChange={onKindsChange}

src/components/relay-settings/sections/KindsSection/components/KindsList.tsx

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ import { useAppSelector } from '@app/hooks/reduxHooks';
99
import { useTranslation } from 'react-i18next';
1010

1111
interface KindsListProps {
12-
allowUnregisteredKinds: boolean;
13-
registeredKinds: number[];
1412
selectedKinds: string[];
1513
isKindsActive: boolean;
1614
onKindsChange: (values: string[]) => void;
1715
}
1816

1917
export const KindsList: React.FC<KindsListProps> = ({
20-
allowUnregisteredKinds,
21-
registeredKinds,
2218
selectedKinds,
2319
isKindsActive,
2420
onKindsChange,
@@ -31,22 +27,9 @@ export const KindsList: React.FC<KindsListProps> = ({
3127
notes: noteOptions.filter((note) => note.category === category.id),
3228
}));
3329

34-
// Helper to check if a kind is registered
35-
const isRegisteredKind = (kindNumber: number) => {
36-
return registeredKinds.includes(kindNumber);
37-
};
38-
39-
// Helper to get status icon for a kind
40-
const getKindStatusIcon = (kindNumber: number, isSelected: boolean) => {
41-
const isRegistered = isRegisteredKind(kindNumber);
42-
43-
if (isRegistered) {
44-
return isSelected ? '✅' : '❌';
45-
} else {
46-
return allowUnregisteredKinds ? '⚠️' : '🚫';
47-
}
48-
};
49-
30+
// All kinds in our list are registered kinds (we know about them)
31+
// The checkbox state determines if they're enabled or disabled
32+
5033
return (
5134
<BaseCheckbox.Group
5235
className="large-label"
@@ -59,30 +42,25 @@ export const KindsList: React.FC<KindsListProps> = ({
5942
<h3 className="checkboxHeader w-full">{group.name}</h3>
6043
<div className="custom-checkbox-group grid-checkbox-group large-label">
6144
{group.notes.map((note) => {
62-
const isRegistered = isRegisteredKind(note.kind);
6345
const isSelected = selectedKinds.includes(note.kindString);
64-
const statusIcon = getKindStatusIcon(note.kind, isSelected);
6546

6647
return (
6748
<div className="checkbox-container" style={{ paddingLeft: '1rem' }} key={note.kindString}>
68-
<span style={{ marginRight: '0.5rem', fontSize: '1.2em' }}>{statusIcon}</span>
6949
<BaseCheckbox
7050
value={note.kindString}
71-
disabled={!isKindsActive || !isRegistered}
51+
disabled={!isKindsActive}
7252
/>
7353
<S.CheckboxLabel
74-
isActive={isKindsActive && isRegistered}
54+
isActive={isKindsActive}
7555
style={{
7656
paddingRight: '.8rem',
7757
paddingLeft: '.8rem',
78-
color: isRegistered ? themeObject[theme].textMain : themeObject[theme].textSecondary,
79-
opacity: isRegistered ? 1 : 0.6
58+
color: themeObject[theme].textMain
8059
}}
8160
>
8261
{t(`kind${note.kind}`)} - {' '}
8362
<span style={{ fontWeight: 'normal' }}>
8463
{note.description}
85-
{!isRegistered && <em> (Unregistered)</em>}
8664
</span>
8765
</S.CheckboxLabel>
8866
</div>

0 commit comments

Comments
 (0)