rustploy-gui 0.1.75

Rustploy — desktop client (glacier-ui) for the Rustploy PaaS daemon
app(
  id = rustploy,
  single_instance = true,
  remember_geometry = true,
  size = "1280 820",
  min_size = "640 680",
  icon = "views/assets/rustploy.png",
  decorations = false,
  application_id = "rustploy-gui",
  antialiasing = false,
  toast_period = 250,
) {
  resources {
    link(rel = theme, href = "views/styles/theme.json")
    link(rel = stylesheet, href = "views/styles/app.gss")

    // JetBrains Mono (src/embedded.rs): só para código e valores (`u-mono`);
    // a interface usa a sans do sistema, a mesma em que o `bold` cai.
    font(
      src = "assets/fonts/JetBrainsMono-Regular.ttf",
      family = "JetBrains Mono"
    )
    font(src = "assets/fonts/JetBrainsMono-Bold.ttf")

    tray(icon = "views/assets/rustploy.png", tooltip = Rustploy) {
      item(label = "Open Rustploy", on_click = tray:open)
      check(
        label = Notifications,
        checked = @__notifications,
        on_click = notifications:toggle
      )
      separator
      item(label = "Quit Rustploy", on_click = tray:quit)
    }
  }

  screen(name = app, initial = true, title = Rustploy) {
    resources {
      link(rel = import, href = login.component.gv, as = Login)
      link(rel = import, href = shell.component.gv, as = Shell)

      script(src = "scripts/app.luau")

      // Plano de "Deploy com dependências": aberto por start_deploy
      // (handlers/services.luau) via open_dialog, com a ordem em
      // __dialog.message; os `choice` devolvem "so"/"aceitar" a ele, e o
      // `button` Rejeitar só fecha (nil). Os botões quebram linha se não
      // couberem.
      dialog(
        name = deploy_plan,
        title = "{t('deploy_plan.title')}",
        icon = question
      ) {
        column(spacing = 8, width = fill) {
          text("{t('deploy_plan.order')}", class = u-label-cap)
          text("{__dialog.message}")
        }

        actions {
          button("{t('deploy_plan.reject')}")
          choice("{t('deploy_plan.only_service')}", value = so, role = neutral)
          choice("{t('deploy_plan.accept')}", value = aceitar)
        }
      }
    }

    column(class = screen) {
      // ── Top edge + top corners (north / nw / ne) ──────────────────────────
      row(class = resize__top) {
        column(
          class = "resize__corner resize__corner--nw",
          on_press = window:resize:nw
        )
        column(class = resize__edge-h, on_press = window:resize:n)
        column(
          class = "resize__corner resize__corner--ne",
          on_press = window:resize:ne
        )
      }

      // ── Middle band: left edge | body | right edge (west / east) ──────────
      row(class = resize__mid) {
        column(class = resize__edge-v, on_press = window:resize:w)

        column(class = resize__body) {
          // ── Custom titlebar ───────────────────────────────────────────
          row(class = titlebar) {
            row(
              class = titlebar__drag,
              on_press = window:drag,
              on_double_click = window:maximize,
            ) {
              text("●", class = titlebar__dot)
              text("{t('common.rustploy')}", class = titlebar__title)
            }

            button("—", class = titlebar__btn, on_click = window:minimize)
            // Quadrado = maximizar; dois sobrepostos = restaurar (a convenção
            // da barra nativa). O estado vem do daemon do glacier, a cada
            // resize.
            if @glacier_window_maximized {
              button(class = titlebar__btn, on_click = window:maximize) {
                container(class = titlebar__icon-box) {
                  svg(
                    class = titlebar__icon,
                    src = "assets/icons/win_restore.svg"
                  )
                }
              }
            } else {
              button(class = titlebar__btn, on_click = window:maximize) {
                container(class = titlebar__icon-box) {
                  svg(
                    class = titlebar__icon,
                    src = "assets/icons/win_maximize.svg"
                  )
                }
              }
            }
            button(
              "✕",
              class = "titlebar__btn titlebar__btn--close",
              on_click = window:close
            )
          }

          if @screen == "login" {
            Login
          } else {
            Shell
          }
        }

        column(class = resize__edge-v, on_press = window:resize:e)
      }

      // ── Bottom edge + bottom corners (south / sw / se) ────────────────────
      row(class = resize__bottom) {
        column(
          class = "resize__corner resize__corner--sw",
          on_press = window:resize:sw
        )
        column(class = resize__edge-h, on_press = window:resize:s)
        column(
          class = "resize__corner resize__corner--se",
          on_press = window:resize:se
        )
      }
    }
  }

  screen(name = log, src = "log_window.screen.gv")
  screen(name = new_job, src = "new_job_window.screen.gv")
  screen(name = new_service, src = "new_service_window.screen.gv")
  screen(name = new_project, src = "new_project_form.screen.gv")
  screen(
    name = new_registry_token,
    src = "new_registry_token_window.screen.gv"
  )
  screen(name = service_export, src = "service_export_window.screen.gv")
  screen(name = services_reorder, src = "services_reorder_window.screen.gv")
}