Skip to content

Commit

Permalink
Merge pull request #2 from faizanalibugti/feat/state
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
faizanalibugti authored Dec 31, 2023
2 parents 37dbdd4 + 074a623 commit 4b0db9c
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ export interface MediaInfoPage {
mediaInfo: MovieDetail | TvShowDetail;
accountState: AccountStates;
currentMedia: SelectedMedia;
isLoggedIn: boolean;
loaded: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ import {
} from '../media-info.selectors';
import { selectCurrentMedia } from '../../global/global.selectors';
import { MediaInfoPage } from '../models/media-info.model';
import { selectIsAuthenticated } from '../../auth/auth.selectors';

export const selectMediaInfoPage = createSelector(
selectMediaInfo,
selectAccountState,
selectCurrentMedia,
selectIsAuthenticated,
selectMediaInfoLoaded,
(mediaInfo, accountState, currentMedia, loaded) =>
(mediaInfo, accountState, currentMedia, isLoggedIn, loaded) =>
({
mediaInfo,
accountState,
currentMedia,
isLoggedIn,
loaded,
} as MediaInfoPage)
);
54 changes: 46 additions & 8 deletions apps/filmpire/src/app/+state/profile/profile.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,54 @@ export class ProfileEffects {
filter(({ sessionId }) => !!sessionId),
concatMap(({ user, sessionId }) =>
forkJoin({
favoriteMovies: this.accountHttp.getFavoriteMovies(
user.id,
sessionId
favoriteMovies: this.accountHttp
.getFavoriteMovies(user.id, sessionId)
.pipe(
catchError((error) => {
// Handle error for getFavoriteMovies
return of({
page: 0,
total_pages: 0,
total_results: 0,
results: [],
});
})
),
favoriteTV: this.accountHttp.getFavouriteTV(user.id, sessionId).pipe(
catchError((error) => {
// Handle error for getFavoriteMovies
return of({
page: 0,
total_pages: 0,
total_results: 0,
results: [],
});
})
),
favoriteTV: this.accountHttp.getFavouriteTV(user.id, sessionId),
watchListMovies: this.accountHttp.getWatchListMovies(
user.id,
sessionId
watchListMovies: this.accountHttp
.getWatchListMovies(user.id, sessionId)
.pipe(
catchError((error) => {
// Handle error for getFavoriteMovies
return of({
page: 0,
total_pages: 0,
total_results: 0,
results: [],
});
})
),
watchListTV: this.accountHttp.getWatchListTV(user.id, sessionId).pipe(
catchError((error) => {
// Handle error for getFavoriteMovies
return of({
page: 0,
total_pages: 0,
total_results: 0,
results: [],
});
})
),
watchListTV: this.accountHttp.getWatchListTV(user.id, sessionId),
}).pipe(
map((profileData: ProfileData) =>
ProfileActions.profileApiActions.loadProfileSuccess({
Expand Down
1 change: 1 addition & 0 deletions apps/filmpire/src/app/account/account.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,5 @@ <h2 class="mb-10 text-3xl font-semibold dark:text-white">
No items to show. Please add a media to either favorite or watchlist for the
item to appear here
</p>
<br/>
</ng-template>
7 changes: 6 additions & 1 deletion apps/filmpire/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
></ng-filmpire-sidebar>
</mat-sidenav>

<mat-sidenav-content class="dark:bg-[#121212] dark:text-white">
<mat-sidenav-content
class="dark:bg-[#121212] dark:text-white"
[ngStyle]="{
'margin-left': snav.opened && !global.isMobile ? '250px' : '0px'
}"
>
<ng-filmpire-navbar
[darkMode]="global.darkMode"
[user]="global.user"
Expand Down
4 changes: 2 additions & 2 deletions apps/filmpire/src/app/media-info/media-info.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ <h2 class="text-2xl font-semibold">Top Cast</h2>
: 'assets/actor_avatar_placeholder.jpg'
"
alt="{{ actor.name }}"
class="mx-auto h-[150px] w-full max-w-[100px] rounded-lg object-cover"
class="mx-auto h-[150px] w-full max-w-[100px] rounded-lg object-cover hover:scale-105"
loading="lazy"
/>
<p class="mt-1 text-center text-sm">{{ actor.name }}</p>
Expand Down Expand Up @@ -195,7 +195,7 @@ <h2 class="text-2xl font-semibold">Top Cast</h2>
</a>

<a
*ngIf="media.mediaInfo.imdb_id"
*ngIf="media.mediaInfo.imdb_id && !media.isLoggedIn"
class="bg-[#1976d2] dark:bg-[#dc1a28]"
href="https://www.imdb.com/title/{{ media.mediaInfo.imdb_id }}"
matTooltip="Visit imDB page"
Expand Down

0 comments on commit 4b0db9c

Please sign in to comment.