40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
// panels.h — Panel draw functions for kanban_cpp.
|
|
//
|
|
// Each draw_* expects to be called inside an active ImGui frame; it issues
|
|
// its own ImGui::Begin/End block guarded by the supplied bool*.
|
|
#pragma once
|
|
|
|
#include "data.h"
|
|
#include <mutex>
|
|
#include <string>
|
|
|
|
namespace kanban_cpp {
|
|
|
|
// Shared app state passed to every panel. Owned by main.cpp.
|
|
// `mu` guards cards/columns/backend_ok/last_refresh_*/sse_status — refresh_data
|
|
// corre en thread aparte y el SSE callback tambien lo hace, ambos escriben a
|
|
// traves del mismo mutex.
|
|
struct AppState {
|
|
ClientConfig cfg;
|
|
std::vector<Card> cards;
|
|
std::vector<Column> columns;
|
|
std::string last_refresh_error;
|
|
int64_t last_refresh_ts = 0;
|
|
bool backend_ok = false;
|
|
// SSE live status: "connecting" | "connected" | "disconnected" | "error: <msg>"
|
|
std::string sse_status = "connecting";
|
|
std::mutex mu;
|
|
};
|
|
|
|
void draw_board (AppState& s, bool* p_open);
|
|
void draw_calendar (AppState& s, bool* p_open);
|
|
void draw_dashboard (AppState& s, bool* p_open);
|
|
void draw_agent_runs(AppState& s, bool* p_open);
|
|
void draw_worktrees (AppState& s, bool* p_open);
|
|
void draw_dod (AppState& s, bool* p_open);
|
|
|
|
// Polls the backend for cards/columns; updates s.last_refresh_*.
|
|
void refresh_data(AppState& s);
|
|
|
|
} // namespace kanban_cpp
|