Skip to content

Commit

Permalink
refactor(stalker): code style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
4gray committed May 4, 2024
1 parent 17b1777 commit 3d5959e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<img
class="stream-icon"
*ngIf="item.stream_icon || item.cover || item.logo"
[src]="item.stream_icon || item.cover || item.logo"
[ngSrc]="item.stream_icon || item.cover || item.logo"
fill
priority
placeholder
placeholder="data:image/png;base64,iVBORw0K..."
/>
<div
class="stream-icon-placeholder"
Expand All @@ -25,8 +29,10 @@
<mat-icon>star</mat-icon
>{{ item.rating || item.rating_imdb }}
</div>
<div class="title">{{ item.name }}</div>
</mat-card-content>
<mat-card-actions>
<div class="title">{{ item.name }}</div>
</mat-card-actions>
</mat-card>
<div
class="no-content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mat-card:hover {
mat-card {
cursor: pointer;
width: 170px;
// height: 300px;

mat-card-content {
padding: 0;
Expand All @@ -30,14 +31,17 @@ mat-card:hover {

.stream-icon {
width: 100%;
position: relative !important;

/* max-height: 300px; */
display: block;
}

.stream-icon-placeholder {
width: 100%;
background: #999;
max-height: 300px;
min-height: 130px;
min-height: 255px;
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -49,8 +53,12 @@ mat-card:hover {

.title {
word-break: break-all;
padding: 8px;
/* padding: 8px; */
text-align: center;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgFor, NgIf } from '@angular/common';
import { NgFor, NgIf, NgOptimizedImage } from '@angular/common';
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatCardModule } from '@angular/material/card';
Expand All @@ -22,6 +22,7 @@ import { PortalStore } from '../portal.store';
FilterPipe,
FormsModule,
MatTooltipModule,
NgOptimizedImage,
TranslateModule,
],
})
Expand Down
20 changes: 20 additions & 0 deletions src/app/xtream/portal.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ export interface PortalState {
searchPhrase: string;
content: any[];
hideExternalInfoDialog: boolean;
currentVod: any;
currentSerial: any;
}

@Injectable({ providedIn: 'root' })
export class PortalStore extends ComponentStore<PortalState> {
constructor() {
super({
searchPhrase: '',
currentVod: undefined,
currentSerial: undefined,
content: [],
hideExternalInfoDialog:
localStorage.getItem('hideExternalInfoDialog') === 'true',
Expand All @@ -20,6 +24,8 @@ export class PortalStore extends ComponentStore<PortalState> {

// selectors
readonly searchPhrase = this.selectSignal((state) => state.searchPhrase);
readonly currentSerial = this.selectSignal((state) => state.currentSerial);
readonly currentVod = this.selectSignal((state) => state.currentVod);

readonly hideExternalInfoDialog = this.selectSignal(
(state) => state.hideExternalInfoDialog
Expand All @@ -43,6 +49,20 @@ export class PortalStore extends ComponentStore<PortalState> {
})
);

readonly setCurrentSerial = this.updater(
(state, currentSerial: any): PortalState => ({
...state,
currentSerial,
})
);

readonly setCurrentVod = this.updater(
(state, currentVod: any): PortalState => ({
...state,
currentVod,
})
);

readonly setHideExternalInfoDialog = this.updater(
(state, hideExternalInfoDialog: boolean): PortalState => {
localStorage.setItem(
Expand Down
8 changes: 5 additions & 3 deletions src/app/xtream/vod-details/vod-details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ <h2>{{ item.info.name }}</h2>
{{ item.info.duration }}
</label>
<label *ngIf="item.info.rating_imdb">
<div class="label">Rating IMDB:</div>
<div class="label">{{ 'XTREAM.IMDB_RATING' | translate }}:</div>
{{ item.info.rating_imdb }}
</label>
<label *ngIf="item.info.rating_kinopoisk">
<div class="label">Rating Kinopoisk:</div>
<div class="label">
{{ 'XTREAM.KINOPOISK_RATING' | translate }}:
</div>
{{ item.info.rating_kinopoisk }}
</label>
<div class="action-buttons">
Expand Down Expand Up @@ -86,7 +88,7 @@ <h2>{{ item.info.name }}</h2>
</div>
</div>
<div class="youtube-trailer" *ngIf="item.info.youtube_trailer">
<h3>YouTube Trailer</h3>
<h3>{{ 'XTREAM.YOUTUBE_TRAILER' | translate }}</h3>
<iframe
width="100%"
height="450"
Expand Down
16 changes: 11 additions & 5 deletions src/app/xtream/xtream-main-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ import { STORE_KEY } from '../shared/enums/store-keys.enum';
import { PlaylistErrorViewComponent } from '../xtream/playlist-error-view/playlist-error-view.component';
import { Breadcrumb, PortalActions } from './breadcrumb.interface';
import { ContentTypeNavigationItem } from './content-type-navigation-item.interface';
import { PlayerDialogComponent } from './player-dialog/player-dialog.component';
import {
PlayerDialogComponent,
PlayerDialogData,
} from './player-dialog/player-dialog.component';
import { PortalStore } from './portal.store';
import { SerialDetailsComponent } from './serial-details/serial-details.component';

Expand Down Expand Up @@ -352,10 +355,13 @@ export class XtreamMainContainerComponent implements OnInit {
} else {
this.streamUrl = streamUrl;
if (this.selectedContentType !== ContentType.ITV) {
this.dialog.open(PlayerDialogComponent, {
data: { streamUrl, player: this.player, title },
width: '80%',
});
this.dialog.open<PlayerDialogComponent, PlayerDialogData>(
PlayerDialogComponent,
{
data: { streamUrl, title },
width: '80%',
}
);
}
}
}
Expand Down

0 comments on commit 3d5959e

Please sign in to comment.