auto-lint
All checks were successful
Code quality checks / biome (push) Successful in 8s

This commit is contained in:
wont-stream 2025-04-10 19:27:18 -04:00
parent 5e03f3ef36
commit 41c205c809
12 changed files with 263 additions and 246 deletions

View file

@ -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"
}
"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"
}
}

View file

@ -1,13 +1,13 @@
import Navbar from './navbar';
import Container from './container';
import Container from "./container";
import Navbar from "./navbar";
import './app.css';
import "./app.css";
export default () => {
return (
<>
<Navbar />
<Container />
</>
)
}
return (
<>
<Navbar />
<Container />
</>
);
};

View file

@ -1,42 +1,49 @@
import { useState } from 'preact/hooks';
import { useState } from "preact/hooks";
import Heart from '../heart';
import Heart from "../heart";
const statusMap = {
online: "border-success-subtle",
idle: "border-warning-subtle",
dnd: "border-danger-subtle",
offline: "border-light-subtle",
}
online: "border-success-subtle",
idle: "border-warning-subtle",
dnd: "border-danger-subtle",
offline: "border-light-subtle",
};
export default () => {
const [status, setStatus] = useState<keyof typeof statusMap>('offline');
const [status, setStatus] = useState<keyof typeof statusMap>("offline");
fetch("https://lanyard.creations.works/v1/users/1273447359417942128")
.then(req => req.json())
.then((res) => {
if (res.data.discord_status) {
setStatus(res.data.discord_status);
} else {
setStatus('offline');
}
})
fetch("https://lanyard.creations.works/v1/users/1273447359417942128")
.then((req) => req.json())
.then((res) => {
if (res.data.discord_status) {
setStatus(res.data.discord_status);
} else {
setStatus("offline");
}
});
return (
<>
<div class="container bg-body-tertiary shadow text-center position-absolute top-50 start-50 translate-middle mx-auto py-4">
<img src="favicon.svg" class={`img-thumbnail rounded-circle border border-4 ${statusMap[status]}`} alt="..." width="100px" height="100px" />
<br />
<h1>Seth</h1>
<h2 class="lead">Dedicated Backend Developer
<br />
<br />
<small class="text-body-secondary">
With a passsion for high-fidelity audio, gaming, and web development
</small>
</h2>
<Heart />
</div>
</>
)
}
return (
<>
<div class="container bg-body-tertiary shadow text-center position-absolute top-50 start-50 translate-middle mx-auto py-4">
<img
src="favicon.svg"
class={`img-thumbnail rounded-circle border border-4 ${statusMap[status]}`}
alt="..."
width="100px"
height="100px"
/>
<br />
<h1>Seth</h1>
<h2 class="lead">
Dedicated Backend Developer
<br />
<br />
<small class="text-body-secondary">
With a passsion for high-fidelity audio, gaming, and web development
</small>
</h2>
<Heart />
</div>
</>
);
};

View file

