ghostscope_ui/ui/
symbols.rs

1/// Centralized UI symbols and icons with ASCII fallbacks
2pub struct UISymbols;
3
4impl UISymbols {
5    // File type icons
6    pub const FILE_FOLDER: &'static str = "πŸ“";
7    pub const FILE_FOLDER_ASCII: &'static str = "[DIR]";
8
9    pub const FILE_PACKAGE: &'static str = "πŸ“¦";
10    pub const FILE_PACKAGE_ASCII: &'static str = "[PKG]";
11
12    pub const FILE_HEADER: &'static str = "πŸ“‘";
13    pub const FILE_HEADER_ASCII: &'static str = "[H]";
14
15    pub const FILE_SOURCE: &'static str = "πŸ“";
16    pub const FILE_SOURCE_ASCII: &'static str = "[C]";
17
18    pub const FILE_RUST: &'static str = "πŸ¦€";
19    pub const FILE_RUST_ASCII: &'static str = "[RS]";
20
21    pub const FILE_ASM: &'static str = "πŸ› οΈ";
22    pub const FILE_ASM_ASCII: &'static str = "[ASM]";
23
24    pub const FILE_GENERIC: &'static str = "πŸ“„";
25    pub const FILE_GENERIC_ASCII: &'static str = "[FILE]";
26
27    // Status icons
28    pub const STATUS_ACTIVE: &'static str = "βœ…";
29    pub const STATUS_ACTIVE_ASCII: &'static str = "[ON]";
30
31    pub const STATUS_DISABLED: &'static str = "⏸️";
32    pub const STATUS_DISABLED_ASCII: &'static str = "[OFF]";
33
34    pub const STATUS_FAILED: &'static str = "❌";
35    pub const STATUS_FAILED_ASCII: &'static str = "[FAIL]";
36
37    pub const STATUS_YES: &'static str = "βœ… Yes";
38    pub const STATUS_YES_ASCII: &'static str = "[YES]";
39
40    pub const STATUS_NO: &'static str = "❌ No ";
41    pub const STATUS_NO_ASCII: &'static str = "[NO]";
42
43    // Navigation symbols
44    pub const NAV_TREE_BRANCH: &'static str = "β”œβ”€";
45    pub const NAV_TREE_BRANCH_ASCII: &'static str = "+-";
46
47    pub const NAV_TREE_LAST: &'static str = "└─";
48    pub const NAV_TREE_LAST_ASCII: &'static str = "\\-";
49
50    pub const NAV_TREE_VERTICAL: &'static str = "β”‚";
51    pub const NAV_TREE_VERTICAL_ASCII: &'static str = "|";
52
53    pub const NAV_TREE_SPACE: &'static str = "  ";
54
55    // UI borders
56    pub const BORDER_HORIZONTAL: &'static str = "─";
57    pub const BORDER_HORIZONTAL_ASCII: &'static str = "-";
58
59    // Progress and status
60    pub const STATS_ICON: &'static str = "πŸ“Š";
61    pub const STATS_ICON_ASCII: &'static str = "[STATS]";
62
63    pub const LIBRARY_ICON: &'static str = "πŸ“š";
64    pub const LIBRARY_ICON_ASCII: &'static str = "[LIBS]";
65
66    // Helper methods for getting symbols with fallback
67    pub fn get_file_icon(extension: &str, use_ascii: bool) -> &'static str {
68        if use_ascii {
69            match extension {
70                "h" | "hpp" | "hh" | "hxx" => Self::FILE_HEADER_ASCII,
71                "c" | "cc" | "cpp" | "cxx" => Self::FILE_SOURCE_ASCII,
72                "rs" => Self::FILE_RUST_ASCII,
73                "s" | "asm" => Self::FILE_ASM_ASCII,
74                _ => Self::FILE_GENERIC_ASCII,
75            }
76        } else {
77            match extension {
78                "h" | "hpp" | "hh" | "hxx" => Self::FILE_HEADER,
79                "c" | "cc" | "cpp" | "cxx" => Self::FILE_SOURCE,
80                "rs" => Self::FILE_RUST,
81                "s" | "asm" => Self::FILE_ASM,
82                _ => Self::FILE_GENERIC,
83            }
84        }
85    }
86
87    pub fn get_status_icon(active: bool, use_ascii: bool) -> &'static str {
88        if use_ascii {
89            if active {
90                Self::STATUS_ACTIVE_ASCII
91            } else {
92                Self::STATUS_DISABLED_ASCII
93            }
94        } else if active {
95            Self::STATUS_ACTIVE
96        } else {
97            Self::STATUS_DISABLED
98        }
99    }
100
101    pub fn get_yes_no_icon(yes: bool, use_ascii: bool) -> &'static str {
102        if use_ascii {
103            if yes {
104                Self::STATUS_YES_ASCII
105            } else {
106                Self::STATUS_NO_ASCII
107            }
108        } else if yes {
109            Self::STATUS_YES
110        } else {
111            Self::STATUS_NO
112        }
113    }
114}