This commit is contained in:
Nicolas Constant 2019-02-23 22:40:22 -05:00
parent 25316f6546
commit 95bb5b1307
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
8 changed files with 86 additions and 49 deletions

View File

@ -24,16 +24,16 @@ export class ManageAccountComponent implements OnInit {
ngOnInit() {
const instance = this.account.info.instance;
this.availableStreams.length = 0;
this.availableStreams.push(new StreamElement(StreamTypeEnum.global, 'Federated Timeline', this.account.info.id, null, null, `federate@${instance}`));
this.availableStreams.push(new StreamElement(StreamTypeEnum.local, 'Local Timeline', this.account.info.id, null, null, `local@${instance}`));
this.availableStreams.push(new StreamElement(StreamTypeEnum.personnal, 'Home', this.account.info.id, null, null, `home@${instance}`));
this.availableStreams.push(new StreamElement(StreamTypeEnum.global, 'Federated Timeline', this.account.info.id, null, null, instance));
this.availableStreams.push(new StreamElement(StreamTypeEnum.local, 'Local Timeline', this.account.info.id, null, null, instance));
this.availableStreams.push(new StreamElement(StreamTypeEnum.personnal, 'Home', this.account.info.id, null, null, instance));
}
addStream(stream: StreamElement): boolean {
if (stream) {
this.store.dispatch([new AddStream(stream)]).toPromise()
.then(() => {
this.notificationService.notify(`${stream.displayableFullName} added`, false);
this.notificationService.notify(`stream added`, false);
});
}
return false;

View File

@ -50,7 +50,7 @@ export class HashtagComponent implements OnInit {
event.stopPropagation();
const hashtag = this.hashtagElement.tag;
const newStream = new StreamElement(StreamTypeEnum.tag, `${hashtag}`, this.lastUsedAccount.id, hashtag, null, this.hashtagElement.displayableFullName);
const newStream = new StreamElement(StreamTypeEnum.tag, `${hashtag}`, this.lastUsedAccount.id, hashtag, null, this.lastUsedAccount.instance);
this.store.dispatch([new AddStream(newStream)]);
return false;

View File

@ -156,7 +156,7 @@ export class StreamOverlayComponent implements OnInit, OnDestroy {
}
const selectedAccount = this.toolsService.getSelectedAccounts()[0];
const hashTagElement = new StreamElement(StreamTypeEnum.tag, hashtag, selectedAccount.id, hashtag, null, `#${hashtag}@${selectedAccount.instance}`);
const hashTagElement = new StreamElement(StreamTypeEnum.tag, hashtag, selectedAccount.id, hashtag, null, selectedAccount.instance);
const newElement = new OverlayBrowsing(hashTagElement, null, null);
this.loadElement(newElement);
// this.canGoForward = false;

View File

@ -1,25 +1,27 @@
<div class="stream-column">
<app-stream-overlay class="stream-overlay" *ngIf="overlayActive" (closeOverlay)="closeOverlay()"
[browseAccountData]="overlayAccountToBrowse"
[browseHashtagData]="overlayHashtagToBrowse"
[browseAccountData]="overlayAccountToBrowse" [browseHashtagData]="overlayHashtagToBrowse"
[browseThreadData]="overlayThreadToBrowse"></app-stream-overlay>
<div class="stream-column__stream-header">
<a class="stream-column__open-menu" href title="edit column" (click)="openEditionMenu()">
<fa-icon class="stream-column__open-menu--icon" [icon]="menuFaIcon"></fa-icon>
</a>
<a class="stream-column__stream-selector" href title="return to top" (click)="goToTop()">
<a class="stream-column__stream-selector" href title="return to top" (click)="goToTop()">
<fa-icon class="stream-column__stream-selector--icon" [icon]="columnFaIcon"></fa-icon>
<h1 class="stream-column__stream-selector--title">{{ streamElement.name.toUpperCase() }}</h1>
<span class="stream-column__stream-selector--subtitle"
*ngIf="streamElement.instance">{{ streamElement.instance.toLowerCase() }}</span>
</a>
<a class="stream-column__open-menu" href title="edit column" (click)="openEditionMenu()">
<fa-icon class="stream-column__open-menu--icon" [icon]="menuFaIcon"></fa-icon>
</a>
</div>
<app-stream-edition class="stream-edition" *ngIf="editionPanelIsOpen"
[streamElement]="streamElement"></app-stream-edition>
<app-stream-statuses class="stream-statuses" [streamElement]="streamElement" [goToTop]="goToTopSubject.asObservable()"
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)" (browseThreadEvent)="browseThread($event)"></app-stream-statuses>
<app-stream-edition class="stream-edition" *ngIf="editionPanelIsOpen" [streamElement]="streamElement">
</app-stream-edition>
<app-stream-statuses class="stream-statuses" [streamElement]="streamElement"
[goToTop]="goToTopSubject.asObservable()" (browseAccountEvent)="browseAccount($event)"
(browseHashtagEvent)="browseHashtag($event)" (browseThreadEvent)="browseThread($event)"></app-stream-statuses>
<!-- <div class="stream-toots flexcroll" #statusstream (scroll)="onScroll()">
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses">
<app-status [statusWrapper]="statusWrapper" (browseAccount)="browseAccount($event)" (browseHashtag)="browseHashtag($event)"></app-status>

View File

@ -17,17 +17,20 @@ $stream-header-height: 40px;
border-bottom: 1px solid #222736;
}
&__open-menu {
float: right;
display: block;
width: $stream-header-height - 10px;
height: $stream-header-height - 10px;
margin: 5px;
position: absolute;
top: 5px;
right: 5px;
&:hover &--icon {
color: darken(whitesmoke, 30);
}
&--icon {
color: whitesmoke; // float: left;
position: relative;
// position: relative;
position: absolute;
top: 4px;
left: 8px;
}
@ -37,20 +40,30 @@ $stream-header-height: 40px;
width: calc(100%);
height: $stream-header-height;
background-color: $column-header-background-color;
text-decoration: none; // &:hover {
// }
text-decoration: none;
color: whitesmoke;
position: relative;
&--icon {
color: whitesmoke;
float: left;
position: relative;
left: 11px;
top: 9px;
}
&--title {
color: whitesmoke;
font-size: 0.8em;
font-weight: normal; // margin: 0 0 0 25px;
padding: 14px 0 0 35px;
font-weight: normal;
position: absolute;
top: 9px;
left: 35px;
}
&--subtitle {
color: $font-link-primary-hover;
font-size: 0.7em;
font-weight: normal;
font-style: italic;
position: absolute;
top: 21px;
left: 35px;;
}
}
}

