Skip to content

Commit

Permalink
apply suggestion
Browse files Browse the repository at this point in the history
Co-authored-by: dmitrylyzo <56478732+dmitrylyzo@users.noreply.github.com>
  • Loading branch information
grafixeyehero and dmitrylyzo committed Sep 8, 2024
1 parent 690b1fb commit b378c46
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ const CancelSeriesTimerButton: FC<CancelSeriesTimerButtonProps> = ({
navigate('/livetv.html');
},
onError: (err: unknown) => {
console.error(
'[cancelSeriesTimer] failed to cancel series timer',
err
);
loading.hide();
toast(globalize.translate('MessageCancelSeriesTimerError', err));
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ const CancelTimerButton: FC<CancelTimerButtonProps> = ({
},

onError: (err: unknown) => {
console.error(
'[cancelTimer] failed to cancel timer',
err
);
loading.hide();
toast(globalize.translate('MessageCancelTimerError', err));
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export interface ContextMenuOpts {
}

interface MoreCommandsButtonProps {
className?: string;
itemType: ItemKind;
selectedItemId?: string;
itemId?: string;
Expand All @@ -96,7 +95,6 @@ interface MoreCommandsButtonProps {
}

const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
className,
itemType,
selectedItemId,
itemId,
Expand All @@ -112,7 +110,7 @@ const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
const queryClient = useQueryClient();
const { data: item } = useGetItemByType({
itemType,
itemId: selectedItemId || itemId
itemId: selectedItemId || itemId || ''
});
const parentId = item?.SeasonId || item?.SeriesId || item?.ParentId;

Expand Down Expand Up @@ -206,7 +204,7 @@ const MoreCommandsButton: FC<MoreCommandsButtonProps> = ({
) {
return (
<IconButton
className={className}
className='button-flat btnMoreCommands'
title={globalize.translate('ButtonMore')}
onClick={onMoreCommandsClick}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const PlayOrResumeButton: FC<PlayOrResumeButtonProps> = ({

return (
<IconButton
className='button-flat btnPlay'
className='button-flat btnPlayOrResume'
data-action={isResumable ? 'resume' : 'play'}
title={
isResumable ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ShuffleButton: FC<ShuffleButtonProps> = ({ item }) => {
return (
<IconButton
title={globalize.translate('Shuffle')}
className='paper-icon-button-light btnShuffle autoSize'
className='button-flat btnShuffle'
onClick={shuffle}
>
<ShuffleIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useDeleteAlternateSources } from 'hooks/api/videosHooks';
import globalize from 'lib/globalize';
import confirm from 'components/confirm/confirm';
import loading from 'components/loading/loading';
import toast from 'components/toast/toast';

interface SplitVersionsButtonProps {
paramId: string;
Expand Down Expand Up @@ -38,10 +39,8 @@ const SplitVersionsButton: FC<SplitVersionsButtonProps> = ({
});
},
onError: (err: unknown) => {
console.error(
'[splitVersions] failed to delete Videos',
err
);
loading.hide();
toast(globalize.translate('MessageSplitVersionsError', err));
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ import { getLiveTvApi } from '@jellyfin/sdk/lib/utils/api/live-tv-api';
import { useQuery } from '@tanstack/react-query';
import { type JellyfinApiContext, useApi } from 'hooks/useApi';
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';

const getItemByType = async (
apiContext: JellyfinApiContext,
itemType: ItemKind,
itemId: NullableString,
itemId: string,
options?: AxiosRequestConfig
) => {
const { api, user } = apiContext;
if (!api) throw new Error('No API instance available');
if (!user?.Id) throw new Error('No User ID provided');
if (!itemId) throw new Error('No item ID provided');

let response;
switch (itemType) {
Expand Down Expand Up @@ -46,7 +44,7 @@ const getItemByType = async (

interface UseGetItemByTypeProps {
itemType: ItemKind;
itemId: NullableString;
itemId: string;
}

export const useGetItemByType = ({
Expand Down
3 changes: 3 additions & 0 deletions src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,9 @@
"MessageAreYouSureDeleteSubtitles": "Are you sure you wish to delete this subtitle file?",
"MessageAreYouSureYouWishToRemoveMediaFolder": "Are you sure you wish to remove this media folder?",
"MessageBrowsePluginCatalog": "Browse our plugin catalog to view available plugins.",
"MessageCancelSeriesTimerError": "An error occurred while cancel series timer {0}",
"MessageCancelTimerError": "An error occurred while cancel timer {0}",
"MessageSplitVersionsError": "An error occurred while split versions {0}",
"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?",
"MessageConfirmDeleteGuideProvider": "Are you sure you wish to delete this guide provider?",
Expand Down

0 comments on commit b378c46

Please sign in to comment.