diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 233bc13f..4e9f4baa 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -78,6 +78,7 @@ import { PollEntryComponent } from './components/create-status/poll-editor/poll- import { ScheduledStatusesComponent } from './components/floating-column/scheduled-statuses/scheduled-statuses.component'; import { ScheduledStatusComponent } from './components/floating-column/scheduled-statuses/scheduled-status/scheduled-status.component'; import { StreamNotificationsComponent } from './components/stream/stream-notifications/stream-notifications.component'; +import { NotificationComponent } from './components/floating-column/manage-account/notifications/notification/notification.component'; const routes: Routes = [ @@ -138,7 +139,8 @@ const routes: Routes = [ PollEntryComponent, ScheduledStatusesComponent, ScheduledStatusComponent, - StreamNotificationsComponent + StreamNotificationsComponent, + NotificationComponent ], entryComponents: [ EmojiPickerComponent diff --git a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html new file mode 100644 index 00000000..cdb7389f --- /dev/null +++ b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html @@ -0,0 +1,26 @@ +
+
+
+ +
+
+ + followed + you! +
+ + +
+ + +
\ No newline at end of file diff --git a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.scss b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.scss new file mode 100644 index 00000000..0b156f04 --- /dev/null +++ b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.scss @@ -0,0 +1,85 @@ +@import "variables"; +@import "commons"; +@import "mixins"; + +.notification { + position: relative; +} + +.stream { + position: relative; + &__notification { + position: relative; + + &--icon { + position: absolute; + top: 5px; + left: 43px; + text-align: center; + width: 20px; + // outline: 1px dotted greenyellow; + } + + &--label { + margin: 0 10px 0 $avatar-column-space; + padding-top: 5px; + } + + + &:not(:last-child) { + border: solid #06070b; + border-width: 0 0 1px 0; + } + } + + &__link { + color: $status-links-color; + } + + &__status { + display: block; + // opacity: 0.65; + } +} + +.followed { + color: $boost-color; +} + +.follow-account { + padding: 5px; + height: 60px; + width: calc(100%); + overflow: hidden; + display: block; + position: relative; + text-decoration: none; + + &__avatar { + float: left; + margin: 0 0 0 10px; + width: 45px; + height: 45px; + border-radius: 2px; + } + + $acccount-info-left: 70px; + &__display-name { + position: absolute; + top: 7px; + left: $acccount-info-left; + color: whitesmoke; + } + + &:hover &__display-name { + text-decoration: underline; + } + + &__acct { + position: absolute; + top: 27px; + left: $acccount-info-left; + font-size: 13px; + color: $status-links-color; + } +} \ No newline at end of file diff --git a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.spec.ts b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.spec.ts new file mode 100644 index 00000000..6c0c172d --- /dev/null +++ b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NotificationComponent } from './notification.component'; + +xdescribe('NotificationComponent', () => { + let component: NotificationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NotificationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NotificationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.ts b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.ts new file mode 100644 index 00000000..6cb88dd1 --- /dev/null +++ b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.ts @@ -0,0 +1,49 @@ +import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; +import { faUserPlus } from "@fortawesome/free-solid-svg-icons"; + +import { NotificationWrapper } from '../notifications.component'; +import { OpenThreadEvent, ToolsService } from '../../../../../services/tools.service'; +import { Account } from '../../../../../services/models/mastodon.interfaces'; + +@Component({ + selector: 'app-notification', + templateUrl: './notification.component.html', + styleUrls: ['./notification.component.scss'] +}) +export class NotificationComponent implements OnInit { + faUserPlus = faUserPlus; + + @Input() notification: NotificationWrapper; + + @Output() browseAccountEvent = new EventEmitter(); + @Output() browseHashtagEvent = new EventEmitter(); + @Output() browseThreadEvent = new EventEmitter(); + + constructor(private readonly toolsService: ToolsService) { } + + ngOnInit() { + } + + browseAccount(accountName: string): void { + this.browseAccountEvent.next(accountName); + } + + browseHashtag(hashtag: string): void { + this.browseHashtagEvent.next(hashtag); + } + + browseThread(openThreadEvent: OpenThreadEvent): void { + this.browseThreadEvent.next(openThreadEvent); + } + + openAccount(account: Account): boolean { + let accountName = this.toolsService.getAccountFullHandle(account); + this.browseAccountEvent.next(accountName); + return false; + } + + openUrl(url: string): boolean { + window.open(url, '_blank'); + return false; + } +} diff --git a/src/app/components/floating-column/manage-account/notifications/notifications.component.html b/src/app/components/floating-column/manage-account/notifications/notifications.component.html index 04484676..53a6fdc5 100644 --- a/src/app/components/floating-column/manage-account/notifications/notifications.component.html +++ b/src/app/components/floating-column/manage-account/notifications/notifications.component.html @@ -1,50 +1,6 @@
- - -
-
- -
-
- followed - you! -
- - -
- - +
diff --git a/src/app/components/floating-column/manage-account/notifications/notifications.component.scss b/src/app/components/floating-column/manage-account/notifications/notifications.component.scss index 177fdae3..2448f89e 100644 --- a/src/app/components/floating-column/manage-account/notifications/notifications.component.scss +++ b/src/app/components/floating-column/manage-account/notifications/notifications.component.scss @@ -13,78 +13,78 @@ color: rgb(255, 113, 113); } - &__notification { - position: relative; + // &__notification { + // position: relative; - &--icon { - position: absolute; - top: 5px; - left: 43px; - text-align: center; - width: 20px; - // outline: 1px dotted greenyellow; - } + // &--icon { + // position: absolute; + // top: 5px; + // left: 43px; + // text-align: center; + // width: 20px; + // // outline: 1px dotted greenyellow; + // } - &--label { - margin: 0 10px 0 $avatar-column-space; - padding-top: 5px; - } + // &--label { + // margin: 0 10px 0 $avatar-column-space; + // padding-top: 5px; + // } - &:not(:last-child) { - border: solid #06070b; - border-width: 0 0 1px 0; - } - } + // &:not(:last-child) { + // border: solid #06070b; + // border-width: 0 0 1px 0; + // } + // } - &__link { - color: $status-links-color; - } + // &__link { + // color: $status-links-color; + // } - &__status { - display: block; - // opacity: 0.65; - } + // &__status { + // display: block; + // // opacity: 0.65; + // } } -.followed { - color: $boost-color; -} +// .followed { +// color: $boost-color; +// } -.follow-account { - padding: 5px; - height: 60px; - width: calc(100%); - overflow: hidden; - display: block; - position: relative; - text-decoration: none; +// .follow-account { +// padding: 5px; +// height: 60px; +// width: calc(100%); +// overflow: hidden; +// display: block; +// position: relative; +// text-decoration: none; - &__avatar { - float: left; - margin: 0 0 0 10px; - width: 45px; - height: 45px; - border-radius: 2px; - } +// &__avatar { +// float: left; +// margin: 0 0 0 10px; +// width: 45px; +// height: 45px; +// border-radius: 2px; +// } - $acccount-info-left: 70px; - &__display-name { - position: absolute; - top: 7px; - left: $acccount-info-left; - color: whitesmoke; - } +// $acccount-info-left: 70px; +// &__display-name { +// position: absolute; +// top: 7px; +// left: $acccount-info-left; +// color: whitesmoke; +// } - &:hover &__display-name { - text-decoration: underline; - } +// &:hover &__display-name { +// text-decoration: underline; +// } - &__acct { - position: absolute; - top: 27px; - left: $acccount-info-left; - font-size: 13px; - color: $status-links-color; - } -} \ No newline at end of file +// &__acct { +// position: absolute; +// top: 27px; +// left: $acccount-info-left; +// font-size: 13px; +// color: $status-links-color; +// } +// } \ No newline at end of file diff --git a/src/app/components/floating-column/manage-account/notifications/notifications.component.ts b/src/app/components/floating-column/manage-account/notifications/notifications.component.ts index 0a79b13e..01fbf172 100644 --- a/src/app/components/floating-column/manage-account/notifications/notifications.component.ts +++ b/src/app/components/floating-column/manage-account/notifications/notifications.component.ts @@ -1,7 +1,5 @@ import { Component, OnInit, Input, ViewChild, ElementRef, OnDestroy, Output, EventEmitter } from '@angular/core'; import { Subscription } from 'rxjs'; -import { faStar, faUserPlus, faRetweet } from "@fortawesome/free-solid-svg-icons"; -import { faStar as faStar2 } from "@fortawesome/free-regular-svg-icons"; import { AccountWrapper } from '../../../../models/account.models'; import { UserNotificationService, UserNotification } from '../../../../services/user-notification.service'; @@ -18,10 +16,6 @@ import { OpenThreadEvent, ToolsService } from '../../../../services/tools.servic styleUrls: ['./notifications.component.scss'] }) export class NotificationsComponent implements OnInit, OnDestroy { - faUserPlus = faUserPlus; - // faStar = faStar; - // faRetweet = faRetweet; - notifications: NotificationWrapper[] = []; isLoading = false; @@ -45,8 +39,7 @@ export class NotificationsComponent implements OnInit, OnDestroy { private userNotificationServiceSub: Subscription; private lastId: string; - constructor( - private readonly toolsService: ToolsService, + constructor( private readonly notificationService: NotificationService, private readonly userNotificationService: UserNotificationService, private readonly mastodonService: MastodonWrapperService) { } @@ -125,17 +118,6 @@ export class NotificationsComponent implements OnInit, OnDestroy { this.isLoading = false; }); } - - openAccount(account: Account): boolean { - let accountName = this.toolsService.getAccountFullHandle(account); - this.browseAccountEvent.next(accountName); - return false; - } - - openUrl(url: string): boolean { - window.open(url, '_blank'); - return false; - } browseAccount(accountName: string): void { this.browseAccountEvent.next(accountName); @@ -150,7 +132,7 @@ export class NotificationsComponent implements OnInit, OnDestroy { } } -class NotificationWrapper { +export class NotificationWrapper { constructor(notification: Notification, provider: AccountInfo) { this.type = notification.type; switch(this.type){