1
0
Fork 0

Add tsx syntax to main.

This commit is contained in:
Kitteh 2021-05-24 09:48:13 +01:00
parent df76573557
commit 92f976fc93
3 changed files with 17 additions and 30 deletions

View file

@ -17,45 +17,32 @@ import "prismjs/components/prism-json";
Prism.highlightAll(); Prism.highlightAll();
/* eslint-enable */ /* eslint-enable */
// Actual Imports // @ts-ignore
import translations from "./translations/index.mjs";
// Actual Imports
import { PageRouter } from "z-pagerouter"; import { PageRouter } from "z-pagerouter";
import { formatDistance } from "./formatDistance"; import { formatDistance } from "./formatDistance";
import { getSealStatus } from "./api/sys/getSealStatus"; import { getSealStatus } from "./api/sys/getSealStatus";
import { makeElement } from "z-makeelement";
import { pageList } from "./allPages"; import { pageList } from "./allPages";
import { pageState } from "./globalPageState"; import { pageState } from "./globalPageState";
import { playground } from "./playground"; import { playground } from "./playground";
import { reloadNavBar } from "./elements/NavBar"; import { reloadNavBar } from "./elements/NavBar";
import { render } from "preact";
import i18next from "i18next"; import i18next from "i18next";
// @ts-ignore
import translations from "./translations/index.mjs";
async function onLoad(): Promise<void> { async function onLoad(): Promise<void> {
document.body.innerHTML = ""; render(
document.body.appendChild(makeElement({ tag: "div", id: "navBarBox" })); <>
document.body.appendChild( <div id="navBarBox" />
makeElement({ <div class="uk-container uk-container-medium uk-align-center">
tag: "div", <div class="uk-card uk-card-body">
class: ["uk-container", "uk-container-medium", "uk-align-center"], <h3 class="uk-card-title" id="pageTitle" />
children: makeElement({ <div id="pageContent" />
tag: "div", </div>
class: ["uk-card", "uk-card-body"], </div>
children: [ </>,
makeElement({ document.body,
tag: "h3",
class: "uk-card-title",
id: "pageTitle",
text: "",
}),
makeElement({
tag: "div",
id: "pageContent",
}),
],
}),
}),
); );
const pageRouter = new PageRouter( const pageRouter = new PageRouter(

View file

@ -12,7 +12,7 @@ let commitHash = gitRevisionPlugin.commithash();
module.exports = { module.exports = {
mode: "development", mode: "development",
cache: true, cache: true,
entry: './src/main.ts', entry: './src/main.tsx',
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js', filename: 'bundle.js',

View file

@ -33,7 +33,7 @@ let commitHash = gitRevisionPlugin.commithash();
module.exports = { module.exports = {
mode: "production", mode: "production",
cache: false, cache: false,
entry: './src/main.ts', entry: './src/main.tsx',
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js', filename: 'bundle.js',