Component based frontend UI design - javascript

We're planning a front end application where you can continuously add/remove UI components in the stage. You can configure them in place and finally can publish the stage (web page).
We’ve an inventory of components. The components are categorized. For example: headers, sidebars. In the inventory they will show a preview (may be an image) of the available components in that category.
An item can be added to the stage (traditionally a simple web page) from the inventory. The stages are related to inventory categories. For example, in the stage, there is one “headers containers” where you can add component only for headers inventory.
Each category may have own rule. For example, You can’t add more than one component in the in “headers containers” (which is in the stage/page) from headers inventory category. However, you can add as many item as you want in the “sidebar containers”.
In the same way, each component may have own rules. Each component may render differently and may have different configuration option. For example, you add an header component from “headers inventory” which has logo, background image. But another may not have background image. Unless a component has a feature (e.g. background image), it won’t be available in the configuration panel.
All of the above components will always work except previewing in inventory. That means, as soon as they’re added to stage, they’re live element, they should work as they should with default settings (unless configured). They will communicate in the backend services to get/save data.
Persisting data: We also want to persists data among the switching of the components (of same type). For example, if you add one header component added on the stage which you configured to have own your logo, switching to another header component (which also has support for logo) should keep the old selected logo.
I am also thinking it will be very good if we can everything a component. For example, logo is a component, background image is a component. Each of them should work independently, with own configurator (file upload button for logo component), validation (check file types for logo component) etc.. The previously mentioned each header component will be container of several components which can hold any number of components and can work as bridge among those components (like merging all the configuration in the same interface rather than individually).
My current thoughts are:
Backbone.js
jQuery UI Widget Factory
But both will require lots of fundamental job at our end. Is there any framework/library that already solved most or some of the problems we’re trying to solve. I am not sure whether Angular.js directive based solution will be good here too. Any suggestion towards that is highly appreciated

If I understand you correctly you want to build a dashboard like functionality. Try taking a look at sDashboard https://github.com/ModelN/sDashboard or commercial options like droptiles http://www.droptiles.com/ or razorflow http://razorflow.com/

Related

I need help to create a Report Builder in React.js

I have a challenge to create a "Report Builder", which aims to allow the creation of financial reports in a customized way from existing editable components.
I haven't found a library that is able to supply what I need, so I believe that the best thing is to build it in parts. I need some help to architect the application.
The first requirements of Report Builder:
A "page" component for the report
A list of components used for a build the report
(Example of components: Title, Text, Bar Graph, Column Graph, Table)
Each component can be individually editable according to its type
A component can be resizable
You can have more than one component
The component can be dragged on the report page and placed in the desired location
The report must be saved and its editing continued later
An existing project that has something very similar to what I need is FathomHQ Reporting.
Its Reporting is showed in this video: https://www.youtube.com/watch?v=Zz-CpLcBO7M
I'm thinking about using DNDKit (https://dndkit.com/) to drag and drop the report, but I'm still not sure how I can keep track of each individual component, and allow that it can be editable.
If anyone has any library or architectural recommendation for building this project, I'll be glad to hear.

Functionally, how do drag and drop page builders work?

I am working on my first extensive MERN project and part of the functionality involves specific components (like a checkbox to-do list, images, text, ets...) that then allow the user to build out different pages, larger multi-checkbox aggregation lists, etc... Think of it as something like https://www.notion.so/notes.
Building the individual react components and configuring them on static pages is straightforward. However, I'm having a hard time conceptually understanding how to take those components and then dynamically allow users to build out custom pages using them.
In a broad sense, how do page builders functionally work?
Here is a broad idea. You will need a page where the left side lists all your UI components [thump nails] and the right side area for dragging and dropping those compoents. You will need a grid system with rows and columns components like Bootstrap Grid or MUI Grid dividing space into 12 portions for the layout of any page. You should let each dropped component give an option to accept its props so users can set it. Setting props can be another component.
When they save the design you should get the react component tree of what they are saving along with all properties and save it in your DB. You should be able to generate both the design view and the actual view with those saved data.
It was easy to say but I know it's a lot of work. I have seen similar work done using Angular and .NET.

