2021-10-15 03:44:59 +09:00
|
|
|
import 'packs/public-path';
|
2023-05-22 22:48:01 +09:00
|
|
|
import { createRoot } from 'react-dom/client';
|
2021-10-15 03:44:59 +09:00
|
|
|
|
2023-05-28 23:38:10 +09:00
|
|
|
import ready from 'flavours/glitch/ready';
|
|
|
|
|
2022-02-17 00:15:22 +09:00
|
|
|
ready(() => {
|
2024-02-29 04:10:01 +09:00
|
|
|
document.querySelectorAll('[data-admin-component]').forEach(element => {
|
2022-02-17 00:15:22 +09:00
|
|
|
const componentName = element.getAttribute('data-admin-component');
|
2024-02-29 04:10:01 +09:00
|
|
|
const componentProps = JSON.parse(element.getAttribute('data-props'));
|
2022-02-17 00:15:22 +09:00
|
|
|
|
|
|
|
import('flavours/glitch/containers/admin_component').then(({ default: AdminComponent }) => {
|
|
|
|
return import('flavours/glitch/components/admin/' + componentName).then(({ default: Component }) => {
|
2023-05-22 22:48:01 +09:00
|
|
|
const root = createRoot(element);
|
|
|
|
|
|
|
|
root.render (
|
2023-06-02 22:00:27 +09:00
|
|
|
<AdminComponent>
|
2022-02-17 00:15:22 +09:00
|
|
|
<Component {...componentProps} />
|
2023-05-22 22:48:01 +09:00
|
|
|
</AdminComponent>,
|
|
|
|
);
|
2021-11-13 03:11:51 +09:00
|
|
|
});
|
2022-02-17 00:15:22 +09:00
|
|
|
}).catch(error => {
|
|
|
|
console.error(error);
|
2021-11-13 03:11:51 +09:00
|
|
|
});
|
|
|
|
});
|
2022-02-17 00:15:22 +09:00
|
|
|
});
|