From 628cb94505213fa0cc304d07182f6f7280699a39 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Sat, 3 Nov 2018 00:57:39 -0400 Subject: [PATCH] add status display in search --- .../floating-column/search/search.component.html | 12 ++++++++---- .../floating-column/search/search.component.scss | 7 +++++++ .../floating-column/search/search.component.ts | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/app/components/floating-column/search/search.component.html b/src/app/components/floating-column/search/search.component.html index dd9e4c78..74f55102 100644 --- a/src/app/components/floating-column/search/search.component.html +++ b/src/app/components/floating-column/search/search.component.html @@ -19,14 +19,18 @@ -
-

Statuses

-
-

Hashtags

#{{ hashtag }} +
+ +
+

Statuses

+ +
+ +
\ No newline at end of file diff --git a/src/app/components/floating-column/search/search.component.scss b/src/app/components/floating-column/search/search.component.scss index 5bf945d9..fdb43481 100644 --- a/src/app/components/floating-column/search/search.component.scss +++ b/src/app/components/floating-column/search/search.component.scss @@ -59,6 +59,13 @@ $button-background-color-hover: lighten($color-primary, 20); border-bottom: 1px solid $separator-color; } } + + &__status { + border-top: 1px solid $separator-color; + &:last-of-type { + border-bottom: 1px solid $separator-color; + } + } } .account { diff --git a/src/app/components/floating-column/search/search.component.ts b/src/app/components/floating-column/search/search.component.ts index ac29b136..efc55e38 100644 --- a/src/app/components/floating-column/search/search.component.ts +++ b/src/app/components/floating-column/search/search.component.ts @@ -4,6 +4,8 @@ import { Store } from '@ngxs/store'; import { MastodonService } from '../../../services/mastodon.service'; import { AccountInfo } from '../../../states/accounts.state'; import { Results, Account, Status } from '../../../services/models/mastodon.interfaces'; +import { ToolsService } from '../../../services/tools.service'; +import { StatusWrapper } from '../../stream/stream.component'; @Component({ @@ -15,13 +17,14 @@ export class SearchComponent implements OnInit { @Input() searchHandle: string; accounts: Account[] = []; - statuses: Status[] = []; + statuses: StatusWrapper[] = []; hashtags: string[] = []; isLoading: boolean; constructor( private readonly store: Store, + private readonly toolsService: ToolsService, private readonly mastodonService: MastodonService) { } ngOnInit() { @@ -46,8 +49,7 @@ export class SearchComponent implements OnInit { console.warn(`search: ${data}`); - const enabledAccounts = this.getRegisteredAccounts().filter(x => x.isSelected); - + const enabledAccounts = this.toolsService.getSelectedAccounts(); //First candid implementation if (enabledAccounts.length > 0) { const candid_oneAccount = enabledAccounts[0]; @@ -57,6 +59,13 @@ export class SearchComponent implements OnInit { console.warn(results); this.accounts = results.accounts.slice(0, 5); this.hashtags = results.hashtags; + + for (let status of results.statuses) { + const statusWrapper = new StatusWrapper(status, candid_oneAccount); + this.statuses.push(statusWrapper); + } + + } }) .catch((err) => console.error(err))