From b28e4e5e080646ec67363cb0a16c9bd97ccffb35 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Feb 2019 10:16:04 +0100 Subject: Add user notification animation --- client/src/app/shared/misc/loader.component.html | 9 ++++- client/src/app/shared/misc/loader.component.scss | 45 ++++++++++++++++++++++ client/src/app/shared/misc/loader.component.ts | 3 +- .../app/shared/misc/small-loader.component.html | 3 ++ .../src/app/shared/misc/small-loader.component.ts | 11 ++++++ client/src/app/shared/shared.module.ts | 3 ++ .../shared/users/user-notifications.component.ts | 6 ++- 7 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 client/src/app/shared/misc/loader.component.scss create mode 100644 client/src/app/shared/misc/small-loader.component.html create mode 100644 client/src/app/shared/misc/small-loader.component.ts (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/misc/loader.component.html b/client/src/app/shared/misc/loader.component.html index 38d06950e..b8b7ad343 100644 --- a/client/src/app/shared/misc/loader.component.html +++ b/client/src/app/shared/misc/loader.component.html @@ -1,3 +1,8 @@ -
-
+
+
+
+
+
+
+
diff --git a/client/src/app/shared/misc/loader.component.scss b/client/src/app/shared/misc/loader.component.scss new file mode 100644 index 000000000..ddb64f07a --- /dev/null +++ b/client/src/app/shared/misc/loader.component.scss @@ -0,0 +1,45 @@ +@import '_variables'; +@import '_mixins'; + +// Thanks to https://loading.io/css/ (CC0 License) + +.lds-ring { + display: inline-block; + position: relative; + width: 50px; + height: 50px; +} + +.lds-ring div { + box-sizing: border-box; + display: block; + position: absolute; + width: 44px; + height: 44px; + margin: 6px; + border: 4px solid; + border-radius: 50%; + animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + border-color: #999999 transparent transparent transparent; +} + +.lds-ring div:nth-child(1) { + animation-delay: -0.45s; +} + +.lds-ring div:nth-child(2) { + animation-delay: -0.3s; +} + +.lds-ring div:nth-child(3) { + animation-delay: -0.15s; +} + +@keyframes lds-ring { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/client/src/app/shared/misc/loader.component.ts b/client/src/app/shared/misc/loader.component.ts index f37d70c85..e3b1eea3a 100644 --- a/client/src/app/shared/misc/loader.component.ts +++ b/client/src/app/shared/misc/loader.component.ts @@ -2,10 +2,9 @@ import { Component, Input } from '@angular/core' @Component({ selector: 'my-loader', - styleUrls: [ ], + styleUrls: [ './loader.component.scss' ], templateUrl: './loader.component.html' }) - export class LoaderComponent { @Input() loading: boolean } diff --git a/client/src/app/shared/misc/small-loader.component.html b/client/src/app/shared/misc/small-loader.component.html new file mode 100644 index 000000000..5a7cea738 --- /dev/null +++ b/client/src/app/shared/misc/small-loader.component.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/client/src/app/shared/misc/small-loader.component.ts b/client/src/app/shared/misc/small-loader.component.ts new file mode 100644 index 000000000..191877f14 --- /dev/null +++ b/client/src/app/shared/misc/small-loader.component.ts @@ -0,0 +1,11 @@ +import { Component, Input } from '@angular/core' + +@Component({ + selector: 'my-small-loader', + styleUrls: [ ], + templateUrl: './small-loader.component.html' +}) + +export class SmallLoaderComponent { + @Input() loading: boolean +} diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index 6f8625c7e..1c4e3df1a 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts @@ -69,6 +69,7 @@ import { InstanceService } from '@app/shared/instance/instance.service' import { HtmlRendererService, LinkifierService, MarkdownService } from '@app/shared/renderer' import { ConfirmComponent } from '@app/shared/confirm/confirm.component' import { GlobalIconComponent } from '@app/shared/icons/global-icon.component' +import { SmallLoaderComponent } from '@app/shared/misc/small-loader.component' @NgModule({ imports: [ @@ -90,6 +91,7 @@ import { GlobalIconComponent } from '@app/shared/icons/global-icon.component' declarations: [ LoaderComponent, + SmallLoaderComponent, VideoThumbnailComponent, VideoMiniatureComponent, FeedComponent, @@ -135,6 +137,7 @@ import { GlobalIconComponent } from '@app/shared/icons/global-icon.component' KeysPipe, LoaderComponent, + SmallLoaderComponent, VideoThumbnailComponent, VideoMiniatureComponent, FeedComponent, diff --git a/client/src/app/shared/users/user-notifications.component.ts b/client/src/app/shared/users/user-notifications.component.ts index b5f9fd399..ce43b604a 100644 --- a/client/src/app/shared/users/user-notifications.component.ts +++ b/client/src/app/shared/users/user-notifications.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core' +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' import { UserNotificationService } from '@app/shared/users/user-notification.service' import { UserNotificationType } from '../../../../../shared' import { ComponentPagination, hasMoreItems } from '@app/shared/rest/component-pagination.model' @@ -15,6 +15,8 @@ export class UserNotificationsComponent implements OnInit { @Input() infiniteScroll = true @Input() itemsPerPage = 20 + @Output() notificationsLoaded = new EventEmitter() + notifications: UserNotification[] = [] // So we can access it in the template @@ -43,6 +45,8 @@ export class UserNotificationsComponent implements OnInit { result => { this.notifications = this.notifications.concat(result.data) this.componentPagination.totalItems = result.total + + this.notificationsLoaded.emit() }, err => this.notifier.error(err.message) -- cgit v1.2.3