diff --git a/biome.json b/biome.json index 640ccfa..921a7a5 100644 --- a/biome.json +++ b/biome.json @@ -32,4 +32,4 @@ "semicolons": "always" } } -} \ No newline at end of file +} diff --git a/ext/manifest.json b/ext/manifest.json index 99abcc0..e23e945 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -1,17 +1,17 @@ { - "manifest_version": 3, - "name": "halfPage", - "description": "Use halfPage as your Startpage.", - "version": "0.0.2", - "browser_specific_settings": { - "gecko": { - "id": "halfPage@new-tab.ipv4.army" - } - }, - "icons": { - "64": "icons/icon.png" - }, - "chrome_url_overrides": { - "newtab": "dist/index.html" - } -} \ No newline at end of file + "manifest_version": 3, + "name": "halfPage", + "description": "Use halfPage as your Startpage.", + "version": "0.0.2", + "browser_specific_settings": { + "gecko": { + "id": "halfPage@new-tab.ipv4.army" + } + }, + "icons": { + "64": "icons/icon.png" + }, + "chrome_url_overrides": { + "newtab": "dist/index.html" + } +} diff --git a/package.json b/package.json index 9df96bb..b0d31ee 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,24 @@ { - "name": "ipv4.army-vite", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "bunx --bun vite", - "build": "bunx --bun tsc -b && bunx --bun vite build", - "preview": "bunx --bun vite preview" - }, - "dependencies": { - "halfmoon": "^2.0.2", - "lucide-preact": "^0.487.0", - "preact": "^10.26.2" - }, - "devDependencies": { - "@biomejs/biome": "1.9.4", - "@fullhuman/postcss-purgecss": "^7.0.2", - "@preact/preset-vite": "^2.10.1", - "lightningcss": "^1.29.3", - "typescript": "~5.7.2", - "vite": "^6.2.0" - } -} \ No newline at end of file + "name": "ipv4.army-vite", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "bunx --bun vite", + "build": "bunx --bun tsc -b && bunx --bun vite build", + "preview": "bunx --bun vite preview" + }, + "dependencies": { + "halfmoon": "^2.0.2", + "lucide-preact": "^0.487.0", + "preact": "^10.26.2" + }, + "devDependencies": { + "@biomejs/biome": "1.9.4", + "@fullhuman/postcss-purgecss": "^7.0.2", + "@preact/preset-vite": "^2.10.1", + "lightningcss": "^1.29.3", + "typescript": "~5.7.2", + "vite": "^6.2.0" + } +} diff --git a/src/components/app.tsx b/src/components/app.tsx index 9274b62..d71bb50 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -1,15 +1,15 @@ -import Navbar from './navbar'; -import Container from './container'; -import Sidebar from './sidebar'; +import Container from "./container"; +import Navbar from "./navbar"; +import Sidebar from "./sidebar"; -import './app.css'; +import "./app.css"; export default () => { - return ( - <> - - - - - ) -} + return ( + <> + + + + + ); +}; diff --git a/src/components/container/index.tsx b/src/components/container/index.tsx index 92e0acb..499fb73 100644 --- a/src/components/container/index.tsx +++ b/src/components/container/index.tsx @@ -1,14 +1,20 @@ export default () => { - return ( - <> -
-
Hello, {localStorage.getItem("name")}.
-
-
-
- -
-
- - ) -} \ No newline at end of file + return ( + <> +
+
Hello, {localStorage.getItem("name")}.
+
+
+
+ +
+
+ + ); +}; diff --git a/src/components/navbar/desc.json b/src/components/navbar/desc.json index ef7d051..8ae29a4 100644 --- a/src/components/navbar/desc.json +++ b/src/components/navbar/desc.json @@ -279,4 +279,4 @@ "image": "https://wsrv.nl/?l=9w=24&url=https://openweathermap.org/img/wn/11n@2x.png" } } -} \ No newline at end of file +} diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx index f3cc3f9..3a3e909 100644 --- a/src/components/navbar/index.tsx +++ b/src/components/navbar/index.tsx @@ -1,28 +1,43 @@ -import { useState } from 'preact/hooks'; -import { ChevronLeft, ChevronRight } from 'lucide-preact'; +import { ChevronLeft, ChevronRight } from "lucide-preact"; +import { useState } from "preact/hooks"; export default () => { - const [wttrDesc, setWttrDesc] = useState("Loading..."); + const [wttrDesc, setWttrDesc] = useState("Loading..."); - fetch(`https://wttr.in/${localStorage.getItem("location") || ""}?format=%t%20with%20%C%c&m`) - .then(res => res.text()) - .then(desc => { - setWttrDesc(desc.trim()); - }) + fetch( + `https://wttr.in/${localStorage.getItem("location") || ""}?format=%t%20with%20%C%c&m`, + ) + .then((res) => res.text()) + .then((desc) => { + setWttrDesc(desc.trim()); + }); - return ( - <> - - - ) -} \ No newline at end of file + return ( + <> + + + ); +}; diff --git a/src/components/sidebar/index.tsx b/src/components/sidebar/index.tsx index 4ea4a93..9dc3f5f 100644 --- a/src/components/sidebar/index.tsx +++ b/src/components/sidebar/index.tsx @@ -1,109 +1,204 @@ const dataset = document.documentElement.dataset; export default () => { - return ( + return ( + - ) -} \ No newline at end of file + +
About
+

+ halfPage is a minimalistic startpage, built on only open-source + software. +

+ halfmoon + wttr.in + Source + + + ); +}; diff --git a/src/index.css b/src/index.css index 2f62af9..091d346 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,3 @@ * { - border-color: transparent !important; -} \ No newline at end of file + border-color: transparent !important; +} diff --git a/src/main.tsx b/src/main.tsx index 8c61ba9..411cba4 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,17 +1,24 @@ -import { render } from 'preact' -import './index.css' -import 'halfmoon/css/halfmoon.min.css'; -import 'halfmoon/css/cores/halfmoon.modern.css'; -import 'halfmoon/css/cores/halfmoon.elegant.css'; -import App from './components/app.tsx' +import { render } from "preact"; +import "./index.css"; +import "halfmoon/css/halfmoon.min.css"; +import "halfmoon/css/cores/halfmoon.modern.css"; +import "halfmoon/css/cores/halfmoon.elegant.css"; +import App from "./components/app.tsx"; const dataset = document.documentElement.dataset; -const colorScheme = localStorage.getItem("colorScheme") || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") || "auto"; +const colorScheme = + localStorage.getItem("colorScheme") || + (window.matchMedia("(prefers-color-scheme: dark)").matches + ? "dark" + : "light") || + "auto"; if (colorScheme === "auto") { - dataset.bsTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; + dataset.bsTheme = window.matchMedia("(prefers-color-scheme: dark)").matches + ? "dark" + : "light"; } else { - dataset.bsTheme = colorScheme; + dataset.bsTheme = colorScheme; } dataset.bsCore = localStorage.getItem("theme") || "default"; @@ -19,9 +26,12 @@ dataset.bsCore = localStorage.getItem("theme") || "default"; const favicon = document.getElementById("favicon") as HTMLLinkElement; fetch(`https://wttr.in/${localStorage.getItem("location") || ""}?format=%c`) - .then(res => res.text()) - .then(emoji => { - favicon.href = `data:image/svg+xml,${emoji.trim()}` - }) + .then((res) => res.text()) + .then((emoji) => { + favicon.href = `data:image/svg+xml,${emoji.trim()}`; + }); -render(, document.getElementById('app') as HTMLElement || document.body) +render( + , + (document.getElementById("app") as HTMLElement) || document.body, +); diff --git a/tsconfig.app.json b/tsconfig.app.json index 7bf2d3e..613d3c5 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -1,37 +1,27 @@ { - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "target": "ES2020", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": [ - "ES2020", - "DOM", - "DOM.Iterable" - ], - "skipLibCheck": true, - "paths": { - "react": [ - "./node_modules/preact/compat/" - ], - "react-dom": [ - "./node_modules/preact/compat/" - ] - }, - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "jsx": "react-jsx", - "jsxImportSource": "preact", - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": [ - "src" - ] -} \ No newline at end of file + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + "paths": { + "react": ["./node_modules/preact/compat/"], + "react-dom": ["./node_modules/preact/compat/"] + }, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + "jsxImportSource": "preact", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/tsconfig.json b/tsconfig.json index 65f670c..a5b06bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,11 @@ { - "files": [], - "references": [ - { - "path": "./tsconfig.app.json" - }, - { - "path": "./tsconfig.node.json" - } - ] -} \ No newline at end of file + "files": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.node.json" + } + ] +} diff --git a/tsconfig.node.json b/tsconfig.node.json index 73aa84f..5a2a3a0 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,24 +1,20 @@ { - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", - "target": "ES2022", - "lib": [ - "ES2023" - ], - "module": "ESNext", - "skipLibCheck": true, - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": [ - "vite.config.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts index 4ea209f..e02958b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,26 +1,28 @@ /// -import { defineConfig } from 'vite' -import preact from '@preact/preset-vite' +import preact from "@preact/preset-vite"; +import { defineConfig } from "vite"; import postCSSPurgeCSS from "@fullhuman/postcss-purgecss"; // https://vite.dev/config/ export default defineConfig({ - css: { - ...(import.meta.env.NODE_ENV === "production") ? { - transformer: "postcss", - postcss: { - plugins: [ - postCSSPurgeCSS({ - content: ["./index.html", "./src/**/*.{ts,tsx}"], - }) - ] - } - } : { transformer: "lightningcss" } - }, - build: { - cssMinify: "lightningcss", - }, - plugins: [preact()], -}) + css: { + ...(import.meta.env.NODE_ENV === "production" + ? { + transformer: "postcss", + postcss: { + plugins: [ + postCSSPurgeCSS({ + content: ["./index.html", "./src/**/*.{ts,tsx}"], + }), + ], + }, + } + : { transformer: "lightningcss" }), + }, + build: { + cssMinify: "lightningcss", + }, + plugins: [preact()], +});