Fix runtime errors: PerformanceObserver, localStorage, crypto.randomUUID, hydration issues, and linting errors
This commit is contained in:
@@ -38,7 +38,8 @@ export async function GET(request: NextRequest) {
|
||||
cls: ((p.performance as Record<string, unknown>)?.coreWebVitals as Record<string, unknown>)?.cls as number || 0
|
||||
}));
|
||||
|
||||
const avgLighthouse = projectsWithPerformance.length > 0
|
||||
// Calculate average lighthouse score (currently unused but kept for future use)
|
||||
const _avgLighthouse = projectsWithPerformance.length > 0
|
||||
? Math.round(projectsWithPerformance.reduce((sum, p) => sum + p.lighthouse, 0) / projectsWithPerformance.length)
|
||||
: 0;
|
||||
|
||||
|
||||
@@ -28,18 +28,18 @@ export default function KernelPanic404() {
|
||||
|
||||
let audioCtx: AudioContext | null = null;
|
||||
let systemFrozen = false;
|
||||
let currentMusic: any = null;
|
||||
let currentMusic: AudioBufferSourceNode | null = null;
|
||||
let hawkinsActive = false;
|
||||
let fsocietyActive = false;
|
||||
|
||||
// Timers storage to clear on unmount
|
||||
const timers: (NodeJS.Timeout | number)[] = [];
|
||||
const interval = (fn: Function, ms: number) => {
|
||||
const interval = (fn: () => void, ms: number) => {
|
||||
const id = setInterval(fn, ms);
|
||||
timers.push(id);
|
||||
return id;
|
||||
};
|
||||
const timeout = (fn: Function, ms: number) => {
|
||||
const timeout = (fn: () => void, ms: number) => {
|
||||
const id = setTimeout(fn, ms);
|
||||
timers.push(id);
|
||||
return id;
|
||||
@@ -49,7 +49,7 @@ export default function KernelPanic404() {
|
||||
function initAudio() {
|
||||
if (!audioCtx) {
|
||||
const AudioContextClass =
|
||||
window.AudioContext || (window as any).webkitAudioContext;
|
||||
window.AudioContext || (window as typeof window & { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;
|
||||
if (AudioContextClass) {
|
||||
audioCtx = new AudioContextClass();
|
||||
}
|
||||
@@ -444,6 +444,7 @@ export default function KernelPanic404() {
|
||||
}
|
||||
|
||||
/* --- FILE SYSTEM --- */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const fileSystem: any = {
|
||||
home: {
|
||||
type: "dir",
|
||||
@@ -551,7 +552,7 @@ export default function KernelPanic404() {
|
||||
|
||||
let currentPath = fileSystem.home.children.guest;
|
||||
let pathStr = "~";
|
||||
let commandHistory: string[] = [];
|
||||
const commandHistory: string[] = [];
|
||||
let historyIndex = -1;
|
||||
|
||||
/* --- UTILS --- */
|
||||
@@ -671,7 +672,7 @@ export default function KernelPanic404() {
|
||||
// Clear initial output
|
||||
output!.innerHTML = "";
|
||||
|
||||
for (let msg of bootMessages) {
|
||||
for (const msg of bootMessages) {
|
||||
printLine(msg.t, msg.type);
|
||||
await sleep(msg.d);
|
||||
}
|
||||
@@ -794,7 +795,7 @@ export default function KernelPanic404() {
|
||||
if (suggestions.length === 0) {
|
||||
try {
|
||||
playSynth("beep");
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -817,13 +818,13 @@ export default function KernelPanic404() {
|
||||
input.setSelectionRange(input.value.length, input.value.length);
|
||||
try {
|
||||
playSynth("beep");
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
} else {
|
||||
// Multiple matches
|
||||
printLine(`Possible completions: ${suggestions.join(" ")}`, "log-dim");
|
||||
try {
|
||||
playSynth("beep");
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,7 +833,7 @@ export default function KernelPanic404() {
|
||||
if (systemFrozen || !input) {
|
||||
try {
|
||||
playSynth("beep");
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -871,7 +872,7 @@ export default function KernelPanic404() {
|
||||
args.includes("-a") || args.includes("-la") || args.includes("-l");
|
||||
const longFormat = args.includes("-l") || args.includes("-la");
|
||||
|
||||
let items = Object.keys(currentPath.children).filter(
|
||||
const items = Object.keys(currentPath.children).filter(
|
||||
(n) => !n.startsWith(".") || showHidden,
|
||||
);
|
||||
|
||||
@@ -1177,7 +1178,7 @@ export default function KernelPanic404() {
|
||||
overlay.style.display = "none";
|
||||
overlay.innerHTML = "";
|
||||
|
||||
const sporeInterval = interval(() => {
|
||||
const _sporeInterval = interval(() => {
|
||||
const spore = document.createElement("div");
|
||||
spore.className = "spore";
|
||||
spore.style.left = Math.random() * 100 + "%";
|
||||
@@ -1187,7 +1188,7 @@ export default function KernelPanic404() {
|
||||
setTimeout(() => spore.remove(), 3000);
|
||||
}, 300);
|
||||
|
||||
const glitchInterval = interval(() => {
|
||||
const _glitchInterval = interval(() => {
|
||||
if (!hawkinsActive) return;
|
||||
body.style.filter = "hue-rotate(180deg) contrast(1.3) brightness(0.9)";
|
||||
setTimeout(
|
||||
@@ -1412,7 +1413,7 @@ export default function KernelPanic404() {
|
||||
|
||||
try {
|
||||
playSynth("key");
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
|
||||
if (e.key === "ArrowUp" && historyIndex > 0) {
|
||||
historyIndex--;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { motion, Variants } from "framer-motion";
|
||||
import { ExternalLink, Github, Layers, ArrowRight, ArrowLeft, Calendar } from "lucide-react";
|
||||
import { ExternalLink, Github, ArrowRight, Calendar } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ function EditorPageContent() {
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [isCreating, setIsCreating] = useState(!projectId);
|
||||
const [showPreview, setShowPreview] = useState(false);
|
||||
const [isTyping, setIsTyping] = useState(false);
|
||||
const [_isTyping, setIsTyping] = useState(false);
|
||||
const [history, setHistory] = useState<typeof formData[]>([]);
|
||||
const [historyIndex, setHistoryIndex] = useState(-1);
|
||||
const [originalFormData, setOriginalFormData] = useState<typeof formData | null>(null);
|
||||
|
||||
@@ -282,7 +282,7 @@ const AdminPage = () => {
|
||||
onClick={() => {
|
||||
try {
|
||||
localStorage.removeItem('admin_lockout');
|
||||
} catch (error) {
|
||||
} catch {
|
||||
// Ignore errors
|
||||
}
|
||||
window.location.reload();
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from 'framer-motion';
|
||||
import { ExternalLink, Calendar, Tag, ArrowLeft, Github as GithubIcon, Share2 } from 'lucide-react';
|
||||
import { ExternalLink, Calendar, ArrowLeft, Github as GithubIcon, Share2 } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { useParams } from 'next/navigation';
|
||||
import { useState, useEffect } from 'react';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import Image from 'next/image';
|
||||
|
||||
interface Project {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user