chore(app): cleanup main files

This commit is contained in:
DanCodes committed 2024-01-09 13:18:54 +00:00
1 parent 5bb89c1b08
commit d3b367b948
15 files changed
+427 -408

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { useState } from "react";
import useKonami from "react-use-konami";
export const useKonamiEasterEgg = () => {
const [easterEgg, setEasterEgg] = useState(false);
const sixtyNine = () => {
setEasterEgg(true);
};
useKonami(sixtyNine, {
code: [
"ArrowUp",
"ArrowUp",
"ArrowDown",
"ArrowDown",
"ArrowLeft",
"ArrowRight",
"ArrowLeft",
"ArrowRight",
"b",
"a",
],
});
return [easterEgg, setEasterEgg] as const;
};
+8
View File
@@ -0,0 +1,8 @@
import { relaunch } from "@tauri-apps/api/process";
export const handleRelaunch = async (_event: unknown, reason?: string) => {
if (reason && reason === "backdropClick") {
return;
}
await relaunch();
};
+5 -3
View File
@@ -1,6 +1,6 @@
import { appLocalDataDir, join } from "@tauri-apps/api/path";
import { Store } from "tauri-plugin-store-api";
// TODO: Add encryption to user data
export interface UserStore {
user: {
Name: string;
@@ -8,7 +8,8 @@ export interface UserStore {
};
}
const user = new Store(".user.dat");
const base = await appLocalDataDir();
const user = new Store(await join(base, ".user.dat"));
/**
* Set User details to .user.dat
@@ -16,8 +17,9 @@ const user = new Store(".user.dat");
const saveUser = async (userName: string, userPassword?: string) => {
user.set("user", {
Name: userName,
Password: userPassword || "",
Password: userPassword,
});
await user.save();
};
+3 -1
View File
@@ -9,7 +9,9 @@ import { v4 as uuidv4 } from "uuid";
export const axiosClient = axios.create({
adapter: axiosTauriApiAdapter,
headers: { "Access-Control-Allow-Origin": "*" },
headers: {
"Access-Control-Allow-Origin": "*",
},
timeout: 60000,
});