@ -3,7 +3,6 @@
}
@keyframes pulse {
0%,
100% {
transform: scale(1);

View file

@ -1,68 +1,71 @@
import { useState } from 'preact/hooks';
import './index.css';
import { useState } from "preact/hooks";
import "./index.css";
export default () => {
const [heartrate, setHeartrate] = useState(0);
const [heartrate, setHeartrate] = useState(0);
const ws = new WebSocket("wss://app.hyperate.io/socket/websocket?token=wv39nM6iyrNJulvpmMQrimYPIXy2dVrYRjkuHpbRapKT2VSh65ngDGHdCdCtmEN9");
const ws = new WebSocket(
"wss://app.hyperate.io/socket/websocket?token=wv39nM6iyrNJulvpmMQrimYPIXy2dVrYRjkuHpbRapKT2VSh65ngDGHdCdCtmEN9",
);
let hrTimeout: ReturnType<typeof setTimeout>;
let hrTimeout: ReturnType<typeof setTimeout>;
const setHrInterval = () => {
hrTimeout = setTimeout(() => {
return setHeartrate(0);
}, 6000);
};
const setHrInterval = () => {
hrTimeout = setTimeout(() => {
return setHeartrate(0);
}, 6000);
};
ws.onopen = () => {
ws.send(
JSON.stringify({
topic: "hr:0BCA",
event: "phx_join",
payload: {},
ref: 0,
}),
);
ws.onopen = () => {
ws.send(
JSON.stringify({
topic: "hr:0BCA",
event: "phx_join",
payload: {},
ref: 0,
}),
);
setInterval(() => {
ws.send(
JSON.stringify({
topic: "phoenix",
event: "heartbeat",
payload: {},
ref: 0,
}),
);
}, 10000);
setInterval(() => {
ws.send(
JSON.stringify({
topic: "phoenix",
event: "heartbeat",
payload: {},
ref: 0,
}),
);
}, 10000);
return setHrInterval();
};
return setHrInterval();
};
ws.onmessage = ({ data }) => {
const { event, payload } = JSON.parse(data);
switch (event) {
case "hr_update": {
clearTimeout(hrTimeout);
setHrInterval();
setHeartrate(payload.hr);
break;
}
default: {
break;
}
}
};
ws.onmessage = ({ data }) => {
const { event, payload } = JSON.parse(data);
switch (event) {
case "hr_update": {
clearTimeout(hrTimeout);
setHrInterval();
setHeartrate(payload.hr);
break;
}
default: {
break;
}
}
};
return (
<>
<div style={heartrate === 0 ? "display:none" : `--bpm: ${heartrate};`} class="heart">
<br />
<span>{heartrate} BPM</span>
</div>
</>
)
}
return (
<>
<div
style={heartrate === 0 ? "display:none" : `--bpm: ${heartrate};`}
class="heart"
>
<br />
<span>{heartrate} BPM</span>
</div>
</>
);
};

View file

@ -1,29 +1,46 @@
import { Minus, Minimize, X } from 'lucide-preact';
import { Minimize, Minus, X } from "lucide-preact";
const close = () => {
window.close();
window.history.back();
}
window.close();
window.history.back();
};
export default () => {
return (
<>
<nav class="navbar shadow fixed-top" style="background-color: var(--bs-content-bg); border-bottom: var(--bs-border-width) solid var(--bs-content-border-color);">
<div class="container-fluid">
<div class="navbar-brand">
<img src="favicon.svg" alt="Logo" width="24" height="24" class="d-inline-block align-text-top" />
Seth
</div>
<span class="navbar-text">
IPv4 dot Army
</span>
<div class="d-flex hstack gap-2">
<button type="button" class="btn btn-outline-success btn-sm"><Minus size={20} /></button>
<button type="button" class="btn btn-outline-warning btn-sm"><Minimize size={20} /></button>
<button type="button" class="btn btn-outline-danger btn-sm" onClick={close}><X size={20} /></button>
</div>
</div>
</nav>
</>
)
}
return (
<>
<nav
class="navbar shadow fixed-top"
style="background-color: var(--bs-content-bg); border-bottom: var(--bs-border-width) solid var(--bs-content-border-color);"
>
<div class="container-fluid">
<div class="navbar-brand">
<img
src="favicon.svg"
alt="Logo"
width="24"
height="24"
class="d-inline-block align-text-top"
/>
Seth
</div>
<span class="navbar-text">IPv4 dot Army</span>
<div class="d-flex hstack gap-2">
<button type="button" class="btn btn-outline-success btn-sm">
<Minus size={20} />
</button>
<button type="button" class="btn btn-outline-warning btn-sm">
<Minimize size={20} />
</button>
<button
type="button"
class="btn btn-outline-danger btn-sm"
onClick={close}
>
<X size={20} />
</button>
</div>
</div>
</nav>
</>
);
};

View file

@ -1,6 +1,9 @@
import { render } from 'preact'
import './index.css'
import 'halfmoon/css/halfmoon.min.css';
import App from './components/app.tsx'
import { render } from "preact";
import "./index.css";
import "halfmoon/css/halfmoon.min.css";
import App from "./components/app.tsx";
render(<App />, document.getElementById('app') as HTMLElement || document.body)
render(
<App />,
(document.getElementById("app") as HTMLElement) || document.body,
);

View file

@ -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"
]
"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"]
}

View file

@ -1,11 +1,11 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.node.json"
}
]
}

View file

@ -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"
]
"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"]
}

View file

@ -1,26 +1,28 @@
/// <reference types="vite/client" />
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()],
});