Skip to main content

beyonder_gpu/block_renderers/
approval.rs

1//! Renderer for ApprovalRequest blocks.
2//! These are the security dialogs — rendered with attention-grabbing amber accent.
3
4use super::render_block_background;
5use crate::pipeline::RectInstance;
6use beyonder_core::Block;
7
8pub fn render_approval_block(
9    block: &Block,
10    x: f32,
11    y: f32,
12    width: f32,
13    height: f32,
14    scale: f32,
15    rects: &mut Vec<RectInstance>,
16) {
17    render_block_background(block, x, y, width, height, rects);
18
19    // Yellow #f9e2af stripe — attention signal
20    rects.push(
21        RectInstance::filled(x, y, 4.0 * scale, height, [0.976, 0.886, 0.686, 1.0])
22            .with_radius(scale * 2.0),
23    );
24
25    // Header bar — dark Yellow tint
26    rects.push(
27        RectInstance::filled(
28            x + scale,
29            y + scale,
30            width - scale * 2.0,
31            26.0 * scale,
32            [0.200, 0.170, 0.088, 1.0],
33        )
34        .with_radius(2.0 * scale),
35    );
36
37    // Approve (Green dark) / Deny (Red dark) buttons
38    let btn_y = y + height - 32.0 * scale;
39    let btn_w = 90.0 * scale;
40    let btn_h = 24.0 * scale;
41    let btn_r = 4.0 * scale;
42    let gap = 10.0 * scale;
43    rects.push(
44        RectInstance::filled(x + gap, btn_y, btn_w, btn_h, [0.210, 0.500, 0.245, 1.0])
45            .with_radius(btn_r),
46    );
47    rects.push(
48        RectInstance::filled(
49            x + gap + btn_w + gap,
50            btn_y,
51            btn_w,
52            btn_h,
53            [0.530, 0.165, 0.220, 1.0],
54        )
55        .with_radius(btn_r),
56    );
57}