diff --git a/package-lock.json b/package-lock.json index 23136ed..035cd05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "@ilittlebig/easy-auth": "^0.0.9", "@tauri-apps/api": "^2", "@tauri-apps/plugin-dialog": "^2.0.1", + "@tauri-apps/plugin-fs": "^2.0.2", "@tauri-apps/plugin-process": "^2.0.0", "@tauri-apps/plugin-shell": "^2", "@tauri-apps/plugin-updater": "^2.0.0", @@ -2563,6 +2564,15 @@ "@tauri-apps/api": "^2.0.0" } }, + "node_modules/@tauri-apps/plugin-fs": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-fs/-/plugin-fs-2.0.2.tgz", + "integrity": "sha512-4YZaX2j7ta81M5/DL8aN10kTnpUkEpkPo1FTYPT8Dd0ImHe3azM8i8MrtjrDGoyBYLPO3zFv7df/mSCYF8oA0Q==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.0.0" + } + }, "node_modules/@tauri-apps/plugin-process": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.0.0.tgz", diff --git a/package.json b/package.json index 26c045c..e620adb 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@ilittlebig/easy-auth": "^0.0.9", "@tauri-apps/api": "^2", "@tauri-apps/plugin-dialog": "^2.0.1", + "@tauri-apps/plugin-fs": "^2.0.2", "@tauri-apps/plugin-process": "^2.0.0", "@tauri-apps/plugin-shell": "^2", "@tauri-apps/plugin-updater": "^2.0.0", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 441776c..ac2f4b0 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Jaafar" -version = "0.0.3" +version = "0.0.5" dependencies = [ "cocoa 0.25.0", "objc", @@ -14,6 +14,7 @@ dependencies = [ "tauri", "tauri-build", "tauri-plugin-dialog", + "tauri-plugin-fs", "tauri-plugin-process", "tauri-plugin-shell", "tauri-plugin-updater", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 71c53db..7268d3d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "Jaafar" -version = "0.0.4" +version = "0.0.5" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -20,6 +20,7 @@ serde_json = "1" rand = "0.8.5" tauri-plugin-dialog = "2" tauri-plugin-process = "2" +tauri-plugin-fs = "2" [target.'cfg(target_os = "macos")'.dependencies] cocoa = "0.25.0" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 4c42458..5af2c15 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -11,6 +11,9 @@ "core:window:default", "core:window:allow-start-dragging", "dialog:default", - "process:default" + "process:default", + "fs:default", + "fs:allow-appdata-write", + "fs:allow-appdata-read" ] -} \ No newline at end of file +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 071c7bf..7c76326 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -12,6 +12,7 @@ use plugins::tauri_traffic_light_positioner_plugin; #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() + .plugin(tauri_plugin_fs::init()) .plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_updater::Builder::new().build()) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1f8901a..6e0ace8 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "$schema": "https://schema.tauri.app/config/2", - "identifier": "com.jaafar.app", + "identifier": "com.jaafar.application", "build": { "beforeDevCommand": "npm run dev", "devUrl": "http://localhost:1420", diff --git a/src/lib/components/dialogs/auth/sign-out-dialog.svelte b/src/lib/components/dialogs/auth/sign-out-dialog.svelte index 500dba3..1d24b4b 100644 --- a/src/lib/components/dialogs/auth/sign-out-dialog.svelte +++ b/src/lib/components/dialogs/auth/sign-out-dialog.svelte @@ -28,7 +28,7 @@ - Confirm Sign-Out + Confirm Sign Out Please confirm if you would like to sign out of your account. diff --git a/src/lib/components/dialogs/settings-dialog.svelte b/src/lib/components/dialogs/settings-dialog.svelte new file mode 100644 index 0000000..ab05781 --- /dev/null +++ b/src/lib/components/dialogs/settings-dialog.svelte @@ -0,0 +1,110 @@ + + + + + + + + Settings +
+ +
+
+ +
+ + +
+ {#each pages as { name, page: Page }} + + + + {/each} +
+
+
+
+
+
diff --git a/src/lib/components/header.svelte b/src/lib/components/header.svelte index 2c0ff58..e2d92f7 100644 --- a/src/lib/components/header.svelte +++ b/src/lib/components/header.svelte @@ -11,12 +11,4 @@ > - diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte deleted file mode 100644 index 1ce9feb..0000000 --- a/src/lib/components/navbar.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/src/lib/components/navbar-button.svelte b/src/lib/components/navigation-button.svelte similarity index 100% rename from src/lib/components/navbar-button.svelte rename to src/lib/components/navigation-button.svelte diff --git a/src/lib/components/settings/account-settings-page.svelte b/src/lib/components/settings/account-settings-page.svelte new file mode 100644 index 0000000..b628e5c --- /dev/null +++ b/src/lib/components/settings/account-settings-page.svelte @@ -0,0 +1,3 @@ +
+ account settings +
diff --git a/src/lib/components/settings/billing-page.svelte b/src/lib/components/settings/billing-page.svelte new file mode 100644 index 0000000..1668710 --- /dev/null +++ b/src/lib/components/settings/billing-page.svelte @@ -0,0 +1,3 @@ +
+ billing +
diff --git a/src/lib/components/settings/integration-page.svelte b/src/lib/components/settings/integration-page.svelte new file mode 100644 index 0000000..2e0498d --- /dev/null +++ b/src/lib/components/settings/integration-page.svelte @@ -0,0 +1,135 @@ + + +
+ + + {#snippet children({ props })} +
+ Captcha Solver + + {selectedCaptcha} + + {#each captchaSolvers as captchaSolver} + {captchaSolver.label} + {/each} + + +

Required for solving captchas on supported websites.

+
+ {/snippet} +
+ +
+ {#if !!$formData.integration.captcha_solver} + + + {#snippet children({ props })} +
+ Captcha API Key + +
+ {/snippet} +
+ +
+ {/if} + + + + {#snippet children({ props })} +
+ Request Delay + +

Configure the delay (in milliseconds) between automated actions.

+
+ {/snippet} +
+ +
+ + + {#snippet children({ props })} +
+ Entry Limit + +

Sets the maximum number of entries/tasks to process per request.

+
+ {/snippet} +
+ +
+ + + + {#snippet children({ props })} +
+ IMAP Email + +
+ {/snippet} +
+ +
+ + + {#snippet children({ props })} +
+ IMAP Password + +
+ {/snippet} +
+ +
+ + + + {#snippet children({ props })} +
+ Webhook + +

Configure a URL for handling webhook events.

+
+ {/snippet} +
+ +
+
diff --git a/src/lib/components/settings/notifications-page.svelte b/src/lib/components/settings/notifications-page.svelte new file mode 100644 index 0000000..8f04956 --- /dev/null +++ b/src/lib/components/settings/notifications-page.svelte @@ -0,0 +1,3 @@ +
+ notifications +
diff --git a/src/lib/components/settings/preferences-page.svelte b/src/lib/components/settings/preferences-page.svelte new file mode 100644 index 0000000..9cacc31 --- /dev/null +++ b/src/lib/components/settings/preferences-page.svelte @@ -0,0 +1,3 @@ +
+ preferences +
diff --git a/src/lib/components/settings/privacy-page.svelte b/src/lib/components/settings/privacy-page.svelte new file mode 100644 index 0000000..5b7cc9d --- /dev/null +++ b/src/lib/components/settings/privacy-page.svelte @@ -0,0 +1,3 @@ +
+ privacy +
diff --git a/src/lib/components/settings/security-page.svelte b/src/lib/components/settings/security-page.svelte new file mode 100644 index 0000000..50592d9 --- /dev/null +++ b/src/lib/components/settings/security-page.svelte @@ -0,0 +1,3 @@ +
+ security +
diff --git a/src/lib/components/settings/sidebar.svelte b/src/lib/components/settings/sidebar.svelte new file mode 100644 index 0000000..7dae13b --- /dev/null +++ b/src/lib/components/settings/sidebar.svelte @@ -0,0 +1,36 @@ + + +
+ {#each pages as page} + + {#snippet child({ props })} + + {/snippet} + + {/each} +
diff --git a/src/lib/components/sidebar.svelte b/src/lib/components/sidebar.svelte new file mode 100644 index 0000000..5b4f951 --- /dev/null +++ b/src/lib/components/sidebar.svelte @@ -0,0 +1,26 @@ + + +
+
+
+
+ +
+ +
+
diff --git a/src/lib/components/ui/scroll-area/index.ts b/src/lib/components/ui/scroll-area/index.ts new file mode 100644 index 0000000..e86a25b --- /dev/null +++ b/src/lib/components/ui/scroll-area/index.ts @@ -0,0 +1,10 @@ +import Scrollbar from "./scroll-area-scrollbar.svelte"; +import Root from "./scroll-area.svelte"; + +export { + Root, + Scrollbar, + //, + Root as ScrollArea, + Scrollbar as ScrollAreaScrollbar, +}; diff --git a/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte b/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte new file mode 100644 index 0000000..b436056 --- /dev/null +++ b/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte @@ -0,0 +1,29 @@ + + + + {@render children?.()} + + diff --git a/src/lib/components/ui/scroll-area/scroll-area.svelte b/src/lib/components/ui/scroll-area/scroll-area.svelte new file mode 100644 index 0000000..9943f83 --- /dev/null +++ b/src/lib/components/ui/scroll-area/scroll-area.svelte @@ -0,0 +1,32 @@ + + + + + {@render children?.()} + + {#if orientation === "vertical" || orientation === "both"} + + {/if} + {#if orientation === "horizontal" || orientation === "both"} + + {/if} + + diff --git a/src/lib/components/ui/select/index.ts b/src/lib/components/ui/select/index.ts new file mode 100644 index 0000000..f31b8ae --- /dev/null +++ b/src/lib/components/ui/select/index.ts @@ -0,0 +1,34 @@ +import { Select as SelectPrimitive } from "bits-ui"; + +import GroupHeading from "./select-group-heading.svelte"; +import Item from "./select-item.svelte"; +import Content from "./select-content.svelte"; +import Trigger from "./select-trigger.svelte"; +import Separator from "./select-separator.svelte"; +import ScrollDownButton from "./select-scroll-down-button.svelte"; +import ScrollUpButton from "./select-scroll-up-button.svelte"; + +const Root = SelectPrimitive.Root; +const Group = SelectPrimitive.Group; + +export { + Root, + Group, + GroupHeading, + Item, + Content, + Trigger, + Separator, + ScrollDownButton, + ScrollUpButton, + // + Root as Select, + Group as SelectGroup, + GroupHeading as SelectGroupHeading, + Item as SelectItem, + Content as SelectContent, + Trigger as SelectTrigger, + Separator as SelectSeparator, + ScrollDownButton as SelectScrollDownButton, + ScrollUpButton as SelectScrollUpButton, +}; diff --git a/src/lib/components/ui/select/select-content.svelte b/src/lib/components/ui/select/select-content.svelte new file mode 100644 index 0000000..56916ef --- /dev/null +++ b/src/lib/components/ui/select/select-content.svelte @@ -0,0 +1,39 @@ + + + + + + + {@render children?.()} + + + + diff --git a/src/lib/components/ui/select/select-group-heading.svelte b/src/lib/components/ui/select/select-group-heading.svelte new file mode 100644 index 0000000..7984bef --- /dev/null +++ b/src/lib/components/ui/select/select-group-heading.svelte @@ -0,0 +1,16 @@ + + + diff --git a/src/lib/components/ui/select/select-item.svelte b/src/lib/components/ui/select/select-item.svelte new file mode 100644 index 0000000..c3a77db --- /dev/null +++ b/src/lib/components/ui/select/select-item.svelte @@ -0,0 +1,37 @@ + + + + {#snippet children({ selected, highlighted })} + + {#if selected} + + {/if} + + {#if childrenProp} + {@render childrenProp({ selected, highlighted })} + {:else} + {label || value} + {/if} + {/snippet} + diff --git a/src/lib/components/ui/select/select-scroll-down-button.svelte b/src/lib/components/ui/select/select-scroll-down-button.svelte new file mode 100644 index 0000000..b927d62 --- /dev/null +++ b/src/lib/components/ui/select/select-scroll-down-button.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/components/ui/select/select-scroll-up-button.svelte b/src/lib/components/ui/select/select-scroll-up-button.svelte new file mode 100644 index 0000000..b8939ba --- /dev/null +++ b/src/lib/components/ui/select/select-scroll-up-button.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/src/lib/components/ui/select/select-separator.svelte b/src/lib/components/ui/select/select-separator.svelte new file mode 100644 index 0000000..38a3ab0 --- /dev/null +++ b/src/lib/components/ui/select/select-separator.svelte @@ -0,0 +1,13 @@ + + + diff --git a/src/lib/components/ui/select/select-trigger.svelte b/src/lib/components/ui/select/select-trigger.svelte new file mode 100644 index 0000000..f917f13 --- /dev/null +++ b/src/lib/components/ui/select/select-trigger.svelte @@ -0,0 +1,24 @@ + + +span]:line-clamp-1", + className + )} + {...restProps} +> + {@render children?.()} + + diff --git a/src/lib/components/ui/separator/index.ts b/src/lib/components/ui/separator/index.ts new file mode 100644 index 0000000..82442d2 --- /dev/null +++ b/src/lib/components/ui/separator/index.ts @@ -0,0 +1,7 @@ +import Root from "./separator.svelte"; + +export { + Root, + // + Root as Separator, +}; diff --git a/src/lib/components/ui/separator/separator.svelte b/src/lib/components/ui/separator/separator.svelte new file mode 100644 index 0000000..839494d --- /dev/null +++ b/src/lib/components/ui/separator/separator.svelte @@ -0,0 +1,22 @@ + + + diff --git a/src/lib/components/ui/tabs/index.ts b/src/lib/components/ui/tabs/index.ts new file mode 100644 index 0000000..f1ab372 --- /dev/null +++ b/src/lib/components/ui/tabs/index.ts @@ -0,0 +1,18 @@ +import { Tabs as TabsPrimitive } from "bits-ui"; +import Content from "./tabs-content.svelte"; +import List from "./tabs-list.svelte"; +import Trigger from "./tabs-trigger.svelte"; + +const Root = TabsPrimitive.Root; + +export { + Root, + Content, + List, + Trigger, + // + Root as Tabs, + Content as TabsContent, + List as TabsList, + Trigger as TabsTrigger, +}; diff --git a/src/lib/components/ui/tabs/tabs-content.svelte b/src/lib/components/ui/tabs/tabs-content.svelte new file mode 100644 index 0000000..f1c0515 --- /dev/null +++ b/src/lib/components/ui/tabs/tabs-content.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/tabs/tabs-list.svelte b/src/lib/components/ui/tabs/tabs-list.svelte new file mode 100644 index 0000000..f03e5fc --- /dev/null +++ b/src/lib/components/ui/tabs/tabs-list.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/tabs/tabs-trigger.svelte b/src/lib/components/ui/tabs/tabs-trigger.svelte new file mode 100644 index 0000000..f1f5825 --- /dev/null +++ b/src/lib/components/ui/tabs/tabs-trigger.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/user-menu.svelte b/src/lib/components/user-menu.svelte index 4973855..5305a88 100644 --- a/src/lib/components/user-menu.svelte +++ b/src/lib/components/user-menu.svelte @@ -2,6 +2,7 @@ import { Button } from "$lib/components/ui/button"; import * as DropdownMenu from "$lib/components/ui/dropdown-menu"; import { signOutDialog } from "$lib/components/dialogs/auth/sign-out-dialog.svelte"; + import { settingsDialog } from "$lib/components/dialogs/settings-dialog.svelte"; @@ -27,12 +28,10 @@ - Profile - + settingsDialog.open = true}> Settings ⌘, - Billing signOutDialog.open = true}> Sign Out diff --git a/src/lib/schemas/settings.ts b/src/lib/schemas/settings.ts new file mode 100644 index 0000000..07d7704 --- /dev/null +++ b/src/lib/schemas/settings.ts @@ -0,0 +1,37 @@ +/** + * + * + * Author: Elias Sjödin + * Created: 2024-11-28 + */ + +import { z } from "zod"; + +const optionalString = (schema: z.ZodString) => { + return z.preprocess(value => { + if (typeof value === "string" && value.trim() === "") { + return undefined; + } + return value; + }, schema.optional()); +} + +const integrationSchema = z.object({ + captcha_solver: optionalString(z.string()), + captcha_solver_api_key: optionalString(z.string()), + request_delay: z.coerce + .number({ invalid_type_error: "Request delay must be a valid number" }) + .min(1000, { message: "Request delay must be at least 1000ms" }), + entry_limit: z.coerce + .number({ invalid_type_error: "Entry limit must be a valid number" }) + .min(1, { message: "Entry limit must be at least 1" }), + imap_email: optionalString(z.string().email({ message: "Invalid email format" })), + imap_password: optionalString(z.string()), + webhook: optionalString(z.string().url({ message: "Webhook must be a valid URL" })), +}) + +export const settingsSchema = z.object({ + integration: integrationSchema, +}); + +export type SettingsSchema = z.infer; diff --git a/src/lib/services/files-service.ts b/src/lib/services/files-service.ts new file mode 100644 index 0000000..1432a4d --- /dev/null +++ b/src/lib/services/files-service.ts @@ -0,0 +1,68 @@ +/** + * + * + * Author: Elias Sjödin + * Created: 2024-11-28 + */ + +import { appDataDir, BaseDirectory } from "@tauri-apps/api/path"; +import { + mkdir, + writeTextFile, + readTextFile, + exists, +} from "@tauri-apps/plugin-fs"; + +export const writeFile = async (fileName: string, data: any) => { + try { + const appDirExists = await exists("", { baseDir: BaseDirectory.AppData }); + if (!appDirExists) { + const appDataDirPath = await appDataDir(); + await mkdir(appDataDirPath); + } + writeTextFile(fileName, data, { baseDir: BaseDirectory.AppData }); + } catch (err) { + console.log("Could not write to file: " + fileName, err) + } +} + +export const writeFileJSON = async (fileName: string, data: any) => { + try { + await writeFile(fileName, JSON.stringify(data, null, 4)); + } catch (err) { + console.log("Could not write JSON to file: " + fileName, err) + } +} + +export const writeFileToPath = async (fileName: string, data: any) => { + try { + writeTextFile(fileName, data, { baseDir: BaseDirectory.Home }); + } catch (err) { + console.log("Could not write to file: " + fileName, err) + } +} + +export const readFile = async (fileName: string) => { + try { + const fileExists = await exists(fileName, { baseDir: BaseDirectory.AppData }); + if (!fileExists) return; + + const fileContent = await readTextFile( + fileName, + { baseDir: BaseDirectory.AppData } + ); + return fileContent; + } catch (err) { + console.log("Could not read file: " + fileName, err) + } +} + +export const readFileJSON = async (fileName: string) => { + try { + const fileContent = await readFile(fileName); + if (!fileContent) return; + return JSON.parse(fileContent); + } catch (err) { + console.log("Could not read JSON file: " + fileName, err) + } +} diff --git a/src/lib/services/hotkeys-service.ts b/src/lib/services/hotkeys-service.ts new file mode 100644 index 0000000..85143a2 --- /dev/null +++ b/src/lib/services/hotkeys-service.ts @@ -0,0 +1,31 @@ +/** + * + * + * Author: Elias Sjödin + * Created: 2024-11-28 + */ + +type Callback = (event: KeyboardEvent) => void; +let hotkeys: { [key: string]: Callback } = {}; + +export const addHotkey = (key: string, callback: Callback) => { + hotkeys = { ...hotkeys, [key]: callback }; +} + +export const removeHotkey = (key: string) => { + delete hotkeys[key]; +} + +const handleKeyDown = (event: KeyboardEvent) => { + const key = event.key.toLowerCase(); + const meta = event.metaKey ? "meta+" : ""; + const shortcut = `${meta}${key}`; + if (hotkeys[shortcut]) hotkeys[shortcut](event); +} + +const init = () => { + window.addEventListener("keydown", handleKeyDown); + return () => window.removeEventListener("keydown", handleKeyDown); +} + +export const cleanup = init(); diff --git a/src/lib/services/settings-service.svelte.ts b/src/lib/services/settings-service.svelte.ts new file mode 100644 index 0000000..64b8c87 --- /dev/null +++ b/src/lib/services/settings-service.svelte.ts @@ -0,0 +1,41 @@ +/** + * + * + * Author: Elias Sjödin + * Created: 2024-11-28 + */ + +import { readFileJSON, writeFileJSON } from "$lib/services/files-service" +import { settingsStore, settingsLoaded, type Settings } from "$lib/stores/settings-store.svelte"; +import { deepMerge } from "$lib/utils" + +const updateSettingsStore = (settings: Settings) => { + for (const key in settings) { + if (typeof settings[key] === "object" && settings[key] !== null) { + settingsStore[key] = { + ...settingsStore[key], + ...settings[key], + }; + } else { + settingsStore[key] = settings[key]; + } + } +}; + +export const loadSettings = async () => { + const settings = await readFileJSON("settings.json"); + if (settings) { + const mergedSettings = deepMerge(settingsStore, settings); + updateSettingsStore(mergedSettings); + } + await saveSettings(); + settingsLoaded.value = true; +} + +export const saveSettings = async (settings?: Settings) => { + if (settings) { + const updatedSettings = deepMerge(settingsStore, settings); + updateSettingsStore(updatedSettings); + } + await writeFileJSON("settings.json", settings || settingsStore); +} diff --git a/src/lib/stores/settings-store.svelte.ts b/src/lib/stores/settings-store.svelte.ts new file mode 100644 index 0000000..433e8bf --- /dev/null +++ b/src/lib/stores/settings-store.svelte.ts @@ -0,0 +1,22 @@ +/** + * + * + * Author: Elias Sjödin + * Created: 2024-11-28 + */ + +export type Settings = { [key: string]: Record }; + +export let settingsStore: Settings = $state({ + integration: { + captcha_solver: undefined, + captcha_solver_api_key: undefined, + request_delay: 3000, + entry_limit: 10, + imap_email: undefined, + imap_password: undefined, + webhook: undefined, + }, +}); + +export let settingsLoaded = $state({ value: false }); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index ac680b3..1e5d26c 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,6 +1,22 @@ import { type ClassValue, clsx } from "clsx"; import { twMerge } from "tailwind-merge"; +type Obj = { [key: string]: Record }; + export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } + +export const deepMerge = (target: Obj, source: Obj) => { + for (const key in source) { + if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) { + if (!target[key] || typeof target[key] !== "object") { + target[key] = {}; + } + deepMerge(target[key], source[key]); + } else { + target[key] = source[key]; + } + } + return target; +} diff --git a/src/routes/(protected)/+layout.svelte b/src/routes/(protected)/+layout.svelte index 0b3ce55..78a8756 100644 --- a/src/routes/(protected)/+layout.svelte +++ b/src/routes/(protected)/+layout.svelte @@ -1,24 +1,17 @@ +
-
-
-
-
- -
- -
-
+
diff --git a/src/routes/(protected)/accounts/+page.svelte b/src/routes/(protected)/accounts/+page.svelte new file mode 100644 index 0000000..31e606f --- /dev/null +++ b/src/routes/(protected)/accounts/+page.svelte @@ -0,0 +1,3 @@ +
+

Accounts

+
diff --git a/src/routes/(protected)/proxies/+page.svelte b/src/routes/(protected)/proxies/+page.svelte new file mode 100644 index 0000000..d869e4b --- /dev/null +++ b/src/routes/(protected)/proxies/+page.svelte @@ -0,0 +1,3 @@ +
+

Proxies

+
diff --git a/src/routes/(protected)/signups/+page.svelte b/src/routes/(protected)/signups/+page.svelte new file mode 100644 index 0000000..1ea6d09 --- /dev/null +++ b/src/routes/(protected)/signups/+page.svelte @@ -0,0 +1,3 @@ +
+

Signups

+
diff --git a/src/routes/(protected)/tasks/+page.svelte b/src/routes/(protected)/tasks/+page.svelte new file mode 100644 index 0000000..4fb84e7 --- /dev/null +++ b/src/routes/(protected)/tasks/+page.svelte @@ -0,0 +1,3 @@ +
+

Tasks

+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index f4fe034..0b750bc 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,6 +1,7 @@