// Janela "Novo projeto": motor Glacier próprio, aberto por open_window a partir
// do app principal (handlers/projects.luau → open_new_project_window), que semeia
// a conexão (api_url/api_token) via open_window({ data = ...
screen(title = "Novo projeto — Rustploy") {
resources {
style """
/* Titlebar custom (mesma linguagem visual do app.gv) */
.titlebar { width: fill; height: 32; background: var(--surface); align-y: center; }
.titlebar_drag { width: fill; height: fill; align-y: center; padding: 0 0 0 16; spacing: 9; }
.titlebar_dot { size: 10; color: var(--blue); }
.titlebar_title { size: 12; bold: true; color: var(--muted); }
.win_btn { width: 48; padding: 5 0; color: var(--border); text-align: center; }
.win_close { width: 48; padding: 5 0; color: var(--danger); text-align: center; }
.np_screen { width: fill; height: fill; }
.np_wrap { width: fill; height: fill; padding: 24; spacing: 18; }
.np_head { width: fill; spacing: 5; }
.np_title { size: 20; bold: true; color: var(--text); }
.np_group { width: fill; spacing: 6; }
.np_label { size: 11; bold: true; color: var(--muted); }
.np_input { width: fill; }
.np_actions { width: fill; spacing: 10; align-y: center; }
.np_spacer { width: fill; }
"""
script(src = "scripts/new_project_window.luau")
}
column(class = np_screen) {
row(class = titlebar) {
row(class = titlebar_drag, on_press = window:drag) {
text(class = titlebar_dot, content = "●")
text(class = titlebar_title, content = "Novo projeto — Rustploy")
}
button(class = win_btn, on_click = window:minimize, text = "—")
button(class = win_close, on_click = window:close, text = "✕")
}
column(class = np_wrap) {
column(class = np_head) {
text(class = np_title, content = "Novo projeto")
text(
class = muted,
content = "Cadastre um projeto no cluster conectado.",
)
}
form(
name = np_form,
on_submit = submit_project,
on_validation_error = np_apontar,
width = fill,
spacing = 14,
) {
column(class = np_group) {
text(class = np_label, content = "NOME")
input(
class = np_input,
form_control = np_name,
rules = required,
msg = "informe um nome",
placeholder = "Nome do projeto",
)
text(
class = err,
if = @erro_np_name,
not_empty,
content = "@erro_np_name",
)
}
column(class = np_group) {
text(class = np_label, content = "DESCRIÇÃO (OPCIONAL)")
input(
class = np_input,
form_control = np_desc,
placeholder = Descrição,
)
}
// Erros de rede/RPC (não de campo) e o status "criando…" — spinner
// enquanto o RPC está no ar ({np_busy}).
text(if = @np_err, not_equals = "", class = err, content = "@np_err")
row(class = busy_row, if = @np_msg, not_equals = "") {
spinner(class = busy_spin, if = @np_busy)
text(class = muted, content = "@np_msg")
}
row(class = np_actions) {
column(class = np_spacer)
button(class = btn_ghost, on_click = cancel, text = Cancelar)
button(type = submit, class = btn_primary, text = "Criar projeto")
}
}
}
}
}