diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 3d82063..1202a31 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -17,6 +17,7 @@ import ContestLeetCodePage from "./pages/ContestLeetCodePage"; import ContestAtCoderPage from "./pages/ContestAtCoderPage"; import TermsPage from "./pages/TermsPage"; import PrivacyPage from "./pages/PrivacyPage"; +import FAQPage from "./pages/FAQPage"; import NotFoundPage from "./pages/NotFoundPage"; import ForgotPassword from "./components/auth/ForgotPassword"; import AccountCenterPage from "./pages/AccountCenterPage"; @@ -24,7 +25,7 @@ import GitHubIntelligencePage from "./pages/GitHubIntelligencePage"; import GitHubCallbackPage from "./pages/GitHubCallbackPage"; import ProtectedRoute from "./components/shared/ProtectedRoute"; import PublicRoute from "./components/shared/PublicRoute"; -import FAQSection from "./components/explore/FAQSection"; + export default function App() { return ( @@ -101,6 +102,7 @@ export default function App() { /> } /> } /> + } /> } /> diff --git a/frontend/src/components/explore/FAQSection.jsx b/frontend/src/components/explore/FAQSection.jsx index 8c9664f..dff77a5 100644 --- a/frontend/src/components/explore/FAQSection.jsx +++ b/frontend/src/components/explore/FAQSection.jsx @@ -1,24 +1,6 @@ import { useState } from "react"; import { Link } from "react-router-dom"; - -const faqs = [ - { - q: "What is CodeLens?", - a: "CodeLens is a platform that helps developers track their coding progress across different platforms like Codeforces, LeetCode, and GitHub in one place.", - }, - { - q: "What problem does CodeLens solve?", - a: "It brings all your coding activity into one place so you can understand your progress, stay consistent, and know what to improve next.", - }, - { - q: "Is my repository data private?", - a: "CodeLens only uses publicly available data from connected platforms and does not store any sensitive information.", - }, - { - q: "How can I contribute to CodeLens?", - a: "You can contribute by solving issues, adding features, improving UI, or fixing bugs. Check the repository and start with beginner-friendly issues.", - }, -]; +import { faqs } from "../../data/faqs"; export default function FAQSection() { const [openIdx, setOpenIdx] = useState(null); @@ -35,15 +17,21 @@ export default function FAQSection() {
{faqs.map((item, index) => { const isOpen = openIdx === index; + const buttonId = `landing-faq-button-${item.id}`; + const panelId = `landing-faq-panel-${item.id}`; return (
); @@ -76,7 +72,7 @@ export default function FAQSection() {
View All FAQs @@ -84,4 +80,4 @@ export default function FAQSection() {
); -} \ No newline at end of file +} diff --git a/frontend/src/components/shared/Footer.jsx b/frontend/src/components/shared/Footer.jsx index 7db19bd..96c447c 100644 --- a/frontend/src/components/shared/Footer.jsx +++ b/frontend/src/components/shared/Footer.jsx @@ -35,6 +35,7 @@ export default function Footer() { {[ { to: "/dashboard", label: "Dashboard" }, { to: "/explore", label: "Explore" }, + { to: "/faq", label: "FAQ" }, { to: "/codeforces", label: "Codeforces" }, ].map((l) => ( item.category))]; + +export default function FAQPage() { + const [openIdx, setOpenIdx] = useState(null); + const itemRefs = useRef([]); + const navigate = useNavigate(); + + const handleGoBack = () => { + if (window.history.length > 1) { + navigate(-1); + return; + } + + navigate("/explore"); + }; + + const toggleFaq = (index, shouldScroll = false) => { + setOpenIdx((currentIndex) => (currentIndex === index ? null : index)); + + if (shouldScroll) { + window.requestAnimationFrame(() => { + window.requestAnimationFrame(() => { + itemRefs.current[index]?.scrollIntoView({ + behavior: "smooth", + block: "start", + }); + }); + }); + } + }; + + return ( +
+ FAQ - CodeLens +
+
+
+

+ Help Center / FAQ +

+

+ Answers Without The Noise. +

+
+ +
+

+ Quick answers for developers connecting coding platforms, reading analytics, + protecting profile data, and contributing to CodeLens. +

+
+ {supportTopics.map((topic) => ( + + {topic} + + ))} +
+
+
+
+ +
+
+ + +
+ {faqs.map((item, index) => { + const isOpen = openIdx === index; + const buttonId = `faq-button-${item.id}`; + const panelId = `faq-panel-${item.id}`; + + return ( +
{ + itemRefs.current[index] = element; + }} + className="border-4 border-black bg-white shadow-[6px_6px_0_0_rgba(0,0,0,1)] sm:shadow-[8px_8px_0_0_rgba(0,0,0,1)]" + > + + +
+
+

+ {item.a} +

+
+
+
+ ); + })} +
+
+
+ +
+
+
+

+ All Caught Up? +

+

+ Head Back To The Platform. +

+
+ +
+
+
+ ); +}