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

Add Home/Dashboard page support? #54

Open
NduatiK opened this issue May 12, 2021 · 3 comments
Open

Add Home/Dashboard page support? #54

NduatiK opened this issue May 12, 2021 · 3 comments

Comments

@NduatiK
Copy link
Contributor

NduatiK commented May 12, 2021

At the moment there is Backoffice has no clear home/dashboard page. I think this could be a nice value addition. Just a simple page that has the app logo, some widgets with useful stats and some shortcuts to existing resources. @edisonywh, what do you think? Is this a stretch for the library, something outside scope?

What I have in mind is something that looks like:
PotentialHomePage

At a high-level, we would add a new page type. Maybe Backoffice.Page.Dashboard?
That page would have two functions: widgets and shortcuts.

widgets would return a list of widgets, just like those at in the Index page.

def widgets(socket) do
    %Backoffice.PlainWidget{
      title: "Blog Posts",
      data: ...
    },
    %Backoffice.PlainWidget{
      title: "Podcast Episodes",
      data:  ...
    },
    %Backoffice.PlainWidget{
      title: "Unique Visitors",
      data:  ...
    }
end

shortcuts would return a list of shortcuts to other pages.

def shortcuts do
[
    %Backoffice.ShortcutWidget{
      title: "Blog",
      subtitle: "Get writing",
      color: "#23A342",
      icon: #svg_data
    }
]
@NduatiK
Copy link
Contributor Author

NduatiK commented May 12, 2021

The question would be, is this useful for the library to provide? Or would it be bloat?
If useful, I would be happy to take it on.

@edisonywh
Copy link
Owner

Definitely! I think the idea has merits, but there's a couple of things I think we need to figure out.

  • What does it look like for the user? Do they create a new Dashboard module and use Backoffice.Page.Dashboard?
  • How do users provide data into the Dashboard page?

The main reason I didn't start with a dashboard is because of the aforementioned reasons, and also that I think dashboard by nature varies by business, so I don't see a way to provide a good default. And I'm not sure if ultimately it adds a lot of value to them (for example if it's not extensible enough to adapt to their use case, they just won't use it altogether)

So my idea instead moved to using Widget as the building block - focus on building a core set of widgets, and this way users can plug & play these into their own dashboard page. One idea for example is to build a ChartWidget that takes in a Contex chart, so users can just pass in the data struct, and the widget can just render them.

I am open to changing my mind though, maybe we can start off by answering some of the questions above!

@NduatiK
Copy link
Contributor Author

NduatiK commented May 18, 2021

Charts? Even better!!!

My initial thought was that:

  • yes, users would create a new Dashboard module and use Backoffice.Page.Dashboard.
  • data would be provided to the page by defining functions that would be periodically called to return the data. For something like a count of say blog posts, the user would provide a function in the Blog module that would return an integer representing the count. I will look into how LiveDashboard allows control of this.

The widget approach you suggest feels a lot more valuable and extensible.
We would probably need

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

2 participants