diff --git a/src/components/Loader.astro b/src/components/Loader.astro index 0bf28b8..fe1864b 100644 --- a/src/components/Loader.astro +++ b/src/components/Loader.astro @@ -2,6 +2,7 @@ import { Settings } from "@utils/settings.ts"; import { SW } from "@utils/proxy.ts"; const settings = new Settings(); + window.settings = settings; const sw = new SW(); diff --git a/src/components/ui/Dropdown.astro b/src/components/ui/Dropdown.astro new file mode 100644 index 0000000..f5c0d5b --- /dev/null +++ b/src/components/ui/Dropdown.astro @@ -0,0 +1,17 @@ +--- +import type { DropdownOptions } from "@utils/types"; +interface Props { + title?: string; + id: string; + options: DropdownOptions[]; +} + +const { title, id, options } = Astro.props; +--- + + diff --git a/src/components/ui/Input.astro b/src/components/ui/Input.astro new file mode 100644 index 0000000..e69de29 diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 9bbfa77..0d9c720 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,8 +1,18 @@ --- -import "@styles/global.css"; +import { readdir } from "node:fs"; +import { join as pathJoin } from "node:path"; +//import "@styles/global.css"; import { ClientRouter } from "astro:transitions"; import Loader from "@components/Loader.astro"; import Header from "@components/Header.astro"; + +import "@styles/global.css"; +import "@styles/default.css"; +readdir(pathJoin(import.meta.dirname, '..', 'styles', 'themes'), { encoding: 'utf-8' }, (err, files) => { + files.forEach(async (name) => { + await import(`../styles/themes/${name.replace('.css', '')}.css`) + }); +}); --- diff --git a/src/pages/[...settings]/proxy.astro b/src/pages/[...settings]/proxy.astro index 1bd8028..0a944d3 100644 --- a/src/pages/[...settings]/proxy.astro +++ b/src/pages/[...settings]/proxy.astro @@ -1,7 +1,41 @@ --- import SettingsLayout from "@layouts/SettingsLayout.astro"; +import Dropdown from "@components/ui/Dropdown.astro"; +import { SearchEngines, type DropdownOptions } from "@utils/types"; +const SearchEngineOptions: DropdownOptions[] = []; +Object.keys(SearchEngines).forEach((k) => SearchEngineOptions.push( + { name: k, value: SearchEngines[k] } +)); --- -
+
+

Proxy

+
+
+
+

Proxy Switcher

+ +
+
+

Proxy Switcher

+ +
+
+

Search Engine

+ +
+
+
+
diff --git a/src/styles/themes/default.css b/src/styles/default.css similarity index 100% rename from src/styles/themes/default.css rename to src/styles/default.css diff --git a/src/styles/global.css b/src/styles/global.css index 99e6ca0..35e6ca4 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -1,12 +1,5 @@ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap'); -/* Themes belong here */ -@import "./themes/default.css"; /* DO NOT MOVE THIS FROM HERE OTHERWISE, THEMES WILL FAIL TO WORK */ -@import "./themes/bluelight.css"; -@import "./themes/cyberpunk.css"; -@import "./themes/midnight.css"; -/* End theme imports */ - @import "tailwindcss"; @theme { diff --git a/src/utils/types.ts b/src/utils/types.ts index 6f7d76c..5d5d401 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -4,4 +4,16 @@ interface SettingsProps extends Props { active: 'appearance' | 'credits' | 'links' | 'proxy'; } -export type { SettingsProps }; +type DropdownOptions = { + name: string; + value: string; + default?: boolean; +}; + +const SearchEngines: Record = { + DuckDuckGo: "https://duckduckgo.com/?q=%s", + Google: "https://google.com/search?q=%s", + Bing: "https://bing.com/search?q=%s", +}; + +export { type SettingsProps, type DropdownOptions, SearchEngines };