Monster commit: native version

This commit is contained in:
2026-01-30 15:03:49 +01:00
parent 22ee5f97e6
commit 2731eea037
35 changed files with 1491 additions and 366 deletions

View File

@@ -1,5 +1,5 @@
use ratatui::layout::Rect;
use ratatui::style::{Color, Modifier, Style};
use ratatui::style::{Modifier, Style};
use ratatui::text::{Line, Span};
use ratatui::widgets::{Block, Borders, Paragraph};
use ratatui::Frame;
@@ -7,17 +7,13 @@ use ratatui::Frame;
use crate::app::App;
use crate::engine::LinkState;
use crate::state::OptionsFocus;
const LABEL_COLOR: Color = Color::Rgb(120, 125, 135);
const HEADER_COLOR: Color = Color::Rgb(100, 160, 180);
const DIVIDER_COLOR: Color = Color::Rgb(60, 65, 70);
const SCROLL_INDICATOR_COLOR: Color = Color::Rgb(80, 85, 95);
use crate::theme::{hint, link_status, modal, ui, values};
pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
let block = Block::default()
.borders(Borders::ALL)
.title(" Options ")
.border_style(Style::new().fg(Color::Cyan));
.border_style(Style::new().fg(modal::INPUT));
let inner = block.inner(area);
frame.render_widget(block, area);
@@ -36,11 +32,11 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
let enabled = link.is_enabled();
let peers = link.peers();
let (status_text, status_color) = if !enabled {
("DISABLED", Color::Rgb(120, 60, 60))
("DISABLED", link_status::DISABLED)
} else if peers > 0 {
("CONNECTED", Color::Rgb(60, 120, 60))
("CONNECTED", link_status::CONNECTED)
} else {
("LISTENING", Color::Rgb(120, 120, 60))
("LISTENING", link_status::LISTENING)
};
let peer_text = if enabled && peers > 0 {
if peers == 1 {
@@ -55,14 +51,14 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
let link_header = Line::from(vec![
Span::styled(
"ABLETON LINK",
Style::new().fg(HEADER_COLOR).add_modifier(Modifier::BOLD),
Style::new().fg(ui::HEADER).add_modifier(Modifier::BOLD),
),
Span::raw(" "),
Span::styled(
status_text,
Style::new().fg(status_color).add_modifier(Modifier::BOLD),
),
Span::styled(peer_text, Style::new().fg(LABEL_COLOR)),
Span::styled(peer_text, Style::new().fg(ui::TEXT_MUTED)),
]);
// Prepare values
@@ -72,10 +68,8 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
let beat_str = format!("{:.2}", link.beat());
let phase_str = format!("{:.2}", link.phase());
let tempo_style = Style::new()
.fg(Color::Rgb(220, 180, 100))
.add_modifier(Modifier::BOLD);
let value_style = Style::new().fg(Color::Rgb(140, 145, 155));
let tempo_style = Style::new().fg(values::TEMPO).add_modifier(Modifier::BOLD);
let value_style = Style::new().fg(values::VALUE);
// Build flat list of all lines
let lines: Vec<Line> = vec![
@@ -178,7 +172,7 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
frame.render_widget(Paragraph::new(visible_lines), padded);
// Render scroll indicators
let indicator_style = Style::new().fg(SCROLL_INDICATOR_COLOR);
let indicator_style = Style::new().fg(ui::TEXT_DIM);
let indicator_x = padded.x + padded.width.saturating_sub(1);
if scroll_offset > 0 {
@@ -201,21 +195,21 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
fn render_section_header(title: &str) -> Line<'static> {
Line::from(Span::styled(
title.to_string(),
Style::new().fg(HEADER_COLOR).add_modifier(Modifier::BOLD),
Style::new().fg(ui::HEADER).add_modifier(Modifier::BOLD),
))
}
fn render_divider(width: usize) -> Line<'static> {
Line::from(Span::styled(
"".repeat(width),
Style::new().fg(DIVIDER_COLOR),
Style::new().fg(ui::BORDER),
))
}
fn render_option_line<'a>(label: &'a str, value: &'a str, focused: bool) -> Line<'a> {
let highlight = Style::new().fg(Color::Yellow).add_modifier(Modifier::BOLD);
let normal = Style::new().fg(Color::White);
let label_style = Style::new().fg(LABEL_COLOR);
let highlight = Style::new().fg(hint::KEY).add_modifier(Modifier::BOLD);
let normal = Style::new().fg(ui::TEXT_PRIMARY);
let label_style = Style::new().fg(ui::TEXT_MUTED);
let prefix = if focused { "> " } else { " " };
let prefix_style = if focused { highlight } else { normal };
@@ -238,7 +232,7 @@ fn render_option_line<'a>(label: &'a str, value: &'a str, focused: bool) -> Line
}
fn render_readonly_line<'a>(label: &'a str, value: &'a str, value_style: Style) -> Line<'a> {
let label_style = Style::new().fg(LABEL_COLOR);
let label_style = Style::new().fg(ui::TEXT_MUTED);
let label_width = 20;
let padded_label = format!("{label:<label_width$}");