mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-22 21:26:52 +00:00
734e186717
Conflicts: - `app/javascript/mastodon/load_locale.js`: The file moved to `app/javascript/mastodon/locales/load_locale.ts`. Ported the changes there and deleted `app/javascript/mastodon/load_locale.js`. - `app/javascript/mastodon/locales/index.js`: The file moved to `app/javascript/mastodon/locales/index.ts`. Did *not* port the changes as I want to try something a bit different.
26 lines
814 B
JavaScript
26 lines
814 B
JavaScript
import './public-path';
|
|
import { createRoot } from 'react-dom/client';
|
|
|
|
import ready from '../mastodon/ready';
|
|
|
|
ready(() => {
|
|
[].forEach.call(document.querySelectorAll('[data-admin-component]'), element => {
|
|
const componentName = element.getAttribute('data-admin-component');
|
|
const componentProps = JSON.parse(element.getAttribute('data-props'));
|
|
|
|
import('../mastodon/containers/admin_component').then(({ default: AdminComponent }) => {
|
|
return import('../mastodon/components/admin/' + componentName).then(({ default: Component }) => {
|
|
const root = createRoot(element);
|
|
|
|
root.render (
|
|
<AdminComponent>
|
|
<Component {...componentProps} />
|
|
</AdminComponent>,
|
|
);
|
|
});
|
|
}).catch(error => {
|
|
console.error(error);
|
|
});
|
|
});
|
|
});
|