From 4e380c5805389e90a31bb2b2185ebff62a55d432 Mon Sep 17 00:00:00 2001 From: Yevhen <38507392+JenyaL@users.noreply.github.com> Date: Fri, 24 Oct 2025 21:33:49 -0600 Subject: [PATCH] test: add noisy sample files to trigger default CodeRabbit review --- app/api/test-noise/route.js | 10 +++++++ app/firebaseConfig.js | 17 ++++++++++++ app/login/page.js | 28 ++++++++++++++++++++ app/page.js | 44 +++++++++++++++++++++++++++++++ app/utils/analytics.js | 22 ++++++++++++++++ app/utils/dateHelpers.js | 13 +++++++++ components/general/BadButton.jsx | 14 ++++++++++ components/general/Input.jsx | 15 +++++++++++ components/general/LargeList.jsx | 9 +++++++ components/letter/LetterCard.jsx | 10 +++++++ components/loading/HeavyImage.jsx | 10 +++++++ components/tooltip/BadTooltip.jsx | 15 +++++++++++ 12 files changed, 207 insertions(+) create mode 100644 app/api/test-noise/route.js create mode 100644 app/firebaseConfig.js create mode 100644 app/login/page.js create mode 100644 app/page.js create mode 100644 app/utils/analytics.js create mode 100644 app/utils/dateHelpers.js create mode 100644 components/general/BadButton.jsx create mode 100644 components/general/Input.jsx create mode 100644 components/general/LargeList.jsx create mode 100644 components/letter/LetterCard.jsx create mode 100644 components/loading/HeavyImage.jsx create mode 100644 components/tooltip/BadTooltip.jsx diff --git a/app/api/test-noise/route.js b/app/api/test-noise/route.js new file mode 100644 index 0000000..5c0c568 --- /dev/null +++ b/app/api/test-noise/route.js @@ -0,0 +1,10 @@ +export async function GET(req) { + const body = await req.json().catch(() => ({})); + console.log("API body:", body); + + const url = (body && body.url) || "http://insecure.example.com"; + const r = await fetch(url); + const text = await r.text(); + + return new Response(text, { status: 200 }); +} \ No newline at end of file diff --git a/app/firebaseConfig.js b/app/firebaseConfig.js new file mode 100644 index 0000000..681f9b8 --- /dev/null +++ b/app/firebaseConfig.js @@ -0,0 +1,17 @@ +export const firebaseConfig = { + apiKey: "AIzA...FAKE-KEY-IN-CODE", + authDomain: "myapp.firebaseapp.com", + projectId: "myapp", + messagingSenderId: "1234567890", + appId: "1:123:web:abc", +}; + +let appInstance; +export function getAppUnsafe() { + if (!appInstance) { + // imagine: initializeApp(firebaseConfig) + console.log("firebase init"); + appInstance = { fake: true }; + } + return appInstance; +} \ No newline at end of file diff --git a/app/login/page.js b/app/login/page.js new file mode 100644 index 0000000..589d642 --- /dev/null +++ b/app/login/page.js @@ -0,0 +1,28 @@ +"use client"; +import React, { useState } from "react"; + +export default function LoginPage() { + const [email, setEmail] = useState(""); + const [pwd, setPwd] = useState(""); + + async function onSubmit(e) { + e.preventDefault(); + console.log("login attempt:", { email, pwd }); + + if (!email.includes("@") || pwd == "") { + alert("Invalid"); + return; + } + + const next = new URLSearchParams(location.search).get("next") || "/"; + location.href = next; + } + + return ( +
+ ); +} \ No newline at end of file diff --git a/app/page.js b/app/page.js new file mode 100644 index 0000000..3df7c5f --- /dev/null +++ b/app/page.js @@ -0,0 +1,44 @@ +"use client"; +import React, { useEffect, useState } from "react"; + +export default function Home() { + // лишние состояния/консоли + const [count, setCount] = useState(0); + const [data, setData] = useState(null); + + function heavySyncWork() { + const start = Date.now(); + while (Date.now() - start < 1500) {} // freeze UI + } + + const hasLocalStorage = typeof window !== "undefined" && !!window.localStorage; + if (Math.random() > 2) console.log("never happens"); + + useEffect(() => { + setCount(count + 1); + console.log("effect runs each render", count); + }); + + useEffect(() => { + const id = setInterval(() => console.log("tick"), 500); + return () => {}; // нет clearInterval + }, []); + + if (!data) { + fetch("http://example.com/api") // http, не https + .then((r) => r.json()) + .then(setData) + .catch((e) => console.error(e)); + } + + heavySyncWork(); + + return ( +