-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Redot-Engine/feature/legal-page
Add dynamic contact, FAQ, and license pages
- Loading branch information
Showing
13 changed files
with
512 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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,83 @@ | ||
"use client"; | ||
|
||
import HeaderSection from "@/components/header-section"; | ||
import { ContactCard } from "@/components/contact/contact-card"; | ||
import { contactCardsData } from "@/constants/contactCardsData"; | ||
import { Start } from "@/components/sections/landing/start"; | ||
import { useInView } from "react-intersection-observer"; | ||
import { motion } from "motion/react"; | ||
import { faqList } from "@/constants/faq"; | ||
import { | ||
Accordion, | ||
AccordionContent, | ||
AccordionItem, | ||
AccordionTrigger, | ||
} from "@/components/ui/accordion"; | ||
import { useTranslations } from "next-intl"; | ||
|
||
export default function Contact() { | ||
const { ref, inView } = useInView({ | ||
threshold: 0.1, | ||
triggerOnce: true, | ||
}); | ||
|
||
const cardVariants = { | ||
hidden: { opacity: 0, scale: 0.9 }, | ||
visible: { opacity: 1, scale: 1 }, | ||
}; | ||
|
||
const t = useTranslations("contact"); | ||
|
||
return ( | ||
<div ref={ref}> | ||
<div className="relative flex w-full items-start justify-center bg-white bg-grid-black/[0.1] dark:bg-black dark:bg-grid-white/[0.1]"> | ||
{/* Radial gradient for the container to give a faded look */} | ||
<div className="pointer-events-none absolute inset-0 flex items-center justify-center bg-white [mask-image:radial-gradient(ellipse_at_center,transparent_20%,black)] dark:bg-black"></div> | ||
<div className="relative z-20 px-5 pb-5 pt-10 lg:px-40"> | ||
<HeaderSection section="contact" /> | ||
</div> | ||
</div> | ||
<div className="mt-10 px-5 lg:px-40"> | ||
<div className="grid grid-rows-4 gap-8 md:grid-cols-2 md:grid-rows-2 lg:grid-cols-4 lg:grid-rows-1"> | ||
{contactCardsData.map((card, index) => ( | ||
<motion.div | ||
key={index} | ||
initial="hidden" | ||
animate={inView ? "visible" : "hidden"} | ||
variants={cardVariants} | ||
transition={{ | ||
duration: 0.5, | ||
delay: index * 0.2, | ||
}} | ||
> | ||
<ContactCard | ||
icon={card.icon} | ||
title={t(`contactCard.${card.title}`)} | ||
description={t(`contactCard.${card.description}`)} | ||
links={card.links} | ||
/> | ||
</motion.div> | ||
))} | ||
</div> | ||
</div> | ||
<div className="mt-24 px-5 lg:px-40"> | ||
<div className="flex flex-col items-center gap-8"> | ||
<h2 className="mt-5 text-center text-3xl font-bold tracking-tighter md:text-4xl"> | ||
{t("faqTitle")} | ||
</h2> | ||
<Accordion type="single" className="w-full md:w-[600px]" collapsible> | ||
{faqList.map((faq, index) => ( | ||
<AccordionItem key={index} value={`item-${index + 1}`}> | ||
<AccordionTrigger className="text-left"> | ||
{t(`faq.${faq.question}`)} | ||
</AccordionTrigger> | ||
<AccordionContent> {t(`faq.${faq.answer}`)}</AccordionContent> | ||
</AccordionItem> | ||
))} | ||
</Accordion> | ||
</div> | ||
</div> | ||
<Start /> | ||
</div> | ||
); | ||
} |
This file contains 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,78 @@ | ||
"use client"; | ||
|
||
import HeaderSection from "@/components/header-section"; | ||
import { useEffect, useState } from "react"; | ||
import axios from "axios"; | ||
import { Start } from "@/components/sections/landing/start"; | ||
|
||
export default function License() { | ||
const [files, setFiles] = useState<{ [key: string]: string }>({ | ||
LICENSE: "", | ||
COPYRIGHT: "", | ||
LOGO_LICENSE: "", | ||
}); | ||
|
||
useEffect(() => { | ||
const fileUrls = { | ||
LICENSE: | ||
"https://raw.githubusercontent.com/Redot-Engine/redot-engine/refs/heads/master/LICENSE.txt", | ||
COPYRIGHT: | ||
"https://raw.githubusercontent.com/Redot-Engine/redot-engine/refs/heads/master/COPYRIGHT.txt", | ||
LOGO_LICENSE: | ||
"https://raw.githubusercontent.com/Redot-Engine/redot-engine/refs/heads/master/LOGO_LICENSE.txt", | ||
}; | ||
|
||
const fetchFiles = async () => { | ||
try { | ||
const responses = await Promise.all( | ||
Object.entries(fileUrls).map(async ([key, url]) => { | ||
const response = await axios.get(url); | ||
return { key, content: response.data }; | ||
}) | ||
); | ||
const newFiles = responses.reduce( | ||
(acc, { key, content }) => { | ||
acc[key] = content; | ||
return acc; | ||
}, | ||
{} as { [key: string]: string } | ||
); | ||
|
||
setFiles(newFiles); | ||
} catch (error) { | ||
console.error("Error fetching files:", error); | ||
} | ||
}; | ||
|
||
fetchFiles(); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<div className="relative flex w-full items-start justify-center bg-white bg-grid-black/[0.1] dark:bg-black dark:bg-grid-white/[0.1]"> | ||
{/* Radial gradient for the container to give a faded look */} | ||
<div className="pointer-events-none absolute inset-0 flex items-center justify-center bg-white [mask-image:radial-gradient(ellipse_at_center,transparent_20%,black)] dark:bg-black"></div> | ||
<div className="relative z-20 px-5 pb-5 pt-10 lg:px-40"> | ||
<HeaderSection section="licenses" /> | ||
</div> | ||
</div> | ||
|
||
<div className="mt-24 flex flex-col gap-8 px-5 lg:px-40"> | ||
<div className="flex flex-col gap-4"> | ||
<h3 className="text-xl font-medium">LICENSE</h3> | ||
<pre>{files.LICENSE}</pre> | ||
</div> | ||
<div className="flex flex-col gap-4"> | ||
<h3 className="text-xl">COPYRIGHT</h3> | ||
<pre>{files.COPYRIGHT}</pre> | ||
</div> | ||
<div className="flex flex-col gap-4"> | ||
<h3 className="text-xl">LOGO LICENSE</h3> | ||
<pre>{files.LOGO_LICENSE}</pre> | ||
</div> | ||
</div> | ||
|
||
<Start /> | ||
</div> | ||
); | ||
} |
This file contains 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,51 @@ | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
interface ContactCardProps { | ||
icon: React.ReactNode; | ||
title: string; | ||
description: string; | ||
links: { label: string; url: string }[]; | ||
direction?: "row" | "col"; | ||
} | ||
|
||
export const ContactCard = ({ | ||
icon, | ||
title, | ||
description, | ||
links, | ||
direction = "row", | ||
}: ContactCardProps) => { | ||
const directionClass = cn({ | ||
"flex-row": direction === "row", | ||
"flex-col": direction === "col", | ||
}); | ||
|
||
return ( | ||
<div className="border-gray-250 flex h-[15rem] flex-col justify-between rounded-xl border bg-background p-4"> | ||
<div className="border-gray-250 flex h-[36px] w-[36px] items-center justify-center rounded-lg border"> | ||
{icon} | ||
</div> | ||
<div className="flex flex-col gap-4"> | ||
<div className="flex flex-col"> | ||
<p className="text-lg font-medium">{title}</p> | ||
<p className="text-base text-black/80">{description}</p> | ||
</div> | ||
<div className={cn("flex flex-wrap gap-2", directionClass)}> | ||
{links.map(({ label, url }) => ( | ||
<Link | ||
key={label} | ||
href={url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-sm font-medium underline" | ||
> | ||
{label} | ||
</Link> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains 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
Oops, something went wrong.