From d2591c3603772d2821dfe69da8ca78d6685ada39 Mon Sep 17 00:00:00 2001 From: Tilak Thapa Date: Tue, 14 May 2024 17:55:06 +0545 Subject: [PATCH 1/3] fix: remove flag form installation code block --- .../docs/_components/code-line-with-flag.tsx | 81 ------------------- .../app/(pages)/docs/_pages/change-log.tsx | 2 +- .../app/(pages)/docs/_pages/method-page.tsx | 4 +- 3 files changed, 3 insertions(+), 84 deletions(-) delete mode 100644 src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx diff --git a/src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx b/src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx deleted file mode 100644 index f53877e..0000000 --- a/src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; -import { useToast } from "@/components/ui/use-toast"; -import { useLang } from "@/providers/lang-provider"; -import { Check, Files, X } from "lucide-react"; -import { useState } from "react"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism"; -interface ICodeLineWithFlag { - code: string; - language: string; - className?: string; - showLangFlag?: boolean; -} - -const CodeLineWithFlag = ({ - code, - language, - className, - showLangFlag = true, -}: ICodeLineWithFlag) => { - const { lang } = useLang(); - const [isCopying, setIsCopying] = useState({ - isCopying: false, - Icon: Files, - }); - - const { toast } = useToast(); - - const codeWithLangFlag = `${code} -${lang}`; - - const handleCopy = () => { - setIsCopying((prev) => ({ ...prev, isCopying: true })); - try { - navigator.clipboard.writeText(showLangFlag ? codeWithLangFlag : code); - setIsCopying((prev) => ({ ...prev, Icon: Check })); - toast({ - description: "Code copied to clipboard 🚀", - }); - } catch (err) { - setIsCopying((prev) => ({ ...prev, Icon: X })); - toast({ - description: "Failed to copy code 😢", - variant: "destructive", - }); - } finally { - setTimeout(() => { - setIsCopying(() => ({ isCopying: false, Icon: Files })); - }, 2000); - } - }; - - return ( -
- - - - {showLangFlag ? codeWithLangFlag : code} - -
- ); -}; -export default CodeLineWithFlag; diff --git a/src/www/src/app/(pages)/docs/_pages/change-log.tsx b/src/www/src/app/(pages)/docs/_pages/change-log.tsx index d45530e..e08aecc 100644 --- a/src/www/src/app/(pages)/docs/_pages/change-log.tsx +++ b/src/www/src/app/(pages)/docs/_pages/change-log.tsx @@ -41,7 +41,7 @@ const ChangeLog = async () => {

diff --git a/src/www/src/app/(pages)/docs/_pages/method-page.tsx b/src/www/src/app/(pages)/docs/_pages/method-page.tsx index 60ecb6f..129e71c 100644 --- a/src/www/src/app/(pages)/docs/_pages/method-page.tsx +++ b/src/www/src/app/(pages)/docs/_pages/method-page.tsx @@ -12,7 +12,7 @@ import { import { marked } from "marked"; import ExampleTabs from "../_components/example-tabs"; import { LangProvider } from "@/providers/lang-provider"; -import CodeLineWithFlag from "../_components/code-line-with-flag"; +import CodeLine from "../_components/code-line"; const MethodPage = async ({ slug }: { slug: string[] }) => { if (!registry) return ; @@ -61,7 +61,7 @@ const MethodPage = async ({ slug }: { slug: string[] }) => { { title: "Installation", toRender: ( - From 3bd0a9364d65a7c46b5654ab6203a48582d4e235 Mon Sep 17 00:00:00 2001 From: Tilak Thapa Date: Tue, 14 May 2024 18:03:53 +0545 Subject: [PATCH 2/3] fix: changelog title --- src/www/src/app/(pages)/docs/_pages/change-log.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/www/src/app/(pages)/docs/_pages/change-log.tsx b/src/www/src/app/(pages)/docs/_pages/change-log.tsx index e08aecc..4dcb3d3 100644 --- a/src/www/src/app/(pages)/docs/_pages/change-log.tsx +++ b/src/www/src/app/(pages)/docs/_pages/change-log.tsx @@ -43,11 +43,12 @@ const ChangeLog = async () => { className="text-lg sm:text-xl lg:text-2xl font-semibold flex gap-2" id={pr.title.replace(/ /g, "-")} > - - - {i + 1}. {pr.title.substring(0, 50)} - {pr.title.length > 50 ? "..." : ""} - + + {i + 1}. {pr.title}

From c9b06b4d38d4db8aa84fde8e31c572f9bc01a479 Mon Sep 17 00:00:00 2001 From: Tilak Thapa Date: Tue, 14 May 2024 18:06:03 +0545 Subject: [PATCH 3/3] fix: change prose to sm --- src/www/src/app/(pages)/docs/_pages/change-log.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/www/src/app/(pages)/docs/_pages/change-log.tsx b/src/www/src/app/(pages)/docs/_pages/change-log.tsx index 4dcb3d3..2d6058b 100644 --- a/src/www/src/app/(pages)/docs/_pages/change-log.tsx +++ b/src/www/src/app/(pages)/docs/_pages/change-log.tsx @@ -51,7 +51,7 @@ const ChangeLog = async () => { {i + 1}. {pr.title} -
+
{(() => { return (