-
Notifications
You must be signed in to change notification settings - Fork 37
feat: add dedicated FAQ page and navigation link #134
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
Merged
+94
−3
Merged
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import { useState } from "react"; | ||
| import { ChevronDown, ScanLine, Award, MapPin } from "lucide-react"; | ||
|
|
||
| const faqs = [ | ||
| { | ||
| title: "How should I position the fish for scanning?", | ||
| icon: ScanLine, | ||
| content: | ||
| "Place the fish on a flat surface with good lighting. Keep the camera around 15 cm away and ensure the whole fish is visible.", | ||
| }, | ||
| { | ||
| title: "What do the freshness scores mean?", | ||
| icon: Award, | ||
| content: | ||
| "Scores range from 0 to 100. Higher scores indicate fresher fish. Scores above 80 are considered high quality.", | ||
| }, | ||
| { | ||
| title: "How does the Market Map work?", | ||
| icon: MapPin, | ||
| content: | ||
| "The Market Map displays freshness trends from anonymized scan results and helps users identify reliable seafood vendors.", | ||
| }, | ||
| ]; | ||
|
|
||
| export default function FAQPage() { | ||
| const [openIndex, setOpenIndex] = useState<number | null>(0); | ||
|
|
||
| return ( | ||
| <div className="px-6 md:px-16 lg:px-24 py-16"> | ||
| <div className="max-w-4xl mx-auto"> | ||
| <span className="status-terminal block mb-4"> | ||
| USER_GUIDE_AND_FAQ | ||
| </span> | ||
|
|
||
| <h1 className="text-4xl md:text-6xl font-bold mb-6"> | ||
| How To Use | ||
| <br /> | ||
| <span className="text-neon">FreshScan AI</span> | ||
| </h1> | ||
|
|
||
| <p className="text-on-surface-variant mb-12"> | ||
| Learn how to scan fish correctly, understand freshness scores, | ||
| and use the Market Map effectively. | ||
| </p> | ||
|
|
||
| <div className="space-y-3"> | ||
| {faqs.map((faq, index) => ( | ||
| <div | ||
| key={index} | ||
| className="bg-surface-mid hover:bg-surface-high transition-colors duration-200" | ||
| > | ||
| <button | ||
| className="w-full p-5 flex items-center justify-between text-left" | ||
| onClick={() => | ||
| setOpenIndex(openIndex === index ? null : index) | ||
| } | ||
| > | ||
| <div className="flex items-center gap-3"> | ||
| <faq.icon size={20} className="text-neon" /> | ||
| <span className="font-semibold">{faq.title}</span> | ||
| </div> | ||
|
|
||
| <ChevronDown | ||
| size={18} | ||
| className={`transition-transform ${ | ||
| openIndex === index ? "rotate-180" : "" | ||
| }`} | ||
| /> | ||
| </button> | ||
|
|
||
| {openIndex === index && ( | ||
| <div className="px-5 pb-5"> | ||
| <p className="text-on-surface-variant"> | ||
| {faq.content} | ||
| </p> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add ARIA state/linkage for the accordion controls.
Line 52 renders interactive disclosure controls, but the button/panel pair has no
aria-expanded/aria-controls+idlinkage, so assistive tech can’t reliably interpret expanded state.Suggested fix
{faqs.map((faq, index) => ( + const panelId = `faq-panel-${index}`; + const buttonId = `faq-button-${index}`; + return ( <div key={index} className="bg-surface-mid hover:bg-surface-high transition-colors duration-200" > <button + id={buttonId} className="w-full p-5 flex items-center justify-between text-left" + aria-expanded={openIndex === index} + aria-controls={panelId} onClick={() => setOpenIndex(openIndex === index ? null : index) } > @@ - {openIndex === index && ( - <div className="px-5 pb-5"> + {openIndex === index && ( + <div + id={panelId} + role="region" + aria-labelledby={buttonId} + className="px-5 pb-5" + > <p className="text-on-surface-variant"> {faq.content} </p> </div> )} </div> + ); ))}🤖 Prompt for AI Agents