1#ifndef YAZE_APP_EDITOR_HACK_ORACLE_UI_ANNOTATION_OVERLAY_PANEL_H
2#define YAZE_APP_EDITOR_HACK_ORACLE_UI_ANNOTATION_OVERLAY_PANEL_H
16#include "imgui/imgui.h"
17#include "nlohmann/json.hpp"
56 std::string
GetId()
const override {
return "oracle.annotations"; }
62 return "Review and edit room-level project annotations";
73 void Draw(
bool* )
override {
77 if (!project->code_folder.empty()) {
78 namespace fs = std::filesystem;
80 fs::path(project->GetAbsolutePath(project->code_folder)) /
81 "Docs" /
"Dev" /
"Planning" /
"annotations.json";
88 ImGui::Text(tr(
"Room filter:"));
92 if (ImGui::Button(tr(
"All")))
96 const char* priorities[] = {
"All",
"Note",
"Bug",
"Blocker"};
102 ImGui::BeginChild(
"annotation_list", ImVec2(0, -120),
103 ImGuiChildFlags_Borders);
116 ImVec2 cursor = ImGui::GetCursorScreenPos();
117 ImGui::GetWindowDrawList()->AddCircleFilled(
118 ImVec2(cursor.x + 6, cursor.y + 10), 5.0f, dot_color);
119 ImGui::Dummy(ImVec2(16, 0));
123 snprintf(label,
sizeof(label),
"Room 0x%02X: %s##ann_%zu", ann.room_id,
124 ann.text.c_str(), i);
126 if (ImGui::Selectable(label,
selected_index_ ==
static_cast<int>(i))) {
133 ann.category.c_str());
142 ImGui::Text(tr(
"Room:"));
144 ImGui::SetNextItemWidth(80);
148 ImGui::Text(tr(
"Priority:"));
150 ImGui::SetNextItemWidth(80);
151 const char* pri_names[] = {
"Note",
"Bug",
"Blocker"};
157 if (ImGui::Button(tr(
"Add"))) {
170 if (ImGui::Button(tr(
"Update"))) {
179 if (ImGui::Button(tr(
"Delete"))) {
193 std::vector<const AnnotationEntry*> result;
195 if (ann.room_id == room_id) {
196 result.push_back(&ann);
209 if (ann.room_id == room_id) {
210 max_pri = std::max(max_pri,
static_cast<int>(ann.priority));
219 return IM_COL32(220, 50, 50, 255);
221 return IM_COL32(220, 150, 30, 255);
224 return IM_COL32(60, 120, 220, 255);
242 if (root.contains(
"annotations") && root[
"annotations"].is_array()) {
243 for (
const auto& item : root[
"annotations"]) {
245 entry.
room_id = item.value(
"room_id", 0);
246 entry.
text = item.value(
"text",
"");
249 entry.
category = item.value(
"category",
"");
250 entry.
created_at = item.value(
"created_at",
"");
264 nlohmann::json arr = nlohmann::json::array();
268 item[
"room_id"] = ann.room_id;
269 item[
"text"] = ann.text;
270 item[
"priority"] =
static_cast<int>(ann.priority);
271 item[
"category"] = ann.category;
272 item[
"created_at"] = ann.created_at;
276 root[
"annotations"] = arr;
279 if (file.is_open()) {
280 file << root.dump(2) << std::endl;
Room-level annotation management for Oracle projects.
void SetAnnotationsPath(const std::string &path)
void Draw(bool *) override
Draw the panel content.
WindowLifecycle GetWindowLifecycle() const override
Get the lifecycle category for this window.
std::string GetWorkflowGroup() const override
Optional workflow group for hack-centric actions.
std::vector< const AnnotationEntry * > GetAnnotationsForRoom(int room_id) const
Get annotations for a specific room.
int GetMaxPriorityForRoom(int room_id) const
Get the highest priority for a room (for dot color). Returns -1 if no annotations.
std::string GetWorkflowDescription() const override
Optional workflow description for menus/command palette.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::vector< AnnotationEntry > annotations_
std::string annotations_path_
static ImU32 GetPriorityColor(AnnotationPriority priority)
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
std::string GetId() const override
Unique identifier for this panel.
std::string GetIcon() const override
Material Design icon for this panel.
Base interface for all logical window content components.
::yaze::project::YazeProject * current_project()
Get the current project instance.
Editors are the view controllers for the application.
AnnotationPriority
Annotation priority levels.
WindowLifecycle
Defines lifecycle behavior for editor windows.
@ CrossEditor
User can pin to persist across editors.
A room-level annotation entry.
AnnotationPriority priority