Rename home to landing page
This commit is contained in:
@@ -3,9 +3,47 @@
|
||||
{% block content %}
|
||||
|
||||
<div id="mithril-loader"></div>
|
||||
|
||||
<script id="mithril-data" type="application/json">
|
||||
{
|
||||
"component": {{ component | tojson | safe }},
|
||||
"props": {{ props | tojson | safe }},
|
||||
"shared": {{ shared | tojson | safe }},
|
||||
"errors": {{ errors | tojson | safe }},
|
||||
"flash": {{ flash | tojson | safe }}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
m.mount(document.getElementById('mithril-loader'), {
|
||||
view: () => m(DiffView, {{ props | tojson | safe }})
|
||||
});
|
||||
const componentMap = {
|
||||
Alert,
|
||||
DiffView,
|
||||
Editor,
|
||||
ResponseView
|
||||
};
|
||||
|
||||
const dataElement = document.getElementById('mithril-data');
|
||||
const data = JSON.parse(dataElement.textContent);
|
||||
|
||||
const componentName = data.component;
|
||||
const props = data.props;
|
||||
const shared = data.shared;
|
||||
const errors = data.errors;
|
||||
const flash = data.flash;
|
||||
|
||||
const component = componentMap[componentName];
|
||||
|
||||
if (component) {
|
||||
m.mount(document.getElementById('mithril-loader'), {
|
||||
view: () => m(component, { ...props, ...shared, errors, flash })
|
||||
});
|
||||
} else {
|
||||
console.error(`Component "${componentName}" not found.`);
|
||||
document.getElementById('mithril-loader').innerHTML = `
|
||||
<div class="p-4 bg-red-100 text-red-800 rounded">
|
||||
<strong>Error:</strong> Mithril component "<strong>${componentName}</strong>" not found.
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user