;
- 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 (
- <>
-
- ♥️
-
- {heartrate} BPM
-
- >
- )
-}
\ No newline at end of file
+ return (
+ <>
+
+ ♥️
+
+ {heartrate} BPM
+
+ >
+ );
+};
diff --git a/src/components/navbar/index.tsx b/src/components/navbar/index.tsx
index 771b5d1..25958c2 100644
--- a/src/components/navbar/index.tsx
+++ b/src/components/navbar/index.tsx
@@ -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 (
- <>
-
- >
- )
-}
\ No newline at end of file
+ return (
+ <>
+
+ >
+ );
+};
diff --git a/src/main.tsx b/src/main.tsx
index 280d27e..8b4285d 100644
--- a/src/main.tsx
+++ b/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(, 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()],
+});