React html customizable styling

How do they do this? I use React.JS and hooks and have online ordering set up, but I wish to do a similar thing where I can style the UI depending on the restaurant.
You can see in the links before, all the online ordering layout is similar but the UI is different for each one.
Thanks
These look like templates to me. You will need some kind of Admin interface from where a user can select the template, as well as information like brand, logo, menu for his website.
Think of something like WordPress, where we select or install a theme for our website and then set up the rest of the website by adding logo, items etc.
So you will definitely need a backend for this to store these values for the individual customers into the database.
You will also need to store the domain name mapped to each template somewhere.
Excellent answer from #vaibhavmande. That is in fact how we do it. (I'm the mobi2go CTO). Here's another sample : https://ghostytoasty.mobi2go.com/. At a basic level you can customize your theme and layout, but you can also customize CSS for each brand. On top of that we actually have a fairly comprehensive javascript framework so orders can be added to a basket without a roundtrip to the server. In some complicated cases we have custom javascript as well (this gives great power but can leave you open to certain bugs). Lots of snapshot testing with https://www.cypress.io/ helps. We're a proud NZ based company but have offices in Australia, North America and Europe. We're also hiring so if you want to learn it all first hand : https://mobi.bamboohr.com/jobs :)

How to 'show/hide' specific JSON Objects (TimelineJS)?

I am using Timeline JS with JSONP as my source file.
The final product will be one timeline about two separate histories (which are related).
I need to be able to show/hide each history's timeline elements so that you can view one and not the other.
Default, of course, shows both histories simultaneously.
Thank you

Layout and design regarding different sections of template when using MVC and AngularJS

Im using Bootstrap and AngularJS with .Net Web API for my backend services. Im still a bit new to AngularJS. When considering the different sections of the layout, my app directive is currently at the container level named "Bottom". However, my individual views will be in the area named "main-content" (these are div boundaries).
The layout also contains an area named "sidebar" which will only be used on one page, the rest of my pages will expand "content-wrapper" from 10 to the full 12 column width of the page.
So Im trying to decide on how to use either use one layout (in terms of our MVC _layout.cshtml typically used for the template) for both types of pages, or use two separate layouts. The latter seems "cleaner", since trying to use a single layout for all scenarios seems more trouble. I think Ive used separate master pages with ASP.Net web forms in the past in these cases. Same idea here? I think this would make things cleaner also with regards to setting up the AngularJS code, as I can separate the two page types with different modules with their own controllers. Does this seem like a good approach, considering not just the mvc layout, but any impact on Angular/Javascript code?
TL;DR: Use one layout CSHTML page.
It's hard to give a confident recommendation without having a deeper knowledge of your application. Ultimately, it's your decision to make based on the information you have.
That being said, if indeed that sidebar is only used on one page, it should be considered part of that page. With that in mind, Container in the image you attached would serve as the host element for the router's view directive and the page with the sidebar will have that sidebar in its template.
If, however, the sidebar may appear on other pages in the future, I would simply hide it based on the current page with the view directive on the content-wrapper in your example. I have a similar situation in an app I'm working in which the sidebar behaves as a sort of internal navigation. If the current page does not have any sensible links to put in that sidebar, we hide it. Something like that may work for you in this case.
In either case, I would recommend against using multiple CSHTML layout pages because of the potential strangeness in the user's experience with some pages using a nice, AJAX-driven navigation and others using an old-school, "white-flash" kind of navigation.
Take a look at ui-router, which is an alternative to the default routing that Angular comes with. It allows you to have multiple views, the content of which can change based on the route. If you are used to using a templating system to layout applications pages and your pages have a generalized sort of layout (ie all pages have a top nav, a main body, and a footer, or something similar) then ui-router goes a long way towards making this much easier in Angular.

Categories

Resources