// 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 = "{t('new_project_form.new_project_rustploy')}") {
resources {
style """
.dialog__wrap { width: fill; height: fill; padding: 24; spacing: 18; }
.dialog__head { width: fill; spacing: 5; }
.dialog__title { size: 20; bold: true; color: var(--text); }
"""
script(src = "scripts/new_project_window.luau")
}
column(class = dialog__screen) {
row(class = titlebar) {
row(class = titlebar__drag, on_press = window:drag) {
text("●", class = titlebar__dot)
text("{t('new_project_form.new_project_rustploy')}", class = titlebar__title)
}
button(class = titlebar__btn, on_click = window:minimize, text = "—")
button(class = "titlebar__btn titlebar__btn--close", on_click = window:close, text = "✕")
}
column(class = dialog__wrap) {
column(class = dialog__head) {
text("{t('new_project_form.new_project')}", class = dialog__title)
text(
"{t('new_project_form.register_a_project_in_the')}",
class = u-muted,
)
}
form(
name = new_project_form,
on_submit = submit_project,
on_validation_error = new_project_show_validation_errors,
class = "form form--gap-14",
) {
column(class = field) {
text("{t('common.name')}", class = field__label)
input(
class = dialog__input,
form_control = new_project_name,
rules = required,
msg = "{t('common.enter_a_name')}",
placeholder = "{t('common.project_name')}",
)
text(
"@error_new_project_name",
class = u-error,
if = @error_new_project_name,
not_empty,
)
}
column(class = field) {
text("{t('new_project_form.description_optional')}", class = field__label)
input(
class = dialog__input,
form_control = new_project_description,
placeholder = "{t('new_project_form.description')}",
)
}
// Erros de rede/RPC (não de campo) e o status "criando…" — spinner
// enquanto o RPC está no ar ({new_project_busy}).
text("@new_project_error", if = @new_project_error, not_equals = "", class = u-error)
row(class = busy-row, if = @new_project_message, not_equals = "") {
spinner(class = busy-row__spin, if = @new_project_busy)
text("@new_project_message", class = u-muted)
}
row(class = dialog__actions) {
column(class = u-fill)
button(class = "btn btn--ghost", on_click = cancel, disabled = @busy_cancel, text = "{t('common.cancel')}")
button(type = submit, disabled = @busy_submit_project, class = "btn btn--primary", text = "{t('new_project_form.create_project')}")
}
}
}
}
}