feat: implement UI redesign for Comparador de Notas
- Introduced a new theme for the application based on dark navy aesthetics. - Created design tokens for colors, spacings, and border radii. - Developed a theme module in Rust to manage styles for various UI components. - Updated multiple screens and components to align with the new design, including cards, buttons, badges, and progress bars. - Enhanced user experience with improved layouts and visual elements across the application.
This commit is contained in:
+56
-25
@@ -1,34 +1,39 @@
|
||||
use crate::domain::entities::layout::{Layout, TipoArquivo};
|
||||
use crate::ui::app::App;
|
||||
use crate::ui::message::Message;
|
||||
use crate::ui::theme as t;
|
||||
use iced::widget::{button, column, container, horizontal_space, row, scrollable, text};
|
||||
use iced::{Alignment, Element, Length};
|
||||
|
||||
/// Tela de gerenciamento de layouts.
|
||||
pub fn view(app: &App) -> Element<'_, Message> {
|
||||
let titulo = text("Gerenciar Layouts").size(22);
|
||||
let cabecalho = row![
|
||||
button("< Voltar")
|
||||
.on_press(Message::IrParaImportacao)
|
||||
.style(t::btn_secondary),
|
||||
horizontal_space(),
|
||||
button("Importar JSON")
|
||||
.on_press(Message::ImportarLayoutJson)
|
||||
.style(t::btn_ghost),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center)
|
||||
.width(Length::Fill);
|
||||
|
||||
let botao_voltar = row![button("< Voltar").on_press(Message::IrParaImportacao)].spacing(8);
|
||||
let titulo = text("Gerenciar Layouts").size(22).color(t::TEXT);
|
||||
|
||||
let secao_csv = view_secao_layouts("Layouts CSV", &app.layouts_salvos, TipoArquivo::Csv);
|
||||
let secao_xlsx = view_secao_layouts("Layouts XLSX", &app.layouts_salvos, TipoArquivo::Xlsx);
|
||||
|
||||
// Importar de JSON
|
||||
let importar_row = row![
|
||||
text("Importar layout de arquivo JSON:").size(14),
|
||||
button("📥 Importar JSON").on_press(Message::ImportarLayoutJson),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center);
|
||||
|
||||
let content = column![titulo, botao_voltar, secao_csv, secao_xlsx, importar_row,]
|
||||
let content = column![titulo, cabecalho, secao_csv, secao_xlsx,]
|
||||
.spacing(16)
|
||||
.padding(16)
|
||||
.padding(20)
|
||||
.width(Length::Fill);
|
||||
|
||||
container(scrollable(content))
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.style(t::fundo)
|
||||
.into()
|
||||
}
|
||||
|
||||
@@ -37,30 +42,56 @@ fn view_secao_layouts<'a>(
|
||||
layouts: &'a [Layout],
|
||||
tipo: TipoArquivo,
|
||||
) -> Element<'a, Message> {
|
||||
let mut col = column![text(titulo).size(16)].spacing(4);
|
||||
let titulo_widget = text(titulo).size(16).color(t::TEXT_SECONDARY);
|
||||
|
||||
let filtrados: Vec<&Layout> = layouts.iter().filter(|l| l.tipo() == tipo).collect();
|
||||
|
||||
let mut col = column![titulo_widget].spacing(4);
|
||||
|
||||
if filtrados.is_empty() {
|
||||
col = col.push(text("(nenhum layout salvo)").size(13));
|
||||
return col.into();
|
||||
col = col.push(text("(nenhum layout salvo)").size(13).color(t::TEXT_MUTED));
|
||||
return container(col)
|
||||
.padding([12, 16])
|
||||
.width(Length::Fill)
|
||||
.style(t::card)
|
||||
.into();
|
||||
}
|
||||
|
||||
for layout in filtrados {
|
||||
if let Some(id) = layout.id() {
|
||||
let linha = row![
|
||||
text(layout.nome()).size(14).width(Length::Fill),
|
||||
horizontal_space(),
|
||||
button("📂 Carregar").on_press(Message::LayoutSelecionado(id)),
|
||||
button("📤 Exportar JSON").on_press(Message::ExportarLayoutJson(id)),
|
||||
button("🗑 Excluir").on_press(Message::ExcluirLayout(id)),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center);
|
||||
let linha = container(
|
||||
row![
|
||||
text(layout.nome())
|
||||
.size(14)
|
||||
.color(t::TEXT)
|
||||
.width(Length::Fill),
|
||||
horizontal_space(),
|
||||
button("Carregar")
|
||||
.on_press(Message::LayoutSelecionado(id))
|
||||
.style(t::btn_primary),
|
||||
button("Exportar JSON")
|
||||
.on_press(Message::ExportarLayoutJson(id))
|
||||
.style(t::btn_ghost),
|
||||
button("Excluir")
|
||||
.on_press(Message::ExcluirLayout(id))
|
||||
.style(t::btn_danger),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(Alignment::Center)
|
||||
.padding([10, 0]),
|
||||
)
|
||||
.width(Length::Fill);
|
||||
|
||||
col = col.push(linha);
|
||||
|
||||
// Separador entre linhas
|
||||
col = col.push(container(iced::widget::horizontal_rule(1)).width(Length::Fill));
|
||||
}
|
||||
}
|
||||
|
||||
col.into()
|
||||
container(col)
|
||||
.padding([12, 16])
|
||||
.width(Length::Fill)
|
||||
.style(t::card)
|
||||
.into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user