Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,227 changes: 48 additions & 1,179 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
"@adobe/mdast-util-gridtables": "^4.0.13",
"@adobe/remark-gridtables": "^3.0.14",
"@next/bundle-analyzer": "^15.4.5",
"@pantheon-systems/pcc-react-sdk": "3.13.0-beta.2",
"@pantheon-systems/pcc-sdk-core": "3.13.0-beta.2",
"@pantheon-systems/pds-toolkit-react": "1.0.0-dev.256",
"@radix-ui/react-popover": "^1.1.14",
"@radix-ui/react-slot": "^1.2.3",
Expand Down
21 changes: 3 additions & 18 deletions src/app/release-notes/[...uri]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
"use server";

import {
fetchArticleBySlug,
getAllPages,
singleSlugForFetch,
} from "@/lib/page-utils";
import { serveLocalAsync } from "@/lib/resolve-component";
import { getAllPages } from "@/lib/page-utils";
import { generateMetadataFromUri } from "@/lib/site-metadata";
import { getMdxProcessed } from "@/server/processor/mdx";
import { ReleaseNoteTemplate } from "@/templates/release-note";
import { ReleaseNoteListingTemplate } from "@/templates/release-note-listing";
import {
getArticleBySlugOrId,
PCCConvenienceFunctions,
} from "@pantheon-systems/pcc-react-sdk/server";
import { notFound } from "next/navigation";
import { basename, join } from "path";

export interface DynamicViewProps {
params: Promise<{ uri: string[] }>;
Expand All @@ -25,11 +14,7 @@ export interface DynamicViewProps {
}>;
}

const getPage = async (
uri: string[],
useLocal: boolean,
category?: string[]
) => {
const getPage = async (uri: string[], category?: string[]) => {
if (uri.length === 1 && !Number.isNaN(parseInt(uri[0]))) {

// list of articles
Expand Down Expand Up @@ -80,7 +65,7 @@ export default async function Page(props: DynamicViewProps) {

const { category } = await props.searchParams;

const { Component } = await getPage(uri, false, category);
const { Component } = await getPage(uri, category);

if (Component === null) {
return notFound();
Expand Down
154 changes: 0 additions & 154 deletions src/components/grid.tsx

This file was deleted.

22 changes: 19 additions & 3 deletions src/components/ui/mdx-wrapper/default-components.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ComponentProps } from "react";
import { ArticleRenderer } from "../pds-re-export";
import { ReactNode } from "react";
import { Alert } from "@/components/common/alert";
import { Callout } from "@/components/common/callout";
import { Accordion } from "@/components/common/accordion";
Expand Down Expand Up @@ -29,7 +28,24 @@ import { Popover } from "@/components/common/popover";
import { Wistia } from "@/components/common/wistia";
import Enablement from "@/components/common/enablement";

export type MdxWrapperProps = ComponentProps<typeof ArticleRenderer>;
// Local type definition (previously extracted from pcc-react-sdk ArticleRenderer)
export interface MdxWrapperArticle {
content?: string;
contentType?: string;
id?: string;
metadata?: Record<string, unknown>;
publishedDate?: string | null;
publishingLevel?: string;
tags?: string[];
title?: string;
updatedAt?: string | null;
previewActiveUntil?: string | null;
}

export interface MdxWrapperProps {
article: MdxWrapperArticle;
componentMap?: Record<string, React.ComponentType<any>>;
}

const ImageRenderer = async ({ src = "", alt }: any) => {
let resolvedSrc = path.join(process.cwd(), "src", "source", "images", src);
Expand Down
1 change: 0 additions & 1 deletion src/components/ui/pds-re-export.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
"use client";
export * from "@pantheon-systems/pds-toolkit-react";
export * from "@pantheon-systems/pcc-react-sdk/components";
48 changes: 0 additions & 48 deletions src/hooks/usePagination.ts

This file was deleted.

69 changes: 0 additions & 69 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
Article,
ArticleWithoutContent,
} from "@pantheon-systems/pcc-react-sdk";
import { clsx, type ClassValue } from "clsx";
import { Metadata } from "next";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
Expand All @@ -19,70 +14,6 @@ export function formatDate(input: string | number): string {
});
}

export function getSeoMetadata(
article: ArticleWithoutContent | null
): Metadata {
if (article == null) {
return {
openGraph: {
type: "website",
},
};
}

const tags: string[] =
article.tags && article.tags.length > 0 ? article.tags : [];
const imageProperties = [
article.metadata?.image,
article.metadata?.["image"],
// Extend as needed
]
.filter((url): url is string => typeof url === "string")
.map((url) => ({ url }));
const description = article.metadata?.description
? String(article.metadata?.description)
: "Article hosted using Pantheon Content Cloud";

const authors: Metadata["authors"] = [];

// Collecting data from metadata fields
Object.entries(article.metadata || {}).forEach(([k, v]) => {
const key = k.toLowerCase().trim();

switch (key) {
case "author": {
if (typeof v === "string") {
authors.push({ name: v });
}
break;
}
case "complex-author": {
if (typeof v === "string") {
const authorName = undefined;

if (authorName) {
authors.push({ name: v });
}
}
break;
}
}
});

return {
title: article.title,
description,
keywords: tags,
authors,
openGraph: {
type: "website",
title: article.title || undefined,
images: imageProperties,
description,
},
};
}

export const isExternalLink = (url: string) => {
// Empty URLs
if (!url) {
Expand Down
Loading