Comment History

This commit is contained in:
spikecodes 2020-11-23 11:33:43 -08:00
parent a8f7fa6941
commit 295d1788d8
7 changed files with 45 additions and 17 deletions

6
Cargo.lock generated
View File

@ -1391,9 +1391,9 @@ checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]] [[package]]
name = "libnghttp2-sys" name = "libnghttp2-sys"
version = "0.1.4+1.41.0" version = "0.1.5+1.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1" checksum = "9657455ff47889b70ffd37c3e118e8cdd23fd1f9f3293a285f141070621c4c79"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -1401,7 +1401,7 @@ dependencies = [
[[package]] [[package]]
name = "libreddit" name = "libreddit"
version = "0.1.5" version = "0.1.6"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"askama", "askama",

View File

@ -3,7 +3,7 @@ name = "libreddit"
description = " Alternative private front-end to Reddit" description = " Alternative private front-end to Reddit"
license = "AGPL-3.0" license = "AGPL-3.0"
repository = "https://github.com/spikecodes/libreddit" repository = "https://github.com/spikecodes/libreddit"
version = "0.1.5" version = "0.1.6"
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"] authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
edition = "2018" edition = "2018"

View File

@ -45,9 +45,7 @@ Think Invidious but for Reddit. Watch your cat videos without being watched.
- [x] Karma - [x] Karma
- [x] Description - [x] Description
- [x] Post history - [x] Post history
- [x] Post sorting - [x] Comment history
- [ ] Comment history
- [ ] Comment sorting
- [ ] Search - [ ] Search
- [ ] Post aggregating - [ ] Post aggregating

View File

@ -116,7 +116,7 @@ pub async fn fetch_posts(url: String, fallback_title: String) -> Result<(Vec<Pos
posts.push(Post { posts.push(Post {
title: if title.is_empty() { fallback_title.to_owned() } else { title }, title: if title.is_empty() { fallback_title.to_owned() } else { title },
community: val(post, "subreddit").await, community: val(post, "subreddit").await,
body: String::new(), body: val(post, "body").await,
author: val(post, "author").await, author: val(post, "author").await,
score: if score > 1000 { format!("{}k", score / 1000) } else { score.to_string() }, score: if score > 1000 { format!("{}k", score / 1000) } else { score.to_string() },
media: img, media: img,

View File

@ -264,12 +264,12 @@ small {
.comment { .comment {
border-radius: 5px; border-radius: 5px;
background: #151515;
display: flex; display: flex;
border: 2px solid #222;
} }
.comment:hover { .comment:hover {
background: #222; background: #111;
} }
.comment_left, .comment_right { .comment_left, .comment_right {
@ -279,10 +279,9 @@ small {
.comment_left { .comment_left {
text-align: center; text-align: center;
border-right: 2px solid #000;
border-radius: 5px 0px 0px 5px;
min-width: 50px; min-width: 50px;
padding: 5px; padding: 5px;
align-items: flex-end;
} }
.comment_title { .comment_title {
@ -290,7 +289,11 @@ small {
} }
.comment_upvote { .comment_upvote {
display: none; margin-top: 0.5em;
border-radius: 5px 5px 0px 0px;
background: #222;
width: 40px;
padding: 10px 0px 0px 0px;
} }
.comment_subreddit { .comment_subreddit {
@ -298,13 +301,16 @@ small {
} }
.comment_score { .comment_score {
margin-top: 1em;
color: aqua; color: aqua;
background: #222;
width: 40px;
padding: 5px 0px 10px 0px;
border-radius: 0px 0px 5px 5px;
} }
.comment_right { .comment_right {
word-wrap: anywhere; word-wrap: anywhere;
padding: 20px 25px; padding: 10px 25px 10px 10px;
flex-grow: 1; flex-grow: 1;
flex-shrink: 1; flex-shrink: 1;
} }
@ -341,6 +347,15 @@ small {
color: aqua; color: aqua;
} }
.post.comment {
background: #000;
border: 2px solid #222;
}
.post.comment > .post_left {
background: black;
}
/* Tables */ /* Tables */
table { table {

View File

@ -41,7 +41,6 @@
<div class="comment_left"> <div class="comment_left">
<button class="comment_upvote"></button> <button class="comment_upvote"></button>
<h3 class="comment_score">{{ comment.score }}</h3> <h3 class="comment_score">{{ comment.score }}</h3>
<button class="comment_upvote"></button>
</div> </div>
<div class="comment_right"> <div class="comment_right">
<p> <p>

View File

@ -25,7 +25,8 @@
<div id="sort_new"><a href="?sort=new">New</a></div> <div id="sort_new"><a href="?sort=new">New</a></div>
</div> </div>
{% for post in posts %} {% for post in posts %}
<div class="post"> {% if post.title != "Comment" %}
<div class='post'>
<div class="post_left"> <div class="post_left">
<button class="post_upvote"></button> <button class="post_upvote"></button>
<h3 class="post_score">{{ post.score }}</h3> <h3 class="post_score">{{ post.score }}</h3>
@ -50,6 +51,21 @@
</div> </div>
<img class="post_thumbnail" src="{{ post.media }}"> <img class="post_thumbnail" src="{{ post.media }}">
</div><br> </div><br>
{% else %}
<div class="comment">
<div class="comment_left">
<button class="comment_upvote"></button>
<h3 class="comment_score">{{ post.score }}</h3>
</div>
<div class="comment_right">
<p>
COMMENT &bull; Posted by <a class="comment_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<span>{{ post.time }}</span>
</p>
<h4 class="comment_body">{{ post.body }}</h4>
</div>
</div><br>
{% endif %}
{% endfor %} {% endfor %}
</main> </main>
{% endblock %} {% endblock %}