From ac88195c6ee4cda165e38fcc20508148ed49f903 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Fri, 27 Feb 2026 02:22:59 -0500 Subject: [PATCH] Add tooltips for readonly item system properties --- client/public/version.js | 2 +- server/app/item_catalog.py | 9 +++++++++ server/tests/test_item_schema_ui.py | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index 0d4459b..2687b90 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.25 R280"; +window.CHGRID_WEB_VERSION = "2026.02.27 R281"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/server/app/item_catalog.py b/server/app/item_catalog.py index e274107..36c4e2e 100644 --- a/server/app/item_catalog.py +++ b/server/app/item_catalog.py @@ -80,6 +80,15 @@ ITEM_TYPE_TOOLTIPS: dict[ItemType, str] = { } GLOBAL_ITEM_PROPERTY_METADATA: dict[str, dict[str, object]] = { + "type": {"valueType": "text", "tooltip": "Item type id for this object.", "label": "Type"}, + "x": {"valueType": "number", "tooltip": "Item X coordinate on the grid.", "label": "X"}, + "y": {"valueType": "number", "tooltip": "Item Y coordinate on the grid.", "label": "Y"}, + "carrierId": {"valueType": "text", "tooltip": "User id currently carrying this item, or none.", "label": "Carrier"}, + "version": {"valueType": "number", "tooltip": "Server-side item version incremented on each update.", "label": "Version"}, + "createdBy": {"valueType": "text", "tooltip": "Username that originally created this item.", "label": "Created by"}, + "createdAt": {"valueType": "text", "tooltip": "Creation timestamp for this item.", "label": "Created at"}, + "updatedAt": {"valueType": "text", "tooltip": "Last update timestamp for this item.", "label": "Updated at"}, + "capabilities": {"valueType": "text", "tooltip": "Supported actions for this item type.", "label": "Capabilities"}, "useSound": { "valueType": "sound", "tooltip": "One-shot sound played when this item is used successfully.", diff --git a/server/tests/test_item_schema_ui.py b/server/tests/test_item_schema_ui.py index 4234bd2..60085c6 100644 --- a/server/tests/test_item_schema_ui.py +++ b/server/tests/test_item_schema_ui.py @@ -19,7 +19,7 @@ def test_ui_definitions_are_complete_for_all_item_types() -> None: assert len(item_types) == len(item_type_order) assert [entry.get("type") for entry in item_types] == item_type_order - required_global_keys = { + required_global_property_keys = { "useSound", "emitSound", "useCooldownMs", @@ -28,6 +28,17 @@ def test_ui_definitions_are_complete_for_all_item_types() -> None: "emitSoundSpeed", "emitSoundTempo", } + required_system_metadata_keys = { + "type", + "x", + "y", + "carrierId", + "version", + "createdBy", + "createdAt", + "updatedAt", + "capabilities", + } for entry in item_types: assert isinstance(entry.get("type"), str) @@ -43,7 +54,8 @@ def test_ui_definitions_are_complete_for_all_item_types() -> None: global_properties = entry["globalProperties"] assert capabilities - assert required_global_keys.issubset(set(global_properties.keys())) + assert required_global_property_keys.issubset(set(global_properties.keys())) + assert required_system_metadata_keys.issubset(set(property_metadata.keys())) for property_key in editable_properties: if property_key == "title": continue