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 manual cycling of random hints in footer #1517

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

Niloth-p
Copy link
Collaborator

@Niloth-p Niloth-p commented Jun 13, 2024

What does this PR do, and why?

Enables cycling through random hints in the footer.

  • Using a hotkey to manually go to next hint
  • Periodically cycle through footer hints automatically

This is in preparation to #1484, where we add contexts and the footer displays only the context-specific hotkey hints.

Outstanding aspect(s)

  • If this is good, the next step could involve making the footer's cycle period a user setting.
  • Deciding the hotkey to go to next hint: I've currently used Tab, but that's subject to change on discussion.
  • Deciding the default cycle period: I've currently set it to 30 seconds, but we could increase it.

External discussion & connections

How did you test this?

  • Manually - Behavioral changes
  • Manually - Visual changes
  • Adapting existing automated tests
  • Adding automated tests for new behavior (or missing tests)
  • Existing automated tests should already cover this (only a refactor of tested code)

Self-review checklist for each commit

  • It is a minimal coherent idea
  • It has a commit summary following the documented style (title & body)
  • It has a commit summary describing the motivation and reasoning for the change
  • It individually passes linting and tests
  • It contains test additions for any new behavior
  • It flows clearly from a previous branch commit, and/or prepares for the next commit

@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Jun 13, 2024
@Niloth-p Niloth-p changed the title Cycle through hints in footer Add manual and automatic cycling of random hints in footer Jun 13, 2024
@zulipbot
Copy link
Member

Hello @zulip/server-hotkeys members, this pull request was labeled with the "area: hotkeys" label, so you may want to check it out!

Copy link
Member

@rsashank rsashank left a comment

Choose a reason for hiding this comment

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

LGTM! The use of freezegun is an interesting approach. Tested it manually too, works as intended 👍

Well done, @Niloth-p! I've left a few comments, nothing major though.

docs/hotkeys.md Outdated
@@ -13,6 +13,7 @@
|Redraw screen|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
|Quit|<kbd>Ctrl</kbd> + <kbd>c</kbd>|
|Show/hide user information (from users list)|<kbd>i</kbd>|
|Next footer hint|<kbd>Tab</kbd>|
Copy link
Member

Choose a reason for hiding this comment

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

NIT: Since the footer hints are random, should we rename this to "New footer hint" or "Random footer hint" instead?

That said, "Next footer hint" seems perfectly fine too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, we could totally go with that. That would be better indeed, at this point.
I was actually thinking of adding functionality to go back to the previous hint as well, but it's too early to decide, I suppose, as it would depend on other features that are yet to be implemented like the hint priority field.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, that makes sense. In that case, it's probably best to keep it as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nah, I've added a new commit updating it already :)
We could change it to "Next" if and when we add the functionality for going to previous hint.

Comment on lines 123 to 125
# Trigger the alarm
alarm_callback = mocked_alarm.call_args[0][1]
alarm_callback(None, None)
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, line 123 is simulating the alarm going off (?) and triggering the callback function. (Correct me if I'm wrong)

Could we make the comment on that line more specific about this to prevent any confusion? We could start the comment with # NOTE: similar to how it's done elsewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the comment is meant to convey that the code below is to trigger the alarm, i.e directly call the callback function. I wasn't completely sure if it's required, just something that I would personally find convenient, if I was reading the code.

Ok, I'll clarify that, thank you for the feedback. Would "Directly trigger the alarm's callback function" be a better description?

Ah, we do seem to have a few comments with #NOTE: in that file, but generally in the codebase, we don't use it that much. Not sure what the convention is regarding its usage in our repo. There doesn't seem to be a global convention. So, I'll wait to hear from the others regarding that.

Copy link
Collaborator Author

@Niloth-p Niloth-p left a comment

Choose a reason for hiding this comment

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

Thank you for the review, Sashank!

Comment on lines 123 to 125
# Trigger the alarm
alarm_callback = mocked_alarm.call_args[0][1]
alarm_callback(None, None)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the comment is meant to convey that the code below is to trigger the alarm, i.e directly call the callback function. I wasn't completely sure if it's required, just something that I would personally find convenient, if I was reading the code.

Ok, I'll clarify that, thank you for the feedback. Would "Directly trigger the alarm's callback function" be a better description?

Ah, we do seem to have a few comments with #NOTE: in that file, but generally in the codebase, we don't use it that much. Not sure what the convention is regarding its usage in our repo. There doesn't seem to be a global convention. So, I'll wait to hear from the others regarding that.

docs/hotkeys.md Outdated
@@ -13,6 +13,7 @@
|Redraw screen|<kbd>Ctrl</kbd> + <kbd>l</kbd>|
|Quit|<kbd>Ctrl</kbd> + <kbd>c</kbd>|
|Show/hide user information (from users list)|<kbd>i</kbd>|
|Next footer hint|<kbd>Tab</kbd>|
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, we could totally go with that. That would be better indeed, at this point.
I was actually thinking of adding functionality to go back to the previous hint as well, but it's too early to decide, I suppose, as it would depend on other features that are yet to be implemented like the hint priority field.

@neiljp
Copy link
Collaborator

neiljp commented Jun 29, 2024

I left some notes in the channel, but getting the first commit merged with an adjusted key would be great as a first step. The remainder could be useful, particularly since refactoring to make it clearer to understand could benefit if we keep the timed approach, but could also depend on the style of help hints we settle on when they're more contextual.

@Niloth-p Niloth-p added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback and removed PR needs mentor review labels Jun 29, 2024
@zulipbot zulipbot added size: M [Automatic label added by zulipbot] and removed size: L [Automatic label added by zulipbot] labels Jul 2, 2024
@Niloth-p Niloth-p changed the title Add manual and automatic cycling of random hints in footer Add manual cycling of random hints in footer Jul 2, 2024
@Niloth-p Niloth-p added PR needs mentor review and removed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Jul 2, 2024
@neiljp
Copy link
Collaborator

neiljp commented Jul 4, 2024

@Niloth-p Thanks for the quick PR adjust, which I only just noticed. The only change I made was to make it clearer that the 'hint' being referred to is an regard to a hotkey :)

@neiljp neiljp merged commit 967d762 into zulip:main Jul 4, 2024
21 checks passed
@neiljp neiljp added this to the Next Release milestone Jul 4, 2024
@Niloth-p Niloth-p deleted the 1517-footer-cycling/pr branch July 5, 2024 10:31
@Niloth-p Niloth-p added PR ready to be merged PR has been reviewed & is ready to be merged and removed PR needs mentor review labels Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: hotkeys area: UI General user interface update PR ready to be merged PR has been reviewed & is ready to be merged size: M [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants