From d7e7654686c3d40b1a3b6a5cd6aaa2fd341ce925 Mon Sep 17 00:00:00 2001
From: Neshura <neshura@neshweb.net>
Date: Fri, 4 Apr 2025 22:46:33 +0200
Subject: [PATCH] Unused Code Cleanup

---
 package.json                          |  1 -
 src/lib/components/ServerCard.svelte  |  1 -
 src/lib/components/ServiceCard.svelte |  1 -
 src/lib/stores/socketStore.ts         |  4 ----
 src/lib/stores/uptimeStore.ts         |  4 ----
 src/lib/types/uptime-kuma-types.ts    |  9 ---------
 src/routes/+layout.svelte             |  4 ----
 src/routes/servers/+page.svelte       |  4 ----
 src/routes/services/+page.svelte      |  3 ---
 yarn.lock                             | 23 +++++++++++++++++++----
 10 files changed, 19 insertions(+), 35 deletions(-)
 delete mode 100644 src/lib/stores/socketStore.ts
 delete mode 100644 src/lib/stores/uptimeStore.ts
 delete mode 100644 src/lib/types/uptime-kuma-types.ts

diff --git a/package.json b/package.json
index 81cc215..da8194a 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,6 @@
 		"clsx": "^2.1.0",
 		"radix-icons-svelte": "^1.2.1",
 		"sanitize-html": "^2.11.0",
-		"socket.io": "^4.7.2",
 		"socket.io-client": "^4.7.2",
 		"tailwind-merge": "^2.2.0",
 		"tailwind-variants": "^0.1.19"
diff --git a/src/lib/components/ServerCard.svelte b/src/lib/components/ServerCard.svelte
index 7337a0f..f18b90d 100644
--- a/src/lib/components/ServerCard.svelte
+++ b/src/lib/components/ServerCard.svelte
@@ -6,7 +6,6 @@
 	import { slide } from 'svelte/transition';
 	import { IconType, type Server } from '$lib/types/data-types';
 	import { Skeleton } from '$lib/components/ui/skeleton';
-	import type { Heartbeat } from '$lib/types/uptime-kuma-types';
 	import { Button } from '$lib/components/ui/button';
 
 	let { server, icons, monitor } = $props<{
diff --git a/src/lib/components/ServiceCard.svelte b/src/lib/components/ServiceCard.svelte
index 4c03cc7..05b986f 100644
--- a/src/lib/components/ServiceCard.svelte
+++ b/src/lib/components/ServiceCard.svelte
@@ -6,7 +6,6 @@
 	import { slide } from 'svelte/transition';
 	import { IconType, type Service } from '$lib/types/data-types';
 	import { Skeleton } from '$lib/components/ui/skeleton';
-	import type { Heartbeat } from '$lib/types/uptime-kuma-types';
 
 	let { service, icons, monitor } = $props<{
 		service: Service;
diff --git a/src/lib/stores/socketStore.ts b/src/lib/stores/socketStore.ts
deleted file mode 100644
index fcbef69..0000000
--- a/src/lib/stores/socketStore.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { writable } from 'svelte/store';
-import { io } from 'socket.io-client';
-
-export let socketStore = writable(io('https://status.neshweb.net/'));
diff --git a/src/lib/stores/uptimeStore.ts b/src/lib/stores/uptimeStore.ts
deleted file mode 100644
index 37ca5cb..0000000
--- a/src/lib/stores/uptimeStore.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { type Writable, writable } from 'svelte/store';
-import type { Heartbeat } from '$lib/types/uptime-kuma-types';
-
-export let uptimeStore: Writable<Map<number, Heartbeat>> = writable(new Map());
diff --git a/src/lib/types/uptime-kuma-types.ts b/src/lib/types/uptime-kuma-types.ts
deleted file mode 100644
index 1ff8908..0000000
--- a/src/lib/types/uptime-kuma-types.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export type Heartbeat = {
-	readonly monitorID: number;
-	readonly status: number;
-	readonly time: string;
-	readonly msg: string;
-	readonly ping: number;
-	readonly important: boolean;
-	readonly duration: number;
-};
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index d6ab29c..2bb0638 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -3,7 +3,6 @@
 <script>
 	import '../app.pcss';
 	import Header from './Header.svelte';
-	import { socketStore } from '$lib/stores/socketStore';
 	import { beforeNavigate } from '$app/navigation';
 	import Footer from './Footer.svelte';
 
@@ -13,9 +12,6 @@
 				navigation.to.url.pathname === '/servers' || navigation.from.url.pathname === '/servers';
 			const services =
 				navigation.to.url.pathname === '/services' || navigation.from.url.pathname === '/services';
-			if (!(servers && services)) {
-				$socketStore.close();
-			}
 		});
 	});
 </script>
diff --git a/src/routes/servers/+page.svelte b/src/routes/servers/+page.svelte
index 5479ef8..0108cb4 100644
--- a/src/routes/servers/+page.svelte
+++ b/src/routes/servers/+page.svelte
@@ -2,11 +2,7 @@
 
 <script lang="ts">
 	import type { Server } from '$lib/types/data-types';
-	import { io } from 'socket.io-client';
-	import type { Heartbeat } from '$lib/types/uptime-kuma-types';
 	import ServerCard from '$lib/components/ServerCard.svelte';
-	import { socketStore } from '$lib/stores/socketStore';
-	import { uptimeStore } from '$lib/stores/uptimeStore';
 
 	let servers: readonly Server[] = $state.frozen([]);
 
diff --git a/src/routes/services/+page.svelte b/src/routes/services/+page.svelte
index 2f36d21..abb7c4f 100644
--- a/src/routes/services/+page.svelte
+++ b/src/routes/services/+page.svelte
@@ -4,10 +4,7 @@
 	import ServiceCard from '$lib/components/ServiceCard.svelte';
 	import type { Service } from '$lib/types/data-types';
 	import { io } from 'socket.io-client';
-	import type { Heartbeat } from '$lib/types/uptime-kuma-types';
-	import { socketStore } from '$lib/stores/socketStore';
 	import { onDestroy } from 'svelte';
-	import { uptimeStore } from '$lib/stores/uptimeStore';
 
 	let services: readonly Service[] = $state.frozen([]);
 
diff --git a/yarn.lock b/yarn.lock
index cece5c8..6673414 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2103,7 +2103,7 @@ socket.io-parser@~4.2.4:
     "@socket.io/component-emitter" "~3.1.0"
     debug "~4.3.1"
 
-socket.io@*, socket.io@^4.7.2:
+socket.io@*:
   version "4.7.2"
   resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.2.tgz#22557d76c3f3ca48f82e73d68b7add36a22df002"
   integrity sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw==
@@ -2131,8 +2131,16 @@ source-map-js@^1.0.2:
   resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
   integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==
 
-"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
-  name string-width-cjs
+"string-width-cjs@npm:string-width@^4.2.0":
+  version "4.2.3"
+  resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
+  integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
+  dependencies:
+    emoji-regex "^8.0.0"
+    is-fullwidth-code-point "^3.0.0"
+    strip-ansi "^6.0.1"
+
+string-width@^4.1.0:
   version "4.2.3"
   resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
   integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -2150,7 +2158,14 @@ string-width@^5.0.1, string-width@^5.1.2:
     emoji-regex "^9.2.2"
     strip-ansi "^7.0.1"
 
-"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
+  version "6.0.1"
+  resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
+  integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
+  dependencies:
+    ansi-regex "^5.0.1"
+
+strip-ansi@^6.0.0, strip-ansi@^6.0.1:
   version "6.0.1"
   resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
   integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==