List with detail
The everyday screen: filter a list, open a record beside it. App shell with a test-environment banner, a page header with actions, search, period and company filters and tabs, a table grouped by month, and the drawer of the current row.
<% notes = [
{ number: 1241, client: "Empresa Exemplo Ltda", doc: "12.345.678/0001-90", issued_on: "18/11/2026", value: "R$ 2.400,00", status: :ok, month: "Novembro de 2026" },
{ number: 1240, client: "Fictícia Serviços ME", doc: "98.765.432/0001-10", issued_on: "12/11/2026", value: "R$ 820,50", status: :ok, month: "Novembro de 2026" },
{ number: 1239, client: "Demo Consultoria", doc: "11.222.333/0001-44", issued_on: "07/11/2026", value: "R$ 3.200,00", status: :bad, month: "Novembro de 2026" },
{ number: 1238, client: "Loja Modelo Eireli", doc: "22.333.444/0001-55", issued_on: "03/11/2026", value: "R$ 150,00", status: :ok, month: "Novembro de 2026" },
{ number: 1231, client: "Empresa Exemplo Ltda", doc: "12.345.678/0001-90", issued_on: "28/10/2026", value: "R$ 2.400,00", status: :ok, month: "Outubro de 2026" },
{ number: 1230, client: "Agência Fictícia", doc: "33.444.555/0001-66", issued_on: "21/10/2026", value: "R$ 5.780,00", status: :neutral, month: "Outubro de 2026" },
{ number: 1229, client: "Fictícia Serviços ME", doc: "98.765.432/0001-10", issued_on: "14/10/2026", value: "R$ 820,50", status: :ok, month: "Outubro de 2026" }
] %>
<% labels = { ok: "Autorizada", bad: "Cancelada", neutral: "Substituída" } %>
<%= app_shell do |shell| %>
<% shell.with_banner "HOMOLOGAÇÃO · ambiente de teste, notas sem validade jurídica" %>
<% shell.with_sidebar(brand: "Emissor Exemplo", brand_href: "#") do |sidebar| %>
<% sidebar.with_item "Notas", href: "#notas", icon: "file-text", current: true %>
<% sidebar.with_item "Totais", href: "#totais", icon: "chart-bar", current: false %>
<% sidebar.with_item "Certificados", href: "#certificados", icon: "lock", current: false %>
<% sidebar.with_item "Configurações", href: "#configuracoes", icon: "settings", current: false %>
<% end %>
<%= page_header(title: "Notas", subtitle: "Última sincronização: há 5 minutos · próxima: em 55 minutos") do |header| %>
<% header.with_action { button "Exportar filtro…", icon: "download" } %>
<% header.with_action { button "Sincronizar", variant: :primary, icon: "refresh" } %>
<% header.with_filters do %>
<%= search_input placeholder: "Buscar por número, chave, nome ou CNPJ" %>
<%= period_picker from: Date.new(2026, 10, 1), to: Date.new(2026, 11, 30), title: "Data de emissão",
presets: [ { label: "Este mês", from: Date.new(2026, 11, 1), to: Date.new(2026, 11, 30) },
{ label: "Últimos 2 meses", from: Date.new(2026, 10, 1), to: Date.new(2026, 11, 30) },
{ label: "Qualquer data", from: nil, to: nil } ] %>
<%= multi_select name: :companies, label: "Empresas", icon: "building", align: :right,
all_label: "Todas as empresas", none_label: "Nenhuma empresa", many_label: "%{count} empresas",
options: notes.uniq { |n| n[:doc] }.map { |n| { value: n[:doc], label: n[:client], sub: n[:doc], status: :ok } } %>
<% end %>
<% header.with_tabs(label: "Tipo de nota") do |tabs| %>
<% tabs.with_tab "Emitidas", count: 1204, selected: true %>
<% tabs.with_tab "Recebidas", count: 318 %>
<% tabs.with_action { button "Colunas", size: :sm, icon: "columns" } %>
<% end %>
<% end %>
<%= table(rows: notes, min_width: "760px", group_by: ->(n) { n[:month] },
row_href: ->(n) { "#nota-#{n[:number]}" }, current: ->(n) { n[:number] == 1240 }) do |t| %>
<% t.column("Número") { |n| n[:number] } %>
<% t.column("Tomador") do |n| %>
<%= n[:client] %> <span class="tr-muted">· <%= n[:doc] %></span>
<% end %>
<% t.column("Emissão") { |n| n[:issued_on] } %>
<% t.column("Valor", align: :right) { |n| n[:value] } %>
<% t.column("Situação") do |n| %>
<%= status_dot n[:status], style: "margin-right: 7px" %><%= labels[n[:status]] %>
<% end %>
<% end %>
<%= drawer(title: "Nota 1240", eyebrow: "Fictícia Serviços ME", close_href: "#") do |d| %>
<% d.with_meta do %>
<%= cluster do %><%= status_pill "Autorizada" %><span class="tr-muted">Emitida em 12/11/2026</span><% end %>
<% end %>
<% d.with_action { button "Abrir PDF", size: :sm, icon: "file-text" } %>
<% d.with_action { button "Baixar XML", size: :sm, icon: "download" } %>
<% d.with_action { button "Copiar chave", size: :sm, variant: :ghost, icon: "copy" } %>
<% d.with_section("Tomador") do %>
<p>Fictícia Serviços ME</p>
<p class="tr-muted">98.765.432/0001-10 · São Paulo/SP</p>
<% end %>
<% d.with_section("Serviço") do %>
<p>Desenvolvimento de software sob encomenda</p>
<p class="tr-muted">Código 1.04 · Competência 11/2026</p>
<% end %>
<% d.with_section("Valores") do %>
<%= table(rows: [ [ "Serviço", "R$ 820,50" ], [ "ISS (5%)", "R$ 41,03" ], [ "Líquido", "R$ 779,47" ] ]) do |t| %>
<% t.column("Item") { |row| row[0] } %>
<% t.column("Valor", align: :right) { |row| row[1] } %>
<% end %>
<% end %>
<% end %>
<% end %>
Dashboard
Cards that answer "what now?" at a glance. A Day / Week / Month switch in the header, a warning callout, cards holding flush tables and a side card. Status colours only where something needs attention.
<% today = [
{ title: "Revisar roteiro do vídeo 2", project: "Canal Exemplo", color: "#0d9488", quest: "Lançar o canal até março" },
{ title: "Ligar para a Empresa Exemplo sobre o piloto", project: "Produto Exemplo", color: "#4f46e5", quest: "Manter o relacionamento com clientes" },
{ title: "Emitir invoice de novembro", project: "Cliente Fictício", color: "#0284c7", quest: "Faturar o cliente todo mês" }
] %>
<% late = [
{ title: "Enviar proposta revisada para a Demo Consultoria", project: "Produto Exemplo", color: "#4f46e5", days: 3 },
{ title: "Gravar narração do vídeo 2", project: "Canal Exemplo", color: "#0d9488", days: 1 }
] %>
<% upcoming = { "Amanhã · sáb 21/11" => [ "Editar vídeo 2" ], "seg 23/11" => [ "Publicar landing do emissor", "Roteirizar vídeo 1 da série" ], "ter 24/11" => [ "Follow-up com a Demo Consultoria" ] } %>
<%= app_shell do |shell| %>
<% shell.with_banner "DEVELOPMENT DATA — kept separate from live data" %>
<% shell.with_sidebar(brand: "Workflows", brand_href: "#") do |sidebar| %>
<% sidebar.with_item "Agenda", href: "#agenda", icon: "calendar", current: true %>
<% sidebar.with_item "Quests", href: "#quests", icon: "target", current: false %>
<% sidebar.with_heading "Negócios" %>
<% sidebar.with_item "Contatos", href: "#contatos", icon: "users", current: false %>
<% sidebar.with_item "Invoices", href: "#invoices", icon: "file-invoice", current: false %>
<% end %>
<%= page_header(title: "Agenda", subtitle: "Hoje é sexta, 20 de novembro de 2026") do |header| %>
<% header.with_action do %>
<%= segmented(label: "Visão") do |views| %>
<% views.with_item "Dia", pressed: true %>
<% views.with_item "Semana" %>
<% views.with_item "Mês" %>
<% end %>
<% end %>
<% header.with_filters do %>
<%= cluster(gap: "4px") do %>
<%= icon_button "chevron-left", label: "Dia anterior", variant: :default %>
<%= button "Hoje" %>
<%= icon_button "chevron-right", label: "Próximo dia", variant: :default %>
<% end %>
<h2 style="flex: 1 1 200px; margin-left: 6px">Sexta, 20 de novembro</h2>
<%= multi_select name: :projects, label: "Projetos", icon: "folder", align: :right,
all_label: "Todos os projetos", none_label: "Nenhum projeto", many_label: "%{count} projetos",
options: [ { value: "produto", label: "Produto Exemplo", color: "#4f46e5" }, { value: "canal", label: "Canal Exemplo", color: "#0d9488" },
{ value: "cliente", label: "Cliente Fictício", color: "#0284c7" } ] %>
<% end %>
<% end %>
<div style="display: flex; flex-wrap: wrap; gap: 20px; padding: 20px; align-items: flex-start">
<%= stack(style: "flex: 999 1 520px; min-width: 0") do %>
<%= callout "2 missões atrasadas. Conclua ou reagende para limpar a agenda.", variant: :warning, icon: "alert-triangle" %>
<%= card(title: "Atrasadas", flush: true) do |c| %>
<% c.with_action { counter late.size } %>
<%= table(rows: late, row_href: ->(_) { "#missao" }) do |t| %>
<% t.column("", width: "44px") { |_| check_box_tag "done[]", "1", false, class: "tr-check", aria: { label: "Concluir missão" } } %>
<% t.column("Missão") { |m| tag.span(m[:title], style: "white-space: normal; color: var(--bad-text); font-weight: 600") } %>
<% t.column("Projeto") { |m| safe_join([ status_dot(color: m[:color], style: "margin-right: 7px"), m[:project] ]) } %>
<% t.column("", align: :right) { |m| status_pill "Atrasada há #{m[:days]} #{m[:days] == 1 ? 'dia' : 'dias'}", status: :bad, dot: false } %>
<% end %>
<% end %>
<%= card(title: "Para hoje", subtitle: "3 missões em 3 projetos", flush: true) do |c| %>
<% c.with_action { button "Nova missão", size: :sm, icon: "plus" } %>
<%= table(rows: today, row_href: ->(_) { "#missao" }) do |t| %>
<% t.column("", width: "44px") { |_| check_box_tag "done[]", "1", false, class: "tr-check", aria: { label: "Concluir missão" } } %>
<% t.column("Missão") { |m| tag.span(m[:title], style: "white-space: normal; font-weight: 500") } %>
<% t.column("Quest") { |m| tag.span(safe_join([ status_dot(color: m[:color], style: "margin-right: 7px"), m[:quest] ]), style: "white-space: normal") } %>
<% end %>
<% end %>
<% end %>
<%= card(title: "Próximos dias", style: "flex: 1 1 260px; min-width: 0") do %>
<%= stack(gap: "14px") do %>
<% upcoming.each do |day, missions| %>
<div>
<p style="font-weight: 600; margin-bottom: 4px"><%= day %></p>
<% missions.each do |mission| %>
<p class="tr-cluster" style="gap: 7px; min-height: 26px"><%= status_dot color: "#0d9488" %><%= mission %></p>
<% end %>
</div>
<% end %>
<% end %>
<% end %>
</div>
<% end %>
Settings form
Fields grouped in cards, one primary action at the end. Text, select, read-only and invalid fields, switches and radios, a destructive zone, a warning with its action, and the toast that confirms the save.
<%= app_shell do |shell| %>
<% shell.with_banner "SANDBOX · dados fictícios, restaurados a cada abertura", kind: :sandbox %>
<% shell.with_sidebar(brand: "Emissor Exemplo", brand_href: "#") do |sidebar| %>
<% sidebar.with_item "Notas", href: "#notas", icon: "file-text", current: false %>
<% sidebar.with_item "Certificados", href: "#certificados", icon: "lock", current: false %>
<% sidebar.with_item "Configurações", href: "#configuracoes", icon: "settings", current: true %>
<% end %>
<%= page_header(title: "Configurações", subtitle: "Valem para todas as empresas deste computador") %>
<form action="#" style="padding: 20px; max-width: 760px">
<%= stack do %>
<%= callout(variant: :warning) do |c| %>
O certificado da Demo Consultoria vence em 12 dias.
<% c.with_action { button "Trocar certificado…", size: :sm } %>
<% end %>
<%= card(title: "Empresa padrão", subtitle: "Usada quando você emite sem escolher outra") do %>
<%= stack(gap: "14px") do %>
<%= field "Razão social" do %><%= text_field_tag :name, "Empresa Exemplo Ltda", class: "tr-input" %><% end %>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px">
<%= field "CNPJ" do %><%= text_field_tag :doc, "12.345.678/0001-90", class: "tr-input", readonly: true %><% end %>
<%= field "Município", hint: "Define a prefeitura que recebe a nota." do %>
<%= select_tag :city, options_for_select([ "São Paulo/SP", "Campinas/SP", "Curitiba/PR" ]), class: "tr-select" %>
<% end %>
</div>
<%= field "E-mail para cópia das notas", error: "Informe um e-mail válido, como financeiro@exemplo.com." do %>
<%= email_field_tag :email, "financeiro@", class: "tr-input", aria: { invalid: true } %>
<% end %>
<% end %>
<% end %>
<%= card(title: "Sincronização") do %>
<%= stack(gap: "14px") do %>
<%= toggle_switch "settings[auto_sync]", label: "Sincronizar automaticamente a cada hora", checked: true %>
<%= toggle_switch "settings[notify]", label: "Avisar quando chegar nota recebida" %>
<%= field "Ambiente" do %>
<%= cluster(gap: "20px") do %>
<label class="tr-cluster"><%= radio_button_tag :environment, "production", true, class: "tr-check" %> Produção</label>
<label class="tr-cluster"><%= radio_button_tag :environment, "homolog", false, class: "tr-check" %> Homologação</label>
<% end %>
<% end %>
<% end %>
<% end %>
<%= card(title: "Zona de risco") do |c| %>
<% c.with_footer { button "Remover dados locais…", variant: :danger, size: :sm, icon: "trash" } %>
<p class="tr-muted">Apaga as notas baixadas deste computador. As notas continuam no portal nacional.</p>
<% end %>
<%= cluster(style: "justify-content: flex-end") do %>
<%= button "Cancelar" %>
<%= button "Salvar configurações", variant: :primary, type: "submit" %>
<% end %>
<% end %>
</form>
<%= toasts do %>
<%= toast "Configurações salvas.", dismiss_after: 0 %>
<% end %>
<% end %>
List with confirmation
A destructive action confirmed in a modal over the list. Tabs with counts, a grouped table with progress and late markers, and the modal that names exactly what will happen.
<% quests = [
{ title: "Lançar o canal até março", project: "Canal Exemplo", color: "#0d9488", deadline: "31/03/2027", done: 5, total: 13, next: "Revisar roteiro do vídeo 2", late: true },
{ title: "Publicar 12 vídeos até fevereiro", project: "Canal Exemplo", color: "#0d9488", deadline: "28/02/2027", done: 1, total: 4, next: "Roteirizar vídeo 1", late: false },
{ title: "Fechar 3 clientes novos no trimestre", project: "Produto Exemplo", color: "#4f46e5", deadline: "31/12/2026", done: 2, total: 5, next: "Follow-up com a Demo Consultoria", late: false },
{ title: "Manter o relacionamento com clientes", project: "Produto Exemplo", color: "#4f46e5", deadline: nil, done: 1, total: 2, next: "Ligar para a Empresa Exemplo", late: false },
{ title: "Faturar o cliente todo mês", project: "Cliente Fictício", color: "#0284c7", deadline: nil, done: 1, total: 3, next: "Emitir invoice de novembro", late: false }
] %>
<%= app_shell do |shell| %>
<% shell.with_sidebar(brand: "Workflows", brand_href: "#") do |sidebar| %>
<% sidebar.with_item "Agenda", href: "#agenda", icon: "calendar", current: false %>
<% sidebar.with_item "Quests", href: "#quests", icon: "target", current: true %>
<% end %>
<%= page_header(title: "Quests", subtitle: "7 quests ativas em 3 projetos") do |header| %>
<% header.with_action { button "Nova quest", variant: :primary, icon: "plus" } %>
<% header.with_filters do %>
<%= search_input placeholder: "Buscar quest ou missão" %>
<%= multi_select name: :projects, label: "Projetos", icon: "folder", align: :right,
all_label: "Todos os projetos", none_label: "Nenhum projeto", many_label: "%{count} projetos",
options: quests.uniq { |q| q[:project] }.map { |q| { value: q[:project], label: q[:project], color: q[:color] } } %>
<% end %>
<% header.with_tabs(label: "Situação da quest") do |tabs| %>
<% tabs.with_tab "Ativas", count: 7, selected: true %>
<% tabs.with_tab "Concluídas", count: 2 %>
<% tabs.with_tab "Abandonadas", count: 1 %>
<% end %>
<% end %>
<%= table(rows: quests, min_width: "820px", group_by: ->(q) { q[:project] }, row_href: ->(_) { "#quest" }) do |t| %>
<% t.column("Quest") { |q| tag.span(q[:title], style: "font-weight: 500") } %>
<% t.column("Prazo") { |q| q[:deadline] || tag.span(safe_join([ icon("repeat", style: "vertical-align: -3px; margin-right: 4px"), "Contínua" ]), class: "tr-muted") } %>
<% t.column("Progresso", width: "200px") do |q| %>
<span class="tr-cluster" style="flex-wrap: nowrap; gap: 10px">
<span aria-hidden="true" style="flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden"><span style="display: block; height: 100%; width: <%= (q[:done] * 100 / q[:total]) %>%; background: var(--accent)"></span></span>
<span class="tr-num tr-muted"><%= q[:done] %> de <%= q[:total] %></span>
</span>
<% end %>
<% t.column("Próxima missão") do |q| %>
<%= q[:next] %> <%= status_pill "Atrasada", status: :bad, dot: false, style: "height: 22px; margin-left: 6px" if q[:late] %>
<% end %>
<% end %>
<%= modal(title: "Abandonar esta quest?", subtitle: "“Publicar 12 vídeos até fevereiro” sai das quests ativas. As 3 missões pendentes saem da agenda.", close_href: "#") do |m| %>
<%= field "Motivo (opcional)" do %>
<%= text_area_tag :reason, nil, class: "tr-input", rows: 3, style: "height: auto; padding: 8px 10px", placeholder: "Ex.: mudança de prioridade" %>
<% end %>
<% m.with_footer do %>
<%= button "Cancelar" %>
<%= button "Abandonar quest", variant: :danger_fill %>
<% end %>
<% end %>
<% end %>