]> Untitled Git - lemmy-ui.git/commitdiff
Merge branch 'main' into fix/add-aria-label-to-featured-pins
authorSleeplessOne1917 <abias1122@gmail.com>
Mon, 19 Jun 2023 23:32:00 +0000 (23:32 +0000)
committerGitHub <noreply@github.com>
Mon, 19 Jun 2023 23:32:00 +0000 (23:32 +0000)
14 files changed:
.github/ISSUE_TEMPLATE/BUG_REPORT.yml
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml
.prettierignore
package.json
src/assets/css/main.css
src/assets/css/themes/_variables.darkly.scss
src/assets/css/themes/_variables.litely.scss
src/assets/css/themes/darkly-red.css
src/assets/css/themes/darkly.css
src/assets/css/themes/litely-red.css
src/assets/css/themes/litely.css
src/shared/components/person/person-listing.tsx
src/shared/components/post/post-listing.tsx
src/shared/components/post/post-listings.tsx

index ae2d4e51f0a74a9ffb498c83f10a0f8acced7bfc..a43a5a5582a3da7372b251bce481d3e080759033 100644 (file)
@@ -8,7 +8,7 @@ body:
       value: |
         Found a bug? Please fill out the sections below. 👍
         Thanks for taking the time to fill out this bug report!
