refactor(structure): reorganize page and component exports

- Move root page from /(app) to / directory
- Convert default exports to named exports in components
- Rename MainView component to HeroSection for better semantics
This commit is contained in:
2025-05-07 14:06:31 +08:00
parent 3417d2ee49
commit 1db666a2ab
7 changed files with 38 additions and 34 deletions
-17
View File
@@ -1,17 +0,0 @@
import FAQs from "@/components/faqs";
import { Header } from "@/components/header";
import { Footer } from "@/components/footer";
import { MainView } from "@/components/main-view";
import { PrimaryFeatures } from "@/components/primary-features";
export default function HomePage() {
return (
<>
<Header />
<MainView />
<PrimaryFeatures />
<FAQs />
<Footer />
</>
)
}
+15
View File
@@ -0,0 +1,15 @@
import { FAQs } from "@/components/faqs";
import { Header } from "@/components/header";
import { Footer } from "@/components/footer";
import { HeroSection } from "@/components/hero-section";
import { PrimaryFeatures } from "@/components/primary-features";
export default function RootPage() {
<>
<Header />
<HeroSection />
<PrimaryFeatures />
<FAQs />
<Footer />
</>;
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
export default function FAQs() { const FAQs = () => {
const t = useTranslations("HomePage.FAQs"); const t = useTranslations("HomePage.FAQs");
const faqs = [ const faqs = [
@@ -23,7 +23,7 @@ export default function FAQs() {
id: 4, id: 4,
question: t("questions.question4"), question: t("questions.question4"),
answer: t("questions.answer4"), answer: t("questions.answer4"),
} },
]; ];
return ( return (
<div className="border-t"> <div className="border-t">
@@ -53,4 +53,6 @@ export default function FAQs() {
</div> </div>
</div> </div>
); );
} };
export { FAQs };
+4 -2
View File
@@ -20,7 +20,7 @@ const navigation = {
], ],
}; };
export function Footer() { const Footer = () => {
return ( return (
<footer> <footer>
<Container> <Container>
@@ -44,4 +44,6 @@ export function Footer() {
</Container> </Container>
</footer> </footer>
); );
} };
export { Footer };
+4 -2
View File
@@ -4,7 +4,7 @@ import { Container } from "@/components/container";
import { ThemeToggle } from "@/components/theme-toggle"; import { ThemeToggle } from "@/components/theme-toggle";
import { LanguageSettings } from "@/components/language-settings"; import { LanguageSettings } from "@/components/language-settings";
export async function Header() { const Header = () => {
return ( return (
<header> <header>
<nav> <nav>
@@ -22,4 +22,6 @@ export async function Header() {
</nav> </nav>
</header> </header>
); );
} };
export { Header };
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
import { Container } from "@/components/container"; import { Container } from "@/components/container";
import { TypingEffect } from "@/components/typing-effect"; import { TypingEffect } from "@/components/typing-effect";
export function MainView() { const HeroSection = () => {
const t = useTranslations("HomePage.MainView"); const t = useTranslations("HomePage.MainView");
return ( return (
@@ -29,17 +29,13 @@ export function MainView() {
className="rounded-2xl bg-muted text-muted-foreground shadow hover:bg-muted/50" className="rounded-2xl bg-muted text-muted-foreground shadow hover:bg-muted/50"
asChild asChild
> >
<Link href="/problemset" prefetch> <Link href="/problemset">{t("quickStart")}</Link>
{t("quickStart")}
</Link>
</Button> </Button>
<Button <Button
size="sm" size="sm"
className="rounded-2xl bg-accent text-accent-foreground shadow hover:bg-accent/50" className="rounded-2xl bg-accent text-accent-foreground shadow hover:bg-accent/50"
> >
<Link href={siteConfig.url.repo.github}> <Link href={siteConfig.url.repo.github}>{t("contactUs")}</Link>
{t("contactUs")}
</Link>
</Button> </Button>
</div> </div>
</div> </div>
@@ -59,4 +55,6 @@ export function MainView() {
</Container> </Container>
</div> </div>
); );
} };
export { HeroSection };
+4 -2
View File
@@ -93,7 +93,7 @@ const LSPCard = () => {
); );
}; };
export function PrimaryFeatures() { const PrimaryFeatures = () => {
const t = useTranslations("HomePage.PrimaryFeatures"); const t = useTranslations("HomePage.PrimaryFeatures");
return ( return (
@@ -110,4 +110,6 @@ export function PrimaryFeatures() {
</div> </div>
</div> </div>
); );
} };
export { PrimaryFeatures };