aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2019-12-20 17:49:57 +0100
committerRigel Kent <sendmemail@rigelk.eu>2019-12-20 17:49:57 +0100
commit223b24e618146f85b20b5bf365bc18d14a5964cd (patch)
tree236fde34d190fa5d0d9a44c6760c0161594dd872 /client/src/app/shared
parent1dc240a9488c66ad38205d08fcfdb32d35efceaa (diff)
downloadPeerTube-223b24e618146f85b20b5bf365bc18d14a5964cd.tar.gz
PeerTube-223b24e618146f85b20b5bf365bc18d14a5964cd.tar.zst
PeerTube-223b24e618146f85b20b5bf365bc18d14a5964cd.zip
Fix upnext, refactor avatar menu, add to playlist overflow
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/misc/utils.ts24
-rw-r--r--client/src/app/shared/video-playlist/video-add-to-playlist.component.html14
-rw-r--r--client/src/app/shared/video-playlist/video-add-to-playlist.component.scss10
3 files changed, 36 insertions, 12 deletions
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index f26240d21..b1d1fc0b5 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -169,6 +169,26 @@ function importModule (path: string) {
169 }) 169 })
170} 170}
171 171
172function isInViewport (el: HTMLElement) {
173 const bounding = el.getBoundingClientRect()
174 return (
175 bounding.top >= 0 &&
176 bounding.left >= 0 &&
177 bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
178 bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
179 )
180}
181
182function isXPercentInViewport (el: HTMLElement, percentVisible: number) {
183 const rect = el.getBoundingClientRect()
184 const windowHeight = (window.innerHeight || document.documentElement.clientHeight)
185
186 return !(
187 Math.floor(100 - (((rect.top >= 0 ? 0 : rect.top) / +-(rect.height / 1)) * 100)) < percentVisible ||
188 Math.floor(100 - ((rect.bottom - windowHeight) / rect.height) * 100) < percentVisible
189 )
190}
191
172export { 192export {
173 sortBy, 193 sortBy,
174 durationToString, 194 durationToString,
@@ -183,5 +203,7 @@ export {
183 objectLineFeedToHtml, 203 objectLineFeedToHtml,
184 removeElementFromArray, 204 removeElementFromArray,
185 importModule, 205 importModule,
186 scrollToTop 206 scrollToTop,
207 isInViewport,
208 isXPercentInViewport
187} 209}
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html
index 648d580fa..0cc8af345 100644
--- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html
+++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html
@@ -41,14 +41,16 @@
41 </div> 41 </div>
42 </div> 42 </div>
43 43
44 <div class="playlist dropdown-item" *ngFor="let playlist of videoPlaylists" (click)="togglePlaylist($event, playlist)"> 44 <div class="playlists">
45 <my-peertube-checkbox [inputName]="'in-playlist-' + playlist.id" [(ngModel)]="playlist.inPlaylist" [onPushWorkaround]="true"></my-peertube-checkbox> 45 <div class="playlist dropdown-item" *ngFor="let playlist of videoPlaylists" (click)="togglePlaylist($event, playlist)">
46 <my-peertube-checkbox [inputName]="'in-playlist-' + playlist.id" [(ngModel)]="playlist.inPlaylist" [onPushWorkaround]="true"></my-peertube-checkbox>
46 47
47 <div class="display-name"> 48 <div class="display-name">
48 {{ playlist.displayName }} 49 {{ playlist.displayName }}
49 50
50 <div *ngIf="playlist.inPlaylist && (playlist.startTimestamp || playlist.stopTimestamp)" class="timestamp-info"> 51 <div *ngIf="playlist.inPlaylist && (playlist.startTimestamp || playlist.stopTimestamp)" class="timestamp-info">
51 {{ formatTimestamp(playlist) }} 52 {{ formatTimestamp(playlist) }}
53 </div>
52 </div> 54 </div>
53 </div> 55 </div>
54 </div> 56 </div>
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss b/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss
index c677fea6c..090b530cf 100644
--- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss
+++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.scss
@@ -1,11 +1,6 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3 3
4.root {
5 max-height: 300px;
6 overflow-y: auto;
7}
8
9.header { 4.header {
10 min-width: 240px; 5 min-width: 240px;
11 padding: 6px 24px 10px 24px; 6 padding: 6px 24px 10px 24px;
@@ -53,6 +48,11 @@
53 padding: 6px 24px; 48 padding: 6px 24px;
54} 49}
55 50
51.playlists {
52 max-height: 180px;
53 overflow-y: auto;
54}
55
56.playlist { 56.playlist {
57 display: flex; 57 display: flex;
58 cursor: pointer; 58 cursor: pointer;