From 85c31ee8d278ac6fa1f0ba143b78d65e5f665f32 Mon Sep 17 00:00:00 2001 From: Tyler Flowers Date: Sun, 26 Nov 2023 15:57:52 -0500 Subject: [PATCH 01/75] initial cleanup --- apps/website/config.ts | 36 - apps/website/package.json | 2 +- apps/website/public/media/index/index1.svg | 10 + apps/website/public/media/index/index2.svg | 11 + apps/website/public/media/index/index3.svg | 105 + apps/website/src/components/base/Button.astro | 3 +- .../src/components/base/CodeBlock.astro | 70 +- .../website/src/components/base/Section.astro | 6 +- apps/website/src/components/logos/Logo.astro | 7 +- apps/website/src/layouts/Layout.astro | 1 + apps/website/src/pages/index.astro | 138 +- apps/website/tailwind.config.cjs | 3 + apps/website/yarn.lock | 3815 +++++++++++++++++ 13 files changed, 4019 insertions(+), 188 deletions(-) create mode 100644 apps/website/public/media/index/index1.svg create mode 100644 apps/website/public/media/index/index2.svg create mode 100644 apps/website/public/media/index/index3.svg create mode 100644 apps/website/yarn.lock diff --git a/apps/website/config.ts b/apps/website/config.ts index 19c92a4..b483705 100644 --- a/apps/website/config.ts +++ b/apps/website/config.ts @@ -28,42 +28,6 @@ export const configConst = { function getProjects(): Project[] { return [ - { - name: 'OneConfig', - description: 'The next-generation config library for Forge and Fabric', - logo: 'oneconfig.minimal', - tag: 'BETA' - }, - { - name: 'OneLauncher', - description: 'The next-generation launcher for Forge and Fabric', - logo: 'polyfrost.minimal', - tag: 'SOON' - }, - { - name: 'OneConfig', - description: 'The next-generation config library for Forge and Fabric', - logo: 'oneconfig.minimal', - tag: 'BETA' - }, - { - name: 'OneLauncher', - description: 'The next-generation launcher for Forge and Fabric', - logo: 'polyfrost.minimal', - tag: 'SOON' - }, - { - name: 'OneConfig', - description: 'The next-generation config library for Forge and Fabric', - logo: 'oneconfig.minimal', - tag: 'BETA' - }, - { - name: 'OneLauncher', - description: 'The next-generation launcher for Forge and Fabric', - logo: 'polyfrost.minimal', - tag: 'SOON' - }, { name: 'OneConfig', description: 'The next-generation config library for Forge and Fabric', diff --git a/apps/website/package.json b/apps/website/package.json index 7d10673..0cd0c4e 100644 --- a/apps/website/package.json +++ b/apps/website/package.json @@ -14,7 +14,7 @@ "tailwindcss": "^3.3.3" }, "devDependencies": { - "@polyfrost/config": "workspace:*", + "@polyfrost/config": "../../packages/config", "@types/node": "~18.17.19", "node-html-parser": "^6.1.10", "typescript": "^5.2.2" diff --git a/apps/website/public/media/index/index1.svg b/apps/website/public/media/index/index1.svg new file mode 100644 index 0000000..46c9513 --- /dev/null +++ b/apps/website/public/media/index/index1.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/website/public/media/index/index2.svg b/apps/website/public/media/index/index2.svg new file mode 100644 index 0000000..4abfa8b --- /dev/null +++ b/apps/website/public/media/index/index2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/apps/website/public/media/index/index3.svg b/apps/website/public/media/index/index3.svg new file mode 100644 index 0000000..fc10294 --- /dev/null +++ b/apps/website/public/media/index/index3.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/website/src/components/base/Button.astro b/apps/website/src/components/base/Button.astro index adbc656..0a4dc9f 100644 --- a/apps/website/src/components/base/Button.astro +++ b/apps/website/src/components/base/Button.astro @@ -4,8 +4,9 @@ import Icon from "@components/icons/Icon.astro"; import type { HTMLAttributes } from "astro/types"; const styles = { + // TODO: adjust active / disabled colors primary: "bg-blue-500 text-white hover:bg-blue-400 active:bg-blue-600 disabled:bg-blue-800 disabled:text-white-1/4", - secondary: "bg-blue-100 text-blue-500 hover:bg-blue-200 active:bg-blue-300 disabled:bg-blue-50 disabled:text-blue-200", + secondary: "bg-blue-20 text-blue-60 border-[1px] border-blue-30 hover:bg-blue-200 active:bg-blue-300 disabled:bg-blue-50 disabled:text-blue-200", } const sizes = { diff --git a/apps/website/src/components/base/CodeBlock.astro b/apps/website/src/components/base/CodeBlock.astro index 5991428..ceeecc0 100644 --- a/apps/website/src/components/base/CodeBlock.astro +++ b/apps/website/src/components/base/CodeBlock.astro @@ -2,20 +2,62 @@ --- -
-	{`public class MyConfig {
-
-	@Switch(name = "Sub Switch", type = OptionType.SWITCH)
-	public static boolean subSwitch = false;
-
-	public MyConfig() {
-		super(new Mod("My Mod", ModType.UTIL_QOL), "config.json");
+
+	
+	public class MyConfig {
+	
+	    @Switch(name = "Sub Switch", type = OptionType.SWITCH)
+	    public static boolean subSwitch = false;
+	
+	    public MyConfig() {
+	        super(new Mod("My Mod", ModType.UTIL_QOL), "config.json");
+	
+	        addDependency("subSwitch", () -> {
+	            // Do stuff here!
+	        });
+	    }
+	
+	}
+
- addDependency("subSwitch", () -> { - // TODO: Make codeblocks better lmao - }); + diff --git a/apps/website/src/components/base/Section.astro b/apps/website/src/components/base/Section.astro index 0d177ef..bb7a062 100644 --- a/apps/website/src/components/base/Section.astro +++ b/apps/website/src/components/base/Section.astro @@ -5,23 +5,25 @@ interface Props extends HTMLAttributes<"section"> { maxWidth?: "none" | String; colReverse?: boolean; wrapperClass?: string; + wFull?: boolean; } const { maxWidth = "1080px", colReverse = true, wrapperClass = "", + wFull = true, ...props } = Astro.props; const twoColumn = Astro.slots.has("left") || Astro.slots.has("right"); -const className = `max-w-[${maxWidth}] w-full px-5 md:p-0 flex gap-4` +const className = `max-w-[${maxWidth}] ${wFull ? "w-full" : ""} px-5 md:p-0 flex gap-4` + (twoColumn ? ` ${maxWidth == "none" ? "justify-center" : "justify-between md:justify-evenly lg:justify-between"} ${colReverse ? "flex-col-reverse" : "flex-col"} md:flex-row md:items-center md:flex-row` : "") + (props.class ? ` ${props.class}` : ""); --- -
+
{twoColumn ? (
diff --git a/apps/website/src/components/logos/Logo.astro b/apps/website/src/components/logos/Logo.astro index 2fd6bea..0b72b91 100644 --- a/apps/website/src/components/logos/Logo.astro +++ b/apps/website/src/components/logos/Logo.astro @@ -1,7 +1,5 @@ --- import type { LogoType } from "@webtypes/Config"; -import { dirname } from "path"; -import { fileURLToPath } from "url"; import type { HTMLAttributes } from "astro/types"; export interface Props extends HTMLAttributes<"svg"> { @@ -20,7 +18,7 @@ let svg: string | undefined; try { if (logo == undefined) return; - const dir = dirname(fileURLToPath(import.meta.url)) + "/../../../public/media"; + const dir = "../../../public/media"; svg = (await import(`${dir}/${logo.replaceAll(".", "/")}.svg?raw` /* @vite-ignore */)).default; if (svg == undefined) return; @@ -44,7 +42,8 @@ try { svg = svg.replace(/ `${key}="${value}"`).join(" ")}`); } catch (err) { - + console.error(`Error occurred while loading SVG. Logo name is ${logo}.`) + console.error(err); } --- diff --git a/apps/website/src/layouts/Layout.astro b/apps/website/src/layouts/Layout.astro index 298071d..51b9922 100644 --- a/apps/website/src/layouts/Layout.astro +++ b/apps/website/src/layouts/Layout.astro @@ -27,6 +27,7 @@ const { + {title} diff --git a/apps/website/src/pages/index.astro b/apps/website/src/pages/index.astro index 87ee0eb..30b3ee6 100644 --- a/apps/website/src/pages/index.astro +++ b/apps/website/src/pages/index.astro @@ -27,32 +27,14 @@ import CodeBlock from "@components/base/CodeBlock.astro"; Modding Minecraft has always been difficult, particularly with their configuration. Remembering all of the keybinds, commands; it just isn't intuitive.
- - - - - - - - - - + + stuff
- - - - - - - - - - - + stuff
@@ -68,123 +50,19 @@ import CodeBlock from "@components/base/CodeBlock.astro";
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + stuff
-
+
-
Written for developers
- - OneConfig's API was designed to give developers all of the tools available in the simplest way possible +
Written for developers
+ + With Polyfrost's simple APIs, it's easy to integrate your mods into Polyfrost something
- - diff --git a/apps/website/src/components/base/Footer.astro b/apps/website/src/components/base/Footer.astro index b24db5f..9bc1c61 100644 --- a/apps/website/src/components/base/Footer.astro +++ b/apps/website/src/components/base/Footer.astro @@ -2,6 +2,5 @@ --- -
- -
+
+
diff --git a/apps/website/src/components/base/Header.astro b/apps/website/src/components/base/Header.astro index d35ad9f..70dc799 100644 --- a/apps/website/src/components/base/Header.astro +++ b/apps/website/src/components/base/Header.astro @@ -1,40 +1,40 @@ --- -import type { HTMLAttributes } from "astro/types" +import type { HTMLAttributes } from 'astro/types'; const sizes = { - "xxl": "h1", - "xl": "h2", - "lg": "h2", - "md": "h3", - "sm": "h4", - "xs": "h5", - "xxs": "h6" + xxl: 'h1', + xl: 'h2', + lg: 'h2', + md: 'h3', + sm: 'h4', + xs: 'h5', + xxs: 'h6', }; -type Headers = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; +type Headers = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; interface Props extends HTMLAttributes { - size?: keyof typeof sizes; - align?: "left" | "center" | "right" | "inherit"; + size?: keyof typeof sizes + align?: 'left' | 'center' | 'right' | 'inherit' } const { - size = "lg", - align = "inherit", + size = 'lg', + align = 'inherit', ...attr } = Astro.props; const Element = sizes[size] as any; // Unfortunately gotta do this -const className = (align == "inherit" ? "" : `text-${align} `) - + (size == "xxl" ? " page-header" : "") - + (attr.class ? ` ${attr.class}` : ""); +const className = (align == 'inherit' ? '' : `text-${align} `) + + (size == 'xxl' ? ' page-header' : '') + + (attr.class ? ` ${attr.class}` : ''); --- - - - + + + - \ No newline at end of file + diff --git a/apps/website/src/components/base/Section.astro b/apps/website/src/components/base/Section.astro index bb7a062..51d9fa1 100644 --- a/apps/website/src/components/base/Section.astro +++ b/apps/website/src/components/base/Section.astro @@ -1,40 +1,42 @@ --- -import type { HTMLAttributes } from "astro/types"; +import type { HTMLAttributes } from 'astro/types'; -interface Props extends HTMLAttributes<"section"> { - maxWidth?: "none" | String; - colReverse?: boolean; - wrapperClass?: string; - wFull?: boolean; +interface Props extends HTMLAttributes<'section'> { + maxWidth?: 'none' | String + colReverse?: boolean + wrapperClass?: string + wFull?: boolean } const { - maxWidth = "1080px", + maxWidth = '1080px', colReverse = true, - wrapperClass = "", + wrapperClass = '', wFull = true, ...props } = Astro.props; -const twoColumn = Astro.slots.has("left") || Astro.slots.has("right"); +const twoColumn = Astro.slots.has('left') || Astro.slots.has('right'); -const className = `max-w-[${maxWidth}] ${wFull ? "w-full" : ""} px-5 md:p-0 flex gap-4` - + (twoColumn ? ` ${maxWidth == "none" ? "justify-center" : "justify-between md:justify-evenly lg:justify-between"} ${colReverse ? "flex-col-reverse" : "flex-col"} md:flex-row md:items-center md:flex-row` : "") - + (props.class ? ` ${props.class}` : ""); +const className = `max-w-[${maxWidth}] ${wFull ? 'w-full' : ''} px-5 md:p-0 flex gap-4${ + twoColumn ? ` ${maxWidth == 'none' ? 'justify-center' : 'justify-between md:justify-evenly lg:justify-between'} ${colReverse ? 'flex-col-reverse' : 'flex-col'} md:flex-row md:items-center md:flex-row` : '' + }${props.class ? ` ${props.class}` : ''}`; --- -
-
- {twoColumn ? ( -
- -
+
+
+ {twoColumn + ? ( +
+ +
-
- -
- ) : ( - - )} -
-
+
+ +
+ ) + : ( + + )} +
+
diff --git a/apps/website/src/components/base/Tag.astro b/apps/website/src/components/base/Tag.astro index e6fd34f..b903344 100644 --- a/apps/website/src/components/base/Tag.astro +++ b/apps/website/src/components/base/Tag.astro @@ -1,14 +1,13 @@ --- -import type { HTMLAttributes } from "astro/types"; +import type { HTMLAttributes } from 'astro/types'; -interface Props extends HTMLAttributes<"span"> {} +interface Props extends HTMLAttributes<'span'> {} const { ...attr } = Astro.props; --- -
- - - -
- +
+ + + +
diff --git a/apps/website/src/components/icons/Icon.astro b/apps/website/src/components/icons/Icon.astro index bf2b362..b36d412 100644 --- a/apps/website/src/components/icons/Icon.astro +++ b/apps/website/src/components/icons/Icon.astro @@ -1,28 +1,26 @@ --- -export type Icons = "chevron-down" | "download" | "book-open"; - import { parse } from 'node-html-parser'; -import type { HTMLAttributes } from "astro/types"; +import type { HTMLAttributes } from 'astro/types'; + +export type Icons = 'chevron-down' | 'download' | 'book-open'; -interface Props extends HTMLAttributes<"svg"> { - icon: Icons; - size?: number | [number, number]; +interface Props extends HTMLAttributes<'svg'> { + icon: Icons + size?: number | [number, number] } async function getSVG(name: string) { const file = await import(`./impl/${name}.svg?raw` /* @vite-ignore */); - if (!file) { + if (!file) throw new Error(`${name} not found`); - } const content = parse(file.default); const svg = content.querySelector('svg'); - if (!svg) { + if (!svg) throw new Error(`${name} is not a valid SVG`); - } const { attributes, innerHTML } = svg; @@ -39,13 +37,12 @@ const { } = Astro.props as Props; let svgAttributes = {}; -let html = ""; +let html = ''; try { const sizeAttributes = () => { - if (!size) { + if (!size) return {}; - } if (Array.isArray(size)) { return { @@ -58,7 +55,7 @@ try { width: size, height: size, }; - } + }; const { attributes: baseAttributes, innerHTML } = await getSVG(icon); svgAttributes = { @@ -69,9 +66,10 @@ try { const colorRegex = /(fill|stroke)=\"([^"]*)\"/g; html = innerHTML.replaceAll(colorRegex, '$1="currentColor"'); -} catch (err) { - +} +catch (err) { + // ignored } --- - + diff --git a/apps/website/src/components/logos/Logo.astro b/apps/website/src/components/logos/Logo.astro index 0b72b91..ad41aad 100644 --- a/apps/website/src/components/logos/Logo.astro +++ b/apps/website/src/components/logos/Logo.astro @@ -1,51 +1,55 @@ --- -import type { LogoType } from "@webtypes/Config"; -import type { HTMLAttributes } from "astro/types"; +import type { LogoType } from '@webtypes/Config'; +import type { HTMLAttributes } from 'astro/types'; -export interface Props extends HTMLAttributes<"svg"> { - logo: LogoType, - size?: number | [number, number], - silent?: boolean, +export interface Props extends HTMLAttributes<'svg'> { + logo: LogoType + size?: number | [number, number] + silent?: boolean } const { - logo, - silent = false, - size = undefined, - ...attr + logo, + silent = false, + size = undefined, + ...attr } = Astro.props; let svg: string | undefined; try { - if (logo == undefined) return; - const dir = "../../../public/media"; - svg = (await import(`${dir}/${logo.replaceAll(".", "/")}.svg?raw` /* @vite-ignore */)).default; - - if (svg == undefined) return; - - if (typeof size == "number" || Array.isArray(size)) { - // SVG main element regex - const svgElementRegex = /]*>/; - - svg = svg.replace(svgElementRegex, (match) => { - let newMatch = match; - if (typeof size == "number") { - newMatch = newMatch.replace(/width="[^"]*"/, `width="${size}"`); - newMatch = newMatch.replace(/height="[^"]*"/, `height="${size}"`); - } else if (Array.isArray(size)) { - newMatch = newMatch.replace(/width="[^"]*"/, `width="${size[0]}"`); - newMatch = newMatch.replace(/height="[^"]*"/, `height="${size[1]}"`); - } - return newMatch; - }); - } - - svg = svg.replace(/ `${key}="${value}"`).join(" ")}`); -} catch (err) { - console.error(`Error occurred while loading SVG. Logo name is ${logo}.`) + if (logo == undefined) + return; + const dir = '../../../public/media'; + svg = (await import(`${dir}/${logo.replaceAll('.', '/')}.svg?raw` /* @vite-ignore */)).default; + + if (svg == undefined) + return; + + if (typeof size == 'number' || Array.isArray(size)) { + // SVG main element regex + const svgElementRegex = /]*>/; + + svg = svg.replace(svgElementRegex, (match) => { + let newMatch = match; + if (typeof size == 'number') { + newMatch = newMatch.replace(/width="[^"]*"/, `width="${size}"`); + newMatch = newMatch.replace(/height="[^"]*"/, `height="${size}"`); + } + else if (Array.isArray(size)) { + newMatch = newMatch.replace(/width="[^"]*"/, `width="${size[0]}"`); + newMatch = newMatch.replace(/height="[^"]*"/, `height="${size[1]}"`); + } + return newMatch; + }); + } + + svg = svg.replace(/ `${key}="${value}"`).join(' ')}`); +} +catch (err) { + console.error(`Error occurred while loading SVG. Logo name is ${logo}.`); console.error(err); } --- - + diff --git a/apps/website/src/layouts/Layout.astro b/apps/website/src/layouts/Layout.astro index 51b9922..c4a2ff4 100644 --- a/apps/website/src/layouts/Layout.astro +++ b/apps/website/src/layouts/Layout.astro @@ -1,42 +1,42 @@ --- -import "../styles/global.css"; -import Navbar from "../components/base/Navbar.astro"; -import Favicon from "/media/polyfrost/minimal_bg.svg?url"; -import Footer from "@components/base/Footer.astro"; +import '../styles/global.css'; +import Footer from '@components/base/Footer.astro'; +import Navbar from '../components/base/Navbar.astro'; +import Favicon from '/media/polyfrost/minimal_bg.svg?url'; interface Props { - title?: string; - favicon?: string; + title?: string + favicon?: string } const { - title = 'Polyfrost', - favicon = Favicon + title = 'Polyfrost', + favicon = Favicon, } = Astro.props; --- - - - - - - - + + + + + + + - - - - + + + + - {title} - + {title} + - - -
- -
-