Fixing keyboard behaviors of the app

This commit is contained in:
Zoe Roux 2020-12-30 19:22:46 +01:00
parent 539dcfc9d8
commit d11cff9176
9 changed files with 75 additions and 39 deletions

View File

@ -45,7 +45,7 @@
padding: 12px; padding: 12px;
color: rgba(255, 255, 255, 0.7) !important; color: rgba(255, 255, 255, 0.7) !important;
&:host-context(.hoverEnabled) &:hover &:host-context(.hoverEnabled) &:hover, &:focus
{ {
color: white !important; color: white !important;
} }
@ -111,7 +111,7 @@ input::-webkit-search-cancel-button
opacity: 0.7; opacity: 0.7;
outline: none; outline: none;
&:host-context(.hoverEnabled) &:hover &:host-context(.hoverEnabled) &:hover, &:focus
{ {
cursor: pointer; cursor: pointer;
opacity: 1; opacity: 1;

View File

@ -1,10 +1,20 @@
<div class="root"> <div class="root">
<div class="episodes" #scrollView (scroll)="onScroll()" infinite-scroll (scrolled)="this.episodes?.loadNext(this.client)" [horizontal]="true" [scrollWindow]="false"> <div class="episodes" #scrollView
<div class="episode" *ngFor="let episode of this.episodes?.items" #itemsDom> (scroll)="onScroll()" infinite-scroll (scrolled)="this.episodes?.loadNext(this.client)"
<button mat-icon-button class="moreBtn" [matMenuTriggerFor]="more" [matMenuTriggerData]="{episode: episode}"><i class="material-icons">more_vert</i></button> [horizontal]="true" [scrollWindow]="false">
<a routerLink="/watch/{{episode.slug}}" href="/watch/{{episode.slug}}"> <a *ngFor="let episode of this.episodes?.items"
routerLink="/watch/{{episode.slug}}" href="/watch/{{episode.slug}}"
class="episode" #itemsDom>
<button mat-icon-button class="moreBtn" [matMenuTriggerFor]="more" [matMenuTriggerData]="{episode: episode}"
tabindex="-1"
(click)="$event.stopImmediatePropagation(); $event.preventDefault()">
<mat-icon>more_vert</mat-icon>
</button>
<div>
<div matRipple class="img" [style.background-image]="sanitize(episode.thumb)"> <div matRipple class="img" [style.background-image]="sanitize(episode.thumb)">
<button mat-icon-button class="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button> <button mat-icon-button class="playBtn" tabindex="-1">
<mat-icon class="playIcon">play_circle_outline</mat-icon>
</button>
</div> </div>
<ng-container *ngIf="displayShowTitle; else noTitle;"> <ng-container *ngIf="displayShowTitle; else noTitle;">
<h6 *ngIf="episode.seasonNumber != 0; else elseBlock;" class="title">{{episode.showTitle}} - S{{episode.seasonNumber}}:E{{episode.episodeNumber}}</h6> <h6 *ngIf="episode.seasonNumber != 0; else elseBlock;" class="title">{{episode.showTitle}} - S{{episode.seasonNumber}}:E{{episode.episodeNumber}}</h6>
@ -16,16 +26,20 @@
<ng-template #elseBlock><h6 class="title">{{episode.title}}</h6></ng-template> <ng-template #elseBlock><h6 class="title">{{episode.title}}</h6></ng-template>
<p class="overview">{{episode.overview}}</p> <p class="overview">{{episode.overview}}</p>
</ng-template> </ng-template>
</a> </div>
</div> </a>
</div> </div>
<mat-menu #more="matMenu"> <mat-menu #more="matMenu">
<ng-template matMenuContent let-episode="episode"> <ng-template matMenuContent let-episode="episode">
<a [href]="'/video/' + episode.link" download><button mat-menu-item>Download episode</button></a> <a [href]="'/video/' + episode.slug" download><button mat-menu-item>Download episode</button></a>
</ng-template> </ng-template>
</mat-menu> </mat-menu>
<button mat-raised-button color="accent" class="scrollBtn leftBtn d-none" #leftBtn (click)="scrollLeft()"><mat-icon>arrow_left</mat-icon></button> <button mat-raised-button color="accent" class="scrollBtn leftBtn d-none" #leftBtn (click)="scrollLeft()">
<button mat-raised-button color="accent" class="scrollBtn rightBtn" #rightBtn (click)="scrollRight()"><mat-icon>arrow_right</mat-icon></button> <mat-icon>arrow_left</mat-icon>
</button>
<button mat-raised-button color="accent" class="scrollBtn rightBtn" #rightBtn (click)="scrollRight()">
<mat-icon>arrow_right</mat-icon>
</button>
</div> </div>

View File

@ -54,6 +54,9 @@
width: 55%; width: 55%;
outline: none; outline: none;
position: relative; position: relative;
cursor: pointer;
color: inherit;
text-decoration: inherit;
@include media-breakpoint-up(sm) @include media-breakpoint-up(sm)
{ {
@ -88,13 +91,10 @@
z-index: 255 z-index: 255
} }
> a { > div
cursor: pointer; {
color: inherit; .img
text-decoration: inherit; {
outline: none;
.img {
width: 100%; width: 100%;
height: 0; height: 0;
padding-top: 56.25%; padding-top: 56.25%;
@ -102,7 +102,8 @@
background-size: contain; background-size: contain;
position: relative; position: relative;
> .playBtn { > .playBtn
{
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
@ -116,7 +117,8 @@
} }
} }
.title { .title
{
padding-top: .2rem; padding-top: .2rem;
font-weight: 600; font-weight: 600;
margin-bottom: 0; margin-bottom: 0;
@ -126,7 +128,8 @@
overflow: hidden; overflow: hidden;
} }
.overview { .overview
{
font-weight: 300; font-weight: 300;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 4; -webkit-line-clamp: 4;
@ -134,7 +137,8 @@
overflow: hidden; overflow: hidden;
} }
.subtitle { .subtitle
{
font-weight: 300; font-weight: 300;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
@ -143,14 +147,14 @@
} }
} }
&:host-context(.hoverEnabled) &:hover &:host-context(.hoverEnabled) &:hover, &:focus
{ {
.moreBtn .moreBtn
{ {
display: block; display: block;
} }
> a > div
{ {
.img .img
{ {
@ -170,6 +174,11 @@
} }
} }
.moreBtn:focus
{
display: block !important;
}
.playIcon .playIcon
{ {
font-size: 64px; font-size: 64px;

View File

@ -1,9 +1,10 @@
import { Component, Input} from '@angular/core'; import { Component, Input, ViewChild } from "@angular/core";
import { MatMenuTrigger } from "@angular/material/menu";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { Episode } from "../../models/resources/episode"; import { Episode } from "../../models/resources/episode";
import {HorizontalScroller} from "../../misc/horizontal-scroller"; import { HorizontalScroller } from "../../misc/horizontal-scroller";
import {Page} from "../../models/page"; import { Page } from "../../models/page";
import {HttpClient} from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
@Component({ @Component({
selector: 'app-episodes-list', selector: 'app-episodes-list',
@ -14,6 +15,7 @@ export class EpisodesListComponent extends HorizontalScroller
{ {
@Input() displayShowTitle: boolean = false; @Input() displayShowTitle: boolean = false;
@Input() episodes: Page<Episode>; @Input() episodes: Page<Episode>;
@ViewChild(MatMenuTrigger) menu: MatMenuTrigger;
constructor(private sanitizer: DomSanitizer, public client: HttpClient) constructor(private sanitizer: DomSanitizer, public client: HttpClient)
{ {
@ -24,4 +26,9 @@ export class EpisodesListComponent extends HorizontalScroller
{ {
return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")"); return this.sanitizer.bypassSecurityTrustStyle("url(" + url + ")");
} }
openMenu(): void
{
this.menu.openMenu();
}
} }

View File

@ -1,11 +1,18 @@
<div class="scroll-row mb-5"> <div class="scroll-row mb-5">
<div class="people-container" #scrollView (scroll)="onScroll()" infinite-scroll (scrolled)="this.people?.loadNext(this.client)" [horizontal]="true" [scrollWindow]="false"> <div class="people-container" #scrollView
<a class="people" *ngFor="let people of this.people?.items" routerLink="/people/{{people.slug}}" href="/people/{{people.slug}}" #itemsDom> (scroll)="onScroll()" infinite-scroll (scrolled)="this.people?.loadNext(this.client)"
[horizontal]="true" [scrollWindow]="false">
<a class="people" *ngFor="let people of this.people?.items"
routerLink="/people/{{people.slug}}" href="/people/{{people.slug}}" #itemsDom>
<div matRipple [style.background-image]="getPeopleIcon(people.slug)"> </div> <div matRipple [style.background-image]="getPeopleIcon(people.slug)"> </div>
<h6 class="name">{{people.name}}</h6> <h6 class="name">{{people.name}}</h6>
<p class="role">{{people.role}}</p> <p class="role">{{people.role}}</p>
</a> </a>
</div> </div>
<button mat-raised-button color="accent" class="scrollBtn leftBtn d-none" #leftBtn (click)="scrollLeft()"><mat-icon>arrow_left</mat-icon></button> <button mat-raised-button color="accent" class="scrollBtn leftBtn d-none" #leftBtn (click)="scrollLeft()">
<button mat-raised-button color="accent" class="scrollBtn rightBtn" #rightBtn (click)="scrollRight()"><mat-icon>arrow_right</mat-icon></button> <mat-icon>arrow_left</mat-icon>
</button>
<button mat-raised-button color="accent" class="scrollBtn rightBtn" #rightBtn (click)="scrollRight()">
<mat-icon>arrow_right</mat-icon>
</button>
</div> </div>

View File

@ -86,11 +86,11 @@
} }
} }
&:host-context(.hoverEnabled) &:hover &:host-context(.hoverEnabled) &:hover, &:focus
{ {
cursor: pointer; cursor: pointer;
> img > div
{ {
outline: solid var(--accentColor); outline: solid var(--accentColor);
} }

View File

@ -106,7 +106,7 @@ button
margin-bottom: 0; margin-bottom: 0;
} }
&:host-context(.hoverEnabled) &:hover &:host-context(.hoverEnabled) &:hover, &:focus
{ {
cursor: pointer; cursor: pointer;
} }
@ -141,4 +141,4 @@ button
max-height: 2.5rem; max-height: 2.5rem;
} }
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, ElementRef, ViewChild } from "@angular/core"; import { Component, ElementRef, ViewChild } from "@angular/core";
import {MatButton} from "@angular/material/button"; import { MatButton } from "@angular/material/button";
// noinspection AngularMissingOrInvalidDeclarationInModule // noinspection AngularMissingOrInvalidDeclarationInModule
@Component({ @Component({

View File

@ -7,7 +7,6 @@ export interface Episode extends IResource
episodeNumber: number; episodeNumber: number;
title: string; title: string;
thumb: string; thumb: string;
slug: string;
overview: string; overview: string;
releaseDate; releaseDate;
runtime: number; runtime: number;