]> Untitled Git - lemmy-ui.git/commitdiff
Show original created time tooltip (#462)
authorDessalines <dessalines@users.noreply.github.com>
Mon, 18 Oct 2021 01:46:15 +0000 (21:46 -0400)
committerGitHub <noreply@github.com>
Mon, 18 Oct 2021 01:46:15 +0000 (21:46 -0400)
* Updating translations.

* Show created and modified times on tippy. Fixes #438

lemmy-translations
src/shared/components/common/moment-time.tsx

index 2849552043b167dd7e803da9dcbbf02f450f550a..0d6ef6791f9175fb98ec99598c724d83e8e0d4ef 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2849552043b167dd7e803da9dcbbf02f450f550a
+Subproject commit 0d6ef6791f9175fb98ec99598c724d83e8e0d4ef
index 20623932f68d77900404e2961cb28ca5d39f12d3..122fbf7cc160122f7fa17ddc5b0105871e4975e4 100644 (file)
@@ -23,13 +23,27 @@ export class MomentTime extends Component<MomentTimeProps, any> {
     moment.locale(lang);
   }
 
+  createdAndModifiedTimes() {
+    let created = this.props.data.published || this.props.data.when_;
+    return `
+      <div>
+        <div>
+          ${capitalizeFirstLetter(i18n.t("created"))}: ${this.format(created)}
+        </div>
+        <div>
+          ${capitalizeFirstLetter(i18n.t("modified"))} ${this.format(
+      this.props.data.updated
+    )}
+        </div>
+        </div>`;
+  }
+
   render() {
     if (!this.props.ignoreUpdated && this.props.data.updated) {
       return (
         <span
-          data-tippy-content={`${capitalizeFirstLetter(
-            i18n.t("modified")
-          )} ${this.format(this.props.data.updated)}`}
+          data-tippy-content={this.createdAndModifiedTimes()}
+          data-tippy-allowHtml={true}
           className="font-italics pointer unselectable"
         >
           <Icon icon="edit-2" classes="icon-inline mr-1" />
@@ -37,13 +51,13 @@ export class MomentTime extends Component<MomentTimeProps, any> {
         </span>
       );
     } else {
-      let str = this.props.data.published || this.props.data.when_;
+      let created = this.props.data.published || this.props.data.when_;
       return (
         <span
           className="pointer unselectable"
-          data-tippy-content={this.format(str)}
+          data-tippy-content={this.format(created)}
         >
-          {moment.utc(str).fromNow(!this.props.showAgo)}
+          {moment.utc(created).fromNow(!this.props.showAgo)}
         </span>
       );
     }