From 35d1ea91a7661fc0f2ee5671807c5f8995822264 Mon Sep 17 00:00:00 2001 From: Will Chen Date: Tue, 12 Dec 2023 21:13:59 -0800 Subject: [PATCH] Update component tempalte with new component helper API --- scripts/component_template/component_name.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/component_template/component_name.py b/scripts/component_template/component_name.py index e58b8abeb..2a7017a6a 100644 --- a/scripts/component_template/component_name.py +++ b/scripts/component_template/component_name.py @@ -3,7 +3,6 @@ from pydantic import validate_arguments import optic.components.component_name.component_name_pb2 as component_name_pb -import optic.protos.ui_pb2 as pb from optic.component_helpers import handler_type, insert_component from optic.events import ClickEvent @@ -24,11 +23,9 @@ def component_name( """ insert_component( key=key, - type=pb.Type( - name="component_name", - value=component_name_pb.ComponentNameType( - label=label, - on_click_handler_id=handler_type(on_click) if on_click else None, - ).SerializeToString(), + type_name="component_name", + proto=component_name_pb.ComponentNameType( + label=label, + on_click_handler_id=handler_type(on_click), ), )