diff --git a/web/src/features/menu/ContextMenu.tsx b/web/src/features/menu/ContextMenu.tsx index 00664b0..d65acb2 100644 --- a/web/src/features/menu/ContextMenu.tsx +++ b/web/src/features/menu/ContextMenu.tsx @@ -12,31 +12,27 @@ debugData([ action: "showContext", data: { title: "Vehicle garage", - options: { - "Dinka Blista": { - description: "Super cool vehicle", - menu: "some_other_identifier", - metadata: { - Plate: "KLT 192", - Status: "In garage", - Health: "30%", - }, + options: [ + { title: "Empty button" }, + { + title: "Example button", + description: "Example button description", + metadata: { ["Value 1"]: "Some value", ["Value 2"]: 300 }, }, - "Elegy Nitro": { - description: "Even cooler vehicle", - metadata: ["Plate: JGM 971", "Status: In garage"], + { + title: "Menu button", + menu: "other_example_menu", + description: "Takes you to another menu", + metadata: ["It also has metadata support"], }, - Burger: { - description: "Make a delicious burger", - metadata: { - Bun: 3, - Lettuce: 2, - Meat: 1, - Tomato: 1, - Cheese: 2, - }, + { + title: "Event button", + description: "Open a menu and send event data", + arrow: true, + event: "some_event", + args: { value1: 300, value2: "Other value" }, }, - }, + ], }, }, ]); diff --git a/web/src/features/menu/Item.tsx b/web/src/features/menu/Item.tsx index dca8d4a..f342a3a 100644 --- a/web/src/features/menu/Item.tsx +++ b/web/src/features/menu/Item.tsx @@ -68,7 +68,7 @@ const Item: React.FC<{ - {option[0]} + {option[1].title ? option[1].title : option[0]} {option[1].description && ( diff --git a/web/src/interfaces/context.ts b/web/src/interfaces/context.ts index 1716f24..276baa0 100644 --- a/web/src/interfaces/context.ts +++ b/web/src/interfaces/context.ts @@ -1,5 +1,6 @@ export interface Option { menu?: string; + title?: string; description?: string; arrow?: boolean; metadata?: string[] | { [key: string]: any }; @@ -15,5 +16,5 @@ export interface Options { export interface ContextMenuProps { title: string; menu?: string; - options: Options; + options: Options | Option[]; }