-        For backend issues, use [lemmy](https://github.com/LemmyNet/lemmy)
+        For backend issues, use [lemmy](https://github.com/LemmyNet/lemmy/issues/new/choose)
   - type: checkboxes
     attributes:
       label: Requirements
index 3c75050ab8a964b03a93030ba90821c505ef5de4..2d656819d6ee569b0855e1052e5af832271b9df9 100644 (file)
@@ -1,16 +1,16 @@
 name: "\U0001F680 Feature request"
-description: Suggest an idea for improving Lemmy
+description: Suggest an idea for improving Lemmy's UI
 labels: ["enhancement"]
 body:
   - type: markdown
     attributes:
       value: |
         Have a suggestion about Lemmy's UI?
-        For backend issues, use [lemmy](https://github.com/LemmyNet/lemmy)
+        For backend issues, use [lemmy](https://github.com/LemmyNet/lemmy/issues/new/choose)
   - type: checkboxes
     attributes:
       label: Requirements
-      description: Before you create a bug report please do the following.
+      description: Before you create a feature request please do the following.
       options:
         - label: Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support
           required: true
index e7a0d20ec6abab0923aa3ce261ceafc787fe4aa6..98eb0d9b885d8e110d58cc1f7bd4da6b1aa2bd2a 100644 (file)
@@ -1,2 +1,3 @@
 src/shared/translations
-lemmy-translations
\ No newline at end of file
+lemmy-translations
+src/assets/css/themes/*.css
index b0d555b50b66a6da1abe44a50fad2006d967e680..554bd234b5ee126f3d5386cc100f61a878f744ba 100644 (file)
@@ -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",
index da3f7ffc630be20157ac817455b451bcc4694e6a..f9aa1ffb2a993e0e73636674ad41600fdb0e9f67 100644 (file)
   margin-top: -6.5px;
 }
 
-.post-title {
-  line-height: 1;
-}
-
 .post-title a:visited {
   color: var(--gray) !important;
 }
index 56ccc3cf7e2cb8cb9bfc4335d57b61a48e6a557c..fa6e305d5a88933c081f51c543c8caa6bb558e13 100644 (file)
@@ -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;
 
index 2fc0fe3dd7cbcd3355567a1bef6e2d3e2aeb6500..1708d4c395b611a35e1a130883137a4d41c0ee6b 100644 (file)
@@ -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);
index aa82bd8e70548d2e189f1e6a373a480af8c640ee..221cc8bc68cf5ffd4800d541c2bf117c7af25de4 100644 (file)
@@ -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,
index 3d764f9c6bb74c394ddb65cbde37dade942e964d..5a289b4964e6e117e75e3752454a366cbd557eda 100644 (file)
@@ -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,
index 055652233354fbb2c0f0526405b28e1ec903ac0d..187478ea0cbb3a44e5a3cc53f7624ad517e766ad 100644 (file)
@@ -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,
index 473cd697757823fe861b239cfbeeb2803346aa61..6f57d01e87c907dff6dc85b4e0fb30d992523bb9 100644 (file)
@@ -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,
index fe8b8418628e2ca191a7d23ea9b415304cec8722..045633c7957f098cc7f54a51c99190d92c569d2d 100644 (file)
@@ -1,3 +1,4 @@
+import classNames from "classnames";
 import { Component } from "inferno";
 import { Link } from "inferno-router";
 import { Person } from "lemmy-js-client";
@@ -48,7 +49,10 @@ export class PersonListing extends Component<PersonListingProps, any> {
         {!this.props.realLink ? (
           <Link
             title={apubName}
-            className={this.props.muted ? "text-muted" : "text-info"}
+            className={classNames("d-inline-flex align-items-baseline", {
+              "text-muted": this.props.muted,
+              "text-info": !this.props.muted,
+            })}
             to={link}
           >
             {this.avatarAndName(displayName)}
@@ -56,7 +60,9 @@ export class PersonListing extends Component<PersonListingProps, any> {
         ) : (
           <a
             title={apubName}
-            className={this.props.muted ? "text-muted" : "text-info"}
+            className={`d-inline-flex align-items-baseline ${
+              this.props.muted ? "text-muted" : "text-info"
+            }`}
             href={link}
             rel={relTags}
           >
index 222e4857aed577e642226e5bf17b8caf0f7fc557..8e69b18ec428f7fea31228f5a73d1dbc18273da8 100644 (file)
@@ -201,7 +201,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     const post = this.postView.post;
 
     return (
-      <div className="post-listing">
+      <div className="post-listing mt-2">
         {!this.state.showEdit ? (
           <>
             {this.listing()}
@@ -367,10 +367,8 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
 
   createdLine() {
     const post_view = this.postView;
-    const url = post_view.post.url;
-    const body = post_view.post.body;
     return (
-      <ul className="list-inline mb-1 text-muted small">
+      <ul className="list-inline mb-1 text-muted small mt-2">
         <li className="list-inline-item">
           <PersonListing person={post_view.creator} />
 
@@ -386,10 +384,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
             </span>
           )}
           {this.props.showCommunity && (
-            <span>
-              <span className="mx-1"> {i18n.t("to")} </span>
-              <CommunityLink community={post_view.community} />
-            </span>
+            <>
+              {" "}
+              {i18n.t("to")} <CommunityLink community={post_view.community} />
+            </>
           )}
         </li>
         {post_view.post.language_id !== 0 && (
@@ -402,21 +400,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
           </span>
         )}
         <li className="list-inline-item">•</li>
-        {url && !(hostname(url) === getExternalHost()) && (
-          <>
-            <li className="list-inline-item">
-              <a
-                className="text-muted font-italic"
-                href={url}
-                title={url}
-                rel={relTags}
-              >
-                {hostname(url)}
-              </a>
-            </li>
-            <li className="list-inline-item">•</li>
-          </>
-        )}
         <li className="list-inline-item">
           <span>
             <MomentTime
@@ -425,21 +408,6 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
             />
           </span>
         </li>
-        {body && (
-          <>
-            <li className="list-inline-item">•</li>
-            <li className="list-inline-item">
-              <button
-                className="text-muted btn btn-sm btn-link p-0"
-                data-tippy-content={mdNoImages.render(body)}
-                data-tippy-allowHtml={true}
-                onClick={linkEvent(this, this.handleShowBody)}
-              >
-                <Icon icon="book-open" classes="icon-inline mr-1" />
-              </button>
-            </li>
-          </>
-        )}
       </ul>
     );
   }
@@ -518,84 +486,107 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     const url = post.url;
 
     return (
-      <div className="post-title overflow-hidden">
-        <h5 className="d-inline">
-          {url && this.props.showBody ? (
-            <a
-              className={
-                !post.featured_community && !post.featured_local
-                  ? "text-body"
-                  : "text-primary"
-              }
-              href={url}
-              title={url}
-              rel={relTags}
-              dangerouslySetInnerHTML={mdToHtmlInline(post.name)}
-            ></a>
-          ) : (
-            this.postLink
+      <>
+        <div className="post-title overflow-hidden">
+          <h5 className="d-inline">
+            {url && this.props.showBody ? (
+              <a
+                className={
+                  !post.featured_community && !post.featured_local
+                    ? "text-body"
+                    : "text-primary"
+                }
+                href={url}
+                title={url}
+                rel={relTags}
+                dangerouslySetInnerHTML={mdToHtmlInline(post.name)}
+              ></a>
+            ) : (
+              this.postLink
+            )}
+          </h5>
+          {(url && isImage(url)) ||
+            (post.thumbnail_url && (
+              <button
+                className="btn btn-link text-monospace text-muted small d-inline-block"
+                data-tippy-content={i18n.t("expand_here")}
+                onClick={linkEvent(this, this.handleImageExpandClick)}
+              >
+                <Icon
+                  icon={
+                    !this.state.imageExpanded ? "plus-square" : "minus-square"
+                  }
+                  classes="icon-inline"
+                />
+              </button>
+            ))}
+          {post.removed && (
+            <small className="ml-2 badge text-bg-secondary">
+              {i18n.t("removed")}
+            </small>
           )}
-        </h5>
-        {(url && isImage(url)) ||
-          (post.thumbnail_url && (
-            <button
-              className="btn btn-link text-monospace text-muted small d-inline-block"
-              data-tippy-content={i18n.t("expand_here")}
-              onClick={linkEvent(this, this.handleImageExpandClick)}
+          {post.deleted && (
+            <small
+              className="unselectable pointer ml-2 text-muted font-italic"
+              data-tippy-content={i18n.t("deleted")}
             >
-              <Icon
-                icon={
-                  !this.state.imageExpanded ? "plus-square" : "minus-square"
-                }
-                classes="icon-inline"
-              />
-            </button>
-          ))}
-        {post.removed && (
-          <small className="ml-2 text-muted font-italic">
-            {i18n.t("removed")}
-          </small>
-        )}
-        {post.deleted && (
-          <small
-            className="unselectable pointer ml-2 text-muted font-italic"
-            data-tippy-content={i18n.t("deleted")}
-          >
-            <Icon icon="trash" classes="icon-inline text-danger" />
-          </small>
-        )}
-        {post.locked && (
-          <small
-            className="unselectable pointer ml-2 text-muted font-italic"
-            data-tippy-content={i18n.t("locked")}
-          >
-            <Icon icon="lock" classes="icon-inline text-danger" />
-          </small>
-        )}
-        {post.featured_community && (
-          <small
-            className="unselectable pointer ml-2 text-muted font-italic"
-            data-tippy-content={i18n.t("featured_in_community")}
-            aria-label={i18n.t("featured_in_community")}
-          >
-            <Icon icon="pin" classes="icon-inline text-primary" />
-          </small>
-        )}
-        {post.featured_local && (
-          <small
-            className="unselectable pointer ml-2 text-muted font-italic"
-            data-tippy-content={i18n.t("featured_in_local")}
-            aria-label={i18n.t("featured_in_local")}
+              <Icon icon="trash" classes="icon-inline text-danger" />
+            </small>
+          )}
+          {post.locked && (
+            <small
+              className="unselectable pointer ml-2 text-muted font-italic"
+              data-tippy-content={i18n.t("locked")}
+            >
+              <Icon icon="lock" classes="icon-inline text-danger" />
+            </small>
+          )}
+          {post.featured_community && (
+            <small
+              className="unselectable pointer ml-2 text-muted font-italic"
+              data-tippy-content={i18n.t("featured_in_community")}
+              aria-label={i18n.t("featured_in_community")}
+            >
+              <Icon icon="pin" classes="icon-inline text-primary" />
+            </small>
+          )}
+          {post.featured_local && (
+            <small
+              className="unselectable pointer ml-2 text-muted font-italic"
+              data-tippy-content={i18n.t("featured_in_local")}
+              aria-label={i18n.t("featured_in_local")}
+            >
+              <Icon icon="pin" classes="icon-inline text-secondary" />
+            </small>
+          )}
+          {post.nsfw && (
+            <small className="ml-2 badge text-bg-danger">
+              {i18n.t("nsfw")}
+            </small>
+          )}
+        </div>
+        {url && this.urlLine()}
+      </>
+    );
+  }
+
+  urlLine() {
+    const post = this.postView.post;
+    const url = post.url;
+
+    return (
+      <p className="d-flex text-muted align-items-center gap-1 small m-0">
+        {url && !(hostname(url) === getExternalHost()) && (
+          <a
+            className="text-muted font-italic"
+            href={url}
+            title={url}
+            rel={relTags}
           >
-            <Icon icon="pin" classes="icon-inline text-secondary" />
-          </small>
-        )}
-        {post.nsfw && (
-          <small className="ml-2 text-muted font-italic">
-            {i18n.t("nsfw")}
-          </small>
+            {hostname(url)}
+          </a>
         )}
-      </div>
+      </p>
     );
   }
 
@@ -625,11 +616,11 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     const post = this.postView.post;
 
     return (
-      <div className="d-flex align-items-center justify-content-start flex-wrap text-muted font-weight-bold mb-1">
+      <div className="d-flex align-items-center justify-content-start flex-wrap text-muted font-weight-bold">
         {this.commentsButton}
         {canShare() && (
           <button
-            className="btn btn-link"
+            className="btn btn-sm btn-link"
             onClick={linkEvent(this, this.handleShare)}
             type="button"
           >
@@ -653,14 +644,24 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     );
   }
 
-  get hasAdvancedButtons() {
+  showPreviewButton() {
+    const post_view = this.postView;
+    const body = post_view.post.body;
+
     return (
-      this.myPost ||
-      (this.showBody && this.postView.post.body) ||
-      amMod(this.props.moderators) ||
-      amAdmin() ||
-      this.canMod_ ||
-      this.canAdmin_
+      <button
+        className="btn btn-link btn-animate text-muted py-0"
+        data-tippy-content={body && mdNoImages.render(body)}
+        data-tippy-allowHtml={true}
+        onClick={linkEvent(this, this.handleShowBody)}
+      >
+        <Icon
+          icon="book-open"
+          classes={classNames("icon-inline mr-1", {
+            "text-success": this.state.showBody,
+          })}
+        />
+      </button>
     );
   }
 
@@ -668,57 +669,64 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     // 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 && (
-          <div className="dropdown">
-            <button
-              className="btn btn-link btn-animate text-muted py-0 dropdown-toggle"
-              onClick={linkEvent(this, this.handleShowAdvanced)}
-              data-tippy-content={i18n.t("more")}
-              data-bs-toggle="dropdown"
-              aria-expanded="false"
-              aria-controls="advancedButtonsDropdown"
-              aria-label={i18n.t("more")}
-            >
-              <Icon icon="more-vertical" inline />
-            </button>
+        <div className="dropdown">
+          <button
+            className="btn btn-link btn-animate text-muted py-0 dropdown-toggle"
+            onClick={linkEvent(this, this.handleShowAdvanced)}
+            data-tippy-content={i18n.t("more")}
+            data-bs-toggle="dropdown"
+            aria-expanded="false"
+            aria-controls="advancedButtonsDropdown"
+            aria-label={i18n.t("more")}
+          >
+            <Icon icon="more-vertical" inline />
+          </button>
 
-            <ul className="dropdown-menu" id="advancedButtonsDropdown">
-              {!this.myPost ? (
-                <>
-                  <li>{this.reportButton}</li>
-                  <li>{this.blockButton}</li>
-                </>
-              ) : (
-                <>
-                  <li>{this.editButton}</li>
-                  <li>{this.deleteButton}</li>
-                </>
-              )}
+          <ul className="dropdown-menu" id="advancedButtonsDropdown">
+            {!this.myPost ? (
+              <>
+                <li>{this.reportButton}</li>
+                <li>{this.blockButton}</li>
+              </>
+            ) : (
+              <>
+                <li>{this.editButton}</li>
+                <li>{this.deleteButton}</li>
+              </>
+            )}
 
-              {/* Any mod can do these, not limited to hierarchy*/}
-              {(amMod(this.props.moderators) || amAdmin()) && (
-                <>
-                  <li>
-                    <hr className="dropdown-divider" />
-                  </li>
-                  <li>{this.lockButton}</li>
-                  {this.featureButtons}
-                </>
-              )}
+            {/* Any mod can do these, not limited to hierarchy*/}
+            {(amMod(this.props.moderators) || amAdmin()) && (
+              <>
+                <li>
+                  <hr className="dropdown-divider" />
+                </li>
+                <li>{this.lockButton}</li>
+                {this.featureButtons}
+              </>
+            )}
 
-              {(this.canMod_ || this.canAdmin_) && (
-                <li>{this.modRemoveButton}</li>
-              )}
-            </ul>
-          </div>
-        )}
+            {(this.canMod_ || this.canAdmin_) && (
+              <li>{this.modRemoveButton}</li>
+            )}
+          </ul>
+        </div>
       </>
     );
   }
