From 7556e1fd033207ec8efa3cf09c5511d8da007fbf Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:12:54 +0100 Subject: [PATCH] Merge pull request #25598 from overleaf/dp-proptypes-misc Convert HotkeysModal components to Typescript GitOrigin-RevId: c2cf7a3a33afeb996650faa6e3ed91c4fe14ef1a --- ...text.jsx => hotkeys-modal-bottom-text.tsx} | 0 .../{hotkeys-modal.jsx => hotkeys-modal.tsx} | 27 +++++++++---------- ....stories.jsx => hotkeys-modal.stories.tsx} | 9 ++++--- ...ys.test.jsx => help-show-hotkeys.test.tsx} | 0 ...jsx => hotkeys-modal-bottom-text.test.tsx} | 0 ...-modal.test.jsx => hotkeys-modal.test.tsx} | 2 +- 6 files changed, 20 insertions(+), 18 deletions(-) rename services/web/frontend/js/features/hotkeys-modal/components/{hotkeys-modal-bottom-text.jsx => hotkeys-modal-bottom-text.tsx} (100%) rename services/web/frontend/js/features/hotkeys-modal/components/{hotkeys-modal.jsx => hotkeys-modal.tsx} (93%) rename services/web/frontend/stories/{hotkeys-modal.stories.jsx => hotkeys-modal.stories.tsx} (63%) rename services/web/test/frontend/features/editor-left-menu/components/{help-show-hotkeys.test.jsx => help-show-hotkeys.test.tsx} (100%) rename services/web/test/frontend/features/hotkeys-modal/components/{hotkeys-modal-bottom-text.test.jsx => hotkeys-modal-bottom-text.test.tsx} (100%) rename services/web/test/frontend/features/hotkeys-modal/components/{hotkeys-modal.test.jsx => hotkeys-modal.test.tsx} (95%) diff --git a/services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal-bottom-text.jsx b/services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal-bottom-text.tsx similarity index 100% rename from services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal-bottom-text.jsx rename to services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal-bottom-text.tsx diff --git a/services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal.jsx b/services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal.tsx similarity index 93% rename from services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal.jsx rename to services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal.tsx index 269b528397..695b3a1fa2 100644 --- a/services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal.jsx +++ b/services/web/frontend/js/features/hotkeys-modal/components/hotkeys-modal.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types' import { Trans, useTranslation } from 'react-i18next' import HotkeysModalBottomText from './hotkeys-modal-bottom-text' import OLModal, { @@ -17,6 +16,12 @@ export default function HotkeysModal({ show, isMac = false, trackChangesVisible = false, +}: { + animation?: boolean + handleHide: () => void + show: boolean + isMac?: boolean + trackChangesVisible?: boolean }) { const { t } = useTranslation() @@ -201,15 +206,13 @@ export default function HotkeysModal({ ) } -HotkeysModal.propTypes = { - animation: PropTypes.bool, - isMac: PropTypes.bool, - show: PropTypes.bool.isRequired, - handleHide: PropTypes.func.isRequired, - trackChangesVisible: PropTypes.bool, -} - -function Hotkey({ combination, description }) { +function Hotkey({ + combination, + description, +}: { + combination: string + description: string +}) { return (
{combination} @@ -217,7 +220,3 @@ function Hotkey({ combination, description }) {
) } -Hotkey.propTypes = { - combination: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, -} diff --git a/services/web/frontend/stories/hotkeys-modal.stories.jsx b/services/web/frontend/stories/hotkeys-modal.stories.tsx similarity index 63% rename from services/web/frontend/stories/hotkeys-modal.stories.jsx rename to services/web/frontend/stories/hotkeys-modal.stories.tsx index a32896ecf5..026624ceef 100644 --- a/services/web/frontend/stories/hotkeys-modal.stories.jsx +++ b/services/web/frontend/stories/hotkeys-modal.stories.tsx @@ -1,14 +1,17 @@ +import { ComponentProps } from 'react' import HotkeysModal from '../js/features/hotkeys-modal/components/hotkeys-modal' -export const ReviewEnabled = args => { +type HotkeysModalProps = ComponentProps + +export const ReviewEnabled = (args: HotkeysModalProps) => { return } -export const ReviewDisabled = args => { +export const ReviewDisabled = (args: HotkeysModalProps) => { return } -export const MacModifier = args => { +export const MacModifier = (args: HotkeysModalProps) => { return } diff --git a/services/web/test/frontend/features/editor-left-menu/components/help-show-hotkeys.test.jsx b/services/web/test/frontend/features/editor-left-menu/components/help-show-hotkeys.test.tsx similarity index 100% rename from services/web/test/frontend/features/editor-left-menu/components/help-show-hotkeys.test.jsx rename to services/web/test/frontend/features/editor-left-menu/components/help-show-hotkeys.test.tsx diff --git a/services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal-bottom-text.test.jsx b/services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal-bottom-text.test.tsx similarity index 100% rename from services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal-bottom-text.test.jsx rename to services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal-bottom-text.test.tsx diff --git a/services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal.test.jsx b/services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal.test.tsx similarity index 95% rename from services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal.test.jsx rename to services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal.test.tsx index 8d18f806f0..1df3c514b7 100644 --- a/services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal.test.jsx +++ b/services/web/test/frontend/features/hotkeys-modal/components/hotkeys-modal.test.tsx @@ -13,7 +13,7 @@ describe('', function () { it('renders the translated modal title on cm6', async function () { const { baseElement } = render() - expect(baseElement.querySelector('.modal-title').textContent).to.equal( + expect(baseElement.querySelector('.modal-title')?.textContent).to.equal( 'Hotkeys' ) })