Sengi-Windows-MacOS-Linux/src/app/components/floating-column/floating-column.component.ts

86 lines
2.7 KiB
TypeScript
Raw Normal View History

2018-09-10 03:55:16 +02:00
import { Component, OnInit } from '@angular/core';
2019-03-02 08:01:53 +01:00
import { faTimes } from "@fortawesome/free-solid-svg-icons";
2018-09-22 06:22:51 +02:00
import { NavigationService, LeftPanelType } from '../../services/navigation.service';
2018-09-11 07:54:23 +02:00
import { AccountWrapper } from '../../models/account.models';
import { OpenThreadEvent } from '../../services/tools.service';
2018-09-10 03:55:16 +02:00
@Component({
2018-09-22 06:22:51 +02:00
selector: 'app-floating-column',
templateUrl: './floating-column.component.html',
styleUrls: ['./floating-column.component.scss']
2018-09-10 03:55:16 +02:00
})
export class FloatingColumnComponent implements OnInit {
2019-03-02 08:01:53 +01:00
faTimes = faTimes;
2018-11-08 05:31:47 +01:00
overlayActive: boolean;
2018-11-08 05:53:33 +01:00
overlayAccountToBrowse: string;
overlayHashtagToBrowse: string;
overlayThreadToBrowse: OpenThreadEvent;
2018-11-08 05:53:33 +01:00
2018-09-22 06:22:51 +02:00
userAccountUsed: AccountWrapper;
2018-09-10 03:55:16 +02:00
2018-09-22 06:22:51 +02:00
openPanel: string;
2018-09-10 03:55:16 +02:00
2018-09-22 06:22:51 +02:00
constructor(private readonly navigationService: NavigationService) { }
ngOnInit() {
this.navigationService.activatedPanelSubject.subscribe((type: LeftPanelType) => {
switch (type) {
case LeftPanelType.Closed:
this.openPanel = '';
break;
case LeftPanelType.AddNewAccount:
this.openPanel = 'addNewAccount';
break;
case LeftPanelType.CreateNewStatus:
this.openPanel = 'createNewStatus';
break;
case LeftPanelType.ManageAccount:
this.userAccountUsed = this.navigationService.getAccountToManage();
this.openPanel = 'manageAccount';
break;
case LeftPanelType.Search:
this.openPanel = 'search';
break;
case LeftPanelType.Settings:
this.openPanel = 'settings';
break;
default:
this.openPanel = '';
}
});
}
closePanel(): boolean {
this.navigationService.closePanel();
return false;
}
2018-09-10 03:55:16 +02:00
2018-11-08 05:53:33 +01:00
browseAccount(account: string): void {
this.overlayAccountToBrowse = account;
this.overlayHashtagToBrowse = null;
this.overlayThreadToBrowse = null;
2018-11-08 05:53:33 +01:00
this.overlayActive = true;
}
browseHashtag(hashtag: string): void {
this.overlayAccountToBrowse = null;
this.overlayHashtagToBrowse = hashtag;
this.overlayThreadToBrowse = null;
2018-11-08 05:53:33 +01:00
this.overlayActive = true;
}
browseThread(openThreadEvent: OpenThreadEvent): void {
this.overlayAccountToBrowse = null;
this.overlayHashtagToBrowse = null;
this.overlayThreadToBrowse = openThreadEvent;
this.overlayActive = true;
2018-11-08 05:53:33 +01:00
}
2018-11-08 05:31:47 +01:00
closeOverlay(): boolean {
this.overlayActive = false;
return false;
}
2018-09-10 03:55:16 +02:00
}