diff --git a/bun.lock b/bun.lock index bbf6075..598ac55 100644 --- a/bun.lock +++ b/bun.lock @@ -59,8 +59,11 @@ "@types/node": "^20.19.26", "@types/react": "19.2.7", "@types/react-dom": "19.2.3", + "@typescript-eslint/eslint-plugin": "^8.54.0", + "@typescript-eslint/parser": "^8.54.0", "eslint": "^9.39.1", "eslint-config-next": "16.1.4", + "eslint-plugin-react-hooks": "^7.0.1", "prisma": "^7.1.0", "tailwindcss": "^4.1.18", "tw-animate-css": "^1.4.0", @@ -137,7 +140,7 @@ "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.1.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ=="], - "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], + "@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.0", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, ""], "@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.2", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="], @@ -571,7 +574,7 @@ "base64-js": ["base64-js@1.5.1", "", {}, ""], - "baseline-browser-mapping": ["baseline-browser-mapping@2.9.18", "", { "bin": { "baseline-browser-mapping": "dist/cli.js" } }, "sha512-e23vBV1ZLfjb9apvfPk4rHVu2ry6RIr2Wfs+O324okSidrX7pTAnEJPCh/O5BtRlr7QtZI7ktOP3vsqr7Z5XoA=="], + "baseline-browser-mapping": ["baseline-browser-mapping@2.9.19", "", { "bin": { "baseline-browser-mapping": "dist/cli.js" } }, "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg=="], "bcryptjs": ["bcryptjs@3.0.3", "", { "bin": { "bcrypt": "bin/bcrypt" } }, "sha512-GlF5wPWnSa/X5LKM1o0wz0suXIINz1iHRLvTS+sLyi7XPbe5ycmYI3DlZqVGZZtDgl4DmasFg7gOB3JYbphV5g=="], @@ -951,7 +954,7 @@ "json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, ""], - "json5": ["json5@1.0.2", "", { "dependencies": { "minimist": "^1.2.0" }, "bin": "lib/cli.js" }, ""], + "json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], "jsx-ast-utils": ["jsx-ast-utils@3.3.5", "", { "dependencies": { "array-includes": "^3.1.6", "array.prototype.flat": "^1.3.1", "object.assign": "^4.1.4", "object.values": "^1.1.6" } }, ""], @@ -1001,7 +1004,7 @@ "loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": "cli.js" }, ""], - "lru-cache": ["lru-cache@7.18.3", "", {}, ""], + "lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], "lru.min": ["lru.min@1.1.3", "", {}, ""], @@ -1203,7 +1206,7 @@ "scheduler": ["scheduler@0.27.0", "", {}, ""], - "semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, ""], + "semver": ["semver@7.7.3", "", { "bin": "bin/semver.js" }, ""], "seq-queue": ["seq-queue@0.0.5", "", {}, ""], @@ -1357,9 +1360,9 @@ "zustand": ["zustand@5.0.8", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["immer"] }, ""], - "@babel/core/json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="], + "@babel/core/semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, ""], - "@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="], + "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, ""], "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, ""], @@ -1403,12 +1406,14 @@ "@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, ""], - "@typescript-eslint/typescript-estree/semver": ["semver@7.7.3", "", { "bin": "bin/semver.js" }, ""], + "@typescript-eslint/utils/@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.9.1", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ=="], "browserslist/caniuse-lite": ["caniuse-lite@1.0.30001766", "", {}, "sha512-4C0lfJ0/YPjJQHagaE9x2Elb69CIqEPZeG0anQt9SIvIoOH4a4uaRl73IavyO+0qZh6MDLH//DrXThEYKHkmYA=="], "dom-helpers/csstype": ["csstype@3.1.3", "", {}, ""], + "eslint/@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.1", "", {}, ""], + "eslint-config-next/globals": ["globals@16.4.0", "", {}, "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw=="], "eslint-import-resolver-node/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, ""], @@ -1417,14 +1422,18 @@ "eslint-plugin-import/debug": ["debug@3.2.7", "", { "dependencies": { "ms": "^2.1.1" } }, ""], + "eslint-plugin-import/semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, ""], + "eslint-plugin-react/resolve": ["resolve@2.0.0-next.5", "", { "dependencies": { "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": "bin/resolve" }, ""], - "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, ""], + "eslint-plugin-react/semver": ["semver@6.3.1", "", { "bin": "bin/semver.js" }, ""], - "is-bun-module/semver": ["semver@7.7.3", "", { "bin": "bin/semver.js" }, ""], + "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, ""], "micromatch/picomatch": ["picomatch@2.3.1", "", {}, ""], + "named-placeholders/lru-cache": ["lru-cache@7.18.3", "", {}, ""], + "next/postcss": ["postcss@8.4.31", "", { "dependencies": { "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } }, ""], "pg-types/postgres-array": ["postgres-array@2.0.0", "", {}, ""], @@ -1435,10 +1444,12 @@ "proper-lockfile/signal-exit": ["signal-exit@3.0.7", "", {}, ""], - "sharp/semver": ["semver@7.7.3", "", { "bin": "bin/semver.js" }, ""], + "tsconfig-paths/json5": ["json5@1.0.2", "", { "dependencies": { "minimist": "^1.2.0" }, "bin": "lib/cli.js" }, ""], "@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.2", "", { "dependencies": { "balanced-match": "^1.0.0" } }, ""], + "@typescript-eslint/utils/@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, ""], + "next/postcss/nanoid": ["nanoid@3.3.11", "", { "bin": "bin/nanoid.cjs" }, ""], } } diff --git a/eslint.config.mjs b/eslint.config.mjs index 929c17b..79e5a1e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,46 +1,88 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import js from "@eslint/js"; +import nextPlugin from "@next/eslint-plugin-next"; +import tsParser from "@typescript-eslint/parser"; +import tsPlugin from "@typescript-eslint/eslint-plugin"; +import reactHooksPlugin from "eslint-plugin-react-hooks"; -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const globals = { + React: "readonly", + process: "readonly", + global: "readonly", +}; -const compat = new FlatCompat({ - baseDirectory: __dirname, -}); - -const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), +export default [ { ignores: [ "node_modules/**", ".next/**", "out/**", "build/**", + "dist/**", "next-env.d.ts", + ".env*", ], + }, + js.configs.recommended, + { + files: ["**/*.{js,jsx,ts,tsx}"], + languageOptions: { + parser: tsParser, + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + ecmaFeatures: { + jsx: true, + }, + }, + globals: { + ...globals, + document: "readonly", + window: "readonly", + navigator: "readonly", + HTMLElement: "readonly", + HTMLDivElement: "readonly", + HTMLButtonElement: "readonly", + HTMLFormElement: "readonly", + MouseEvent: "readonly", + Event: "readonly", + ResizeObserver: "readonly", + requestAnimationFrame: "readonly", + cancelAnimationFrame: "readonly", + setTimeout: "readonly", + Blob: "readonly", + URL: "readonly", + Navigator: "readonly", + Request: "readonly", + }, + }, + plugins: { + "@next/next": nextPlugin, + "@typescript-eslint": tsPlugin, + "react-hooks": reactHooksPlugin, + }, rules: { - "no-console": "error", + ...nextPlugin.configs.recommended.rules, + ...nextPlugin.configs["core-web-vitals"].rules, + ...tsPlugin.configs.recommended.rules, + ...reactHooksPlugin.configs.recommended.rules, + "no-console": "warn", "no-var": "error", "prefer-const": "error", eqeqeq: ["error", "always"], - "no-unused-vars": [ - "error", + "no-debugger": "error", + "@typescript-eslint/no-unused-vars": [ + "warn", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", }, ], - "no-debugger": "error", - "no-alert": "error", }, }, { files: ["src/components/ui/**/*.{ts,tsx}"], rules: { - "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "off", }, }, ]; - -export default eslintConfig; diff --git a/package.json b/package.json index d3796de..8399938 100644 --- a/package.json +++ b/package.json @@ -64,8 +64,11 @@ "@types/node": "^20.19.26", "@types/react": "19.2.7", "@types/react-dom": "19.2.3", + "@typescript-eslint/eslint-plugin": "^8.54.0", + "@typescript-eslint/parser": "^8.54.0", "eslint": "^9.39.1", "eslint-config-next": "16.1.4", + "eslint-plugin-react-hooks": "^7.0.1", "prisma": "^7.1.0", "tailwindcss": "^4.1.18", "tw-animate-css": "^1.4.0", diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx index 06aed8f..049d88f 100644 --- a/src/app/admin/layout.tsx +++ b/src/app/admin/layout.tsx @@ -37,6 +37,7 @@ function TopBar() { useEffect(() => { const initialBg = initAdminSimpleMode(); + // eslint-disable-next-line react-hooks/set-state-in-effect setSimpleBg(initialBg); if (initialBg) { setMode("low"); @@ -84,6 +85,7 @@ function AdminLayoutInner({ children }: { children: React.ReactNode }) { const [silkColor, setSilkColor] = useState(darkThemeColor); useEffect(() => { + // eslint-disable-next-line react-hooks/set-state-in-effect setSilkColor(theme === "light" ? lightThemeColor : darkThemeColor); }, [theme]); diff --git a/src/app/api/public/[...trpc]/route.ts b/src/app/api/public/[...trpc]/route.ts new file mode 100644 index 0000000..4bdf1b5 --- /dev/null +++ b/src/app/api/public/[...trpc]/route.ts @@ -0,0 +1,22 @@ +import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; +import { appRouter } from "@/server/routers/_app"; +import { createContext } from "@/server/context"; + +const handler = async (req: Request) => { + console.log(`[PUBLIC TRPC] ${req.method} ${req.url}`); + return fetchRequestHandler({ + endpoint: "/api/public/trpc", + req, + router: appRouter, + createContext: async () => { + const ctx = await createContext({ req }); + console.log("[PUBLIC TRPC] Context created"); + return ctx; + }, + onError: ({ error, path }) => { + console.error(`[PUBLIC TRPC ERROR] path: ${path}, error:`, error); + }, + }); +}; + +export { handler as GET, handler as POST }; diff --git a/src/app/api/public/[trpc]/route.ts b/src/app/api/public/[trpc]/route.ts deleted file mode 100644 index deeec37..0000000 --- a/src/app/api/public/[trpc]/route.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; -import { appRouter } from "@/server/routers/_app"; -import { createContext } from "@/server/context"; - -const handler = (req: Request) => - fetchRequestHandler({ - endpoint: "/api/public/trpc", - req, - router: appRouter, - createContext: () => createContext({ req }), - }); - -export { handler as GET, handler as POST }; diff --git a/src/app/api/trpc/[trpc]/route.ts b/src/app/api/trpc/[...trpc]/route.ts similarity index 55% rename from src/app/api/trpc/[trpc]/route.ts rename to src/app/api/trpc/[...trpc]/route.ts index 78809e5..d56105c 100644 --- a/src/app/api/trpc/[trpc]/route.ts +++ b/src/app/api/trpc/[...trpc]/route.ts @@ -5,6 +5,7 @@ import { auth } from "@/auth"; import { headers } from "next/headers"; const handler = async (req: Request) => { + console.log(`[AUTH TRPC] ${req.method} ${req.url}`); const session = await auth.api.getSession({ headers: await headers(), }); @@ -13,7 +14,16 @@ const handler = async (req: Request) => { endpoint: "/api/trpc", req, router: appRouter, - createContext: () => createContext({ req, session }), + createContext: async () => { + const ctx = await createContext({ req, session }); + console.log( + `[AUTH TRPC] Context created for user: ${session?.user?.email || "anonymous"}`, + ); + return ctx; + }, + onError: ({ error, path }) => { + console.error(`[AUTH TRPC ERROR] path: ${path}, error:`, error); + }, }); }; diff --git a/src/components/FaultyTerminal.tsx b/src/components/FaultyTerminal.tsx index 297a553..4e3fc6d 100644 --- a/src/components/FaultyTerminal.tsx +++ b/src/components/FaultyTerminal.tsx @@ -1,7 +1,7 @@ "use client"; -import { Renderer, Program, Mesh, Color, Triangle } from 'ogl'; -import React, { useEffect, useRef, useMemo, useCallback } from 'react'; +import { Renderer, Program, Mesh, Color, Triangle } from "ogl"; +import React, { useEffect, useRef, useMemo, useCallback } from "react"; type Vec2 = [number, number]; @@ -72,7 +72,7 @@ float hash21(vec2 p){ float noise(vec2 p) { - return sin(p.x * 10.0) * sin(p.y * (3.0 + sin(time * 0.090909))) + 0.2; + return sin(p.x * 10.0) * sin(p.y * (3.0 + sin(time * 0.090909))) + 0.2; } mat2 rotate(float angle) @@ -87,20 +87,20 @@ float fbm(vec2 p) p *= 1.1; float f = 0.0; float amp = 0.5 * uNoiseAmp; - + mat2 modify0 = rotate(time * 0.02); f += amp * noise(p); p = modify0 * p * 2.0; amp *= 0.454545; - + mat2 modify1 = rotate(time * 0.02); f += amp * noise(p); p = modify1 * p * 2.0; amp *= 0.454545; - + mat2 modify2 = rotate(time * 0.08); f += amp * noise(p); - + return f; } @@ -109,7 +109,7 @@ float pattern(vec2 p, out vec2 q, out vec2 r) { vec2 offset0 = vec2(0.0); mat2 rot01 = rotate(0.1 * time); mat2 rot1 = rotate(0.1); - + q = vec2(fbm(p + offset1), fbm(rot01 * p + offset1)); r = vec2(fbm(rot1 * q + offset0), fbm(q + offset0)); return fbm(p + r); @@ -121,42 +121,42 @@ float digit(vec2 p){ p = p * grid; vec2 q, r; float intensity = pattern(s * 0.1, q, r) * 1.3 - 0.03; - + if(uUseMouse > 0.5){ vec2 mouseWorld = uMouse * uScale; float distToMouse = distance(s, mouseWorld); float mouseInfluence = exp(-distToMouse * 8.0) * uMouseStrength * 10.0; intensity += mouseInfluence; - + float ripple = sin(distToMouse * 20.0 - iTime * 5.0) * 0.1 * mouseInfluence; intensity += ripple; } - + if(uUsePageLoadAnimation > 0.5){ float cellRandom = fract(sin(dot(s, vec2(12.9898, 78.233))) * 43758.5453); float cellDelay = cellRandom * 0.8; float cellProgress = clamp((uPageLoadProgress - cellDelay) / 0.2, 0.0, 1.0); - + float fadeAlpha = smoothstep(0.0, 1.0, cellProgress); intensity *= fadeAlpha; } - + p = fract(p); p *= uDigitSize; - + float px5 = p.x * 5.0; float py5 = (1.0 - p.y) * 5.0; float x = fract(px5); float y = fract(py5); - + float i = floor(py5) - 2.0; float j = floor(px5) - 2.0; float n = i * i + j * j; float f = n * 0.0625; - + float isOn = step(0.1, intensity - f); float brightness = isOn * (0.2 + y * 0.8) * (0.75 + x * 0.25); - + return step(0.0, p.x) * step(p.x, 1.0) * step(0.0, p.y) * step(p.y, 1.0) * brightness; } @@ -173,10 +173,10 @@ float displace(vec2 look) } vec3 getColor(vec2 p){ - + float bar = step(mod(p.y + time * 20.0, 1.0), 0.2) * 0.4 + 1.0; bar *= uScanlineIntensity; - + float displacement = displace(p); p.x += displacement; @@ -186,12 +186,12 @@ vec3 getColor(vec2 p){ } float middle = digit(p); - + const float off = 0.002; float sum = digit(p + vec2(-off, -off)) + digit(p + vec2(0.0, -off)) + digit(p + vec2(off, -off)) + digit(p + vec2(-off, 0.0)) + digit(p + vec2(0.0, 0.0)) + digit(p + vec2(off, 0.0)) + digit(p + vec2(-off, off)) + digit(p + vec2(0.0, off)) + digit(p + vec2(off, off)); - + vec3 baseColor = vec3(0.9) * middle + sum * 0.1 * vec3(1.0) * bar; return baseColor; } @@ -210,7 +210,7 @@ void main() { if(uCurvature != 0.0){ uv = barrel(uv); } - + vec2 p = uv * uScale; vec3 col = getColor(p); @@ -233,14 +233,18 @@ void main() { `; function hexToRgb(hex: string): [number, number, number] { - let h = hex.replace('#', '').trim(); + let h = hex.replace("#", "").trim(); if (h.length === 3) h = h - .split('') - .map(c => c + c) - .join(''); + .split("") + .map((c) => c + c) + .join(""); const num = parseInt(h, 16); - return [((num >> 16) & 255) / 255, ((num >> 8) & 255) / 255, (num & 255) / 255]; + return [ + ((num >> 16) & 255) / 255, + ((num >> 8) & 255) / 255, + (num & 255) / 255, + ]; } export default function FaultyTerminal({ @@ -256,7 +260,7 @@ export default function FaultyTerminal({ chromaticAberration = 0, dither = 0, curvature = 0.2, - tint = '#ffffff', + tint = "#ffffff", mouseReact = true, mouseStrength = 0.2, dpr = Math.min(window.devicePixelRatio || 1, 2), @@ -274,11 +278,17 @@ export default function FaultyTerminal({ const frozenTimeRef = useRef(0); const rafRef = useRef(0); const loadAnimationStartRef = useRef(0); - const timeOffsetRef = useRef(Math.random() * 100); + const timeOffsetRef = useRef( + // eslint-disable-next-line react-hooks/purity + Math.random() * 100, + ); const tintVec = useMemo(() => hexToRgb(tint), [tint]); - const ditherValue = useMemo(() => (typeof dither === 'boolean' ? (dither ? 1 : 0) : dither), [dither]); + const ditherValue = useMemo( + () => (typeof dither === "boolean" ? (dither ? 1 : 0) : dither), + [dither], + ); const handleMouseMove = useCallback((e: MouseEvent) => { const ctn = containerRef.current; @@ -306,7 +316,11 @@ export default function FaultyTerminal({ uniforms: { iTime: { value: 0 }, iResolution: { - value: new Color(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height) + value: new Color( + gl.canvas.width, + gl.canvas.height, + gl.canvas.width / gl.canvas.height, + ), }, uScale: { value: scale }, @@ -321,14 +335,17 @@ export default function FaultyTerminal({ uCurvature: { value: curvature }, uTint: { value: new Color(tintVec[0], tintVec[1], tintVec[2]) }, uMouse: { - value: new Float32Array([smoothMouseRef.current.x, smoothMouseRef.current.y]) + value: new Float32Array([ + smoothMouseRef.current.x, + smoothMouseRef.current.y, + ]), }, uMouseStrength: { value: mouseStrength }, uUseMouse: { value: mouseReact ? 1 : 0 }, uPageLoadProgress: { value: pageLoadAnimation ? 0 : 1 }, uUsePageLoadAnimation: { value: pageLoadAnimation ? 1 : 0 }, - uBrightness: { value: brightness } - } + uBrightness: { value: brightness }, + }, }); programRef.current = program; @@ -340,7 +357,7 @@ export default function FaultyTerminal({ program.uniforms.iResolution.value = new Color( gl.canvas.width, gl.canvas.height, - gl.canvas.width / gl.canvas.height + gl.canvas.width / gl.canvas.height, ); } @@ -387,14 +404,14 @@ export default function FaultyTerminal({ rafRef.current = requestAnimationFrame(update); ctn.appendChild(gl.canvas); - if (mouseReact) ctn.addEventListener('mousemove', handleMouseMove); + if (mouseReact) ctn.addEventListener("mousemove", handleMouseMove); return () => { cancelAnimationFrame(rafRef.current); resizeObserver.disconnect(); - if (mouseReact) ctn.removeEventListener('mousemove', handleMouseMove); + if (mouseReact) ctn.removeEventListener("mousemove", handleMouseMove); if (gl.canvas.parentElement === ctn) ctn.removeChild(gl.canvas); - gl.getExtension('WEBGL_lose_context')?.loseContext(); + gl.getExtension("WEBGL_lose_context")?.loseContext(); loadAnimationStartRef.current = 0; timeOffsetRef.current = Math.random() * 100; }; @@ -417,11 +434,15 @@ export default function FaultyTerminal({ mouseStrength, pageLoadAnimation, brightness, - handleMouseMove + handleMouseMove, ]); return ( -
+
); } - diff --git a/src/components/background/admin-background.tsx b/src/components/background/admin-background.tsx index 89bd965..6477589 100644 --- a/src/components/background/admin-background.tsx +++ b/src/components/background/admin-background.tsx @@ -12,6 +12,7 @@ export default function AdminBackground({ color }: AdminBackgroundProps) { useEffect(() => { if (typeof window === "undefined") return; + // eslint-disable-next-line react-hooks/set-state-in-effect setSimple(window.__moodAdminSimpleBg === true); const handler = () => { setSimple(window.__moodAdminSimpleBg === true); diff --git a/src/lib/trpc/public-provider.tsx b/src/lib/trpc/public-provider.tsx index 4018ea3..4990dfd 100644 --- a/src/lib/trpc/public-provider.tsx +++ b/src/lib/trpc/public-provider.tsx @@ -17,7 +17,7 @@ export default function PublicTRPCProvider({ publicTrpc.createClient({ links: [ httpBatchLink({ - url: "/api/public", + url: "/api/public/trpc", transformer: superjson, }), ], diff --git a/src/perf/context.tsx b/src/perf/context.tsx index 7187ad7..5f829e9 100644 --- a/src/perf/context.tsx +++ b/src/perf/context.tsx @@ -24,6 +24,7 @@ export function PerfModeProvider({ children }: { children: React.ReactNode }) { useEffect(() => { const initial = loadPerfMode(); + // eslint-disable-next-line react-hooks/set-state-in-effect setModeState(initial); setEffectiveMode(computeEffectiveMode(initial)); }, []); diff --git a/src/perf/motion.tsx b/src/perf/motion.tsx index 116b040..8dfd313 100644 --- a/src/perf/motion.tsx +++ b/src/perf/motion.tsx @@ -1,5 +1,7 @@ "use client"; +/* eslint-disable react-hooks/static-components */ + import React from "react"; import { motion, MotionProps } from "framer-motion"; import { usePerfMode } from "./context"; diff --git a/src/server/context.ts b/src/server/context.ts index 6284ec7..1cc3d90 100644 --- a/src/server/context.ts +++ b/src/server/context.ts @@ -7,7 +7,10 @@ interface CreateContextOptions { session?: typeof auth.$Infer.Session | null; } -export async function createContext({ req, session }: CreateContextOptions) { +export async function createContext({ + req: _req, + session, +}: CreateContextOptions) { const finalSession = session !== undefined ? session