Skip to content

Commit 5166a7b

Browse files
committed
feat: add visual status indicators to relay settings components
- Add ✅/❌ indicators to event kinds to show selection status - Add ✅/⚠️/❌ indicators to dynamic kinds based on registration and selection - Add ✅/❌ indicators to media type extensions (photo, video, audio) - Add ✅/❌ indicators to network protocol options - Improve visual consistency across all relay settings sections - Make selection status immediately visible for better UX
1 parent e345331 commit 5166a7b

4 files changed

Lines changed: 64 additions & 17 deletions

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ export const DynamicKindsList: React.FC<DynamicKindsListProps> = ({
5151
>
5252
{dynamicKinds.map((kind) => {
5353
const isRegistered = isDynamicKindRegistered(kind);
54-
const statusIcon = isRegistered ? '✅' : (allowUnregisteredKinds ? '⚠️' : '🚫');
54+
const isSelected = selectedDynamicKinds.includes(kind);
55+
56+
// Show status based on registration and selection
57+
let statusIcon;
58+
if (isSelected) {
59+
statusIcon = isRegistered ? '✅' : '⚠️'; // Selected: green check for registered, warning for unregistered
60+
} else {
61+
statusIcon = '❌'; // Not selected: red X
62+
}
5563

5664
return (
5765
<div

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,20 @@ export const KindsList: React.FC<KindsListProps> = ({
4343
<div className="custom-checkbox-group grid-checkbox-group large-label">
4444
{group.notes.map((note) => {
4545
const isSelected = selectedKinds.includes(note.kindString);
46+
const statusIcon = isSelected ? '✅' : '❌';
4647

4748
return (
48-
<div className="checkbox-container" style={{ paddingLeft: '1rem' }} key={note.kindString}>
49+
<div
50+
className="checkbox-container"
51+
style={{
52+
paddingLeft: '1rem',
53+
display: 'flex',
54+
alignItems: 'center',
55+
gap: '0.5rem'
56+
}}
57+
key={note.kindString}
58+
>
59+
<span style={{ fontSize: '1.2em', minWidth: '1.5rem' }}>{statusIcon}</span>
4960
<BaseCheckbox
5061
value={note.kindString}
5162
disabled={!isKindsActive}

src/components/relay-settings/sections/MediaSection/components/MediaTypeList.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,27 @@ export const MediaTypeList: React.FC<MediaTypeListProps> = ({
2626
}) => {
2727
const theme = useAppSelector((state) => state.theme.theme);
2828

29-
const options = formats.map((format) => ({
30-
label: (
31-
<S.CheckboxLabel
32-
style={{
33-
color: themeObject[theme].textMain
34-
}}
35-
isActive={true}
36-
>
37-
{format.ext.toUpperCase()}
38-
</S.CheckboxLabel>
39-
),
40-
value: format.mime
41-
}));
29+
const options = formats.map((format) => {
30+
const isSelected = selectedFormats.includes(format.mime);
31+
const statusIcon = isSelected ? '✅' : '❌';
32+
33+
return {
34+
label: (
35+
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
36+
<span style={{ fontSize: '1.2em', minWidth: '1.5rem' }}>{statusIcon}</span>
37+
<S.CheckboxLabel
38+
style={{
39+
color: themeObject[theme].textMain
40+
}}
41+
isActive={true}
42+
>
43+
{format.ext.toUpperCase()}
44+
</S.CheckboxLabel>
45+
</div>
46+
),
47+
value: format.mime
48+
};
49+
});
4250

4351
return (
4452
<BaseCheckbox.Group

src/components/relay-settings/sections/NetworkSection/components/ProtocolSelect.tsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,28 @@ export const ProtocolSelect: React.FC<ProtocolSelectProps> = ({
2323
</S.LabelSpan>
2424
<Checkbox.Group
2525
options={[
26-
{ label: 'WebSocket', value: 'WebSocket', style: { fontSize: '.85rem' } },
27-
{ label: 'Libp2p QUIC', value: 'QUIC', style: { fontSize: '.85rem' } },
26+
{
27+
label: (
28+
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
29+
<span style={{ fontSize: '1.2em', minWidth: '1.5rem' }}>
30+
{selectedProtocols.includes('WebSocket') ? '✅' : '❌'}
31+
</span>
32+
<span style={{ fontSize: '.85rem' }}>WebSocket</span>
33+
</div>
34+
),
35+
value: 'WebSocket'
36+
},
37+
{
38+
label: (
39+
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
40+
<span style={{ fontSize: '1.2em', minWidth: '1.5rem' }}>
41+
{selectedProtocols.includes('QUIC') ? '✅' : '❌'}
42+
</span>
43+
<span style={{ fontSize: '.85rem' }}>Libp2p QUIC</span>
44+
</div>
45+
),
46+
value: 'QUIC'
47+
},
2848
]}
2949
value={selectedProtocols}
3050
className="custom-checkbox-group"

0 commit comments

Comments
 (0)