jamaljsr / polar

One-click Bitcoin Lightning networks for local app development & testing
https://lightningpolar.com
MIT License
768 stars 144 forks source link

Feature Request: Polar Widgets #620

Open crisdut opened 1 year ago

crisdut commented 1 year ago

Polar is a great project, and I like to use it to explain how LN works and show the possibilities of the network. However, sometimes I miss some features to help me, like "step-by-step guides" or "tutorials".

But extending Polar with these features will increase complexity and is out of scope.

Because of this, I start thinking about changing Polar to support Widgets.

How Works

I think exists two ways to make this works:

  1. Create a type of "react event bus hook" to nodes and actions commands to allow the widgets to intercept and process events.
  2. Change Sidebar to supports inject new "Actions".

Example:

Imagine a tutorial Widget called "My First Invoice", like a IntroJS.

To build this, I need to check if "Create Invoice" and "Pay Invoice" is called to my widget works.

Event Bus Example: here

Does make sense to you?

jamaljsr commented 1 year ago

I think I understand what you are trying to accomplish. You'd like some extensibility points added to Polar which would allow others to create widget-like plugins that add additional functionality, such as step-by-step tutorials. Are you imagining the widgets living in the same codebase as Polar, or external plugins that can be loaded in at runtime?

crisdut commented 1 year ago

I think I understand what you are trying to accomplish. You'd like some extensibility points added to Polar which would allow others to create widget-like plugins that add additional functionality, such as step-by-step tutorials. Are you imagining the widgets living in the same codebase as Polar, or external plugins that can be loaded in at runtime?

Hi @jamaljsr,

Yes, exactly.

Well, I think the best solution is external repos. The users install widgets by command line or with an interface with a list of widgets.

jamaljsr commented 1 year ago

This is an interesting idea. It's not something I can prioritize working on at the moment, but I would be fine reviewing a PR if someone else wants to work on implementing it.

crisdut commented 1 year ago

This is an interesting idea. It's not something I can prioritize working on at the moment, but I would be fine reviewing a PR if someone else wants to work on implementing it.

Ok, don't worry.

I opened the PR to share some ideas.

Next week, I will start the implementation.

Thanks for feedback!