mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
apply suggestion
Co-authored-by: dmitrylyzo <56478732+dmitrylyzo@users.noreply.github.com>
This commit is contained in:
parent
690b1fbed5
commit
49b0ba3071
8 changed files with 17 additions and 11 deletions
|
@ -39,6 +39,8 @@ const CancelSeriesTimerButton: FC<CancelSeriesTimerButtonProps> = ({
|
||||||
navigate('/livetv.html');
|
navigate('/livetv.html');
|
||||||
},
|
},
|
||||||
onError: (err: unknown) => {
|
onError: (err: unknown) => {
|
||||||
|
loading.hide();
|
||||||
|
toast(globalize.translate('MessageCancelSeriesTimerError'));
|
||||||
console.error(
|
console.error(
|
||||||
'[cancelSeriesTimer] failed to cancel series timer',
|
'[cancelSeriesTimer] failed to cancel series timer',
|
||||||
err
|
err
|
||||||
|
|
|
@ -35,6 +35,8 @@ const CancelTimerButton: FC<CancelTimerButtonProps> = ({
|
||||||
},
|
},
|
||||||
|
|
||||||
onError: (err: unknown) => {
|
onError: (err: unknown) => {
|
||||||
|
loading.hide();
|
||||||
|
toast(globalize.translate('MessageCancelTimerError'));
|
||||||
console.error(
|
console.error(
|
||||||
'[cancelTimer] failed to cancel timer',
|
'[cancelTimer] failed to cancel timer',
|
||||||
err
|
err
|
||||||
|
|
|
@ -82,7 +82,6 @@ export interface ContextMenuOpts {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MoreCommandsButtonProps {
|
interface MoreCommandsButtonProps {
|
||||||
className?: string;
|
|
||||||
itemType: ItemKind;
|
itemType: ItemKind;
|
||||||
selectedItemId?: string;
|
selectedItemId?: string;
|
||||||
itemId?: string;
|
itemId?: string;
|
||||||
|
@ -96,7 +95,6 @@ interface MoreCommandsButtonProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
|
const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
|
||||||
className,
|
|
||||||
itemType,
|
itemType,
|
||||||
selectedItemId,
|
selectedItemId,
|
||||||
itemId,
|
itemId,
|
||||||
|
@ -112,7 +110,7 @@ const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { data: item } = useGetItemByType({
|
const { data: item } = useGetItemByType({
|
||||||
itemType,
|
itemType,
|
||||||
itemId: selectedItemId || itemId
|
itemId: selectedItemId || itemId || ''
|
||||||
});
|
});
|
||||||
const parentId = item?.SeasonId || item?.SeriesId || item?.ParentId;
|
const parentId = item?.SeasonId || item?.SeriesId || item?.ParentId;
|
||||||
|
|
||||||
|
@ -206,7 +204,7 @@ const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
className={className}
|
className='button-flat btnMoreCommands'
|
||||||
title={globalize.translate('ButtonMore')}
|
title={globalize.translate('ButtonMore')}
|
||||||
onClick={onMoreCommandsClick}
|
onClick={onMoreCommandsClick}
|
||||||
>
|
>
|
||||||
|
|
|
@ -70,7 +70,7 @@ const PlayOrResumeButton: FC<PlayOrResumeButtonProps> = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
className='button-flat btnPlay'
|
className='button-flat btnPlayOrResume'
|
||||||
data-action={isResumable ? 'resume' : 'play'}
|
data-action={isResumable ? 'resume' : 'play'}
|
||||||
title={
|
title={
|
||||||
isResumable ?
|
isResumable ?
|
||||||
|
|
|
@ -18,7 +18,7 @@ const ShuffleButton: FC<ShuffleButtonProps> = ({ item }) => {
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
title={globalize.translate('Shuffle')}
|
title={globalize.translate('Shuffle')}
|
||||||
className='paper-icon-button-light btnShuffle autoSize'
|
className='button-flat btnShuffle'
|
||||||
onClick={shuffle}
|
onClick={shuffle}
|
||||||
>
|
>
|
||||||
<ShuffleIcon />
|
<ShuffleIcon />
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useDeleteAlternateSources } from 'hooks/api/videosHooks';
|
||||||
import globalize from 'lib/globalize';
|
import globalize from 'lib/globalize';
|
||||||
import confirm from 'components/confirm/confirm';
|
import confirm from 'components/confirm/confirm';
|
||||||
import loading from 'components/loading/loading';
|
import loading from 'components/loading/loading';
|
||||||
|
import toast from 'components/toast/toast';
|
||||||
|
|
||||||
interface SplitVersionsButtonProps {
|
interface SplitVersionsButtonProps {
|
||||||
paramId: string;
|
paramId: string;
|
||||||
|
@ -38,8 +39,10 @@ const SplitVersionsButton: FC<SplitVersionsButtonProps> = ({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (err: unknown) => {
|
onError: (err: unknown) => {
|
||||||
|
loading.hide();
|
||||||
|
toast(globalize.translate('MessageSplitVersionsError'));
|
||||||
console.error(
|
console.error(
|
||||||
'[splitVersions] failed to delete Videos',
|
'[splitVersions] failed to split versions',
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,17 @@ import { getLiveTvApi } from '@jellyfin/sdk/lib/utils/api/live-tv-api';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { type JellyfinApiContext, useApi } from 'hooks/useApi';
|
import { type JellyfinApiContext, useApi } from 'hooks/useApi';
|
||||||
import type { ItemDto } from 'types/base/models/item-dto';
|
import type { ItemDto } from 'types/base/models/item-dto';
|
||||||
import type{ NullableString } from 'types/base/common/shared/types';
|
|
||||||
import { ItemKind } from 'types/base/models/item-kind';
|
import { ItemKind } from 'types/base/models/item-kind';
|
||||||
|
|
||||||
const getItemByType = async (
|
const getItemByType = async (
|
||||||
apiContext: JellyfinApiContext,
|
apiContext: JellyfinApiContext,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
itemId: NullableString,
|
itemId: string,
|
||||||
options?: AxiosRequestConfig
|
options?: AxiosRequestConfig
|
||||||
) => {
|
) => {
|
||||||
const { api, user } = apiContext;
|
const { api, user } = apiContext;
|
||||||
if (!api) throw new Error('No API instance available');
|
if (!api) throw new Error('No API instance available');
|
||||||
if (!user?.Id) throw new Error('No User ID provided');
|
if (!user?.Id) throw new Error('No User ID provided');
|
||||||
if (!itemId) throw new Error('No item ID provided');
|
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
|
@ -46,7 +44,7 @@ const getItemByType = async (
|
||||||
|
|
||||||
interface UseGetItemByTypeProps {
|
interface UseGetItemByTypeProps {
|
||||||
itemType: ItemKind;
|
itemType: ItemKind;
|
||||||
itemId: NullableString;
|
itemId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useGetItemByType = ({
|
export const useGetItemByType = ({
|
||||||
|
|
|
@ -1045,6 +1045,9 @@
|
||||||
"MessageAreYouSureDeleteSubtitles": "Are you sure you wish to delete this subtitle file?",
|
"MessageAreYouSureDeleteSubtitles": "Are you sure you wish to delete this subtitle file?",
|
||||||
"MessageAreYouSureYouWishToRemoveMediaFolder": "Are you sure you wish to remove this media folder?",
|
"MessageAreYouSureYouWishToRemoveMediaFolder": "Are you sure you wish to remove this media folder?",
|
||||||
"MessageBrowsePluginCatalog": "Browse our plugin catalog to view available plugins.",
|
"MessageBrowsePluginCatalog": "Browse our plugin catalog to view available plugins.",
|
||||||
|
"MessageCancelSeriesTimerError": "An error occurred while cancel series timer",
|
||||||
|
"MessageCancelTimerError": "An error occurred while cancel timer",
|
||||||
|
"MessageSplitVersionsError": "An error occurred while split versions",
|
||||||
"MessageChangeRecordingPath": "Changing your recording folder will not migrate existing recordings from the old location to the new. You'll need to move them manually if desired.",
|
"MessageChangeRecordingPath": "Changing your recording folder will not migrate existing recordings from the old location to the new. You'll need to move them manually if desired.",
|
||||||
"MessageConfirmAppExit": "Do you want to exit?",
|
"MessageConfirmAppExit": "Do you want to exit?",
|
||||||
"MessageConfirmDeleteGuideProvider": "Are you sure you wish to delete this guide provider?",
|
"MessageConfirmDeleteGuideProvider": "Are you sure you wish to delete this guide provider?",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue