Foundation / checks (deploy) (push) Successful in 3m26s
Foundation / checks (ecs) (push) Successful in 2m2s
Foundation / checks (client) (push) Successful in 12m47s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 11m44s
Foundation / checks (checks) (push) Canceled after 17m14s
Foundation / checks (postgres) (push) Canceled after 4m27s
- A stale_grant before Welcome spends only that grant: the session tries the next one in the bundle and ends as exhausted when none is left (other refusals still stop). - UI scale (ADR-0084 amendment): embedded scalable font (ProggyForever), scale from logical window height (720 reference, 1.0-2.5) times a Ctrl+= / Ctrl+- nudge; panel sizes and table columns in logical units; movable panels placed again per scale. - --size W,H for engineering review screenshots. - Tests: client_remote_session (stale grant, exhausted), client_ui_state (scale). Refresh the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.3 KiB
C++
60 lines
2.3 KiB
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <optional>
|
|
#include <span>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace evo::client {
|
|
enum class UiError : std::uint8_t { invalid, stale_time, busy, exhausted };
|
|
enum class NoticeLevel : std::uint8_t { info, warning, error };
|
|
struct Notice {
|
|
std::uint64_t id{}, expires_at_ms{};
|
|
NoticeLevel level{};
|
|
std::string text;
|
|
};
|
|
struct Dialog {
|
|
std::uint64_t id{};
|
|
std::string title, body;
|
|
};
|
|
// Main-thread, bounded presentation state. Never store credentials or authority here.
|
|
class UiState {
|
|
public:
|
|
static constexpr std::size_t max_notices = 8, max_text = 240, max_title = 96;
|
|
[[nodiscard]] std::expected<void, UiError> advance(std::uint64_t now_ms);
|
|
[[nodiscard]] std::expected<std::uint64_t, UiError>
|
|
notify(std::string_view text, NoticeLevel level, std::uint64_t lifetime_ms = 5000);
|
|
[[nodiscard]] bool dismiss(std::uint64_t id);
|
|
[[nodiscard]] std::expected<std::uint64_t, UiError> open_dialog(std::string_view title,
|
|
std::string_view body);
|
|
[[nodiscard]] bool close_dialog(std::uint64_t id);
|
|
[[nodiscard]] std::span<const Notice> notices() const noexcept {
|
|
return notices_;
|
|
}
|
|
[[nodiscard]] const std::optional<Dialog>& dialog() const noexcept {
|
|
return dialog_;
|
|
}
|
|
[[nodiscard]] std::uint64_t evicted_notices() const noexcept {
|
|
return evicted_;
|
|
}
|
|
|
|
private:
|
|
std::uint64_t now_{}, next_id_{1}, evicted_{};
|
|
std::vector<Notice> notices_;
|
|
std::optional<Dialog> dialog_;
|
|
};
|
|
|
|
// Engineering UI scale. The UI grows with the window: logical height over a 720-point
|
|
// reference, clamped to [1, 2.5] (display DPI is already in the logical size), times the
|
|
// user's nudge, clamped to [0.5, 2]. A non-finite or non-positive input counts as 1.
|
|
inline constexpr float ui_reference_height = 720.0F;
|
|
inline constexpr float ui_window_min = 1.0F, ui_window_max = 2.5F;
|
|
inline constexpr float ui_user_min = 0.5F, ui_user_max = 2.0F, ui_user_step = 0.1F;
|
|
[[nodiscard]] float ui_scale(int logical_height, float user) noexcept;
|
|
// One nudge up (+1) or down (-1), kept on the 0.1 grid and within the user range.
|
|
[[nodiscard]] float ui_user_nudge(float user, int direction) noexcept;
|
|
} // namespace evo::client
|