Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 4009773

Browse files
staticoclaude
andcommitted
Fix role display and add DM separator
- Handle null role values (database returns null, not undefined) - Add separator line below node info in DM conversations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent aec3223 commit 4009773

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/ui/components/DMPanel.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function DMPanel({
7777

7878
// Right panel dimensions
7979
const rightPanelWidth = width - LEFT_PANEL_WIDTH - 3; // 3 for borders/padding
80-
const chatHeight = height - 5; // 2-line header + input area
80+
const chatHeight = height - 6; // 2-line header + separator + input area
8181

8282
// Calculate scroll offset for messages
8383
const visibleMsgCount = chatHeight;
@@ -285,8 +285,8 @@ const ROLE_NAMES: Record<number, string> = {
285285
5: "Tracker", 6: "Sensor", 7: "TAK", 8: "Hidden", 9: "L&F", 10: "TAK+Trk",
286286
};
287287

288-
function formatRole(role?: number): string {
289-
if (role === undefined) return "-";
288+
function formatRole(role?: number | null): string {
289+
if (role == null) return "-";
290290
return ROLE_NAMES[role] || `R${role}`;
291291
}
292292

@@ -339,15 +339,15 @@ function NodeInfoHeader({ nodeNum, nodeStore, deleteConfirm }: NodeInfoHeaderPro
339339
: "-";
340340

341341
return (
342-
<Box flexDirection="column" paddingX={1}>
343-
{/* Line 1: Short name, ID, long name */}
344-
<Box>
342+
<Box flexDirection="column">
343+
<Box paddingX={1}>
344+
{/* Line 1: Short name, ID, long name */}
345345
<Text color={theme.fg.accent} bold>{shortName}</Text>
346346
<Text color={theme.fg.muted}> {nodeId}</Text>
347347
{longName && <Text color={theme.fg.primary}> {longName}</Text>}
348348
</Box>
349-
{/* Line 2: Role, last heard, hops, hardware */}
350-
<Box>
349+
<Box paddingX={1}>
350+
{/* Line 2: Role, last heard, hops, hardware */}
351351
<Text color={theme.fg.muted}>Role:</Text>
352352
<Text color={theme.fg.secondary}>{role}</Text>
353353
<Text color={theme.fg.muted}> Heard:</Text>
@@ -357,6 +357,8 @@ function NodeInfoHeader({ nodeNum, nodeStore, deleteConfirm }: NodeInfoHeaderPro
357357
<Text color={theme.fg.muted}> HW:</Text>
358358
<Text color={theme.data.hardware}>{hwModel}</Text>
359359
</Box>
360+
{/* Separator */}
361+
<Box borderStyle="single" borderColor={theme.border.normal} borderTop borderBottom={false} borderLeft={false} borderRight={false} />
360362
</Box>
361363
);
362364
}

src/ui/components/NodesPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ const ROLE_NAMES: Record<number, string> = {
405405
10: "TAK+Trk",
406406
};
407407

408-
function formatRole(role?: number): string {
409-
if (role === undefined) return "-";
408+
function formatRole(role?: number | null): string {
409+
if (role == null) return "-";
410410
return ROLE_NAMES[role] || `R${role}`;
411411
}
412412

413-
function getRoleColor(role?: number): string {
414-
if (role === undefined) return theme.fg.muted;
413+
function getRoleColor(role?: number | null): string {
414+
if (role == null) return theme.fg.muted;
415415
// Router/Repeater = infrastructure = purple
416416
if (role === 2 || role === 4) return theme.packet.nodeinfo;
417417
// Tracker/Sensor = cyan

0 commit comments

Comments
 (0)