Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dvaJi committed Sep 21, 2023
1 parent ecff38d commit 07ab74a
Show file tree
Hide file tree
Showing 9 changed files with 19,761 additions and 19,572 deletions.
16 changes: 11 additions & 5 deletions lib/markdownToHtml.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { remark } from "remark";
import html from "remark-html";
import { serialize } from "next-mdx-remote/serialize";
import remarkGfm from "remark-gfm";

export default async function markdownToHtml(markdown: any): Promise<string> {
const result = await remark().use(html).process(markdown);
return result.toString();
export default async function markdownToHtml<T>(markdown: any) {
const mdxSource = await serialize<Record<string, unknown>, T>(markdown, {
parseFrontmatter: true,
mdxOptions: {
remarkPlugins: [remarkGfm],
},
});

return mdxSource;
}
3 changes: 0 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ const nextConfig = {
"img-cdn1.ravens-scans.com",
],
},
experimental: {
legacyBrowsers: false,
},
rewrites: async () => [
{
source: "/ads.txt",
Expand Down
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
"@mdx-js/react": "^2.3.0",
"@nanostores/persistent": "^0.9.1",
"@nanostores/react": "^0.7.1",
"@next/mdx": "^13.4.19",
"@prisma/client": "^5.3.0",
"@next/mdx": "^13.5.2",
"@prisma/client": "^5.3.1",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.6",
"@tailwindcss/typography": "^0.5.10",
"@tanstack/react-table": "^8.9.9",
"@tanstack/react-table": "^8.10.1",
"clsx": "^2.0.0",
"date-fns": "^2.30.0",
"dotenv": "^16.3.1",
Expand All @@ -42,7 +42,7 @@
"hsr-data": "^0.3.0",
"leaflet": "^1.9.4",
"nanostores": "^0.9.3",
"next": "^13.4.19",
"next": "^13.5.2",
"next-mdx-remote": "^4.4.1",
"next-pwa": "^5.6.0",
"next-sitemap": "^4.2.3",
Expand All @@ -52,32 +52,30 @@
"react-lazy-load-image-component": "^1.6.0",
"react-leaflet": "^4.2.1",
"react-tooltip": "^5.21.4",
"remark": "^14.0.3",
"remark-gfm": "^3.0.1",
"remark-html": "^15.0.2",
"remark-gfm": "^4.0.0",
"swr": "^2.2.2",
"tof-builds": "0.10.0",
"zod": "^3.22.2"
},
"devDependencies": {
"@builder.io/partytown": "^0.8.1",
"@next/bundle-analyzer": "^13.4.19",
"@next/env": "^13.4.19",
"@next/bundle-analyzer": "^13.5.2",
"@next/env": "^13.5.2",
"@types/leaflet": "^1.9.4",
"@types/node": "^18.17.15",
"@types/react": "^18.2.21",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"@types/react-lazy-load-image-component": "^1.6.0",
"autoprefixer": "^10.4.15",
"autoprefixer": "^10.4.16",
"cross-env": "^7.0.3",
"eslint": "8.47.0",
"eslint-config-next": "^13.4.19",
"eslint-config-next": "^13.5.2",
"globby": "^13.2.2",
"postcss": "^8.4.29",
"postcss": "^8.4.30",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.3",
"prettier-plugin-tailwindcss": "^0.5.4",
"prisma": "^5.3.0",
"prisma": "^5.3.1",
"tailwindcss": "^3.3.3",
"typescript": "5.1.6"
}
Expand Down
33 changes: 14 additions & 19 deletions pages/privacy-policy.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
import { getLocale } from "@lib/localData";
import { GetStaticProps } from "next";
import { GetStaticProps, InferGetStaticPropsType } from "next";
import { MDXRemote } from "next-mdx-remote";
import Head from "next/head";
import { useRouter } from "next/router";

import Card from "@components/ui/Card";
import { MDContent } from "../interfaces/md-content";
import markdownToHtml from "../lib/markdownToHtml";
import { getContentBySlug } from "../lib/mdApi";

interface MdPage {
data: MDContent;
}
import { getLocale } from "@lib/localData";
import markdownToHtml from "@lib/markdownToHtml";
import { getContentBySlug } from "@lib/mdApi";

const PrivacyPolicy = ({ data }: MdPage) => {
const router = useRouter();
const PrivacyPolicy = ({
data,
source,
}: InferGetStaticPropsType<typeof getStaticProps>) => {
return (
<Card>
<Head>
<title>{data.title} | GenshinBuilds</title>
<meta property="og:image" content={data.ogImage?.url} />
</Head>
{router.isFallback ? (
<div>Loading...</div>
) : (
<div dangerouslySetInnerHTML={{ __html: data.content }}></div>
)}
<article className="prose prose-invert max-w-none">
<MDXRemote {...source} />
</article>
</Card>
);
};
Expand All @@ -40,14 +35,14 @@ export const getStaticProps: GetStaticProps = async ({ locale = "en" }) => {
"ogImage",
"coverImage",
]);
const content = await markdownToHtml(post.content || "");
const source = await markdownToHtml<any>(post.content || "");

return {
props: {
data: {
...post,
content,
},
source,
lngDict,
},
};
Expand Down
Loading

1 comment on commit 07ab74a

@vercel
Copy link

@vercel vercel bot commented on 07ab74a Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.