From 94274a1e7fee63dd8a73e74e2e56a3517e3807d6 Mon Sep 17 00:00:00 2001
From: Jay Sitter
Date: Mon, 19 Jun 2023 11:26:29 -0400
Subject: [PATCH 1/3] feat(post): Move post domain beneath post title (#1363)
* feat(post): Move post domain and preview button beneath post title
* fix: Move the 'show body' button back to actions line; only show if there is something to show; add 'active' color
* fix: Fix some margins
---
src/assets/css/main.css | 4 -
src/shared/components/post/post-listing.tsx | 231 +++++++++++---------
2 files changed, 127 insertions(+), 108 deletions(-)
diff --git a/src/assets/css/main.css b/src/assets/css/main.css
index da3f7ffc..f9aa1ffb 100644
--- a/src/assets/css/main.css
+++ b/src/assets/css/main.css
@@ -84,10 +84,6 @@
margin-top: -6.5px;
}
-.post-title {
- line-height: 1;
-}
-
.post-title a:visited {
color: var(--gray) !important;
}
diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx
index 80da4b32..48d2dc6a 100644
--- a/src/shared/components/post/post-listing.tsx
+++ b/src/shared/components/post/post-listing.tsx
@@ -367,10 +367,8 @@ export class PostListing extends Component {
createdLine() {
const post_view = this.postView;
- const url = post_view.post.url;
- const body = post_view.post.body;
return (
-
+
-
@@ -402,21 +400,6 @@ export class PostListing extends Component {
)}
- •
- {url && !(hostname(url) === getExternalHost()) && (
- <>
- -
-
- {hostname(url)}
-
-
- - •
- >
- )}
-
{
/>
- {body && (
- <>
- - •
- -
-
-
- >
- )}
);
}
@@ -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 && (
-
+
);
}
@@ -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 2/3] 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 3/3] 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.canMod_ || this.canAdmin_) && (
+
{this.modRemoveButton}
+ )}
+
+
>
);
}