Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(sandbox): fix broken links in deployed sandbox (#1449)

rubyycheung6c4f5dbce37f
diff --git a/apps/sandbox/public/templates/avatar-profile.jpg b/apps/sandbox/public/avatars/avatar-profile.jpg
similarity index 100%
rename from apps/sandbox/public/templates/avatar-profile.jpg
rename to apps/sandbox/public/avatars/avatar-profile.jpg
diff --git a/apps/sandbox/public/templates/xds-design-avatar.png b/apps/sandbox/public/avatars/xds-design-avatar.png
similarity index 100%
rename from apps/sandbox/public/templates/xds-design-avatar.png
rename to apps/sandbox/public/avatars/xds-design-avatar.png
diff --git a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx
index 84f7c7c972..38e484d85a 100644
--- a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx
@@ -22,6 +22,7 @@ import {blocks} from '../../generated/blockRegistry';
import {gitVersions} from '../../generated/versionRegistry';
const blocksByHref = new Map(blocks.map(b => [b.href.replace(/\/$/, ''), b]));
+const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
function buildNavTree(currentPath: string): XDSTreeListItemData[] {
const norm = currentPath.replace(/\/$/, '');
@@ -29,7 +30,7 @@ function buildNavTree(currentPath: string): XDSTreeListItemData[] {
const pageItems: XDSTreeListItemData[] = templates.map(t => ({
id: t.href,
label: t.name,
- href: t.href,
+ href: basePath + t.href,
isSelected: t.href.replace(/\/$/, '') === norm,
}));
@@ -43,7 +44,7 @@ function buildNavTree(currentPath: string): XDSTreeListItemData[] {
componentMap.get(group)!.push({
id: b.href,
label: shortName,
- href: b.href,
+ href: basePath + b.href,
isSelected: b.href.replace(/\/$/, '') === norm,
});
}
@@ -921,7 +922,7 @@ export function PreviewShell({children}: {children: React.ReactNode}) {
backgroundColor: '#f0f0f0',
}}>
<iframe
- src={`${pathname}?embed=1`}
+ src={`${basePath}${pathname}?embed=1`}
title={`${pageName} — ${viewport}`}
style={{
width: viewportWidths[viewport],
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts b/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts
index 0d7b7b1015..e9663997ee 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts
@@ -73,8 +73,8 @@ export const SIM_COUNT = 350;
export const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
export const DUMMY_IMAGE = `${basePath}/templates/dummy-placeholder.png`;
-export const AVATAR_IMAGE = `${basePath}/templates/avatar-profile.jpg`;
-export const XDS_DESIGN_AVATAR = `${basePath}/templates/xds-design-avatar.png`;
+export const AVATAR_IMAGE = `${basePath}/avatars/avatar-profile.jpg`;
+export const XDS_DESIGN_AVATAR = `${basePath}/avatars/xds-design-avatar.png`;
export const FIRST_CARD_IMAGE = `${basePath}/templates/first-card.png`;
export const SHOPPING_DETAILS_IMAGE = `${basePath}/templates/shopping-details.png`;
export const SCREENSHOT_3_IMAGE = `${basePath}/templates/screenshot-3.png`;
diff --git a/apps/sandbox/src/app/sandboxPages.ts b/apps/sandbox/src/app/sandboxPages.ts
index cf532d3f6a..4075f38493 100644
--- a/apps/sandbox/src/app/sandboxPages.ts
+++ b/apps/sandbox/src/app/sandboxPages.ts
@@ -116,12 +116,6 @@ export const categories: SandboxCategory[] = [
href: '/pages/theme-editor/',
description: 'Customize and preview XDS design tokens',
},
- {
- name: 'Code Fiddle',
- href: '/pages/code-fiddle/',
- description:
- 'CodePen-style playground with code panels and live XDS preview',
- },
{
name: 'CodeBlock Perf',
href: '/pages/codeblock-perf/',