@@ -727,7 +735,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     const post_view = this.postView;
     return (
       <Link
-        className="btn btn-link text-muted py-0 pl-0 text-muted"
+        className="btn btn-link text-muted pl-0 text-muted"
         title={i18n.t("number_of_comments", {
           count: Number(post_view.counts.comments),
           formattedCount: Number(post_view.counts.comments),
@@ -869,10 +877,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
       <button
         className="btn btn-link btn-sm d-flex align-items-center rounded-0 dropdown-item"
         onClick={linkEvent(this, this.handleShowReportDialog)}
-        data-tippy-content={i18n.t("show_report_dialog")}
         aria-label={i18n.t("show_report_dialog")}
       >
-        <Icon icon="flag" inline />
+        <Icon classes="mr-1" icon="flag" inline />
+        {i18n.t("create_report")}
       </button>
     );
   }
@@ -882,10 +890,14 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
       <button
         className="btn btn-link btn-sm d-flex align-items-center rounded-0 dropdown-item"
         onClick={linkEvent(this, this.handleBlockPersonClick)}
-        data-tippy-content={i18n.t("block_user")}
         aria-label={i18n.t("block_user")}
       >
-        {this.state.blockLoading ? <Spinner /> : <Icon icon="slash" inline />}
+        {this.state.blockLoading ? (
+          <Spinner />
+        ) : (
+          <Icon classes="mr-1" icon="slash" inline />
+        )}
+        {i18n.t("block_user")}
       </button>
     );
   }
index 00370f039bfea8b104d206e1fcf497e27e400501..e6c7e5f68957cb37ca5a5bafb1e6fb8927c7c584 100644 (file)
@@ -96,9 +96,7 @@ export class PostListings extends Component<PostListingsProps, any> {
                 onAddAdmin={this.props.onAddAdmin}
                 onTransferCommunity={this.props.onTransferCommunity}
               />
-              {idx + 1 !== this.posts.length && (
-                <hr className="my-3 border border-primary" />
-              )}
+              {idx + 1 !== this.posts.length && <hr className="my-3" />}
             </>
           ))
         ) : (