From 565f6303c234bfb40988c876d84b23be868c2ada Mon Sep 17 00:00:00 2001 From: bitmap4 Date: Tue, 5 Nov 2024 22:14:46 +0000 Subject: [PATCH] feat: faq page (closes #8) --- src/app/faq/page.tsx | 51 ++++++++++++++++++++++++++++++++----------- src/content/faqs.json | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 src/content/faqs.json diff --git a/src/app/faq/page.tsx b/src/app/faq/page.tsx index 63fb8a1..c88bfb5 100644 --- a/src/app/faq/page.tsx +++ b/src/app/faq/page.tsx @@ -1,10 +1,42 @@ import { ReactNode } from 'react'; +import At from '@/components/At'; +import faqs from '@/content/faqs.json'; +import Link from 'next/link'; interface QuestionProps { - title: string; + title: ReactNode; children: ReactNode; } +function parseContent(text: string): ReactNode[] { + const atParts = text.split('@'); + const result: ReactNode[] = []; + + atParts.forEach((part, index) => { + if (index > 0) { + result.push(); + } + result.push(...replaceLinks(part, index)); + }); + + return result; +} + +function replaceLinks(text: string, keyPrefix: number): ReactNode[] { + const urlRegex = /(https?:\/\/[^\s]+)/g; + const parts = text.split(urlRegex); + + return parts.map((part, index) => + urlRegex.test(part) ? ( + + {part} + + ) : ( + part + ) + ); +} + const Question = ({ title, children }: QuestionProps) => (

{title}

@@ -19,18 +51,11 @@ export default function FAQs() {

FAQs

- - Game theory is the study of mathematical models of strategic interaction among rational decision-makers. It has applications in various fields, including economics, political science, psychology, and computer science. - - - In economics, game theory is used to model the behavior of individuals and firms in situations where their decisions affect each other. It helps in understanding competitive behaviors, market strategies, and the outcomes of different economic scenarios. - - - Some common concepts in game theory include Nash equilibrium, dominant strategies, Pareto efficiency, and zero-sum games. These concepts help in analyzing and predicting the outcomes of strategic interactions. - - - Yes, game theory can be applied to various real-life situations, such as business negotiations, political campaigns, and social interactions. It provides a framework for understanding and predicting the behavior of individuals and groups in strategic settings. - + {faqs.map((faq, index) => ( + + {parseContent(faq.answer)} + + ))}
diff --git a/src/content/faqs.json b/src/content/faqs.json new file mode 100644 index 0000000..1a54a2d --- /dev/null +++ b/src/content/faqs.json @@ -0,0 +1,38 @@ +[ + { + "question": "What is GameTheory@IIITH?", + "answer": "GameTheory@IIITH is a student-run club at IIITH to learn, practice, and master strategic and critical thinking through games like poker, Monopoly, etc in a fun and social environment. We host weekly Poker nights, workshops, and other board games as well." + }, + { + "question": "Are there any membership requirements for GameTheory@IIITH?", + "answer": "You must fill out the membership form (which contains a non-disclosure agreement) to gain access to any and all of our future events. https://forms.gle/b3FtfsSFQmboAUoDA" + }, + { + "question": "Do I need to know how to play poker to participate?", + "answer": "The club is open to the entire IIIT community, regardless of their familiarity with strategy games. Beginners are always welcome— a beginner table is always reserved for learning purposes and a member will teach you." + }, + { + "question": "Do I have to have prior experience in the game before joining the event?", + "answer": "No prior experience is needed! We welcome players of all levels and provide instruction of relevant board games when necessary." + }, + { + "question": "Why play strategy games?", + "answer": "Strategy games encourage you to think ahead, weigh risks, and make calculated decisions—skills that are valuable in many real-world scenarios. Playing these games regularly can help you become a more strategic thinker." + }, + { + "question": "How do I stay updated on upcoming events?", + "answer": "You can stay informed through our Instagram pages, Outlook email announcements, or our WhatsApp group. Watch out for upcoming event schedules and special theme nights!" + }, + { + "question": "Are there prizes or competitions at these game nights?", + "answer": "Yes! Apart from being featured on our social media and being added to our leaderboard, we often add a competitive element with small prizes or bragging rights for the winners." + }, + { + "question": "Can I suggest a new game or event idea?", + "answer": "Absolutely! We’re always open to new ideas and suggestions. If you have a favorite strategy game or a unique event idea, let us know." + }, + { + "question": "How can I join GameTheory@IIITH as a team member?", + "answer": "We usually have recruitments in the monsoon semester of every year. Follow our social media and watch out on Outlook!" + } +] \ No newline at end of file