luc-github / ESP3D-WEBUI

A Web UI for ESP8266 or ESP32 based boards connected to 3D printers / CNC
GNU General Public License v3.0
756 stars 305 forks source link

Implement optional 'compact' and 'inline' item list settings, used for key map shortcuts #289

Closed aaronse closed 1 year ago

aaronse commented 1 year ago

Implemented optional 'compact' and 'inline' item list settings, used for key map shortcuts:

Before: ![image](https://user-images.githubusercontent.com/16479976/210276112-90d787f6-df6a-40d5-b078-08248d1e243d.png) After: ![image](https://user-images.githubusercontent.com/16479976/210276060-79923c1e-ab88-4e24-83df-0c36bb5e6012.png)
luc-github commented 1 year ago

I did not use inline/compact because I got feedback people does not like compact controls especially on CNC

Additionnaly it may cause overload , unreadibility, more over with language like german which is very long image

image After several version of UI I tried to implement, I decided to make it simple and avoid complex implementation for simple things Sorry missed to translated key it is even more talktive image

aaronse commented 1 year ago

imo - The warning messages should be on separate line and not cause the input text box to change width.

Am digging around code to see if/how that can be done... Sorry, am very new to this project and slow to contribute.

luc-github commented 1 year ago

yes but it is not the way inline is currently implemented , I did not spent tiime on this because was not used - and even without this message the label translation can be very long and so the shortcut lenght which just move the problem little bit forward

When testing need to test in worst condition not the best ^_^ this is Murphy Law and even ok because of Murphy Law image

aaronse commented 1 year ago

This looks good to me, even in German...

image

Compared to existing behavior without edits in this pull request (+ putting validation on separate line) ...

image

luc-github commented 1 year ago

well the issue here are 1 - text overflow on X+ X- 2 - the modified shortcut is unreadable on Home X

Compared to readable version ? what is exactly the issue of readable version ? I only see the interline could be smaller that is all , no mention UI should be consistent with Macros List, Extra content List , well all UI actually

aaronse commented 1 year ago

Am editing code to put warning/error messages on separate line. I only meant for label ('key' or 'Schluessel') to be inlined with the text input field. Thoughts?

Sorry, I didn't understand:

1 - text overflow on X+ X-

aaronse commented 1 year ago

Thoughts on inline just label, but not warn/error message?

For example:

image

Let me know, I will update pull request.

luc-github commented 1 year ago

did you read my previous comment ?

luc-github commented 1 year ago

image

One possible mitigation would be not display Key: because only one entry currently just the control name then the input

aaronse commented 1 year ago

did you read my previous comment ?

yep

2 - the modified shortcut is unreadable on Home X

I don't see the issue? The Control+Shift+Alt+Backspace very unlikely edge case will renders ok on dekstop and tablet. And will even render ok on phone when they exit edit mode. This isn't an issue for phone users even, they probably won't be using (bluetooth) keyboard.

image

aaronse commented 1 year ago

One possible mitigation would be not display Key: because only one entry currently just the control name then the input

Sounds good to me. Want me to try editing? Will add showLabel=false property to itemlist

luc-github commented 1 year ago

no need - just add condition on label on

 let labelTxt
if (idList == "keymap" && type == "text") {
                                    labelTxt = ""
                                } else {
                                    labelTxt = label
                                }

                                return (
                                    <Field
                                        id={item.id}
                                        label={T(labelTxt)}

if only used for this case not need to add new flag - limite code is better - add flag only if more than 1 case

luc-github commented 1 year ago

even better is for idList == "keymap" is get the id of control as label and do not show the standalone label entry so interline would be limited

luc-github commented 1 year ago

I am out today , I will have a look in evening

aaronse commented 1 year ago

I am out today , I will have a look in evening

Sure thing, am US West Coast timezone. Cheers!

luc-github commented 1 year ago

this commit make the trick and I have also removed the unnecessary change now in formatItem, making code back to generic

https://github.com/luc-github/ESP3D-WEBUI/commit/cbd31127b3541355e5b7207c1c91ec492c8339ff

aaronse commented 1 year ago

Pulled, run dev-printer-marlin and tried out. Looks good to me :-)

aaronse commented 1 year ago

Thoughts on enabling keyboard users to always have "Use keyboard" enabled by default? When resetting CNC, User often needs to refresh webpage, having keyboard enabled (if configured in settings) by default helps.

image

"Use Keyboard" in Dashboard page's Panel List drop down still behaves same way, but initial default value on page load is based on preferences setting.

luc-github commented 1 year ago

this can be a setting in setting page / same for auto repeat, yes

aaronse commented 1 year ago

Pushed https://github.com/luc-github/ESP3D-WEBUI/pull/289/commits/d8ba542dfaaaee0a9fa3f5903a823963d48b3852 adding this setting.

luc-github commented 1 year ago

I am not sure it should be enabled by default

luc-github commented 1 year ago

in opposite way - should auto repeat be also part of dashboard menu ?

aaronse commented 1 year ago

no the way you did is always reset state to setting when going to dashboard I am not sure it should be enabled by default

Not sure I understand. Hope info below helps clarify my thinking/understanding...

Use Keyboard general setting is false by default when User first installs. IF User changes Use Keyboard general setting to true, then, dashboard Use Keyboard will be true when the User loads or refreshes the webpage. This is my intent.

User can still disable Use Keyboard from the dashboard. I didn't remove Use Keyboard panel lists dropdown from Dashboard page because I'm guessing you still want it there for reasons. I don't know why User still needs to enable and disable Use Keyboard from the Dashboard page now that code is fixed to not process key shortcuts if Terminal console (or other text input) fields has focus.

should auto repeat be also part of dashboard menu ?

The current behavior of Auto repeat general setting (not dashboard) makes sense to me.

luc-github commented 1 year ago

no the way you did is always reset state to setting when going to dashboard

I read to fast code change - and removed my comment

I am not sure it should be enabled by default

it was the answer about :

Thoughts on enabling keyboard users to always have "Use keyboard" enabled by default?

Let user enabling in settings is indeed ok

luc-github commented 1 year ago

Is compact still necessary ? it is not used actually

aaronse commented 1 year ago

Goal of compact: true is to not have empty line, which looks better to me. Your thoughts? It's being used and set true in "id": "keymap."

If "compact" : false or "compact" is not defined then setting renders like...

image

if "compact" : true then setting renders like...

image

Another example...

Before: ![image](https://user-images.githubusercontent.com/16479976/211178356-04ad4133-e952-4613-9b52-dcc129d46865.png) After: ![image](https://user-images.githubusercontent.com/16479976/211178350-91247e02-ad3b-4ce1-b3d2-0e8c145219bd.png)

Don't know why the text input width is less in the "After" version. I'll take a look at fixing the text input width issue if you think Compact is an improvement and should be merged to main.

luc-github commented 1 year ago

then should not be the default behaviour instead of add new flag (compact) ? is there any situation the compact as defaut behavior cause rendering issue ?

aaronse commented 1 year ago

I didn't (and still don't) know enough about settings rendering code to be able to assume this would improve rendering of all settings. That's why I only modified the new one, for now at least.

Let me know your preference?

luc-github commented 1 year ago

well if compact is better rendering - it is better to apply "display:table-cell" to itemEditor and check macro / extra panel instead - no ? image

Note: the icon change flag too much on right is not related to that - it should be fixed in future when I have time

luc-github commented 1 year ago

so far looks ok for me

aaronse commented 1 year ago

Cool. Not clear what you want me to do?

luc-github commented 1 year ago

well as said remove compact flag from your PR and update itemEditor style accordingly to use the same behavior

luc-github commented 1 year ago

it should simplify your PR and so I can merge it

aaronse commented 1 year ago

Current code with just compact:true for keymap.... <div class="itemEditor" style={((compact) ? "display:table-cell;" : "")}>

Renders...

image

But, removing the setting and using display:table-cell for all results in Add Macro not rendering correctly,

<div class="itemEditor" style="display:table-cell;">

image

aaronse commented 1 year ago

Nevermind looks like the Add Macro render behavior is unrelated to Compact. So, am removing...

luc-github commented 1 year ago

it should not it should do same on my side it is due to the collabsed button text which is too long and should be trimmed somehow to avoid that

luc-github commented 1 year ago

please update here https://github.com/luc-github/ESP3D-WEBUI/blob/3.0/src/style/components/_control.scss#L84 not using style

luc-github commented 1 year ago

@aaronse I have fixed additionnal 2 small issues - bumped version and built packages - now ready to use I did not find proper way to handle the button oversized if text too long - text-overflow is not taken in account - and I have no time to spend on this now - so I have added a wrap for the buttons - but I have no fix if text itself is too long - so it display horizontal scrollbars ...