MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / draw

Function draw

crates/openshell-tui/src/ui/splash.rs:57–121  ·  view source on GitHub ↗

Draw the splash screen centered on the full terminal area.

(frame: &mut Frame<'_>, area: Rect, theme: &crate::theme::Theme)

Source from the content-addressed store, hash-verified

55
56/// Draw the splash screen centered on the full terminal area.
57pub fn draw(frame: &mut Frame<'_>, area: Rect, theme: &crate::theme::Theme) {
58 let t = theme;
59 let modal_w = MODAL_WIDTH.min(area.width.saturating_sub(2));
60 let modal_h = MODAL_HEIGHT.min(area.height.saturating_sub(2));
61
62 // Center the modal.
63 let popup = centered_rect(modal_w, modal_h, area);
64
65 // Clear the area behind the modal.
66 frame.render_widget(Clear, popup);
67
68 // Outer double-line border.
69 let block = Block::default()
70 .borders(Borders::ALL)
71 .border_type(BorderType::Double)
72 .border_style(t.border)
73 .padding(Padding::new(3, 3, 1, 1));
74
75 let inner = block.inner(popup);
76 frame.render_widget(block, popup);
77
78 // Split inner area: art content + spacer + footer (2 lines).
79 let chunks = Layout::default()
80 .direction(Direction::Vertical)
81 .constraints([
82 Constraint::Length(CONTENT_LINES), // OPEN + SHELL + blank + tagline
83 Constraint::Min(0), // spacer
84 Constraint::Length(2), // footer (version + prompt)
85 ])
86 .split(inner);
87
88 // -- Art + tagline --
89 let open_style = t.heading;
90 let shell_style = t.accent_bold;
91
92 let mut content_lines: Vec<Line<'_>> = Vec::with_capacity(CONTENT_LINES as usize);
93
94 for line in &OPEN_ART {
95 content_lines.push(Line::from(Span::styled(*line, open_style)));
96 }
97 for line in &SHELL_ART {
98 content_lines.push(Line::from(Span::styled(*line, shell_style)));
99 }
100
101 // Blank + tagline.
102 content_lines.push(Line::from(""));
103 content_lines.push(Line::from(Span::styled(TAGLINE, t.muted)).alignment(Alignment::Center));
104
105 frame.render_widget(Paragraph::new(content_lines), chunks[0]);
106
107 // -- Footer: version + ALPHA badge on line 1, prompt on line 2 --
108 let version = format!("v{}", openshell_core::VERSION);
109 let alpha_badge = "ALPHA";
110
111 let footer = Paragraph::new(vec![
112 Line::from(vec![
113 Span::styled(version, t.accent),
114 Span::styled(" ", t.muted),

Callers

nothing calls this directly

Calls 2

centered_rectFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected