forked from seth/ipv4.army
base project
This commit is contained in:
parent
79f300a918
commit
4fedd38df1
33 changed files with 407 additions and 2514 deletions
3
src/App.tsx
Normal file
3
src/App.tsx
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default () => {
|
||||
return <div>Hello, World!</div>
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
import Container from "./container";
|
||||
import Navbar from "./navbar";
|
||||
|
||||
import "./app.css";
|
||||
|
||||
export default () => {
|
||||
return (
|
||||
<>
|
||||
<Navbar />
|
||||
<Container />
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
import { useState } from "preact/hooks";
|
||||
|
||||
import Heart from "../heart";
|
||||
|
||||
const statusMap = {
|
||||
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");
|
||||
|
||||
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>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
:root {
|
||||
--bpm: 0;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0%,
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
.heart {
|
||||
animation: pulse calc(60s / var(--bpm)) infinite ease;
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
import { useState } from "preact/hooks";
|
||||
|
||||
import "./index.css";
|
||||
|
||||
export default () => {
|
||||
const [heartrate, setHeartrate] = useState(0);
|
||||
|
||||
const ws = new WebSocket(
|
||||
"wss://app.hyperate.io/socket/websocket?token=wv39nM6iyrNJulvpmMQrimYPIXy2dVrYRjkuHpbRapKT2VSh65ngDGHdCdCtmEN9",
|
||||
);
|
||||
|
||||
let hrTimeout: ReturnType<typeof setTimeout>;
|
||||
|
||||
const setHrInterval = () => {
|
||||
hrTimeout = setTimeout(() => {
|
||||
return setHeartrate(0);
|
||||
}, 6000);
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
style={heartrate === 0 ? "display:none" : `--bpm: ${heartrate};`}
|
||||
class="heart"
|
||||
>
|
||||
♥️
|
||||
<br />
|
||||
<span>{heartrate} BPM</span>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -1,46 +0,0 @@
|
|||
import { Minimize, Minus, X } from "lucide-preact";
|
||||
|
||||
const close = () => {
|
||||
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>
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
@import "./App.css";
|
||||
|
||||
:root {
|
||||
--color-background-primary: #1a1d1f;
|
||||
--color-background-secondary: #24282b;
|
||||
--color-background-tertiary: #222527;
|
||||
|
||||
--color-text-primary: #DEDEDE;
|
||||
--color-text-secondary: #ACACAC;
|
||||
--color-link: #7289DA;
|
||||
--color-link-hover: #4E5D94;
|
||||
--color-link-active: #5B6EAE;
|
||||
}
|
||||
|
||||
html,
|
||||
head,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Circular Std', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--color-background-primary);
|
||||
color: var(--color-text-primary);
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
}
|
23
src/index.html
Normal file
23
src/index.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="theme-color" content="#1a1d1f">
|
||||
<meta name="description"
|
||||
content="A Dedicated Backend Developer, with a passion for high-fidelity audio, gaming, and web development.">
|
||||
<meta name="keywords" content="Seth, IPv4, Army, Seth@IPv4, web development, audio, gaming">
|
||||
<meta name="author" content="Seth">
|
||||
<title>Seth @ IPv4 dot Army</title>
|
||||
<link rel="icon" href="/public/favicon.svg" />
|
||||
<meta name="color-scheme" content="dark" />
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
<style id="font"></style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script src="index.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
72
src/index.tsx
Normal file
72
src/index.tsx
Normal file
|
@ -0,0 +1,72 @@
|
|||
import "tsx-dom";
|
||||
|
||||
import App from './App';
|
||||
|
||||
document.getElementById("font")!.innerText = `@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/Black.woff2') format('woff2');
|
||||
font-weight: black;
|
||||
font-style: normal;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/BlackItalic.woff2') format('woff2');
|
||||
font-weight: black;
|
||||
font-style: italic;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/Bold.woff2') format('woff2');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/BoldItalic.woff2') format('woff2');
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/Book.woff2') format('woff2');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/BookItalic.woff2') format('woff2');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/Medium.woff2') format('woff2');
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
font-display: swap
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Circular Std';
|
||||
src: url('/public/font/MediumItalic.woff2') format('woff2');
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
font-display: swap
|
||||
}`
|
||||
|
||||
document.body.appendChild(<App />);
|
||||
|
||||
// You're garbage, let me collect you.
|
||||
fetch("/api/gc")
|
|
@ -1,9 +0,0 @@
|
|||
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,
|
||||
);
|
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference types="vite/client" />
|
Loading…
Add table
Add a link
Reference in a new issue