@@ -10,6 +9,8 @@
import "~/composables/downloads.js";
import { invoke } from "@tauri-apps/api/core";
+import { AppStatus } from "~/types";
+import { listen } from "@tauri-apps/api/event";
import { useAppState } from "./composables/app-state.js";
import {
initialNavigation,
@@ -19,26 +20,18 @@ import {
const router = useRouter();
const state = useAppState();
+try {
+ state.value = JSON.parse(await invoke("fetch_state"));
+} catch (e) {
+ console.error("failed to parse state", e);
+}
-async function fetchState() {
+router.beforeEach(async () => {
try {
state.value = JSON.parse(await invoke("fetch_state"));
- if (!state.value)
- throw createError({
- statusCode: 500,
- statusMessage: `App state is: ${state.value}`,
- fatal: true,
- });
} catch (e) {
console.error("failed to parse state", e);
- throw e;
}
-}
-await fetchState();
-
-// This is inefficient but apparently we do it lol
-router.beforeEach(async () => {
- await fetchState();
});
setupHooks();
diff --git a/main/assets/main.scss b/assets/main.scss
similarity index 100%
rename from main/assets/main.scss
rename to assets/main.scss
diff --git a/main/assets/wallpaper.jpg b/assets/wallpaper.jpg
similarity index 100%
rename from main/assets/wallpaper.jpg
rename to assets/wallpaper.jpg
diff --git a/build.mjs b/build.mjs
deleted file mode 100644
index c4846f1..0000000
--- a/build.mjs
+++ /dev/null
@@ -1,48 +0,0 @@
-import fs from "fs";
-import process from "process";
-import childProcess from "child_process";
-import createLogger from "pino";
-
-const OUTPUT = "./.output";
-const logger = createLogger({ transport: { target: "pino-pretty" } });
-
-async function spawn(exec, opts) {
- const output = childProcess.spawn(exec, { ...opts, shell: true });
- output.stdout.on("data", (data) => {
- process.stdout.write(data);
- });
- output.stderr.on("data", (data) => {
- process.stderr.write(data);
- });
-
- return await new Promise((resolve, reject) => {
- output.on("error", (err) => reject(err));
- output.on("exit", () => resolve());
- });
-}
-
-const views = fs.readdirSync(".").filter((view) => {
- const expectedPath = `./${view}/package.json`;
- return fs.existsSync(expectedPath);
-});
-
-fs.mkdirSync(OUTPUT, { recursive: true });
-
-for (const view of views) {
- const loggerChild = logger.child({});
- process.chdir(`./${view}`);
-
- loggerChild.info(`Install deps for "${view}"`);
- await spawn("yarn");
-
- loggerChild.info(`Building "${view}"`);
- await spawn("yarn build", {
- env: { ...process.env, NUXT_APP_BASE_URL: `/${view}/` },
- });
-
- process.chdir("..");
-
- fs.cpSync(`./${view}/.output/public`, `${OUTPUT}/${view}`, {
- recursive: true,
- });
-}
\ No newline at end of file
diff --git a/main/components/GameOptions/Launch.vue b/components/GameOptions/Launch.vue
similarity index 100%
rename from main/components/GameOptions/Launch.vue
rename to components/GameOptions/Launch.vue
diff --git a/main/components/GameOptionsModal.vue b/components/GameOptionsModal.vue
similarity index 100%
rename from main/components/GameOptionsModal.vue
rename to components/GameOptionsModal.vue
diff --git a/main/components/GameStatusButton.vue b/components/GameStatusButton.vue
similarity index 86%
rename from main/components/GameStatusButton.vue
rename to components/GameStatusButton.vue
index 1dea40b..9731721 100644
--- a/main/components/GameStatusButton.vue
+++ b/components/GameStatusButton.vue
@@ -46,7 +46,7 @@
class="absolute right-0 z-[500] mt-2 w-32 origin-top-right rounded-md bg-zinc-900 shadow-lg ring-1 ring-zinc-100/5 focus:outline-none"
>
-
-
+