Add tooltips for readonly item system properties

This commit is contained in:
Jage9
2026-02-27 02:22:59 -05:00
parent 1440273661
commit ac88195c6e
3 changed files with 24 additions and 3 deletions

View File

@@ -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";

View File

@@ -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.",

View File

@@ -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