mpa-config icon indicating copy to clipboard operation
mpa-config copied to clipboard

Thought about default way to define a page

Open arnaudmiribel opened this issue 3 years ago • 1 comments

Wondering if it would not be cleaner to expect script_path in all situations instead of page_name when adding a new page. And if page_name is not given, then infer it from script_path (instead of the other way around). I find it "weird" that I have to title() manually my script path whenever I want to add it as a new page...

What do you think?

Current behavior

By default, the user gives a page name, and the MPA will look for a script whose name equals page_name.lower().replace(" ", "_")

    pages:
      - page_name: Data Docs  # inferring script_path is pages/data_docs.py
        icon: 🗺
      - page_name: Data Sources
        icon: 📚
        script_path: pages/data_lookup.py

Proposed behavior

If the user only gives a script path, then the MPA will infer the page name based on script_path.replace("_", " ").title()

    pages:
      - script_path: pages/data_docs.py  # inferring page_name is Data Docs
        icon: 🗺
      - script_path: pages/data_lookup.py
        icon: 📚
        page_name: Data Sources

Yea a pretty strong cons to my proposed behavior is that it's great to lookup all pages by their titles. That's probably how you memorize them best.

arnaudmiribel avatar Jul 13 '22 13:07 arnaudmiribel

In my mind, if you have to put something, it's easier to just put a title. But, it is a little strange that you have to "figure out" the right title. I feel like it's pretty easy to tell people "just put the filename as the page name, but without the underscore". If you have to put something, as you do in either of these cases, I'd rather type out the page name than the script path.

One nice extra feature might be to automatically also show extra pages that have been newly added, even if they aren't in the config yaml, and just don't have an icon. It would be nice to prompt users somehow that they should add them to the config, so in some ways I don't mind that we're forcing users to do that first.

Random idea I just came up with -- what if we shipped a CLI to pop up a management page that let you edit the config.yaml 🤯 ? Now that I type it, I think it might be pretty great...you could select the emoji from a emoji picker, add a custom name, change visibility......

blackary avatar Jul 13 '22 13:07 blackary