From: Dessalines Date: Tue, 9 Apr 2019 21:21:19 +0000 (-0700) Subject: Styling, sidebar message. X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%7B%7D/%7BpictshareAvatarThumbnail%28?a=commitdiff_plain;h=4bfb32c6658d3547ea7728fcf0927b187685658e;p=lemmy.git Styling, sidebar message. --- diff --git a/server/src/websocket_server/server.rs b/server/src/websocket_server/server.rs index a946c9e0..42124d2d 100644 --- a/server/src/websocket_server/server.rs +++ b/server/src/websocket_server/server.rs @@ -391,25 +391,25 @@ impl Handler for ChatServer { let json: Value = serde_json::from_str(&msg.msg) .expect("Couldn't parse message"); - let data: &Value = &json["data"]; + let data = &json["data"].to_string(); let op = &json["op"].as_str().unwrap(); let user_operation: UserOperation = UserOperation::from_str(&op).unwrap(); let res: String = match user_operation { UserOperation::Login => { - let login: Login = serde_json::from_str(&data.to_string()).unwrap(); + let login: Login = serde_json::from_str(data).unwrap(); login.perform(self, msg.id) }, UserOperation::Register => { - let register: Register = serde_json::from_str(&data.to_string()).unwrap(); + let register: Register = serde_json::from_str(data).unwrap(); register.perform(self, msg.id) }, UserOperation::CreateCommunity => { - let create_community: CreateCommunity = serde_json::from_str(&data.to_string()).unwrap(); + let create_community: CreateCommunity = serde_json::from_str(data).unwrap(); create_community.perform(self, msg.id) }, UserOperation::ListCommunities => { - let list_communities: ListCommunities = serde_json::from_str(&data.to_string()).unwrap(); + let list_communities: ListCommunities = serde_json::from_str(data).unwrap(); list_communities.perform(self, msg.id) }, UserOperation::ListCategories => { @@ -417,55 +417,55 @@ impl Handler for ChatServer { list_categories.perform(self, msg.id) }, UserOperation::CreatePost => { - let create_post: CreatePost = serde_json::from_str(&data.to_string()).unwrap(); + let create_post: CreatePost = serde_json::from_str(data).unwrap(); create_post.perform(self, msg.id) }, UserOperation::GetPost => { - let get_post: GetPost = serde_json::from_str(&data.to_string()).unwrap(); + let get_post: GetPost = serde_json::from_str(data).unwrap(); get_post.perform(self, msg.id) }, UserOperation::GetCommunity => { - let get_community: GetCommunity = serde_json::from_str(&data.to_string()).unwrap(); + let get_community: GetCommunity = serde_json::from_str(data).unwrap(); get_community.perform(self, msg.id) }, UserOperation::CreateComment => { - let create_comment: CreateComment = serde_json::from_str(&data.to_string()).unwrap(); + let create_comment: CreateComment = serde_json::from_str(data).unwrap(); create_comment.perform(self, msg.id) }, UserOperation::EditComment => { - let edit_comment: EditComment = serde_json::from_str(&data.to_string()).unwrap(); + let edit_comment: EditComment = serde_json::from_str(data).unwrap(); edit_comment.perform(self, msg.id) }, UserOperation::CreateCommentLike => { - let create_comment_like: CreateCommentLike = serde_json::from_str(&data.to_string()).unwrap(); + let create_comment_like: CreateCommentLike = serde_json::from_str(data).unwrap(); create_comment_like.perform(self, msg.id) }, UserOperation::GetPosts => { - let get_posts: GetPosts = serde_json::from_str(&data.to_string()).unwrap(); + let get_posts: GetPosts = serde_json::from_str(data).unwrap(); get_posts.perform(self, msg.id) }, UserOperation::CreatePostLike => { - let create_post_like: CreatePostLike = serde_json::from_str(&data.to_string()).unwrap(); + let create_post_like: CreatePostLike = serde_json::from_str(data).unwrap(); create_post_like.perform(self, msg.id) }, UserOperation::EditPost => { - let edit_post: EditPost = serde_json::from_str(&data.to_string()).unwrap(); + let edit_post: EditPost = serde_json::from_str(data).unwrap(); edit_post.perform(self, msg.id) }, UserOperation::EditCommunity => { - let edit_community: EditCommunity = serde_json::from_str(&data.to_string()).unwrap(); + let edit_community: EditCommunity = serde_json::from_str(data).unwrap(); edit_community.perform(self, msg.id) }, UserOperation::FollowCommunity => { - let follow_community: FollowCommunity = serde_json::from_str(&data.to_string()).unwrap(); + let follow_community: FollowCommunity = serde_json::from_str(data).unwrap(); follow_community.perform(self, msg.id) }, UserOperation::GetFollowedCommunities => { - let followed_communities: GetFollowedCommunities = serde_json::from_str(&data.to_string()).unwrap(); + let followed_communities: GetFollowedCommunities = serde_json::from_str(data).unwrap(); followed_communities.perform(self, msg.id) }, UserOperation::GetUserDetails => { - let get_user_details: GetUserDetails = serde_json::from_str(&data.to_string()).unwrap(); + let get_user_details: GetUserDetails = serde_json::from_str(data).unwrap(); get_user_details.perform(self, msg.id) }, // _ => { diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index cf42238e..268aa115 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -45,7 +45,7 @@ export class Communities extends Component { render() { return ( -
+
{this.state.loading ?

:
diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 477eec65..8faf858a 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -5,7 +5,7 @@ import { retryWhen, delay, take } from 'rxjs/operators'; import { UserOperation, CommunityUser, GetFollowedCommunitiesResponse } from '../interfaces'; import { WebSocketService, UserService } from '../services'; import { PostListings } from './post-listings'; -import { msgOp } from '../utils'; +import { msgOp, repoUrl } from '../utils'; interface State { subscribedCommunities: Array; @@ -46,17 +46,15 @@ export class Main extends Component { return (
-
+
-
-

A Landing message

- {UserService.Instance.loggedIn && +
+ {UserService.Instance.loggedIn ?
{this.state.loading ? -

: +

:
-

Subscribed forums

    {this.state.subscribedCommunities.map(community => @@ -65,7 +63,8 @@ export class Main extends Component {
} -
+
: + this.landing() }
@@ -73,6 +72,21 @@ export class Main extends Component { ) } + landing() { + return ( +
+

Welcome to + + LemmyBeta +

+

Lemmy is a link aggregator / reddit alternative, intended to work in the fediverse.

+

Its self-hostable, has live-updating comment threads, and is tiny (~80kB). Federation into the ActivityPub network is on the roadmap.

+

This is a very early beta version, and a lot of features are currently broken or missing.

+

Suggest new features or report bugs here.

+

Made with Rust, Actix, Inferno, Typescript.

+
+ ) + } parseMessage(msg: any) { console.log(msg); diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx index ca0c5a2a..a9d95362 100644 --- a/ui/src/components/navbar.tsx +++ b/ui/src/components/navbar.tsx @@ -25,7 +25,7 @@ export class Navbar extends Component { // Subscribe to user changes UserService.Instance.sub.subscribe(user => { - let loggedIn: boolean = user !== null; + let loggedIn: boolean = user !== undefined; this.setState({isLoggedIn: loggedIn}); }); } @@ -40,7 +40,7 @@ export class Navbar extends Component { // TODO toggle css collapse navbar() { return ( -
: - Login + Login / Sign up }
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx index f36893f6..5ca3f770 100644 --- a/ui/src/components/post.tsx +++ b/ui/src/components/post.tsx @@ -101,17 +101,17 @@ export class Post extends Component { sortRadios() { return (
-