Skip to content

Commit

Permalink
Merge pull request #1339 from mregni/features/ES-1335
Browse files Browse the repository at this point in the history
Fixing link issue for Jellyfin #1335
  • Loading branch information
mregni authored Aug 24, 2020
2 parents 6d6184c + 67e1bc6 commit 7fc662f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import InboxRoundedIcon from '@material-ui/icons/InboxRounded';
import InsertDriveFileRoundedIcon from '@material-ui/icons/InsertDriveFileRounded';
import SubtitlesRoundedIcon from '@material-ui/icons/SubtitlesRounded';
import MusicNoteRoundedIcon from '@material-ui/icons/MusicNoteRounded';
import PaletteRoundedIcon from '@material-ui/icons/PaletteRounded';

import { RootState } from '../../../../store/RootReducer';
import { getBackdropImageLink, getItemDetailLink } from '../../../../shared/utils/MediaServerUrlUtil';
Expand Down
30 changes: 4 additions & 26 deletions EmbyStat.Web/ClientApp/src/shared/components/cards/TopListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import classNames from 'classnames';
import { useSelector } from 'react-redux';
import { TopCard, TopCardItem } from '../../models/common';
import { RootState } from '../../../store/RootReducer';
import getFullMediaServerUrl from '../../utils/MediaServerUrlUtil';
import getFullMediaServerUrl, { getItemDetailLink, getBackdropImageLink, getPrimaryImageLink } from '../../utils/MediaServerUrlUtil';

const useStyles = makeStyles((theme) => ({
container: {
Expand Down Expand Up @@ -73,25 +73,7 @@ const TopListCard = (props: Props) => {
const [hoveredItem, setHoveredItem] = useState<TopCardItem>(data.values[0]);

const settings = useSelector((state: RootState) => state.settings);
const getBackdropUrl = (): string => {
console.log("DEBUG INFO FOR ISSUE #1295");
console.log(settings);
if (settings != null) {
const fullAddress = getFullMediaServerUrl(settings);
console.log(fullAddress);
console.log(`${fullAddress}/Items/${hoveredItem.mediaId}/Images/Backdrop?EnableImageEnhancers=false`);
return `${fullAddress}/Items/${hoveredItem?.mediaId ?? ''}/Images/Backdrop?EnableImageEnhancers=false`;
}

return '';
};

const classes = useStyles({ backdrop: getBackdropUrl() });

const getPosterUrl = (): string => {
const fullAddress = getFullMediaServerUrl(settings);
return `${fullAddress}/Items/${hoveredItem.mediaId}/Images/Primary?maxHeight=200&tag=${hoveredItem.image}&quality=90&enableimageenhancers=false`;
};
const classes = useStyles({ backdrop: getBackdropImageLink(settings, hoveredItem.mediaId) });

const calculateTime = (date: string): string => {
return moment(date).format('l');
Expand All @@ -111,7 +93,7 @@ const TopListCard = (props: Props) => {
<Grid container direction="row">
<Grid item className={classes.poster}>
<img
src={getPosterUrl()}
src={getPrimaryImageLink(settings, hoveredItem.mediaId, hoveredItem.image)}
alt="poster"
width="92"
height="138"
Expand Down Expand Up @@ -140,11 +122,7 @@ const TopListCard = (props: Props) => {
>
<Grid item className={classes.link}>
<a
href={`${getFullMediaServerUrl(
settings
)}/web/index.html#!/item?id=${pair.mediaId}&serverId=${
settings.mediaServer.serverId
}`}
href={`${getItemDetailLink(settings, pair.mediaId)}`}
target="_blank"
rel="noopener noreferrer"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const StatisticsLoader = (props: Props) => {
history.push('/jobs');
}

if (!runningSyncLoading && runningSync) {
if (!typePresentLoading && !runningSyncLoading && runningSync) {
return (
<div
className={classes.root}>
Expand All @@ -93,7 +93,7 @@ const StatisticsLoader = (props: Props) => {
)
}

if (!typePresentLoading && !typePresent) {
if (!runningSyncLoading && !typePresentLoading && !typePresent) {
return (
<div
className={classes.root}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getItemDetailLink = (settings: Settings, itemId: string): string =>
return `${getFullMediaServerUrl(settings)}/web/index.html#!/item?id=${itemId}&serverId=${settings.mediaServer.serverId}`;
}

return `${getFullMediaServerUrl(settings)}/web/index.html#!/itemdetails.html?id=${itemId}&serverId=${settings.mediaServer.serverId}`;
return `${getFullMediaServerUrl(settings)}/web/index.html#!/details?id=${itemId}&serverId=${settings.mediaServer.serverId}`;
}

export const getPrimaryImageLink = (settings: Settings, itemId: string, tag: string): string => {
Expand Down

0 comments on commit 7fc662f

Please sign in to comment.