(frame: &mut Frame<'_>, app: &App, area: Rect)
| 664 | // --------------------------------------------------------------------------- |
| 665 | |
| 666 | pub fn draw_update(frame: &mut Frame<'_>, app: &App, area: Rect) { |
| 667 | let t = &app.theme; |
| 668 | let Some(form) = &app.update_provider_form else { |
| 669 | return; |
| 670 | }; |
| 671 | |
| 672 | let modal_width = 60u16.min(area.width.saturating_sub(4)); |
| 673 | // name(1) + type(1) + spacer(1) + key_label(1) + value(1) + cursor_hint(1) + spacer(1) + status(1) + hint(1) |
| 674 | let content_height = 9; |
| 675 | let modal_height = (content_height + 4).min(area.height.saturating_sub(2)); |
| 676 | let popup_area = centered_rect(modal_width, modal_height, area); |
| 677 | |
| 678 | frame.render_widget(Clear, popup_area); |
| 679 | |
| 680 | let block = Block::default() |
| 681 | .title(Span::styled(" Update Provider ", t.heading)) |
| 682 | .borders(Borders::ALL) |
| 683 | .border_style(t.accent) |
| 684 | .padding(Padding::new(2, 2, 1, 1)); |
| 685 | |
| 686 | let inner = block.inner(popup_area); |
| 687 | frame.render_widget(block, popup_area); |
| 688 | |
| 689 | let chunks = Layout::default() |
| 690 | .direction(Direction::Vertical) |
| 691 | .constraints([ |
| 692 | Constraint::Length(1), // name |
| 693 | Constraint::Length(1), // type |
| 694 | Constraint::Length(1), // spacer |
| 695 | Constraint::Length(1), // key label |
| 696 | Constraint::Length(1), // value input |
| 697 | Constraint::Length(1), // cursor hint |
| 698 | Constraint::Length(1), // spacer |
| 699 | Constraint::Length(1), // status |
| 700 | Constraint::Length(1), // hint |
| 701 | Constraint::Min(0), |
| 702 | ]) |
| 703 | .split(inner); |
| 704 | |
| 705 | frame.render_widget( |
| 706 | Paragraph::new(Line::from(vec![ |
| 707 | Span::styled("Name: ", t.muted), |
| 708 | Span::styled(&form.provider_name, t.heading), |
| 709 | ])), |
| 710 | chunks[0], |
| 711 | ); |
| 712 | |
| 713 | frame.render_widget( |
| 714 | Paragraph::new(Line::from(vec![ |
| 715 | Span::styled("Type: ", t.muted), |
| 716 | Span::styled(&form.provider_type, t.text), |
| 717 | ])), |
| 718 | chunks[1], |
| 719 | ); |
| 720 | |
| 721 | let key_label = if form.credential_key.is_empty() { |
| 722 | "New value:" |
| 723 | } else { |
no test coverage detected