diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 854773db..4bcdf753 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -27,7 +27,7 @@ import { FloatingColumnComponent } from './components/floating-column/floating-c
import { ColumnsEditorComponent } from './components/floating-column/columns-editor/columns-editor.component';
import { MessageEditorComponent } from './components/floating-column/message-editor/message-editor.component';
import { StreamsState } from "./states/streams.state";
-import { TootComponent } from "./components/stream/toot/toot.component";
+import { StatusComponent } from "./components/stream/status/status.component";
const routes: Routes = [
{ path: "", redirectTo: "home", pathMatch: "full" },
@@ -43,7 +43,7 @@ const routes: Routes = [
StreamsMainDisplayComponent,
StreamComponent,
StreamsSelectionFooterComponent,
- TootComponent,
+ StatusComponent,
RegisterNewAccountComponent,
AccountIconComponent,
FloatingColumnComponent,
diff --git a/src/app/components/stream/status/status.component.html b/src/app/components/stream/status/status.component.html
new file mode 100644
index 00000000..024746ea
--- /dev/null
+++ b/src/app/components/stream/status/status.component.html
@@ -0,0 +1,5 @@
+
+
![]({{ status.account.avatar }})
+
@
+
+
\ No newline at end of file
diff --git a/src/app/components/stream/toot/toot.component.scss b/src/app/components/stream/status/status.component.scss
similarity index 100%
rename from src/app/components/stream/toot/toot.component.scss
rename to src/app/components/stream/status/status.component.scss
diff --git a/src/app/components/stream/toot/toot.component.spec.ts b/src/app/components/stream/status/status.component.spec.ts
similarity index 57%
rename from src/app/components/stream/toot/toot.component.spec.ts
rename to src/app/components/stream/status/status.component.spec.ts
index 856e2bb2..ddf4f677 100644
--- a/src/app/components/stream/toot/toot.component.spec.ts
+++ b/src/app/components/stream/status/status.component.spec.ts
@@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { TootComponent } from './toot.component';
+import { StatusComponent } from './status.component';
-describe('TootComponent', () => {
- let component: TootComponent;
- let fixture: ComponentFixture;
+describe('StatusComponent', () => {
+ let component: StatusComponent;
+ let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ TootComponent ]
+ declarations: [ StatusComponent ]
})
.compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(TootComponent);
+ fixture = TestBed.createComponent(StatusComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/components/stream/status/status.component.ts b/src/app/components/stream/status/status.component.ts
new file mode 100644
index 00000000..3a4c9304
--- /dev/null
+++ b/src/app/components/stream/status/status.component.ts
@@ -0,0 +1,18 @@
+import { Component, OnInit, Input } from "@angular/core";
+import { Status } from "../../../services/models/mastodon.interfaces";
+
+
+@Component({
+ selector: "app-status",
+ templateUrl: "./status.component.html",
+ styleUrls: ["./status.component.scss"]
+})
+export class StatusComponent implements OnInit {
+ @Input() status: Status;
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/src/app/components/stream/stream.component.html b/src/app/components/stream/stream.component.html
index 44627349..600a0954 100644
--- a/src/app/components/stream/stream.component.html
+++ b/src/app/components/stream/stream.component.html
@@ -3,8 +3,8 @@
{{ streamElement.name.toUpperCase() }}
diff --git a/src/app/components/stream/stream.component.ts b/src/app/components/stream/stream.component.ts
index 7bcc1d1f..864efa5e 100644
--- a/src/app/components/stream/stream.component.ts
+++ b/src/app/components/stream/stream.component.ts
@@ -14,12 +14,12 @@ import { Status } from "../../services/models/mastodon.interfaces";
styleUrls: ["./stream.component.scss"]
})
export class StreamComponent implements OnInit {
+ private _streamElement: StreamElement;
private apiRoutes = new ApiRoutes();
private account: AccountInfo;
private websocketStreaming: StreamingWrapper;
- private type: StreamTypeEnum;
- statuses: TootWrapper[] = [];
- private _streamElement: StreamElement;
+
+ statuses: Status[] = [];
@Input()
set streamElement(streamElement: StreamElement) {
@@ -29,7 +29,7 @@ export class StreamComponent implements OnInit {
const user = splitedUserName[0];
const instance = splitedUserName[1];
this.account = this.getRegisteredAccounts().find(x => x.username == user && x.instance == instance);
- this.type = streamElement.type;
+ // this.type = streamElement.type;
this.retrieveToots(); //TODO change this for WebSockets
this.launchWebsocket();
@@ -39,15 +39,12 @@ export class StreamComponent implements OnInit {
return this._streamElement;
}
- toots: TootWrapper[] = [];
-
constructor(
private readonly store: Store,
private readonly streamingService: StreamingService,
private readonly httpClient: HttpClient) {
}
-
ngOnInit() {
}
@@ -56,7 +53,7 @@ export class StreamComponent implements OnInit {
}
private getTimelineRoute(): string {
- switch (this.type) {
+ switch (this._streamElement.type) {
case StreamTypeEnum.personnal:
return this.apiRoutes.getHomeTimeline;
case StreamTypeEnum.local:
@@ -78,11 +75,7 @@ export class StreamComponent implements OnInit {
const headers = new HttpHeaders({ 'Authorization': `Bearer ${this.account.token.access_token}` });
this.httpClient.get(route, { headers: headers }).toPromise()
.then((results: Status[]) => {
- var statuses = results.map((status: Status) => {
- return new TootWrapper(status);
- });
-
- for (const s of statuses) {
+ for (const s of results) {
this.statuses.push(s);
}
});
@@ -91,7 +84,7 @@ export class StreamComponent implements OnInit {
private launchWebsocket(): void {
//Web socket
let streamRequest: string;
- switch (this.type) {
+ switch (this._streamElement.type) {
case StreamTypeEnum.global:
streamRequest = 'public';
break;
@@ -107,25 +100,9 @@ export class StreamComponent implements OnInit {
this.websocketStreaming.statusUpdateSubjet.subscribe((update: StatusUpdate) => {
if (update) {
if (update.type === EventEnum.update) {
- this.statuses.unshift(new TootWrapper(update.status));
+ this.statuses.unshift(update.status);
}
}
});
-
}
-
-}
-
-export class TootWrapper {
- constructor(status: Status) {
- this.account = new AccountWrapper();
- this.account.username = status.account.username;
- this.account.display_name = status.account.display_name;
- this.account.avatar = status.account.avatar;
-
- this.content = status.content;
- }
-
- account: AccountWrapper; //TODO change to Account
- content: string;
-}
+}
\ No newline at end of file
diff --git a/src/app/components/stream/toot/toot.component.html b/src/app/components/stream/toot/toot.component.html
deleted file mode 100644
index 7d6f3b47..00000000
--- a/src/app/components/stream/toot/toot.component.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
![]({{ toot.account.avatar }})
-
@
-
-
\ No newline at end of file
diff --git a/src/app/components/stream/toot/toot.component.ts b/src/app/components/stream/toot/toot.component.ts
deleted file mode 100644
index 691d61fa..00000000
--- a/src/app/components/stream/toot/toot.component.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Component, OnInit, Input } from "@angular/core";
-import { TootWrapper } from "../stream.component";
-
-@Component({
- selector: "app-toot",
- templateUrl: "./toot.component.html",
- styleUrls: ["./toot.component.scss"]
-})
-export class TootComponent implements OnInit {
- @Input() toot: TootWrapper;
-
- constructor() { }
-
- ngOnInit() {
- }
-
-}