From 09c763f82d7da739e7a5bf6aa459525ac9a95c0b Mon Sep 17 00:00:00 2001 From: Patrick Skillen Date: Tue, 2 Jun 2026 14:38:18 +0100 Subject: [PATCH] fix(ui): MC channel editor hashtag labels and type suffix Show #hashtag names when constellation channels return mc_channel_type as integer 2, and append muted PUBLIC/HASHTAG in the dual-list editor. Relates to meshflow-api#379 --- .../nodes/McChannelNameWithType.tsx | 13 +++++ .../nodes/MeshCoreChannelEditor.tsx | 22 ++++---- src/lib/mc-channel-editor.test.ts | 25 +++++++++ src/lib/mc-channel-editor.ts | 55 ++++++++++++++++-- src/lib/message-channels.test.ts | 24 +++++++- src/lib/message-channels.ts | 56 +++++++++++++++++-- src/lib/models.ts | 2 +- 7 files changed, 173 insertions(+), 24 deletions(-) create mode 100644 src/components/nodes/McChannelNameWithType.tsx diff --git a/src/components/nodes/McChannelNameWithType.tsx b/src/components/nodes/McChannelNameWithType.tsx new file mode 100644 index 0000000..26a5d2b --- /dev/null +++ b/src/components/nodes/McChannelNameWithType.tsx @@ -0,0 +1,13 @@ +import type { McChannelRowDisplay } from '@/lib/mc-channel-editor'; + +type McChannelNameWithTypeProps = McChannelRowDisplay; + +/** Channel name with muted PUBLIC / HASHTAG suffix (MeshCore channel editor lists). */ +export function McChannelNameWithType({ label, typeLabel }: McChannelNameWithTypeProps) { + return ( + + {label} + {typeLabel ? {typeLabel} : null} + + ); +} diff --git a/src/components/nodes/MeshCoreChannelEditor.tsx b/src/components/nodes/MeshCoreChannelEditor.tsx index 3aaa77d..23a005c 100644 --- a/src/components/nodes/MeshCoreChannelEditor.tsx +++ b/src/components/nodes/MeshCoreChannelEditor.tsx @@ -14,16 +14,18 @@ import { import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { useConstellationChannels } from '@/hooks/api/useConstellations'; import { useMeshtasticApi } from '@/hooks/api/useApi'; -import { filterChannelsForProtocol, formatMessageChannelLabel } from '@/lib/message-channels'; +import { filterChannelsForProtocol } from '@/lib/message-channels'; import { assignedFromFeeder, + assignedMcChannelRowDisplay, assignedOrderKey, assignedToApplyEntries, - formatAssignedMcChannelLabel, + messageChannelRowDisplay, newDraftChannel, reorderAssigned, type AssignedMcChannel, } from '@/lib/mc-channel-editor'; +import { McChannelNameWithType } from '@/components/nodes/McChannelNameWithType'; import type { OwnedManagedNode } from '@/lib/models'; import { cn } from '@/lib/utils'; @@ -183,7 +185,7 @@ export function MeshCoreChannelEditor({ node, open, onOpenChange }: MeshCoreChan className="flex w-full items-center justify-between gap-2 rounded-md border border-transparent px-3 py-2.5 text-left text-sm hover:bg-muted/80 active:bg-muted" onClick={() => assignFromCatalog(ch.id)} > - {formatMessageChannelLabel(ch)} + @@ -267,11 +269,9 @@ export function MeshCoreChannelEditor({ node, open, onOpenChange }: MeshCoreChan className="flex items-center gap-1 rounded-md border border-border bg-card pl-2 pr-1 py-1" > {index} - - {formatAssignedMcChannelLabel(row, catalog, feederSnapshots)} - {row.draft ? ( - (new) - ) : null} + + + {row.draft ? (new) : null}