FEATURE: Allow users to hide the banner in their interface preferences

FEATURE: Allow users to hide the banner in their interface preferences

diff --git a/javascripts/discourse/connectors/discovery-list-container-top/featured-tiles.js b/javascripts/discourse/connectors/discovery-list-container-top/featured-tiles.js
new file mode 100644
index 0000000..632d1e0
--- /dev/null
+++ b/javascripts/discourse/connectors/discovery-list-container-top/featured-tiles.js
@@ -0,0 +1,8 @@
+export default {
+  shouldRender() {
+    let val = window.localStorage.getItem("show_featured_topics_banner");
+    if (val === "false") val = false;
+    if (val === null) val = true;
+    return val;
+  }
+};
diff --git a/javascripts/discourse/connectors/user-preferences-interface/featured-tiles.hbs b/javascripts/discourse/connectors/user-preferences-interface/featured-tiles.hbs
new file mode 100644
index 0000000..a134f46
--- /dev/null
+++ b/javascripts/discourse/connectors/user-preferences-interface/featured-tiles.hbs
@@ -0,0 +1,5 @@
+<div class="control-group other">
+  <label class="control-label">{{theme-i18n "preference_header"}}</label>
+
+  {{preference-checkbox labelKey=(theme-prefix "preference_description") checked=model.show_featured_topics_banner}}
+</div>
\ No newline at end of file
diff --git a/javascripts/discourse/connectors/user-preferences-interface/featured-tiles.js b/javascripts/discourse/connectors/user-preferences-interface/featured-tiles.js
new file mode 100644
index 0000000..f93dc1d
--- /dev/null
+++ b/javascripts/discourse/connectors/user-preferences-interface/featured-tiles.js
@@ -0,0 +1,7 @@
+import User from "discourse/models/user";
+
+export default {
+  shouldRender(component) {
+    return component.model.id === User.current().id;
+  }
+};
diff --git a/javascripts/discourse/initializers/init-featured-tiles.js b/javascripts/discourse/initializers/init-featured-tiles.js
new file mode 100644
index 0000000..b6c3c53
--- /dev/null
+++ b/javascripts/discourse/initializers/init-featured-tiles.js
@@ -0,0 +1,51 @@
+import { withPluginApi } from "discourse/lib/plugin-api";
+import { observes } from "discourse-common/utils/decorators";
+import User from "discourse/models/user";
+
+export default {
+  name: "discourse-featured-tiles",
+
+  initialize() {
+    withPluginApi("0.8.9", api => {
+      api.modifyClass("controller:preferences/interface", {
+        @observes("model.id")
+        updateShowFeaturedTopicsBanner() {
+          // debugger;
+          if (this.model.id !== User.current().id) return;
+          this.set(
+            "model.show_featured_topics_banner",
+            this.storedFeaturedTopicsValue()
+          );
+        },
+
+        storedFeaturedTopicsValue() {
+          let val = window.localStorage.getItem("show_featured_topics_banner");
+          if (val === "false") val = false;
+          if (val === null) val = true;
+          return !!val;
+        },
+
+        actions: {
+          save() {
+            this._super();
+            debugger;
+            if (this.model.id !== User.current().id) return;
+            if (
+              this.storedFeaturedTopicsValue() !==
+              this.model.show_featured_topics_banner
+            ) {
+              if (this.model.show_featured_topics_banner) {
+                window.localStorage.removeItem("show_featured_topics_banner");
+              } else {
+                window.localStorage.setItem(
+                  "show_featured_topics_banner",
+                  false
+                );
+              }
+            }
+          }
+        }
+      });
+    });
+  }
+};
diff --git a/locales/en.yml b/locales/en.yml
index 8d456e9..49848b3 100644
--- a/locales/en.yml
+++ b/locales/en.yml
@@ -12,3 +12,5 @@ en:
       display_categories: Display the tiles when viewing these categories. Blank for all categories
       scope_to_category: Filter topics to the current category?
       display_mobile: Display on mobile devices?
+  preference_header: Featured Topics Banner
+  preference_description: Show featured topics banner on this device
\ No newline at end of file

GitHub sha: 275e17d691578cfd0779d110081b8e181a874d40