Browse Source

Fix playlist deletion crash (#216)

- Due to incorrect syntax of useTranslation hook
master
jeffvli 3 years ago
parent
commit
87e695d8da
  1. 12
      src/components/shared/ContextMenu.tsx

12
src/components/shared/ContextMenu.tsx

@ -4,8 +4,8 @@ import _ from 'lodash';
import { nanoid } from 'nanoid/non-secure'; import { nanoid } from 'nanoid/non-secure';
import { useQuery, useQueryClient } from 'react-query'; import { useQuery, useQueryClient } from 'react-query';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { useTranslation } from 'react-i18next';
import { ButtonToolbar, Col, Grid, Form, Icon, Row, Whisper } from 'rsuite'; import { ButtonToolbar, Col, Grid, Form, Icon, Row, Whisper } from 'rsuite';
import { t } from 'i18next';
import { useAppDispatch, useAppSelector } from '../../redux/hooks'; import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { import {
addModalPage, addModalPage,
@ -97,6 +97,7 @@ export const ContextMenu = ({
}; };
export const GlobalContextMenu = () => { export const GlobalContextMenu = () => {
const { t } = useTranslation();
const history = useHistory(); const history = useHistory();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@ -933,12 +934,11 @@ export const GlobalContextMenu = () => {
speaker={ speaker={
<ContextMenuPopover> <ContextMenuPopover>
<p> <p>
{ {t('Are you sure you want to delete {{n}} playlist(s)?', {
(t('Are you sure you want to delete {{n}} playlist(s)?'), n: String(multiSelect?.selected?.length),
{ n: multiSelect.selected?.length }) })}
}
</p> </p>
<StyledButton onClick={handleDeletePlaylist} appearance="link"> <StyledButton size="sm" onClick={handleDeletePlaylist} appearance="primary">
{t('Yes')} {t('Yes')}
</StyledButton> </StyledButton>
</ContextMenuPopover> </ContextMenuPopover>

Loading…
Cancel
Save