diff --git a/src/app/wallets/page.tsx b/src/app/wallets/page.tsx index f2e9a47f..ce8bef84 100644 --- a/src/app/wallets/page.tsx +++ b/src/app/wallets/page.tsx @@ -1,56 +1,58 @@ // src/app/wallets/page.tsx -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState } from "react"; import Image from "next/image"; -import { getFileContent, getRoot } from '@/lib/authAndFetch' -import { getBanner } from '@/lib/helpers' -import { parseMarkdown } from '@/lib/parseMarkdown'; -import WalletList from '@/components/WalletList'; -import { genMetadata } from '@/lib/helpers'; -import { Metadata } from 'next'; +import { getFileContent, getRoot } from "@/lib/authAndFetch"; +import { getBanner } from "@/lib/helpers"; +import { parseMarkdown } from "@/lib/parseMarkdown"; +import WalletList from "@/components/WalletList"; +import { genMetadata } from "@/lib/helpers"; +import { Metadata } from "next"; -const imgUrl = getBanner(`using-zcash`) +const imgUrl = getBanner(`using-zcash`); export const metadata: Metadata = genMetadata({ - title: "Wallets", - url: "https://zechub.wiki/wallets", - image: imgUrl, -}) + title: "Wallets", + url: "https://zechub.wiki/wallets", + image: imgUrl, +}); export default async function Page({ params }: { params: { slug: string } }) { - - const { slug } = params - const url = `/site/Using_Zcash/Wallets.md` - - const markdown = await getFileContent(url) - - const content = markdown ? markdown : 'No Data or Wrong file' - const urlRoot = `/site/using-zcash` - const roots = await getRoot(urlRoot) - - - const walletsParsed = parseMarkdown(content); - // console.log("Parsed Wallets:", walletsParsed); // Check parsed markdown output - - return ( - - - - - - - 0 ? 'md:flex-row md:space-x-5' : 'md:flex-col'} h-auto w-full py-5`}> - - - - - - - - ) -} \ No newline at end of file + const { slug } = params; + const url = `/site/Using_Zcash/Wallets.md`; + + const markdown = await getFileContent(url); + + const content = markdown ? markdown : "No Data or Wrong file"; + const urlRoot = `/site/using-zcash`; + const roots = await getRoot(urlRoot); + + const walletsParsed = parseMarkdown(content); + // console.log("Parsed Wallets:", walletsParsed); // Check parsed markdown output + + return ( + + + + + + 0 ? "md:flex-row md:space-x-5" : "md:flex-col" + } h-auto w-full py-5`} + > + + + + + + + + ); +} diff --git a/src/components/WalletList.tsx b/src/components/WalletList.tsx index 926fe721..de488b12 100644 --- a/src/components/WalletList.tsx +++ b/src/components/WalletList.tsx @@ -161,7 +161,7 @@ const WalletList: React.FC = ({ allWallets }) => { ); const sortedWallets = filteredWallets.sort((a, b) => likes[b.title] - likes[a.title]); - + return ( diff --git a/src/lib/parseMarkdown.ts b/src/lib/parseMarkdown.ts index 7141a353..74263292 100644 --- a/src/lib/parseMarkdown.ts +++ b/src/lib/parseMarkdown.ts @@ -4,9 +4,9 @@ export function parseMarkdown(md: string) { const lines = section.trim().split("\n"); const titleMatch = lines[0]?.match(/## \[(.*?)\]\((.*?)\)/); const imageUrlMatch = lines[1]?.match(/!\[logo\]\((.*?) ".*?"\)/); - const devices = lines[2]?.split(": ")[1]?.split(" | ").map(item => item.trim()); - const pools = lines[3]?.split(": ")[1]?.split(" | ").map(item => item.trim()); - const features = lines[4]?.split(": ")[1]?.split(" | ").map(item => item.trim()); + const devices = lines[2]?.split(": ")[1]?.split(" | ").map(item => item.trim()) || []; + const pools = lines[3]?.split(": ")[1]?.split(" | ").map(item => item.trim()) || []; + const features = lines[4]?.split(": ")[1]?.split(" | ").map(item => item.trim()) || []; const syncSpeed = lines[5]?.match(/!\[syncspeed\]\((.*?) ".*?"\)/); return { @@ -16,7 +16,7 @@ export function parseMarkdown(md: string) { devices, pools, features, - syncSpeed :syncSpeed ? syncSpeed[1] : '', + syncSpeed : syncSpeed ? syncSpeed[1] : '', }; });