-
Notifications
You must be signed in to change notification settings - Fork 32
feat: add dedicated FAQ page #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
saurabhhhcodes
wants to merge
7
commits into
kunalverma2512:main
Choose a base branch
from
saurabhhhcodes:feat/faq-page-31
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cb866f4
feat: add dedicated FAQ page
saurabhhhcodes 8034de9
fix: address FAQ page review feedback
saurabhhhcodes 712bea4
fix: bind FAQ panel regions to toggles
saurabhhhcodes 30c5e49
fix: use history back on FAQ page
saurabhhhcodes c9b6285
fix: contain FAQ page mobile width
saurabhhhcodes 311d34f
fix: harden faq page navigation behavior
saurabhhhcodes e4aae50
fix: polish FAQ accordion panel
saurabhhhcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| export const faqs = [ | ||
| { | ||
| id: "what-is-codelens", | ||
| category: "Platform tracking", | ||
| 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.", | ||
| }, | ||
| { | ||
| id: "problem-solved", | ||
| category: "Platform tracking", | ||
| 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.", | ||
| }, | ||
| { | ||
| id: "data-privacy", | ||
| category: "Data privacy", | ||
| q: "Is my repository data private?", | ||
| a: "CodeLens only uses publicly available data from connected platforms and does not store any sensitive information.", | ||
| }, | ||
| { | ||
| id: "contribute", | ||
| category: "Open source", | ||
| 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.", | ||
| }, | ||
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| import { useRef, useState } from "react"; | ||
| import { useNavigate } from "react-router-dom"; | ||
| import { faqs } from "../data/faqs"; | ||
|
|
||
| const supportTopics = [...new Set(faqs.map((item) => 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 ( | ||
| <main className="w-full overflow-x-hidden bg-white text-black"> | ||
| <title>FAQ - CodeLens</title> | ||
| <section className="border-b-4 border-black px-6 py-20 sm:px-10 lg:px-16 lg:py-28"> | ||
| <div className="mx-auto grid max-w-7xl gap-12 lg:grid-cols-[0.9fr_1.1fr] lg:items-end"> | ||
| <div> | ||
| <p className="mb-5 text-xs font-black uppercase tracking-[0.28em] text-black"> | ||
| Help Center / FAQ | ||
| </p> | ||
| <h1 className="text-5xl font-black uppercase leading-none tracking-tight text-black sm:text-7xl lg:text-8xl"> | ||
| Answers Without The Noise. | ||
| </h1> | ||
| </div> | ||
|
|
||
| <div className="border-4 border-black bg-white p-6 shadow-[6px_6px_0_0_rgba(0,0,0,1)] sm:p-8 sm:shadow-[10px_10px_0_0_rgba(0,0,0,1)]"> | ||
| <p className="text-base font-bold leading-relaxed text-black sm:text-lg"> | ||
| Quick answers for developers connecting coding platforms, reading analytics, | ||
| protecting profile data, and contributing to CodeLens. | ||
| </p> | ||
| <div className="mt-8 grid grid-cols-1 gap-3 sm:grid-cols-2"> | ||
| {supportTopics.map((topic) => ( | ||
| <span | ||
| key={topic} | ||
| className="border-2 border-black px-3 py-3 text-center text-[11px] font-black uppercase tracking-widest" | ||
| > | ||
| {topic} | ||
| </span> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </section> | ||
|
|
||
| <section className="px-6 py-16 sm:px-10 lg:px-16 lg:py-24"> | ||
| <div className="mx-auto grid max-w-7xl gap-10 lg:grid-cols-[320px_1fr]"> | ||
| <aside className="h-fit border-4 border-black bg-black p-6 text-white lg:sticky lg:top-24"> | ||
| <h2 className="text-3xl font-black uppercase leading-none tracking-tight"> | ||
| FAQ Index | ||
| </h2> | ||
| <div className="mt-6 flex flex-col gap-3"> | ||
| {faqs.map((item, index) => ( | ||
| <button | ||
| key={item.id} | ||
| type="button" | ||
| onClick={() => toggleFaq(index, true)} | ||
| className={`break-words border-2 px-4 py-3 text-left text-xs font-black uppercase tracking-widest transition-colors ${ | ||
| openIdx === index | ||
| ? "border-white bg-white text-black" | ||
| : "border-white text-white hover:bg-white hover:text-black" | ||
| }`} | ||
| > | ||
| {String(index + 1).padStart(2, "0")} / {item.q} | ||
| </button> | ||
| ))} | ||
| </div> | ||
| </aside> | ||
|
|
||
| <div className="flex flex-col gap-6"> | ||
| {faqs.map((item, index) => { | ||
| const isOpen = openIdx === index; | ||
| const buttonId = `faq-button-${item.id}`; | ||
| const panelId = `faq-panel-${item.id}`; | ||
|
|
||
| return ( | ||
| <article | ||
| key={item.id} | ||
| ref={(element) => { | ||
| 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)]" | ||
| > | ||
| <button | ||
| type="button" | ||
| onClick={() => toggleFaq(index)} | ||
| className="flex w-full items-center justify-between gap-6 p-6 text-left sm:p-8" | ||
| aria-expanded={isOpen} | ||
| aria-controls={panelId} | ||
| id={buttonId} | ||
| > | ||
| <span className="text-2xl font-black uppercase leading-tight tracking-tight sm:text-4xl"> | ||
| {item.q} | ||
| </span> | ||
| <span className="text-4xl font-black leading-none" aria-hidden="true"> | ||
| {isOpen ? "-" : "+"} | ||
| </span> | ||
| </button> | ||
|
|
||
| <div | ||
| id={panelId} | ||
| role="region" | ||
| aria-labelledby={buttonId} | ||
| aria-hidden={!isOpen} | ||
| className={`grid transition-all duration-300 ease-in-out ${ | ||
| isOpen ? "grid-rows-[1fr] border-t-4 border-black" : "grid-rows-[0fr]" | ||
| }`} | ||
| > | ||
| <div className="overflow-hidden"> | ||
| <p className="max-w-3xl px-6 py-6 text-base font-bold leading-relaxed text-black sm:px-8 sm:text-lg"> | ||
| {item.a} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </article> | ||
| ); | ||
| })} | ||
| </div> | ||
| </div> | ||
| </section> | ||
|
|
||
| <section className="border-t-4 border-black bg-black px-6 py-14 text-white sm:px-10 lg:px-16"> | ||
| <div className="mx-auto flex max-w-7xl flex-col gap-8 lg:flex-row lg:items-center lg:justify-between"> | ||
| <div> | ||
| <p className="mb-3 text-xs font-black uppercase tracking-[0.28em]"> | ||
| All Caught Up? | ||
| </p> | ||
| <h2 className="text-4xl font-black uppercase leading-none tracking-tight sm:text-6xl"> | ||
| Head Back To The Platform. | ||
| </h2> | ||
| </div> | ||
| <button | ||
| type="button" | ||
| onClick={handleGoBack} | ||
| className="inline-flex border-4 border-white px-8 py-5 text-sm font-black uppercase tracking-widest text-white transition-colors hover:bg-white hover:text-black" | ||
| > | ||
| Go Back | ||
| </button> | ||
| </div> | ||
| </section> | ||
| </main> | ||
| ); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.