class Clacky::UI2::Components::CommonComponent
CommonComponent renders common UI elements (progress, success, error, warning)
def render_error(message)
-
(String)- Error message
Parameters:
-
message(String) -- Error message
def render_error(message) symbol = format_symbol(:error) text = format_text(message, :error) "#{symbol} #{text}" end
def render_progress(message)
-
(String)- Progress indicator
Parameters:
-
message(String) -- Progress message
def render_progress(message) symbol = format_symbol(:thinking) text = format_text(message, :thinking) "#{symbol} #{text}" end
def render_success(message)
-
(String)- Success message
Parameters:
-
message(String) -- Success message
def render_success(message) symbol = format_symbol(:success) text = format_text(message, :success) "#{symbol} #{text}" end
def render_task_complete(iterations:, cost:, duration: nil, cache_tokens: nil, cache_requests: nil, cache_hits: nil)
-
(String)- Formatted completion summary
Parameters:
-
cache_hits(Integer) -- Cache hit requests count -
cache_requests(Integer) -- Total cache requests count -
cache_tokens(Integer) -- Cache read tokens -
duration(Float) -- Duration in seconds -
cost(Float) -- Cost in USD -
iterations(Integer) -- Number of iterations
def render_task_complete(iterations:, cost:, duration: nil, cache_tokens: nil, cache_requests: nil, cache_hits: nil) lines = [] lines << "" lines << @pastel.dim("─" * 60) lines << render_success("Task Complete") lines << "" # Display each stat on a separate line lines << " Iterations: #{iterations}" lines << " Cost: $#{cost.round(4)}" lines << " Duration: #{duration.round(1)}s" if duration # Display cache information if available if cache_tokens && cache_tokens > 0 lines << " Cache Tokens: #{cache_tokens} tokens" end if cache_requests && cache_requests > 0 hit_rate = cache_hits > 0 ? ((cache_hits.to_f / cache_requests) * 100).round(1) : 0 lines << " Cache Requests: #{cache_requests} (#{cache_hits} hits, #{hit_rate}% hit rate)" end lines.join("\n") end
def render_thinking
-
(String)- Thinking indicator
def render_thinking symbol = format_symbol(:thinking) text = format_text("Thinking...", :thinking) "#{symbol} #{text}" end
def render_warning(message)
-
(String)- Warning message
Parameters:
-
message(String) -- Warning message
def render_warning(message) symbol = format_symbol(:warning) text = format_text(message, :warning) "#{symbol} #{text}" end
def render_working(message)
-
(String)- Working indicator
Parameters:
-
message(String) -- Progress message
def render_working(message) symbol = format_symbol(:working) text = format_text(message, :working) "#{symbol} #{text}" end