Add hotkey help window

This commit is contained in:
Karina Kwiatek 2023-03-05 18:45:38 +01:00
parent a39696dd3e
commit 9572f844ec
5 changed files with 96 additions and 0 deletions

View File

@ -31,6 +31,7 @@
= render 'shared/announcements'
= yield
= render "shared/formatting"
= render "shared/hotkeys"
.d-none#toasts
- if Rails.env.development?
#debug

View File

@ -34,6 +34,10 @@
%i.fa.fa-fw.fa-flask
= t(".feedback.features")
.dropdown-divider
%a.dropdown-item{ href: "#", data: { bs_target: "#modal-hotkeys", bs_toggle: "modal", hotkey: "Shift+?,?" } }
%i.fa.fa-keyboard
= t(".hotkeys")
.dropdown-divider
= link_to destroy_user_session_path, data: { turbo_method: :delete }, class: "dropdown-item" do
%i.fa.fa-fw.fa-sign-out
= t("voc.logout")

View File

@ -0,0 +1,74 @@
.modal.fade#modal-hotkeys{ aria: { hidden: true, labelledby: 'modal-hotkeys-label' }, role: :dialog, tabindex: -1 }
.modal-dialog
.modal-content
.modal-header
%h5.modal-title#modal-hotkeys-label= t('.title')
%button.btn-close{ data: { bs_dismiss: :modal }, type: :button }
%span.visually-hidden= t("voc.close")
.modal-body
.row
.col-6
.card
.card-header
%h5.card-title= t('.navigation.title')
%ul.list-group.list-group-flush
%li.list-group-item
= t('navigation.timeline')
%kbd
%kbd g
%kbd t
%li.list-group-item
= t('navigation.inbox')
%kbd
%kbd g
%kbd i
- if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod?
%li.list-group-item
= t('navigation.discover')
%kbd
%kbd g
%kbd d
%li.list-group-item
= t('navigation.notifications')
%kbd
%kbd g
%kbd n
%li.list-group-item
= t('navigation.dropdown.profile.profile')
%kbd
%kbd g
%kbd p
.col-6
.card
.card-header
%h5.card-title= t('.global.title')
%ul.list-group.list-group-flush
%li.list-group-item
= t('.global.navigation.up')
%kbd k
%li.list-group-item
= t('.global.navigation.down')
%kbd j
%li.list-group-item
= t('navigation.desktop.ask_question')
%kbd n
%li.list-group-item
= t('.show_dialog')
%kbd ?
.card
.card-header
%h5.card-title= t('.answer.title')
%ul.list-group.list-group-flush
%li.list-group-item
= t('voc.smile')
%kbd l
%li.list-group-item
= t('.answer.view_comments')
%kbd x
%li.list-group-item
= t('.answer.comment')
%kbd c
%li.list-group-item
= t('.answer.all_answers')
%kbd a

View File

@ -330,6 +330,7 @@ en:
heading: "Feedback"
bugs: "Bugs"
features: "Feature Requests"
hotkeys: "Keyboard Shortcuts"
desktop:
ask_question: "Ask a question"
list: :user.actions.list
@ -583,6 +584,21 @@ en:
question:
visible_to_you: "Only visible to you as it was asked directly"
visible_mod_mode: "You can see this because you are in moderation view"
hotkeys:
navigation:
title: "Navigation"
title: "Keyboard Shortcuts"
show_dialog: "Show this dialog"
answer:
title: "Answer actions"
view_comments: "View comments"
comment: "Write a comment"
all_answers: "View all answers"
global:
navigation:
up: "Move selection up"
down: "Move selection down"
title: "Site-wide"
tabs:
admin:
announcements: "Announcements"

View File

@ -17,6 +17,7 @@ en:
mute: "Mute"
save: "Save changes"
show_anonymous_questions: "Show all questions from this user"
smile: "Smile"
subscribe: "Subscribe"
unsubscribe: "Unsubscribe"
register: "Sign up"