[Glitch] Fix /share and cleanup and reorganize frontend locale loading

Port b0780cfeed to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput
2023-06-02 15:00:27 +02:00
committed by Claire
parent 734e186717
commit 9e66c07be7
14 changed files with 151 additions and 86 deletions

View File

@ -6,14 +6,14 @@ import ready from 'flavours/glitch/ready';
ready(() => {
[].forEach.call(document.querySelectorAll('[data-admin-component]'), element => {
const componentName = element.getAttribute('data-admin-component');
const { locale, ...componentProps } = JSON.parse(element.getAttribute('data-props'));
const { ...componentProps } = JSON.parse(element.getAttribute('data-props'));
import('flavours/glitch/containers/admin_component').then(({ default: AdminComponent }) => {
return import('flavours/glitch/components/admin/' + componentName).then(({ default: Component }) => {
const root = createRoot(element);
root.render (
<AdminComponent locale={locale}>
<AdminComponent>
<Component {...componentProps} />
</AdminComponent>,
);