From 20fdd5b6d7cc5ad3c773ac0d2e175705c9bd7183 Mon Sep 17 00:00:00 2001 From: iuwqyir Date: Tue, 20 May 2025 21:04:28 +0000 Subject: [PATCH] show deprecation in playground UI (#7100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## PR-Codex overview This PR focuses on adding a `deprecated` property to various types and components within the application, allowing for better handling and display of deprecated links and features in the UI. ### Detailed summary - Added `deprecated` property to `pathInfo` in `navLinks.ts`. - Updated `MinimalBlueprintSpec` type in `utils.ts` to include `deprecated`. - Modified `SidebarLink` type in `sidebar.tsx` to optionally include `crossedOut`. - Enhanced UI to visually indicate deprecated items in `page.tsx`. - Included `deprecated` status for various API endpoints in `insightBlueprints.ts`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../src/app/insight/[blueprint_slug]/page.tsx | 24 ++++++++++++- .../src/app/insight/insightBlueprints.ts | 34 +++++++++++++++++++ apps/playground-web/src/app/insight/page.tsx | 12 ++++++- apps/playground-web/src/app/insight/utils.ts | 2 ++ apps/playground-web/src/app/navLinks.ts | 1 + .../src/components/ui/sidebar.tsx | 2 ++ 6 files changed, 73 insertions(+), 2 deletions(-) diff --git a/apps/playground-web/src/app/insight/[blueprint_slug]/page.tsx b/apps/playground-web/src/app/insight/[blueprint_slug]/page.tsx index 9604218d930..f11aad927ae 100644 --- a/apps/playground-web/src/app/insight/[blueprint_slug]/page.tsx +++ b/apps/playground-web/src/app/insight/[blueprint_slug]/page.tsx @@ -1,3 +1,4 @@ +import { Badge } from "@/components/ui/badge"; import { Breadcrumb, BreadcrumbItem, @@ -5,6 +6,7 @@ import { BreadcrumbList, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; +import { cn } from "@/lib/utils"; import { redirect } from "next/navigation"; import { THIRDWEB_CLIENT } from "../../../lib/client"; import { isProd } from "../../../lib/env"; @@ -53,8 +55,28 @@ export default async function Page(props: {

- {title} +
+ + {title} + + {pathMetadata.deprecated && ( + + Deprecated + + )} +

+ {pathMetadata.deprecated && ( +
+
+ {pathMetadata.description} +
+
+ )} @@ -60,10 +61,19 @@ function BlueprintSection(props: { {item.name} + {item.deprecated && ( + + Deprecated + + )} diff --git a/apps/playground-web/src/app/insight/utils.ts b/apps/playground-web/src/app/insight/utils.ts index b07558fda8b..f17b1087fdd 100644 --- a/apps/playground-web/src/app/insight/utils.ts +++ b/apps/playground-web/src/app/insight/utils.ts @@ -20,6 +20,7 @@ export type BlueprintListItem = { name: string; path: string; method: string; + deprecated: boolean; }[]; }; @@ -36,6 +37,7 @@ export type MinimalBlueprintSpec = { paths: { name: string; path: string; + deprecated: boolean; }[]; }; diff --git a/apps/playground-web/src/app/navLinks.ts b/apps/playground-web/src/app/navLinks.ts index 0390ebbfe80..dc8ce973c1e 100644 --- a/apps/playground-web/src/app/navLinks.ts +++ b/apps/playground-web/src/app/navLinks.ts @@ -141,6 +141,7 @@ export function getSidebarLinks() { return { name: pathInfo.name, href: `/insight/${blueprint.id}?path=${pathInfo.path}`, + crossedOut: pathInfo.deprecated, }; }), }; diff --git a/apps/playground-web/src/components/ui/sidebar.tsx b/apps/playground-web/src/components/ui/sidebar.tsx index 35e3441765e..0b9da32a758 100644 --- a/apps/playground-web/src/components/ui/sidebar.tsx +++ b/apps/playground-web/src/components/ui/sidebar.tsx @@ -11,6 +11,7 @@ import { CustomAccordion } from "./CustomAccordion"; export type LinkMeta = { name: string; href: string; + crossedOut?: boolean; }; export type LinkGroup = { @@ -83,6 +84,7 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) { className={clsx( "block overflow-hidden text-ellipsis py-1 font-medium transition-colors duration-300 hover:text-foreground lg:text-base", isActive ? "text-foreground" : "text-muted-foreground", + "crossedOut" in link && link.crossedOut && "line-through", )} > {link.name}