Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend Library Functions #126

Open
ccoverstreet opened this issue Nov 18, 2021 · 3 comments
Open

Frontend Library Functions #126

ccoverstreet opened this issue Nov 18, 2021 · 3 comments

Comments

@ccoverstreet
Copy link
Owner

There is some functionality that would be helpful to include in the front-end. For instance, custom popups/alerts would make Jablko feel more cohesive and allow for modules on the front-end to more uniformly interact with users.

A cool idea would be to specify a prompt format using a JavaScript object to specify a format with outputs.

{
  fields: [
    {
      label: "Some prompt",
      id: "input1",
      type: "input"
    },
    {
      label: "Second prompt",
      id: "checkbox1",
      type: "checkbox"
    }
  ]
}

A good example usage for this type of library would be the prompts needed for Jarmuz-Status and Jablko-Cookbook. Right now, they are implemented by swapping the displayed content of the dashboard card to a prompt like screen. Both of these JMODs have almost the exact same implementation, which leads to a lot of redundant and tedious display code. By having a Jablko-Frontend Library, much of the effort with unifying appearance and making sure data appears as requested could be removed from JMOD development. This would greatly reduce potential bugs in code for both behavior and appearance of JMODs and reduce the amount of layout shifts that occur when a JMOD swaps visible content.

@ccoverstreet
Copy link
Owner Author

It might also be helpful to pass a submit handler function to JPrompt. The submit handler would receive the output JSON object and the HTML node. This way, remove is called by the callback function and individual JMODs have the opportunity to validate the output. If the output is invalid, JAlert could be used to prompt the user on what to change.

@ccoverstreet
Copy link
Owner Author

Proof of concept works pretty well. Just need to namespace and add to template.html

@ccoverstreet
Copy link
Owner Author

Initial version has been added with jablko.prompt, jablko.alert, and jablko.confirm. jablko.alert implementation may change a little.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant