use ratatui::prelude::*;
use crate::tui::app::App;
use crate::tui::widgets::card::{self, selectable_row, Card};
pub fn render(frame: &mut Frame, app: &App, area: Rect) {
let cursor = app.wizard.as_ref().map(|w| w.region_cursor).unwrap_or(0);
let mut body: Vec<Line> = Vec::new();
body.extend(selectable_row(
"g",
"Global · recommended",
"cloud.zilliz.com · aws · gcp · azure · Auth0 + API key",
cursor == 0,
));
body.push(Line::from(""));
body.extend(selectable_row(
"c",
"China",
"cloud.zilliz.com.cn · aliyun · tencent · API key only",
cursor == 1,
));
let footer = Line::from(vec![
Span::styled(
"Region determines the auth endpoint and data residency. Press ",
Style::default().fg(Color::DarkGray),
),
Span::styled(
" ? ",
Style::default()
.fg(Color::White)
.bg(Color::DarkGray)
.add_modifier(Modifier::BOLD),
),
Span::styled(" to learn more.", Style::default().fg(Color::DarkGray)),
]);
card::render(
frame,
area,
&Card {
eyebrow: Some("SIGN IN · STEP 1 OF 3"),
title: Some("Choose your Zilliz Cloud region."),
body,
footer: Some(footer),
error: app.wizard.as_ref().and_then(|w| w.error.as_deref()),
step: Some("1 / 3"),
max_width: 76,
},
);
}