watt42_viewlib/sample.py

17 lines
636 B
Python

import json
import panel
from watt42_viewlib import attach_w42_state
w42_state = panel.rx(None)
attach_w42_state(rx_var=w42_state, system_id="fb2b91ce-383e-4356-96b3-b6405dacb353")
state_as_text = panel.bind(lambda s: f"W42 State:\n\n```\n{json.dumps(s, indent=2)}\n```\n\nReplace this with some awesome visuals", w42_state)
state_pane = panel.pane.Markdown(state_as_text, sizing_mode='stretch_width')
_ = panel.template.FastListTemplate(
title="Sample W42 View App",
sidebar=[panel.pane.Markdown("This is a sample sidebar.")],
main=[panel.pane.Markdown("# Welcome to the Main Content Area"), state_pane],
).servable()