forked from seth/ipv4.army
auto-lint
This commit is contained in:
parent
5e03f3ef36
commit
41c205c809
12 changed files with 263 additions and 246 deletions
|
@ -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 />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
}
|
||||
|
||||
@keyframes pulse {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
transform: scale(1);
|
||||
|
@ -16,4 +15,4 @@
|
|||
|
||||
.heart {
|
||||
animation: pulse calc(60s / var(--bpm)) infinite ease;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
13
src/main.tsx
13
src/main.tsx
|
@ -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,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue