Skip to content

Commit c8144d2

Browse files
rebeliceclaude
andcommitted
fix(tree): remove unused function and simplify nil check
- Remove unused buildNodeLabel function - Simplify nil check for FilteredNodes slice (len() handles nil) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6951c40 commit c8144d2

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

internal/ui/components/tree_view.go

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -605,57 +605,6 @@ func (tv *TreeView) getNodeIcon(node *models.TreeNode) string {
605605
return lipgloss.NewStyle().Foreground(iconColor).Render(icon)
606606
}
607607

608-
// buildNodeLabel builds the display label for a node, including metadata
609-
func (tv *TreeView) buildNodeLabel(node *models.TreeNode) string {
610-
label := node.Label
611-
metaStyle := lipgloss.NewStyle().Foreground(tv.Theme.Metadata)
612-
613-
// Add metadata based on node type
614-
switch node.Type {
615-
case models.TreeNodeTypeDatabase:
616-
// Active database already shown with icon color, no need for extra text
617-
// Just show the database name
618-
619-
case models.TreeNodeTypeSchema:
620-
// Label already includes count info from loadTree, show empty marker if no children
621-
if node.Loaded && len(node.Children) == 0 {
622-
label += " " + metaStyle.Render("∅")
623-
}
624-
625-
case models.TreeNodeTypeTableGroup, models.TreeNodeTypeViewGroup:
626-
// Label already includes count from loadTree
627-
628-
case models.TreeNodeTypeTable:
629-
// Add row count if available with better formatting
630-
if meta, ok := node.Metadata.(map[string]interface{}); ok {
631-
if rowCount, ok := meta["row_count"].(int64); ok {
632-
label += " " + metaStyle.Render(formatNumber(rowCount))
633-
}
634-
}
635-
636-
case models.TreeNodeTypeColumn:
637-
// Column label already includes type from BuildColumnNodes
638-
// Add indicators for constraints
639-
if meta, ok := node.Metadata.(models.ColumnInfo); ok {
640-
var indicators []string
641-
642-
if meta.PrimaryKey {
643-
pkStyle := lipgloss.NewStyle().Foreground(tv.Theme.PrimaryKey)
644-
indicators = append(indicators, pkStyle.Render("⚿"))
645-
}
646-
647-
// Note: ForeignKey and NotNull fields don't exist in ColumnInfo yet
648-
// They can be added in future enhancement
649-
650-
if len(indicators) > 0 {
651-
label += " " + strings.Join(indicators, " ")
652-
}
653-
}
654-
}
655-
656-
return label
657-
}
658-
659608
// buildNodeLabelWithHighlight builds the display label with match highlighting and schema path
660609
func (tv *TreeView) buildNodeLabelWithHighlight(node *models.TreeNode, selected bool) string {
661610
metaStyle := lipgloss.NewStyle().Foreground(tv.Theme.Metadata)
@@ -676,7 +625,7 @@ func (tv *TreeView) buildNodeLabelWithHighlight(node *models.TreeNode, selected
676625
// Build suffix parts (schema path in filter mode, or metadata in normal mode)
677626
var suffix string
678627

679-
if tv.FilteredNodes != nil && len(tv.FilteredNodes) > 0 {
628+
if len(tv.FilteredNodes) > 0 {
680629
// In filter mode: add schema path for context
681630
schemaName := tv.getNodeSchemaName(node)
682631
if schemaName != "" {

0 commit comments

Comments
 (0)