about summary refs log tree commit diff
path: root/app/javascript/packs
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-14 20:51:50 +0200
committerThibaut Girka <thib@sitedethib.com>2018-05-14 20:51:50 +0200
commitba7ee67498905cbc96d531d45a80e284880e09ee (patch)
tree755476fb27484fb36bd01578f8f22d4dd8d64562 /app/javascript/packs
parent46659655439e7d76726aa38ed5d599a795b3790f (diff)
parent03b69ebc450efc07246bd64204276941b7ede3fc (diff)
Merge branch 'master' into glitch-soc/merge
Diffstat (limited to 'app/javascript/packs')
-rw-r--r--app/javascript/packs/public.js33
1 files changed, 9 insertions, 24 deletions
diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js
index 38aaf895f..1e6ee62af 100644
--- a/app/javascript/packs/public.js
+++ b/app/javascript/packs/public.js
@@ -6,7 +6,6 @@ function main() {
   const emojify = require('../mastodon/features/emoji/emoji').default;
   const { getLocale } = require('../mastodon/locales');
   const { localeData } = getLocale();
-  const VideoContainer = require('../mastodon/containers/video_container').default;
   const React = require('react');
   const ReactDOM = require('react-dom');
 
@@ -51,30 +50,16 @@ function main() {
       });
     });
 
-    [].forEach.call(document.querySelectorAll('[data-component="Video"]'), (content) => {
-      const props = JSON.parse(content.getAttribute('data-props'));
-      ReactDOM.render(<VideoContainer locale={locale} {...props} />, content);
-    });
-
-    const cards = document.querySelectorAll('[data-component="Card"]');
-
-    if (cards.length > 0) {
-      import(/* webpackChunkName: "containers/cards_container" */ '../mastodon/containers/cards_container').then(({ default: CardsContainer }) => {
-        const content = document.createElement('div');
-
-        ReactDOM.render(<CardsContainer locale={locale} cards={cards} />, content);
-        document.body.appendChild(content);
-      }).catch(error => console.error(error));
-    }
-
-    const mediaGalleries = document.querySelectorAll('[data-component="MediaGallery"]');
-
-    if (mediaGalleries.length > 0) {
-      const MediaGalleriesContainer = require('../mastodon/containers/media_galleries_container').default;
-      const content = document.createElement('div');
+    const reactComponents = document.querySelectorAll('[data-component]');
+    if (reactComponents.length > 0) {
+      import(/* webpackChunkName: "containers/media_container" */ '../mastodon/containers/media_container')
+        .then(({ default: MediaContainer }) => {
+          const content = document.createElement('div');
 
-      ReactDOM.render(<MediaGalleriesContainer locale={locale} galleries={mediaGalleries} />, content);
-      document.body.appendChild(content);
+          ReactDOM.render(<MediaContainer locale={locale} components={reactComponents} />, content);
+          document.body.appendChild(content);
+        })
+        .catch(error => console.error(error));
     }
   });
 }