-
Notifications
You must be signed in to change notification settings - Fork 9
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
UI Redesign #54
Comments
While I love the UI for Synology, I'm not sure it's really the best comparison, we aren't trying to build an entire OS gui, just controls for embedded devices so if be looking more at things like the UI for a WiFi access point, smart power plug etc |
Yeah - agree we are not building an entire OS gui - But StarBase is a lightweight OS-like layer so maybe a bit of a OS GUI ... ;-) A bit about the history:
I would like to keep most of these things in some way but realise it is too overwhelming / nerdy now. My next idea is instead of dragging them to another column is dragging them anywhere you like - so get rid of the column structure - see : https://www.w3schools.com/css/css_positioning.asp I think implementing these absolute positions is not too difficult and it allows more freedom to organise it the way a user wants - this led me to Synology interface. So long story short - would be nice to have this positioning implemented - as we are close to that - but for the rest we could make a control structure which makes it look much more straightforward as it is now. What about Home Assistant interface? This also has panels which can be moved around? Maybe you can share screenshots of simpler UI's we can use for inspiration? |
[{"id":"Files","type":"sysmod","ro":true,"max":255,"n":[{"id":"fileTbl","type":"table","ro":false,"n":[{"id":"flName","type":"text","ro":true,"max":32},{"id":"flSize","type":"number","ro":true},{"id":"flTime","type":"number","ro":true},{"id":"flEdit","type":"fileEdit","ro":false,"value":["F_Fiber.json","F_Panel-128x64.json","F_Panel-32x32.json","F_Panel-64x64.json","F_Panel-80x80.json","F_Panel-8x8.json","F_Panel-90x90.json","F_Rings241-9.json","balls.sc","blink.sc","helloworld1.sc","helloworld2.sc","helloworld3.sc","model.json","octo.sc","blink.sc","helloworld1.sc","helloworld2.sc","helloworld3.sc","model.json","octo.sc"]}]},{"id":"upload","type":"fileUpload","ro":false},{"id":"drsize","type":"progress","ro":true,"max":262144}]},{"id":"System","type":"sysmod","ro":true,"max":255,"s":true,"n":[{"id":"upTime","type":"text","ro":true,"max":16},{"id":"reboot","type":"button","ro":false},{"id":"loops","type":"text","ro":true,"max":16},{"id":"chip","type":"text","ro":true,"max":16},{"id":"heap","type":"progress","ro":true,"max":292},{"id":"mainStack","type":"progress","ro":true,"max":8192},{"id":"tcpStack","type":"progress","ro":true,"max":16384},{"id":"reset0","type":"select","ro":true},{"id":"reset1","type":"select","ro":true},{"id":"restartReason","type":"select","ro":true},{"id":"build","type":"text","ro":true,"max":32},{"id":"update","type":"fileUpload","ro":false},{"id":"name","type":"text","ro":false,"max":24,"value":"Lab-16","oldValue":"Star3232-16"},{"id":"now","type":"number","ro":true,"max":-1},{"id":"timeBase","type":"number","ro":true,"max":-1}],"view":"vAll"},{"id":"Pins","type":"sysmod","ro":true,"max":255,"n":[{"id":"pinTbl","type":"table","ro":true,"n":[{"id":"pinNr","type":"pin","ro":true,"max":40},{"id":"pinOwner","type":"text","ro":true,"max":32},{"id":"pinDetails","type":"text","ro":true,"max":256}]},{"id":"board","type":"canvas","ro":true,"interval":100,"loopFun":0},{"id":"pin19","type":"checkbox","ro":false,"value":1}]},{"id":"Print","type":"sysmod","ro":true,"max":255,"n":[{"id":"pOut","type":"select","ro":false,"value":1,"oldValue":2},{"id":"log","type":"textarea","ro":false}]},{"id":"Web","type":"sysmod","ro":true,"max":255,"n":[{"id":"clTbl","type":"table","ro":true,"n":[{"id":"clNr","type":"number","ro":true,"max":999},{"id":"clIp","type":"text","ro":true,"max":16},{"id":"clIsFull","type":"checkbox","ro":true},{"id":"clStatus","type":"select","ro":true},{"id":"clLength","type":"number","ro":true,"max":64}]},{"id":"maxQueue","type":"number","ro":true,"max":64},{"id":"wsSend","type":"text","ro":true,"max":16},{"id":"wsRecv","type":"text","ro":true,"max":16},{"id":"udpSend","type":"text","ro":true,"max":16},{"id":"udpRecv","type":"text","ro":true,"max":16}]},{"id":"Network","type":"sysmod","ro":true,"max":255,"s":true,"n":[{"id":"ssid","type":"text","ro":false,"max":31,"value":"ewtr","oldValue":""},{"id":"pw","type":"password","ro":false,"value":"zonledmod","oldValue":"","max":63},{"id":"connect","type":"button","ro":false},{"id":"nwstatus","type":"text","ro":true,"max":32},{"id":"rssi","type":"text","ro":true,"max":32}]},{"id":"E131","type":"usermod","ro":true,"max":255,"n":[{"id":"dun","type":"number","ro":false,"max":7,"value":1},{"id":"dch","type":"number","ro":false,"min":1,"max":512,"value":1},{"id":"e131Tbl","type":"table","ro":true,"n":[{"id":"e131Channel","type":"number","ro":true,"min":1,"max":512},{"id":"e131Name","type":"text","ro":true,"max":32},{"id":"e131Max","type":"number","ro":true},{"id":"e131Value","type":"number","ro":true,"max":255}]}]},{"id":"Model","type":"sysmod","ro":true,"max":255,"s":true,"n":[{"id":"saveModel","type":"button","ro":false},{"id":"showObsolete","type":"checkbox","ro":false,"value":0},{"id":"deleteObsolete","type":"button","ro":false}]},{"id":"UI","type":"sysmod","ro":true,"max":255,"n":[{"id":"vlTbl","type":"table","ro":true,"n":[{"id":"vlVar","type":"text","ro":true,"max":32},{"id":"vlLoopps","type":"number","ro":true,"max":999}]}]},{"id":"Instances","type":"sysmod","ro":true,"max":255,"n":[{"id":"insTbl","type":"table","ro":true,"n":[{"id":"insName","type":"text","ro":false,"max":32},{"id":"insLink","type":"number","ro":true},{"id":"insIp","type":"text","ro":true,"max":16},{"id":"insType","type":"text","ro":true,"max":16},{"id":"insVersion","type":"number","ro":true,"max":-1},{"id":"insUp","type":"number","ro":true,"max":-1},{"id":"inson","type":"checkbox","ro":false},{"id":"insdch","type":"number","ro":false,"min":1,"max":512},{"id":"insbri","type":"range","ro":false,"max":255,"log":true},{"id":"insShow","type":"url","ro":true},{"id":"insTS","type":"number","ro":true,"max":-1},{"id":"insTT","type":"number","ro":true,"max":-1},{"id":"insTM","type":"number","ro":true,"max":-1},{"id":"insNow","type":"number","ro":true,"max":-1}]}]},{"id":"Modules","type":"sysmod","ro":true,"max":255,"n":[{"id":"mdlTbl","type":"table","ro":true,"n":[{"id":"mdlName","type":"text","ro":true,"max":32},{"id":"mdlSuccess","type":"checkbox","ro":true},{"id":"mdlEnabled","type":"checkbox","ro":false,"value":[true,true,true,true,true,true,true,false,false,true,true,true,true,true]}]}]},{"id":"Motion Tracking","type":"usermod","ro":true,"max":255,"n":[{"id":"mtReady","type":"checkbox","ro":true},{"id":"gyro","type":"coord3D","ro":true},{"id":"accell","type":"coord3D","ro":true}]},{"id":"AppMod Demo","type":"appmod","ro":true,"max":255,"n":[{"id":"on","type":"checkbox","ro":false,"value":1},{"id":"bri","type":"range","ro":false,"max":255,"value":10,"log":true},{"id":"textField","type":"text","ro":false,"max":32,"value":"text"},{"id":"blinkPin","type":"pin","ro":false,"max":40},{"id":"frequency","type":"range","ro":false,"max":255,"value":44}]},{"id":"Live","type":"usermod","ro":true,"max":255,"n":[{"id":"script","type":"select","ro":false},{"id":"fps1","type":"text","ro":true,"max":10},{"id":"fps2","type":"text","ro":true,"max":10}]}] |
Above is contents of model.json, which is used by JavaScript to generate all the fields in the ui see this discussion: https://discord.com/channels/700041398778331156/1262883283809603698 |
Copying discussion from discord here ... |
@aaronaverill said on July 17 I've done UI design and dev for a few decades if you want to bounce ideas around. For what I know of your app, it seems to be primarily tailored to an admin dashboard kind of look and feel. If that's true, I would go with a vertical left rail for primary navigation, and a main area to the right of that with a vertical scrolling overflow Yeah this typically collapses into a hamburger menu on the left side on mobile with a vertical list that scrolls if needed just like you did! Do you have the concept of module collections? You could offer that as a top level navigation on the side, with the modules being indented under, if you get a lot of modules this can be more easily navigated This is adjacent to UI design, but related to the implementation, and forgive me if I'm telling you stuff you know but you should move to implementing your javascript inside of classes with private functions prefixed with # so the minimizer will obfuscate them and you can stick to human readable method names but not worry about performance Apologies for a newb question but are you doing the new ui development in a separate branch in the starbase repo? I guess its a personal preference but for example I find the 3,000 line index.js file of wled to be inscrutable for anyone except the original developer. Modern js techniques will allow much easier contribution, maintenance and quicker feature innovation |
@ewowi July 18 I might do it just in the main branch as the old ui is still fully available, so the new ui is not interfering, it’s just /newUI to see it We now zip all the files using npm into html_ui.h so it’s just a c file instead of index.js etc to be copied to the file system (like done in WLED) as far as I know index.html must explicitly import index.js, index.css etc so not sure if dynamic import works here ? Fully agree but see the remark, but the idea of splitting into more files is for sure a good idea! /newui is in StarBase: a32ef8e newnavbar.css: new: all css for navbar newui.htm: new: only meta data and file imports (css/js) newui.js: new:
@Aaroneous you can check this link to see what I have added, probably you have some questions or remarks so happy to discuss. A few things:
This is in StarBase latest main commit /newui |
@aaronaverill on July 18 So my first recommendation is to have your top nav by sticky by using a flex layout for the body and wrap the page contents in a div that has overflow-y as auto so you get a vertical scrollbar .... etc ...
.. all your page content
I think the nav layout looks ok once that is fixed
|
@ewowi July 18 Although my advanced html and even more css skills are very limited this sounds good to me 🙂 |
@aaronaverill July 18 I have opinions hahaha
Is equivalent to the same with append and add event handler, but it's maybe a lot less code on the mcu to serve back to the webpage |
@ewowi July 18: Thanls a lot for your feedback, this helps a lot! So what can we do? Does this makes sense:
Regarding 2 and also 3: I can add it, but I think it would be nicer if you fork and pull request it, by that your work is also visible 😉 |
@aaronaverill on July 18 oh its also maybe worth mentioning, defining d = document and naming functions like cE doesn't really buy you any space savings since gzip is gonna squish all that down into a few bits if it's used everywhere in your code. Since vscode is doing function completion, it's pretty much just as easy to have the javascript say document.createElement ...etc... and then it's more maintainable by others that dont know the homegrown system of abbreviations. I guess wled did this but maybe it was before there is so many build tools to squish files down for you Sorry, I missed this earlier. My opinion: If you're starting an entirely new project, and if you're requiring ESP32, use modern tools all the way, modern javascript languages and pull in any libraries that are useful and will work on the platform. Set up the project to be relevant for another 5-10 years. To me that would also mean modern javascript, so just as an example. this: let found = false; Becomes this: const found = model.some(module => module.id == json.id) I'm also happy to set up a base app framework window - body, top nav, pages, with a modern approach, if you wanna use that as a learning tool. I'm not sure if your goals are to just get this done or more a hobby where you're playing around learning new tech |
@ewowi July 18 ounds like a good plan to use the latest insights in setting it up, I am not sure what the average level of our contributors is, mostly I am asked to do UI stuff and I am good at Google and copy and paste, so I took what WLED had and build on it For sure! I did current commit in main as it is running side by side, and not interfering and allows more people to see it , instead of them needing to compile a different branch That sound great, my goal is somewhat in between getting it done and play around with new tech, the way we work is continuous improvement so it can always be better Added this in latest commit: Did not use innerHTML but cE calls here as otherwise I did not know how to place the call to the navBar class in between
This is an improvement, thx! if you have suggestions for point 1 to 5, I am happy to hear 🙏 And I am thinking, shouldn’t these style options also be moved to css ? @Aaroneous not to overhelm you with questions (the nr 1 to 5), so no hurry, but maybe start with 1. Here you can see what I mean: |
@aaronaverill at July 19 definitely the absolute 40px, you need to set that px to be higher, or possibly have an empty positioning container around it that is positioned relatively, eg:
The position of any absolute element is based on the nearest parent that is relative, or in the case of none, the browser window. So without the container, your menu is going to be 40px from the top of the browser screen. You need to keep the drop down "absolute" because that style will cause it to be removed from the flow of the page layout - it won't take up space pushing things below it and will sit on top like you want I haven't looked closely at your code, but if you have your menu in an outer container, you can then show/hide that with the toggle, and when it's shrunk to mobile use CSS media queries to change it from position:relative to position:absolute with a 100% width/height and top/left = 0, so your mobile menu fills the entire screen until they click (when it hides) Some of this you can do with css styles, so you can do with javascript. I'd start by adding a class to the menu called "top-nav" or something I will try to have two project templates for you by Sunday based on your GUI here: If nothing else, maybe you can learn some techniques I found have helped with my web development oh its delightful. in vscode
And here you have all your mocked data in the file server-response.json You can easily layer mobile navigation ui on later. Or change up the nav hierarchy but its something that can give you ideas if nothing else this is decent it doesn't cover private class properties (#) or setters, but I think you can see my code and figure that out in 2 seconds lol @ewowi I think you can just refresh the whole UI by setting innerHTML on any main pages which are active. Until you find performance is too shitty then write incremental updates of different areas more smartly |
@ewowi July 22 I am doing things step by step (to flatten the learning curve 😉 ): Added support for live server in the newui.js. See Added there also a mini versie of your App class, which is invoked now if the ip is 127.0.0.1 (Live Server). Could you do a quick check there (although it is now a mix of old and new 😉 ) 3 short questions: The live server is really cool by the way!!! so much easier now to develop |
@aaronaverill on July 22
the advantage of a setter is you can then do things like refresh the UI, but it is functionally equivalent of writing a function to set a member variable |
Added new commit 5e79219 Implementing main navigation as proposed by @aaronaverill and made some modifications to make it fit for StarMod Screen.Recording.2024-07-30.at.11.33.42.movClick on the commit changes to review what is done. Main challenge: make it possible to use modern ui design while keeping it modular so also old style can be used to not have a big bang change which is a step to far for current devs including me ;-) So we take it step by step. What has been done:
|
New version in NewUi-dev branch: 864477f |
Current StarMod UI is a POC UI, meaning it implements the StarMod architecture but is not the user friendliest.
So we need to redesign it.
Step 1: Inspiration
Inspiration 1: Synology UI
Requirements:
The text was updated successfully, but these errors were encountered: