Skip to content

Commit

Permalink
fix(portals): fix favorite button behavior in vod-details view
Browse files Browse the repository at this point in the history
this commit closes #327
  • Loading branch information
4gray committed Dec 16, 2023
1 parent d021a73 commit eb4eb60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/app/xtream/detail-view.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
width: 300px;
height: 500px;
background-color: #999;
border-radius: 5px;

&::after {
content: 'No cover';
Expand Down
22 changes: 16 additions & 6 deletions src/app/xtream/vod-details/vod-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,21 @@ export class VodDetailsComponent implements OnInit {
this.playlistService
.getPortalFavorites(this.portalId)
.subscribe((favorites) => {
this.isFavorite = favorites.some(
(i) =>
i?.stream_id === this.item?.movie_data?.stream_id ||
(i as any)?.details?.id === (this.item as any)?.id
);
this.isFavorite = favorites.some((i) => {
const hasStreamId =
i?.stream_id !== undefined &&
this.item?.movie_data?.stream_id !== undefined;
const hasId =
(i as any)?.details?.id !== undefined &&
(this.item as any)?.id !== undefined;

return (
(hasStreamId &&
i.stream_id === this.item.movie_data.stream_id) ||
(hasId &&
(i as any).details.id === (this.item as any).id)
);
});
});
}

Expand All @@ -67,7 +77,7 @@ export class VodDetailsComponent implements OnInit {
});
} else {
this.addToFavoritesClicked.emit({
name: this.item.info.name,
name: this.item.movie_data.name,
stream_id: this.item.movie_data.stream_id,
container_extension:
this.item.movie_data.container_extension,
Expand Down

1 comment on commit eb4eb60

@vercel
Copy link

@vercel vercel bot commented on eb4eb60 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

iptvnator – ./

iptvnator.vercel.app
iptvnator-git-electron-4gray.vercel.app
iptvnator-4gray.vercel.app

Please sign in to comment.