mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 09:18:51 +01:00
Fix bypass shortcuts limit
This commit is contained in:
parent
22abc2fb31
commit
6ec7073151
2 changed files with 8 additions and 1 deletions
|
@ -22,7 +22,7 @@ import Icon from './icon';
|
||||||
import MenuConfirm from './menu-confirm';
|
import MenuConfirm from './menu-confirm';
|
||||||
import Modal from './modal';
|
import Modal from './modal';
|
||||||
|
|
||||||
const SHORTCUTS_LIMIT = 9;
|
export const SHORTCUTS_LIMIT = 9;
|
||||||
|
|
||||||
const TYPES = [
|
const TYPES = [
|
||||||
'following',
|
'following',
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
import Icon from '../components/icon';
|
import Icon from '../components/icon';
|
||||||
import Menu2 from '../components/menu2';
|
import Menu2 from '../components/menu2';
|
||||||
import MenuConfirm from '../components/menu-confirm';
|
import MenuConfirm from '../components/menu-confirm';
|
||||||
|
import { SHORTCUTS_LIMIT } from '../components/shortcuts-settings';
|
||||||
import Timeline from '../components/timeline';
|
import Timeline from '../components/timeline';
|
||||||
import { api } from '../utils/api';
|
import { api } from '../utils/api';
|
||||||
import showToast from '../utils/show-toast';
|
import showToast from '../utils/show-toast';
|
||||||
|
@ -313,6 +314,12 @@ function Hashtags({ media: mediaView, columnMode, ...props }) {
|
||||||
<MenuItem
|
<MenuItem
|
||||||
disabled={!currentAuthenticated}
|
disabled={!currentAuthenticated}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (states.shortcuts.length >= SHORTCUTS_LIMIT) {
|
||||||
|
alert(
|
||||||
|
`Max ${SHORTCUTS_LIMIT} shortcuts reached. Unable to add shortcut.`,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const shortcut = {
|
const shortcut = {
|
||||||
type: 'hashtag',
|
type: 'hashtag',
|
||||||
hashtag: hashtags.join(' '),
|
hashtag: hashtags.join(' '),
|
||||||
|
|
Loading…
Reference in a new issue