diff --git a/src/UI/CustomThemeError.svelte b/src/UI/CustomThemeError.svelte
new file mode 100644
index 0000000000..48d8cdb17a
--- /dev/null
+++ b/src/UI/CustomThemeError.svelte
@@ -0,0 +1,31 @@
+
+
+
+
+
Something went wrong
+
{stack[0]}
+ {#each stack.slice(1) as stck}
+
{stck}
+ {/each}
+ {#if customDefinition}
+
+ {/if}
+
diff --git a/src/index.ts b/src/index.ts
index 2150cdd0ec..f7afb22783 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,19 +1,13 @@
import DetermineTheme from "./Logic/DetermineTheme"
-import SvelteUIElement from "./UI/Base/SvelteUIElement"
-import { FixedUiElement } from "./UI/Base/FixedUiElement"
-import Combine from "./UI/Base/Combine"
-import { SubtleButton } from "./UI/Base/SubtleButton"
-import { Utils } from "./Utils"
-import ArrowDownTray from "@babeard/svelte-heroicons/mini/ArrowDownTray"
import SingleThemeGui from "./UI/SingleThemeGui.svelte"
+import CustomThemeError from "./UI/CustomThemeError.svelte"
async function main() {
+ const target = document.getElementById("maindiv")
+ const childs = Array.from(target.children)
try {
-
const theme = await DetermineTheme.getTheme()
- const target = document.getElementById("maindiv")
- const childs = Array.from(target.children)
new SingleThemeGui({
target,
props: { theme }
@@ -25,22 +19,15 @@ async function main() {
} catch (err) {
console.error("Error while initializing: ", err, err.stack)
const customDefinition = DetermineTheme.getCustomDefinition()
- new Combine([
- new FixedUiElement(err.toString().split("\n").join("
")).SetClass("block alert"),
- customDefinition?.length > 0
- ? new SubtleButton(
- new SvelteUIElement(ArrowDownTray),
- "Download the raw file"
- ).onClick(() =>
- Utils.offerContentsAsDownloadableFile(
- DetermineTheme.getCustomDefinition(),
- "mapcomplete-theme.json",
- { mimetype: "application/json" }
- )
- )
- : undefined,
- ]).AttachTo("maindiv")
+ new CustomThemeError({
+ target,
+ props: {
+ stack: err.toString().split("\n"),
+ customDefinition
+ }
+ })
+
}
}