From 28fd28f6d3c46b069c7aa5cea3f3cb88220fa27f Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 10:47:29 -0400 Subject: [PATCH 01/14] feat: Badge-ify NSFW and removed by mod title info --- src/shared/components/post/post-listing.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 56961e22..fa0aad9a 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -552,7 +552,7 @@ export class PostListing extends Component { ))} {post.removed && ( - + {i18n.t("removed")} )} @@ -589,9 +589,7 @@ export class PostListing extends Component { )} {post.nsfw && ( - - {i18n.t("nsfw")} - + {i18n.t("nsfw")} )} ); From cc6679e8e359b4ad5b87d533c6db0d4fc53ddbfc Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 12:03:12 -0400 Subject: [PATCH 02/14] fix: Prettier ignore generated themes, as they aren't written by humans --- .prettierignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index e7a0d20e..98eb0d9b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ src/shared/translations -lemmy-translations \ No newline at end of file +lemmy-translations +src/assets/css/themes/*.css From 90cd24b8caa012ddeb878818401d9189d88ab233 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 12:46:31 -0400 Subject: [PATCH 03/14] fix: Fix post creator text alignment --- src/shared/components/person/person-listing.tsx | 8 ++++++-- src/shared/components/post/post-listing.tsx | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/shared/components/person/person-listing.tsx b/src/shared/components/person/person-listing.tsx index fe8b8418..4d2f5cf4 100644 --- a/src/shared/components/person/person-listing.tsx +++ b/src/shared/components/person/person-listing.tsx @@ -48,7 +48,9 @@ export class PersonListing extends Component { {!this.props.realLink ? ( {this.avatarAndName(displayName)} @@ -56,7 +58,9 @@ export class PersonListing extends Component { ) : ( diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 56961e22..93a436f3 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -386,10 +386,10 @@ export class PostListing extends Component { )} {this.props.showCommunity && ( - - {i18n.t("to")} - - + <> + {" "} + {i18n.t("to")} + )} {post_view.post.language_id !== 0 && ( From 473406d1daf97fcd3665f9b2bc9bbd402348308e Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 15:38:16 -0400 Subject: [PATCH 04/14] fix: Fix too-intense hr color between posts --- src/assets/css/themes/_variables.darkly.scss | 2 ++ src/assets/css/themes/_variables.litely.scss | 2 ++ src/shared/components/post/post-listings.tsx | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/assets/css/themes/_variables.darkly.scss b/src/assets/css/themes/_variables.darkly.scss index 56ccc3cf..fa6e305d 100644 --- a/src/assets/css/themes/_variables.darkly.scss +++ b/src/assets/css/themes/_variables.darkly.scss @@ -92,6 +92,8 @@ $input-border-color: $body-bg; $input-group-addon-color: $gray-500; $input-group-addon-bg: $gray-700; +$hr-border-color: rgba($body-color, 0.25); + $table-accent-bg: $gray-800; $table-border-color: $gray-700; diff --git a/src/assets/css/themes/_variables.litely.scss b/src/assets/css/themes/_variables.litely.scss index 2fc0fe3d..1708d4c3 100644 --- a/src/assets/css/themes/_variables.litely.scss +++ b/src/assets/css/themes/_variables.litely.scss @@ -76,3 +76,5 @@ $border-radius: 0.5rem; $border-radius-lg: 0.5rem; $border-radius-sm: 1rem; $rounded-pill: 0.25rem; + +$hr-border-color: rgba($body-color, 0.25); diff --git a/src/shared/components/post/post-listings.tsx b/src/shared/components/post/post-listings.tsx index 00370f03..e6c7e5f6 100644 --- a/src/shared/components/post/post-listings.tsx +++ b/src/shared/components/post/post-listings.tsx @@ -96,9 +96,7 @@ export class PostListings extends Component { onAddAdmin={this.props.onAddAdmin} onTransferCommunity={this.props.onTransferCommunity} /> - {idx + 1 !== this.posts.length && ( -
- )} + {idx + 1 !== this.posts.length &&
} )) ) : ( From eb9bc1d4fbadbe22c4e7e9ce585c8f8c4089352c Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 15:45:01 -0400 Subject: [PATCH 05/14] fix: Add compiled theme stylesheets --- src/assets/css/themes/darkly-red.css | 2 +- src/assets/css/themes/darkly.css | 2 +- src/assets/css/themes/litely-red.css | 2 +- src/assets/css/themes/litely.css | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/css/themes/darkly-red.css b/src/assets/css/themes/darkly-red.css index aa82bd8e..221cc8bc 100644 --- a/src/assets/css/themes/darkly-red.css +++ b/src/assets/css/themes/darkly-red.css @@ -450,7 +450,7 @@ hr { margin-top: 1rem; margin-bottom: 1rem; border: 0; - border-top: 1px solid rgba(0, 0, 0, 0.1); + border-top: 1px solid rgba(222, 226, 230, 0.25); } small, diff --git a/src/assets/css/themes/darkly.css b/src/assets/css/themes/darkly.css index 3d764f9c..5a289b49 100644 --- a/src/assets/css/themes/darkly.css +++ b/src/assets/css/themes/darkly.css @@ -450,7 +450,7 @@ hr { margin-top: 1rem; margin-bottom: 1rem; border: 0; - border-top: 1px solid rgba(0, 0, 0, 0.1); + border-top: 1px solid rgba(222, 226, 230, 0.25); } small, diff --git a/src/assets/css/themes/litely-red.css b/src/assets/css/themes/litely-red.css index 05565223..187478ea 100644 --- a/src/assets/css/themes/litely-red.css +++ b/src/assets/css/themes/litely-red.css @@ -450,7 +450,7 @@ hr { margin-top: 1rem; margin-bottom: 1rem; border: 0; - border-top: 1px solid rgba(0, 0, 0, 0.1); + border-top: 1px solid rgba(222, 226, 230, 0.25); } small, diff --git a/src/assets/css/themes/litely.css b/src/assets/css/themes/litely.css index 473cd697..6f57d01e 100644 --- a/src/assets/css/themes/litely.css +++ b/src/assets/css/themes/litely.css @@ -449,7 +449,7 @@ hr { margin-top: 1rem; margin-bottom: 1rem; border: 0; - border-top: 1px solid rgba(34, 34, 34, 0.1); + border-top: 1px solid rgba(73, 80, 87, 0.25); } small, From 7f818921d2e58523c23c603e47858016ef078052 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 16:02:55 -0400 Subject: [PATCH 06/14] fix(post): Fix missing labels on block/report buttons in new dropdown --- src/shared/components/post/post-listing.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 56961e22..2e048a2f 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -867,10 +867,10 @@ export class PostListing extends Component { ); } @@ -880,10 +880,14 @@ export class PostListing extends Component { ); } From ad984c8584bf04a9e1800d012caa57b9bc3e820e Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 18 Jun 2023 23:19:56 -0400 Subject: [PATCH 08/14] fix: Use classnames --- src/shared/components/person/person-listing.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shared/components/person/person-listing.tsx b/src/shared/components/person/person-listing.tsx index 4d2f5cf4..045633c7 100644 --- a/src/shared/components/person/person-listing.tsx +++ b/src/shared/components/person/person-listing.tsx @@ -1,3 +1,4 @@ +import classNames from "classnames"; import { Component } from "inferno"; import { Link } from "inferno-router"; import { Person } from "lemmy-js-client"; @@ -48,9 +49,10 @@ export class PersonListing extends Component { {!this.props.realLink ? ( {this.avatarAndName(displayName)} From 5ccd8922dabefef4be096b8dd58b1a102505e51d Mon Sep 17 00:00:00 2001 From: ayan4m1 Date: Sun, 18 Jun 2023 21:36:27 -0400 Subject: [PATCH 09/14] feat(css): make vertical rhythm more consistent for post listings --- src/shared/components/post/post-listing.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index d2e3893c..80da4b32 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -201,7 +201,7 @@ export class PostListing extends Component { const post = this.postView.post; return ( -
+
{!this.state.showEdit ? ( <> {this.listing()} @@ -621,11 +621,11 @@ export class PostListing extends Component { const post = this.postView.post; return ( -
+
{this.commentsButton} {canShare() && ( - - - )} ); } @@ -518,80 +486,105 @@ export class PostListing extends Component { const url = post.url; return ( -
-
- {url && this.props.showBody ? ( - - ) : ( - this.postLink - )} -
- {(url && isImage(url)) || - (post.thumbnail_url && ( - - ))} - {post.removed && ( - - {i18n.t("removed")} - - )} - {post.deleted && ( - + ) : ( + this.postLink + )} + + {(url && isImage(url)) || + (post.thumbnail_url && ( + + ))} + {post.removed && ( + + {i18n.t("removed")} + + )} + {post.deleted && ( + + + + )} + {post.locked && ( + + + + )} + {post.featured_community && ( + + + + )} + {post.featured_local && ( + + + + )} + {post.nsfw && ( + + {i18n.t("nsfw")} + + )} +
+ {url && this.urlLine()} + + ); + } + + urlLine() { + const post = this.postView.post; + const url = post.url; + + return ( +

+ {url && !(hostname(url) === getExternalHost()) && ( + - - + {hostname(url)} + )} - {post.locked && ( - - - - )} - {post.featured_community && ( - - - - )} - {post.featured_local && ( - - - - )} - {post.nsfw && ( - {i18n.t("nsfw")} - )} -

+

); } @@ -660,15 +653,45 @@ export class PostListing extends Component { ); } + showPreviewButton() { + const post_view = this.postView; + const body = post_view.post.body; + + return ( + + ); + } + postActions() { // Possible enhancement: Priority+ pattern instead of just hard coding which get hidden behind the show more button. // Possible enhancement: Make each button a component. const post_view = this.postView; + const post = post_view.post; + return ( <> {this.saveButton} {this.crossPostButton} + {/** + * If there is a URL, or if the post has a body and we were told not to + * show the body, show the MetadataCard/body toggle. + */} + {(post.url || (post.body && !this.props.showBody)) && + this.showPreviewButton()} + {this.showBody && post_view.post.body && this.viewSourceButton} {this.hasAdvancedButtons && ( From a7e5c5ee8a135bc370facd06b77a3418ba9ebaf8 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 19 Jun 2023 11:29:57 -0400 Subject: [PATCH 13/14] v0.18.0-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b0d555b5..554bd234 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lemmy-ui", - "version": "0.18.0-rc.1", + "version": "0.18.0-rc.2", "description": "An isomorphic UI for lemmy", "repository": "https://github.com/LemmyNet/lemmy-ui", "license": "AGPL-3.0", From e8dfaa458a1093092be34ddf4cce9a0fbf13d15f Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Mon, 19 Jun 2023 15:56:55 -0400 Subject: [PATCH 14/14] fix: Always show advanced post buttons dropdown --- src/shared/components/post/post-listing.tsx | 91 +++++++++------------ 1 file changed, 39 insertions(+), 52 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 48d2dc6a..5ee07613 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -642,17 +642,6 @@ export class PostListing extends Component { ); } - get hasAdvancedButtons() { - return ( - this.myPost || - (this.showBody && this.postView.post.body) || - amMod(this.props.moderators) || - amAdmin() || - this.canMod_ || - this.canAdmin_ - ); - } - showPreviewButton() { const post_view = this.postView; const body = post_view.post.body; @@ -694,50 +683,48 @@ export class PostListing extends Component { {this.showBody && post_view.post.body && this.viewSourceButton} - {this.hasAdvancedButtons && ( -
- +
+ -
    - {!this.myPost ? ( - <> -
  • {this.reportButton}
  • -
  • {this.blockButton}
  • - - ) : ( - <> -
  • {this.editButton}
  • -
  • {this.deleteButton}
  • - - )} +
      + {!this.myPost ? ( + <> +
    • {this.reportButton}
    • +
    • {this.blockButton}
    • + + ) : ( + <> +
    • {this.editButton}
    • +
    • {this.deleteButton}
    • + + )} - {/* Any mod can do these, not limited to hierarchy*/} - {(amMod(this.props.moderators) || amAdmin()) && ( - <> -
    • -
      -
    • -
    • {this.lockButton}
    • - {this.featureButtons} - - )} + {/* Any mod can do these, not limited to hierarchy*/} + {(amMod(this.props.moderators) || amAdmin()) && ( + <> +
    • +
      +
    • +
    • {this.lockButton}
    • + {this.featureButtons} + + )} - {(this.canMod_ || this.canAdmin_) && ( -
    • {this.modRemoveButton}
    • - )} -
    -
- )} + {(this.canMod_ || this.canAdmin_) && ( +
  • {this.modRemoveButton}
  • + )} + +
    ); }