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 basic fields in footer notification styling #971

Merged
merged 4 commits into from
Jun 16, 2021

Conversation

Ezio-Sarthak
Copy link
Member

@Ezio-Sarthak Ezio-Sarthak commented Mar 30, 2021

What does this PR do?!

  • Adds general styling fields: task:success, task:error, task:warning.
  • Adds contrast-color style for footer hint text.
  • refactor: Add default report helpers for success/error/warning footer notifications.
  • Replace the instances of set_footer_text() with added helpers wherever reasonable.

I'd highly appreciate any feedback :)

Fixes #782.

@zulipbot zulipbot added size: L [Automatic label added by zulipbot] enhancement New feature or request further discussion required Discuss this on #zulip-terminal on chat.zulip.org feedback wanted labels Mar 30, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the footer-notification-styling branch 2 times, most recently from 251cf02 to 4a9431e Compare March 31, 2021 02:24
@Rohitth007
Copy link
Collaborator

@Ezio-Sarthak Really nice addition to ZT.
Why area:neutral though? footer should make sense as there is also a header, for the default color.
Also in terms of readability, I feel someone looking at themes.pyfor the very first time would instantly make sense of what a header is and what a footer is than area:neutral.
Just a suggestion :)

@Ezio-Sarthak
Copy link
Member Author

@Rohitth007 thanks for the feedback. Re area: neutral, it's true that it wouldn't be readable for footer styling sense, though my intent was that this could be used as a general style elsewhere in the UI in future, if that makes sense?

@Rohitth007
Copy link
Collaborator

Rohitth007 commented Mar 31, 2021

@Ezio-Sarthak I'm assuming the footer would have an independent styling as it acts sort of like a notification bar?
Also, I think applying same setting to different components reduces independent customizability.

Copy link
Member

@zee-bit zee-bit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice work. The footer looks much clean and dynamic now. 👍

I haven't tested it on all themes yet, but the darker ones are looking good.
I am also inclined to Sai's point above that we should have footer instead of area, but the task sounds like a fine replacement too. I would love to gather some more opinions on this, but the PR, in general, should be very close to being merge-able. I have dropped in some points below, but they are mostly minor and may need discussion. :)

zulipterminal/config/themes.py Outdated Show resolved Hide resolved
Comment on lines 192 to 211
('area:neutral', 'black', 'light gray',
None, DEF['black'], DEF['light_gray']),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this to task, to be more consistent with other footer styles. We could always have another one for area:neutral if the need be.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. The original intent for it was that it might be used (in general) for other areas (in future) where there's no highlighting required, e.g., typing status. However, since I couldn't think of more such examples, currently we could just align it with other footer-dedicated attributes. We could simply add such themes later in any case 👍

zulipterminal/ui_tools/boxes.py Outdated Show resolved Hide resolved
@Ezio-Sarthak Ezio-Sarthak force-pushed the footer-notification-styling branch 2 times, most recently from c3240b8 to 9c48738 Compare April 17, 2021 03:35
@Ezio-Sarthak Ezio-Sarthak force-pushed the footer-notification-styling branch 2 times, most recently from ad7a80c to 8da6281 Compare April 28, 2021 11:24
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ezio-Sarthak Thanks for taking this up - I agree with others that the visual feedback is much better 👍

I've left some comments inline, but I think we'll likely be able to squash these commits together.

Reading this PR it's more clear that we now call a function in a very similar way in many places! I'd consider a refactor before this to add something like report_success and similar methods to the controller which would have the default timeout and know the style to use and where to report it (ie. footer). That would make it less explicit where/how we're reporting it, but remove the need for all the explicit style variables here and the existing time variable (which we could scale up slightly based on the string length?).

This needs a black rebase in any case.

zulipterminal/ui.py Outdated Show resolved Hide resolved
Comment on lines 52 to 54
'task:success': 'standout',
'task:failure': 'standout',
'task:warning': 'standout',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if having these the same as the footer default provides the (temporary) strikingly visible update that we'll get with the colored themes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a color (say green) on a result (say success) draws user's attention more than just changing the text with the default footer background. We could surely gain feedback in stream in any case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, my initial thought would be to temporarily do something like invert from the default style; I'm not sure what that translates to. Discussing on the stream would be good, though this would be a small update later too.

zulipterminal/config/themes.py Outdated Show resolved Hide resolved
zulipterminal/config/themes.py Outdated Show resolved Hide resolved
zulipterminal/config/themes.py Outdated Show resolved Hide resolved
@neiljp neiljp added the PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback label Jun 3, 2021
@zulipbot zulipbot added size: XL [Automatic label added by zulipbot] and removed size: L [Automatic label added by zulipbot] labels Jun 15, 2021
@Ezio-Sarthak Ezio-Sarthak force-pushed the footer-notification-styling branch 4 times, most recently from 9a34ecd to a8ed8a9 Compare June 16, 2021 18:02
@Ezio-Sarthak Ezio-Sarthak added PR needs review PR requires feedback to proceed and removed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Jun 16, 2021
This commit:
 * adds styles for various notification categories (inverted color
   backgrounds).
 * Improves the default 'footer' style, avoiding conflict with the added
   styles.

The categories with associated styles and footer used as of now:
 * success (task:success) - on successful completion of a task
 * warning (task:warning) - providing heads-up for a certain task
 * error (task:error) - on an errorenous result
 * neutral (footer) - default notification style
This commit adds entries in themes.py, labelled 'footer_contrast' that
define the color for hint text. This could also be referred to as the
color scheme for background of the footer.

Prior to this an old theme style name was in use, which could give
unreliable rendering results between systems. This commit migrates from
this old absent "code" style to use the newly added style.

Tests amended.
This commit:
 * amends set_footer_text() to allow styles passed explicitly, with
   default style set to 'footer'.
 * adds general helpers for footer notification that avoid need to specify
   style and duration of the notification. (report_success, report_error,
   report_warning).

Tests amended.
This commit replaces those instances of `set_footer_text` with the new
report_* helpers, that notify user of a success/error/warning response.

Tests amended.

Fixes zulip#782.
@neiljp neiljp force-pushed the footer-notification-styling branch from 4dd1121 to 5eecc12 Compare June 16, 2021 20:19
@neiljp neiljp merged commit 9eaa6b0 into zulip:main Jun 16, 2021
@neiljp neiljp removed the PR needs review PR requires feedback to proceed label Jun 16, 2021
@neiljp neiljp added this to the Next Release milestone Jun 16, 2021
@neiljp
Copy link
Collaborator

neiljp commented Jun 16, 2021

@Ezio-Sarthak Thanks for the polish on this; I adapted some of the commit text and have just merged it 🎉

@Ezio-Sarthak Ezio-Sarthak deleted the footer-notification-styling branch June 17, 2021 04:54
@neiljp neiljp added the area: UI General user interface update label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UI General user interface update enhancement New feature or request feedback wanted further discussion required Discuss this on #zulip-terminal on chat.zulip.org size: XL [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support a variety of footer notification styling
5 participants