diff --git a/src/components/shortcuts-settings.jsx b/src/components/shortcuts-settings.jsx index 2a1ee799..1d551c6c 100644 --- a/src/components/shortcuts-settings.jsx +++ b/src/components/shortcuts-settings.jsx @@ -22,7 +22,7 @@ import Icon from './icon'; import MenuConfirm from './menu-confirm'; import Modal from './modal'; -const SHORTCUTS_LIMIT = 9; +export const SHORTCUTS_LIMIT = 9; const TYPES = [ 'following', diff --git a/src/pages/hashtag.jsx b/src/pages/hashtag.jsx index b17a0b0b..1a7fd0cb 100644 --- a/src/pages/hashtag.jsx +++ b/src/pages/hashtag.jsx @@ -11,6 +11,7 @@ import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; import Icon from '../components/icon'; import Menu2 from '../components/menu2'; import MenuConfirm from '../components/menu-confirm'; +import { SHORTCUTS_LIMIT } from '../components/shortcuts-settings'; import Timeline from '../components/timeline'; import { api } from '../utils/api'; import showToast from '../utils/show-toast'; @@ -313,6 +314,12 @@ function Hashtags({ media: mediaView, columnMode, ...props }) { { + if (states.shortcuts.length >= SHORTCUTS_LIMIT) { + alert( + `Max ${SHORTCUTS_LIMIT} shortcuts reached. Unable to add shortcut.`, + ); + return; + } const shortcut = { type: 'hashtag', hashtag: hashtags.join(' '),