edb_tui/ui/icons.rs
1// EDB - Ethereum Debugger
2// Copyright (C) 2024 Zhuo Zhang and Wuqi Zhang
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Affero General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Affero General Public License for more details.
13//
14// You should have received a copy of the GNU Affero General Public License
15// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17//! Unicode icons and symbols for visual enhancement
18//!
19//! This module provides a comprehensive set of Unicode symbols and icons
20//! used throughout the TUI for visual appeal and clarity.
21
22/// Collection of Unicode icons used throughout the TUI
23#[derive(Debug, Clone)]
24pub struct Icons;
25
26impl Icons {
27 // Status indicators
28 /// Icon for successful operations and completed actions
29 pub const SUCCESS: &'static str = "✅";
30 /// Icon for errors and failed operations
31 pub const ERROR: &'static str = "❌";
32 /// Icon for warnings and caution messages
33 pub const WARNING: &'static str = "⚠️";
34 /// Icon for informational messages
35 pub const INFO: &'static str = "ℹ️";
36 /// Icon for ongoing processing and loading states
37 pub const PROCESSING: &'static str = "🔄";
38
39 // Execution states
40 /// Icon for function or contract calls in transaction traces
41 pub const CALL: &'static str = "📞";
42 /// Icon for function returns in transaction traces
43 pub const RETURN: &'static str = "↩️";
44 /// Icon for transaction reverts and failed operations
45 pub const REVERT: &'static str = "❌";
46 /// Icon for contract creation operations
47 pub const CREATE: &'static str = "🏗️";
48 /// Icon indicating the current execution position
49 pub const CURRENT_EXECUTION: &'static str = "🔸";
50 /// Icon for breakpoints in the debugger
51 pub const BREAKPOINT: &'static str = "🔹";
52 /// Icon indicating when a target execution point is reached
53 pub const TARGET_REACHED: &'static str = "🎯";
54
55 // File and code
56 /// Icon for individual source files
57 pub const FILE: &'static str = "📄";
58 /// Icon for directories and folders
59 pub const FOLDER: &'static str = "📁";
60 /// Icon for compiled code and bytecode
61 pub const CODE: &'static str = "💾";
62 /// Icon for functions and methods
63 pub const FUNCTION: &'static str = "⚙️";
64 /// Icon for variables and storage items
65 pub const VARIABLE: &'static str = "📊";
66 /// Icon for mappings and key-value structures
67 pub const MAPPING: &'static str = "📈";
68
69 // Connection states
70 /// Icon for established RPC connections
71 pub const CONNECTED: &'static str = "🔗";
72 /// Icon for disconnected or failed connections
73 pub const DISCONNECTED: &'static str = "💔";
74 /// Icon for connection attempts in progress
75 pub const CONNECTING: &'static str = "🔄";
76
77 // Navigation
78 /// Up arrow for navigation and scrolling
79 pub const ARROW_UP: &'static str = "↑";
80 /// Down arrow for navigation and scrolling
81 pub const ARROW_DOWN: &'static str = "↓";
82 /// Left arrow for navigation and hierarchy
83 pub const ARROW_LEFT: &'static str = "←";
84 /// Right arrow for navigation and hierarchy
85 pub const ARROW_RIGHT: &'static str = "→";
86 /// Indicator for the current line in code view
87 pub const CURRENT_LINE: &'static str = "►";
88
89 // Box drawing characters for elegant borders
90 /// Top-left corner character for rounded boxes
91 pub const BOX_TOP_LEFT: &'static str = "╭";
92 /// Top-right corner character for rounded boxes
93 pub const BOX_TOP_RIGHT: &'static str = "╮";
94 /// Bottom-left corner character for rounded boxes
95 pub const BOX_BOTTOM_LEFT: &'static str = "╰";
96 /// Bottom-right corner character for rounded boxes
97 pub const BOX_BOTTOM_RIGHT: &'static str = "╯";
98 /// Horizontal line character for box borders
99 pub const BOX_HORIZONTAL: &'static str = "─";
100 /// Vertical line character for box borders
101 pub const BOX_VERTICAL: &'static str = "│";
102
103 // Tree characters for hierarchical displays
104 /// Tree branch character for intermediate items
105 pub const TREE_BRANCH: &'static str = "├─";
106 /// Tree branch character for the last item in a group
107 pub const TREE_LAST_BRANCH: &'static str = "└─";
108 /// Vertical line character for tree structure continuation
109 pub const TREE_VERTICAL: &'static str = "│";
110 /// Nested branch character for hierarchical structures
111 pub const TREE_NESTED_BRANCH: &'static str = "┌─";
112
113 // Activity indicators (animated)
114 /// Animation frames for the loading spinner
115 pub const SPINNER_FRAMES: &'static [&'static str] =
116 &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
117
118 // Progress bars
119 /// Full block character for completed progress sections
120 pub const PROGRESS_FULL: &'static str = "█";
121 /// Empty block character for incomplete progress sections
122 pub const PROGRESS_EMPTY: &'static str = "░";
123 /// Partial block characters for fractional progress display
124 pub const PROGRESS_PARTIAL: &'static [&'static str] = &["▏", "▎", "▍", "▌", "▋", "▊", "▉"];
125
126 // Special characters
127 /// Bullet point character for lists and emphasis
128 pub const BULLET: &'static str = "•";
129 /// Diamond character for special markers
130 pub const DIAMOND: &'static str = "◆";
131 /// Filled circle character for active states
132 pub const CIRCLE: &'static str = "●";
133 /// Empty circle character for inactive states
134 pub const CIRCLE_EMPTY: &'static str = "○";
135 /// Filled square character for solid indicators
136 pub const SQUARE: &'static str = "■";
137 /// Empty square character for outline indicators
138 pub const SQUARE_EMPTY: &'static str = "□";
139
140 // Expand/collapse indicators
141 /// Down arrow indicating an expanded section
142 pub const EXPANDED: &'static str = "▼";
143 /// Right arrow indicating a collapsed section
144 pub const COLLAPSED: &'static str = "►";
145 /// Plus sign indicator for expandable content
146 pub const EXPANDABLE: &'static str = "[+]";
147 /// Minus sign indicator for collapsible content
148 pub const COLLAPSIBLE: &'static str = "[-]";
149}