chore: Remove unused code and fix theme page rendering
This commit is contained in:
@@ -4,7 +4,6 @@ import { Navigation } from "@/components/navigation";
|
|||||||
import ThemePage from "@/components/theme-page";
|
import ThemePage from "@/components/theme-page";
|
||||||
import { getThemeFromId } from "@/lib/themes";
|
import { getThemeFromId } from "@/lib/themes";
|
||||||
import { Metadata, ResolvingMetadata } from "next";
|
import { Metadata, ResolvingMetadata } from "next";
|
||||||
import { useParams } from "next/navigation";
|
|
||||||
|
|
||||||
export async function generateMetadata(
|
export async function generateMetadata(
|
||||||
{ params, searchParams }: any,
|
{ params, searchParams }: any,
|
||||||
@@ -38,17 +37,9 @@ export async function generateMetadata(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function ThemeInfoPage() {
|
export default async function ThemeInfoPage() {
|
||||||
const params = useParams<{ theme: string }>();
|
|
||||||
const { theme: themeID } = params;
|
|
||||||
|
|
||||||
const theme = await getThemeFromId(themeID);
|
|
||||||
if (!theme) {
|
|
||||||
return <div>Theme not found</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex min-h-screen flex-col items-center justify-start">
|
<main className="flex min-h-screen flex-col items-center justify-start">
|
||||||
<ThemePage theme={theme} />
|
<ThemePage />
|
||||||
<Footer />
|
<Footer />
|
||||||
<Navigation /> {/* At the bottom of the page */}
|
<Navigation /> {/* At the bottom of the page */}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { getThemeAuthorLink, getThemeMarkdown, ZenTheme } from "@/lib/themes";
|
import { getThemeAuthorLink, getThemeFromId, getThemeMarkdown, ZenTheme } from "@/lib/themes";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Markdown from "react-markdown";
|
import Markdown from "react-markdown";
|
||||||
import '../app/privacy-policy/markdown.css';
|
import '../app/privacy-policy/markdown.css';
|
||||||
import { ChevronLeft, LoaderCircleIcon } from "lucide-react";
|
import { ChevronLeft, LoaderCircleIcon } from "lucide-react";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
|
export default async function ThemePage() {
|
||||||
|
const params = useParams<{ theme: string }>();
|
||||||
|
const { theme: themeID } = params;
|
||||||
|
|
||||||
|
const theme = await getThemeFromId(themeID);
|
||||||
|
if (!theme) {
|
||||||
|
return <div>Theme not found</div>;
|
||||||
|
}
|
||||||
|
|
||||||
export default function ThemePage({ theme }: { theme: ZenTheme }) {
|
|
||||||
const [readme, setReadme] = useState<string | null>(null);
|
const [readme, setReadme] = useState<string | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getThemeMarkdown(theme).then(setReadme);
|
getThemeMarkdown(theme).then(setReadme);
|
||||||
|
|||||||
Reference in New Issue
Block a user