summaryrefslogtreecommitdiffstats
path: root/ui/src/components/user.tsx
diff options
context:
space:
mode:
authorDessalines <happydooby@gmail.com>2019-04-15 16:12:06 -0700
committerDessalines <happydooby@gmail.com>2019-04-15 16:12:06 -0700
commit5351e379d5e89a50aaa82f01f414191981cd9ca6 (patch)
treeb407f0b6ed9be27682e3767271e34933c947cb2a /ui/src/components/user.tsx
parent1bf0dfde20e9b526017fa9f234a3d267e9259a51 (diff)
Commiting before I lose everything. I'll do this properly in a merge
Diffstat (limited to 'ui/src/components/user.tsx')
-rw-r--r--ui/src/components/user.tsx19
1 files changed, 11 insertions, 8 deletions
diff --git a/ui/src/components/user.tsx b/ui/src/components/user.tsx
index 5dd3ac6a..b899686a 100644
--- a/ui/src/components/user.tsx
+++ b/ui/src/components/user.tsx
@@ -125,24 +125,27 @@ export class User extends Component<any, UserState> {
}
overview() {
- let combined: Array<any> = [];
- combined.push(...this.state.comments);
- combined.push(...this.state.posts);
+ let combined: Array<{type_: string, data: Comment | Post}> = [];
+ let comments = this.state.comments.map(e => {return {type_: "comments", data: e}});
+ let posts = this.state.posts.map(e => {return {type_: "posts", data: e}});
+
+ combined.push(...comments);
+ combined.push(...posts);
// Sort it
if (this.state.sort == SortType.New) {
- combined.sort((a, b) => b.published.localeCompare(a.published));
+ combined.sort((a, b) => b.data.published.localeCompare(a.data.published));
} else {
- combined.sort((a, b) => b.score - a.score);
+ combined.sort((a, b) => b.data.score - a.data.score);
}
return (
<div>
{combined.map(i =>
<div>
- {i.community_id
- ? <PostListing post={i} showCommunity viewOnly />
- : <CommentNodes nodes={[{comment: i}]} noIndent viewOnly />
+ {i.type_ == "posts"
+ ? <PostListing post={i.data as Post} showCommunity viewOnly />
+ : <CommentNodes nodes={[{comment: i.data as Comment}]} noIndent viewOnly />
}
</div>
)