added img loading screen
This commit is contained in:
parent
93f52d2cf1
commit
c3e7e64498
5 changed files with 43 additions and 5 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
@if (['png', 'jpg', 'jpeg', 'gif'].includes(getFileType(filePath))) {
|
@if (['png', 'jpg', 'jpeg', 'gif'].includes(getFileType(filePath))) {
|
||||||
<img
|
<img
|
||||||
src="{{ filePath }}"
|
src="{{ filePath }}"
|
||||||
|
(load)="onImageLoad()"
|
||||||
alt="image"
|
alt="image"
|
||||||
[ngStyle]="{
|
[ngStyle]="{
|
||||||
height:
|
height:
|
||||||
|
|
@ -17,6 +18,7 @@
|
||||||
<img
|
<img
|
||||||
class="otherFiles"
|
class="otherFiles"
|
||||||
src="./assets/img/attachments/{{ getFileType(filePath) }}.png"
|
src="./assets/img/attachments/{{ getFileType(filePath) }}.png"
|
||||||
|
(load)="onImageLoad()"
|
||||||
alt="image"
|
alt="image"
|
||||||
[ngStyle]="{
|
[ngStyle]="{
|
||||||
height:
|
height:
|
||||||
|
|
@ -30,6 +32,7 @@
|
||||||
controls
|
controls
|
||||||
preload="auto"
|
preload="auto"
|
||||||
src="{{ filePath }}"
|
src="{{ filePath }}"
|
||||||
|
(load)="onImageLoad()"
|
||||||
[ngStyle]="{
|
[ngStyle]="{
|
||||||
width:
|
width:
|
||||||
openOnSecondaryChat && viewWidth >= RESPONSIVE_THRESHOLD
|
openOnSecondaryChat && viewWidth >= RESPONSIVE_THRESHOLD
|
||||||
|
|
@ -42,6 +45,7 @@
|
||||||
<video
|
<video
|
||||||
src="{{ filePath }}"
|
src="{{ filePath }}"
|
||||||
alt="video"
|
alt="video"
|
||||||
|
(load)="onImageLoad()"
|
||||||
[ngStyle]="{
|
[ngStyle]="{
|
||||||
height:
|
height:
|
||||||
openOnSecondaryChat && viewWidth >= RESPONSIVE_THRESHOLD
|
openOnSecondaryChat && viewWidth >= RESPONSIVE_THRESHOLD
|
||||||
|
|
@ -51,5 +55,17 @@
|
||||||
></video>
|
></video>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
<img
|
||||||
|
*ngIf="imgIsLoading"
|
||||||
|
src="./../../../../../assets/img/attachments/loading.svg"
|
||||||
|
alt="loading"
|
||||||
|
class="loadingImg"
|
||||||
|
[ngStyle]="{
|
||||||
|
height:
|
||||||
|
openOnSecondaryChat && viewWidth >= RESPONSIVE_THRESHOLD
|
||||||
|
? '5vw'
|
||||||
|
: '7.5vw'
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
.filesView {
|
.filesView {
|
||||||
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: 0.3s ease-in-out;
|
transition: 0.3s ease-in-out;
|
||||||
|
overflow: hidden;
|
||||||
filter: drop-shadow(3px 3px 3px rgba(0, 0, 0, 0.3));
|
filter: drop-shadow(3px 3px 3px rgba(0, 0, 0, 0.3));
|
||||||
img,
|
img,
|
||||||
video {
|
video {
|
||||||
|
|
@ -22,12 +24,29 @@
|
||||||
width: auto;
|
width: auto;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
}
|
}
|
||||||
|
.loadingImg {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
animation: spin 10s linear infinite;
|
||||||
|
}
|
||||||
&:hover {
|
&:hover {
|
||||||
filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.35));
|
filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.35));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*------------- ANIMATION -------------*/
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
0% {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*------------- RESPONSIVE -------------*/
|
/*------------- RESPONSIVE -------------*/
|
||||||
|
|
||||||
@media screen and (max-width: 510px) {
|
@media screen and (max-width: 510px) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ export class AttachmentsComponent {
|
||||||
@Input() filePath: string = '';
|
@Input() filePath: string = '';
|
||||||
@Input() openOnSecondaryChat: boolean = false;
|
@Input() openOnSecondaryChat: boolean = false;
|
||||||
@Input() viewWidth: number = 0;
|
@Input() viewWidth: number = 0;
|
||||||
loadingUrl: string = './../../../assets/img/loading.svg';
|
|
||||||
|
imgIsLoading = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public downloadFilesService: DownloadFilesService,
|
public downloadFilesService: DownloadFilesService,
|
||||||
|
|
@ -27,6 +28,10 @@ export class AttachmentsComponent {
|
||||||
|
|
||||||
RESPONSIVE_THRESHOLD = this.sharedService.RESPONSIVE_THRESHOLD;
|
RESPONSIVE_THRESHOLD = this.sharedService.RESPONSIVE_THRESHOLD;
|
||||||
|
|
||||||
|
onImageLoad() {
|
||||||
|
this.imgIsLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the file type from the given file name.
|
* Gets the file type from the given file name.
|
||||||
* @param {string} file - The name of the file.
|
* @param {string} file - The name of the file.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { User } from '../../../interface/user.interface';
|
import { User } from '../../../interface/user.interface';
|
||||||
import { Chat, ChatAnswers } from '../../../interface/chat.interface';
|
import { Chat, ChatAnswers } from '../../../interface/chat.interface';
|
||||||
import { ChatContentComponent } from '../chat-content/chat-content.component';
|
import { ChatContentComponent } from '../chat-content/chat-content.component';
|
||||||
|
|
@ -54,8 +54,6 @@ export class SingleChatComponent {
|
||||||
isMsgEditFormOpen: boolean = false;
|
isMsgEditFormOpen: boolean = false;
|
||||||
firstLoadOptionMenu: boolean = false;
|
firstLoadOptionMenu: boolean = false;
|
||||||
|
|
||||||
filePath: string | undefined = '';
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public chatService: ChatService,
|
public chatService: ChatService,
|
||||||
public channelService: ChatService,
|
public channelService: ChatService,
|
||||||
|
|
@ -156,7 +154,7 @@ export class SingleChatComponent {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (inputDate.toDateString() === currentDate.toDateString()) {
|
if (inputDate.toDateString() === currentDate.toDateString()) {
|
||||||
return this.translateService.instant('months.today');
|
return this.translateService.instant('weekdays.today');
|
||||||
} else {
|
} else {
|
||||||
return `${dayNumber} ${month}`;
|
return `${dayNumber} ${month}`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue