feat: added explanatory text to Settings Keyboard Shortcuts (#53048)

Co-authored-by: Mama Naomi <nhcarrigan@gmail.com>
This commit is contained in:
weilirs
2024-01-22 21:56:41 -05:00
committed by GitHub
parent 7316e800ba
commit 58761aa3ff
4 changed files with 7 additions and 1 deletions

View File

@@ -198,6 +198,7 @@
"sound-mode": "This adds the pleasant sound of acoustic guitar throughout the website. You'll get musical feedback as you type in the editor, complete challenges, claim certifications, and more.",
"sound-volume": "Campfire Volume:",
"scrollbar-width": "Editor Scrollbar Width",
"shortcuts-explained": "Within a challenge, press ESC followed by the question mark to show a list of available shortcuts.",
"username": {
"contains invalid characters": "Username \"{{username}}\" contains invalid characters",
"is too short": "Username \"{{username}}\" is too short",

View File

@@ -288,6 +288,7 @@ class AboutSettings extends Component<AboutProps, AboutState> {
<KeyboardShortcutsSettings
keyboardShortcuts={keyboardShortcuts}
toggleKeyboardShortcuts={toggleKeyboardShortcuts}
explain={t('settings.shortcuts-explained')}
/>
<ScrollbarWidthSettings />
</FullWidthRow>

View File

@@ -7,11 +7,13 @@ import ToggleButtonSetting from './toggle-button-setting';
type KeyboardShortcutsProps = {
keyboardShortcuts: boolean;
toggleKeyboardShortcuts: (sound: boolean) => void;
explain?: string;
};
export default function KeyboardShortcutsSettings({
keyboardShortcuts,
toggleKeyboardShortcuts
toggleKeyboardShortcuts,
explain
}: KeyboardShortcutsProps): JSX.Element {
const { t } = useTranslation();
@@ -19,6 +21,7 @@ export default function KeyboardShortcutsSettings({
<>
<ToggleButtonSetting
action={t('settings.labels.keyboard-shortcuts')}
explain={explain}
flag={keyboardShortcuts}
flagName='keyboard-shortcuts'
offLabel={t('buttons.off')}

View File

@@ -305,6 +305,7 @@ test.describe('Settings', () => {
name: translations.settings.labels['keyboard-shortcuts']
})
.locator('p')
.first()
).toBeVisible();
await expect(
page.getByText(translations.settings['scrollbar-width'])