View File

@ -1,5 +1,5 @@
<div class="streams-selection-footer">
<a class="stream-selection" *ngFor="let str of streams; let i=index" href (click)="onColumnSelection(i)" title="open {{str.displayableFullName}}">
<a class="stream-selection" *ngFor="let str of streams; let i=index" href (click)="onColumnSelection(i)" title="open {{getDisplayableName(str)}}">
<span class="stream-selection__column-reprensentation"></span>
</a>
</div>

View File

@ -1,32 +1,54 @@
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { StreamElement } from '../../states/streams.state';
import { StreamElement, StreamTypeEnum } from '../../states/streams.state';
import { Store } from '@ngxs/store';
import { NavigationService } from '../../services/navigation.service';
@Component({
selector: 'app-streams-selection-footer',
templateUrl: './streams-selection-footer.component.html',
styleUrls: ['./streams-selection-footer.component.scss']
selector: 'app-streams-selection-footer',
templateUrl: './streams-selection-footer.component.html',
styleUrls: ['./streams-selection-footer.component.scss']
})
export class StreamsSelectionFooterComponent implements OnInit {
streams: StreamElement[] = [];
private streams$: Observable<StreamElement[]>;
streams: StreamElement[] = [];
private streams$: Observable<StreamElement[]>;
constructor(
private readonly navigationService: NavigationService,
private readonly store: Store) {
this.streams$ = this.store.select(state => state.streamsstatemodel.streams);
}
constructor(
private readonly navigationService: NavigationService,
private readonly store: Store) {
this.streams$ = this.store.select(state => state.streamsstatemodel.streams);
}
ngOnInit() {
this.streams$.subscribe((streams: StreamElement[]) => {
this.streams = streams;
});
}
ngOnInit() {
this.streams$.subscribe((streams: StreamElement[]) => {
this.streams = streams;
});
}
onColumnSelection(index: number): boolean {
this.navigationService.columnSelected(index);
return false;
}
onColumnSelection(index: number): boolean {
this.navigationService.columnSelected(index);
return false;
}
getDisplayableName(stream: StreamElement): string {
let prefix = '';
switch (stream.type) {
case StreamTypeEnum.local:
prefix = "local";
break;
case StreamTypeEnum.personnal:
prefix = "home";
break;
case StreamTypeEnum.global:
prefix = "federated";
break;
case StreamTypeEnum.tag:
prefix = `#${stream.tag}`;
break;
case StreamTypeEnum.list:
prefix = `${stream.list}`;
break;
}
return `${prefix}@${stream.instance}`;
}
}

View File

@ -98,7 +98,7 @@ export class StreamElement {
public accountId: string,
public tag: string,
public list: string,
public displayableFullName: string) {
public instance: string) {
this.id = `${type}-${name}-${accountId}`;
}
}