diff --git a/app/javascript/mastodon/components/badge.jsx b/app/javascript/mastodon/components/badge.jsx deleted file mode 100644 index 2a335d7f50..0000000000 --- a/app/javascript/mastodon/components/badge.jsx +++ /dev/null @@ -1,31 +0,0 @@ -import PropTypes from 'prop-types'; - -import { FormattedMessage } from 'react-intl'; - -import GroupsIcon from '@/material-icons/400-24px/group.svg?react'; -import PersonIcon from '@/material-icons/400-24px/person.svg?react'; -import SmartToyIcon from '@/material-icons/400-24px/smart_toy.svg?react'; - - -export const Badge = ({ icon = , label, domain, roleId }) => ( -
- {icon} - {label} - {domain && {domain}} -
-); - -Badge.propTypes = { - icon: PropTypes.node, - label: PropTypes.node, - domain: PropTypes.node, - roleId: PropTypes.string -}; - -export const GroupBadge = () => ( - } label={} /> -); - -export const AutomatedBadge = () => ( - } label={} /> -); diff --git a/app/javascript/mastodon/components/badge.tsx b/app/javascript/mastodon/components/badge.tsx new file mode 100644 index 0000000000..dd588f799a --- /dev/null +++ b/app/javascript/mastodon/components/badge.tsx @@ -0,0 +1,45 @@ +import type { FC, ReactNode } from 'react'; + +import { FormattedMessage } from 'react-intl'; + +import GroupsIcon from '@/material-icons/400-24px/group.svg?react'; +import PersonIcon from '@/material-icons/400-24px/person.svg?react'; +import SmartToyIcon from '@/material-icons/400-24px/smart_toy.svg?react'; + +interface BadgeProps { + icon?: ReactNode; + label?: ReactNode; + domain?: ReactNode; + roleId?: string; +} + +export const Badge: FC = ({ + icon = , + label, + domain, + roleId, +}) => ( +
+ {icon} + {label} + {domain && {domain}} +
+); + +export const GroupBadge = () => ( + } + label={ + + } + /> +); + +export const AutomatedBadge = () => ( + } + label={ + + } + /> +); diff --git a/app/javascript/mastodon/containers/admin_component.jsx b/app/javascript/mastodon/containers/admin_component.jsx deleted file mode 100644 index 7400111293..0000000000 --- a/app/javascript/mastodon/containers/admin_component.jsx +++ /dev/null @@ -1,22 +0,0 @@ -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; - -import { IntlProvider } from 'mastodon/locales'; - -export default class AdminComponent extends PureComponent { - - static propTypes = { - children: PropTypes.node.isRequired, - }; - - render () { - const { children } = this.props; - - return ( - - {children} - - ); - } - -} diff --git a/app/javascript/mastodon/containers/admin_component.tsx b/app/javascript/mastodon/containers/admin_component.tsx new file mode 100644 index 0000000000..5beaf45b34 --- /dev/null +++ b/app/javascript/mastodon/containers/admin_component.tsx @@ -0,0 +1,17 @@ +import React, { ReactNode } from 'react'; + +import { IntlProvider } from 'mastodon/locales'; + +interface Props { + children: ReactNode; +} + +const AdminComponent: React.FC = ({ children }) => { + return ( + + {children} + + ); +}; + +export default AdminComponent; diff --git a/app/javascript/mastodon/containers/compose_container.jsx b/app/javascript/mastodon/containers/compose_container.tsx similarity index 100% rename from app/javascript/mastodon/containers/compose_container.jsx rename to app/javascript/mastodon/containers/compose_container.tsx diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx b/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx deleted file mode 100644 index 73eaecba59..0000000000 --- a/app/javascript/mastodon/features/notifications/components/clear_column_button.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; - -import { FormattedMessage } from 'react-intl'; - -import DeleteForeverIcon from '@/material-icons/400-24px/delete_forever.svg?react'; -import { Icon } from 'mastodon/components/icon'; - -export default class ClearColumnButton extends PureComponent { - - static propTypes = { - onClick: PropTypes.func.isRequired, - }; - - render () { - return ( - - ); - } - -} diff --git a/app/javascript/mastodon/features/notifications/components/clear_column_button.tsx b/app/javascript/mastodon/features/notifications/components/clear_column_button.tsx new file mode 100644 index 0000000000..bdfa9f4bf5 --- /dev/null +++ b/app/javascript/mastodon/features/notifications/components/clear_column_button.tsx @@ -0,0 +1,27 @@ +import React, { MouseEventHandler } from 'react'; +import { FormattedMessage } from 'react-intl'; + +import DeleteForeverIcon from '@/material-icons/400-24px/delete_forever.svg?react'; +import { Icon } from 'mastodon/components/icon'; + +interface Props { + onClick?: MouseEventHandler; +} + +const ClearColumnButton: React.FC = ({ onClick }) => { + return ( + + ); +}; + +export default ClearColumnButton; diff --git a/app/javascript/mastodon/features/notifications/components/grant_permission_button.jsx b/app/javascript/mastodon/features/notifications/components/grant_permission_button.jsx deleted file mode 100644 index cd46d878bb..0000000000 --- a/app/javascript/mastodon/features/notifications/components/grant_permission_button.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import PropTypes from 'prop-types'; -import { PureComponent } from 'react'; - -import { FormattedMessage } from 'react-intl'; - -export default class GrantPermissionButton extends PureComponent { - - static propTypes = { - onClick: PropTypes.func.isRequired, - }; - - render () { - return ( - - ); - } - -} diff --git a/app/javascript/mastodon/features/notifications/components/grant_permission_button.tsx b/app/javascript/mastodon/features/notifications/components/grant_permission_button.tsx new file mode 100644 index 0000000000..3e160cb0d0 --- /dev/null +++ b/app/javascript/mastodon/features/notifications/components/grant_permission_button.tsx @@ -0,0 +1,23 @@ +import { MouseEventHandler } from 'react'; +import { FormattedMessage } from 'react-intl'; + +interface Props { + onClick: MouseEventHandler; +} + +const GrantPermissionButton: React.FC = ({ onClick }) => { + return ( + + ); +}; + +export default GrantPermissionButton; diff --git a/app/javascript/mastodon/features/standalone/compose/index.jsx b/app/javascript/mastodon/features/standalone/compose/index.tsx similarity index 100% rename from app/javascript/mastodon/features/standalone/compose/index.jsx rename to app/javascript/mastodon/features/standalone/compose/index.tsx diff --git a/app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx b/app/javascript/mastodon/features/ui/components/__tests__/column-test.tsx similarity index 64% rename from app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx rename to app/javascript/mastodon/features/ui/components/__tests__/column-test.tsx index ca74fa2dc4..93f07c7d8b 100644 --- a/app/javascript/mastodon/features/ui/components/__tests__/column-test.jsx +++ b/app/javascript/mastodon/features/ui/components/__tests__/column-test.tsx @@ -9,17 +9,29 @@ describe('', () => { it('runs the scroll animation if the column contains scrollable content', () => { const scrollToMock = jest.fn(); const { container } = render( - +
, ); - container.querySelector('.scrollable').scrollTo = scrollToMock; + const scrollable = container.querySelector('.scrollable'); + if (scrollable?.scrollTo) scrollable.scrollTo = scrollToMock; + fireEvent.click(screen.getByText('notifications')); expect(scrollToMock).toHaveBeenCalledWith({ behavior: 'smooth', top: 0 }); }); it('does not try to scroll if there is no scrollable content', () => { - render(); + render( + , + ); fireEvent.click(screen.getByText('notifications')); }); }); diff --git a/app/javascript/mastodon/features/ui/components/column_subheading.jsx b/app/javascript/mastodon/features/ui/components/column_subheading.jsx deleted file mode 100644 index e970a0bfdd..0000000000 --- a/app/javascript/mastodon/features/ui/components/column_subheading.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import PropTypes from 'prop-types'; - -const ColumnSubheading = ({ text }) => { - return ( -
- {text} -
- ); -}; - -ColumnSubheading.propTypes = { - text: PropTypes.string.isRequired, -}; - -export default ColumnSubheading; diff --git a/app/javascript/mastodon/features/ui/components/column_subheading.tsx b/app/javascript/mastodon/features/ui/components/column_subheading.tsx new file mode 100644 index 0000000000..655cfe1da9 --- /dev/null +++ b/app/javascript/mastodon/features/ui/components/column_subheading.tsx @@ -0,0 +1,11 @@ +import React from 'react'; + +interface Props { + text: string; +} + +const ColumnSubheading: React.FC = ({ text }) => { + return
{text}
; +}; + +export default ColumnSubheading; diff --git a/app/javascript/mastodon/features/ui/components/drawer_loading.jsx b/app/javascript/mastodon/features/ui/components/drawer_loading.tsx similarity index 100% rename from app/javascript/mastodon/features/ui/components/drawer_loading.jsx rename to app/javascript/mastodon/features/ui/components/drawer_loading.tsx