Skip to content

Commit

Permalink
Release 1.4.1 (#219)
Browse files Browse the repository at this point in the history
* SUL23-620: Corrected shared tags events view contextual filter argument name

* SUL23-593: Show list paragraph empty message if no results

* Add Image credit field on media image

* SUL23-480: caption missing but really under the image (#217)

* Removed the absolute

* fixup to table

* fixup

* Updated dependencies

* SUL23-481 | hardcode h3 headings for feature collections (#218)

* SUL23-481 | hardcode headings for feature collections

* adjust heading level for collections

* Improved invalidation when comparing the home page path

* Updated version in package.json

---------

Co-authored-by: Mike Decker <[email protected]>
Co-authored-by: Jen Breese <[email protected]>
Co-authored-by: Rebecca Hong <[email protected]>
  • Loading branch information
4 people authored Oct 2, 2024
1 parent 20b6586 commit 4a77208
Show file tree
Hide file tree
Showing 12 changed files with 330 additions and 343 deletions.
20 changes: 12 additions & 8 deletions app/api/revalidate/route.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import {NextRequest, NextResponse} from "next/server"
import {revalidateTag} from "next/cache"
import {getEntityFromPath, getMenu} from "@/lib/gql/fetcher"
import {getActiveTrail} from "@/lib/drupal/utils"
import {revalidateTag, unstable_cache as nextCache} from "next/cache"
import {getEntityFromPath} from "@/lib/gql/fetcher"

export const revalidate = 0

const getHomePagePath = nextCache(
async () => {
const {entity} = await getEntityFromPath("/")
return entity?.path
},
[],
{tags: ["paths:/"]}
)

export const GET = async (request: NextRequest) => {
const secret = request.nextUrl.searchParams.get("secret")
if (secret !== process.env.DRUPAL_REVALIDATE_SECRET)
Expand All @@ -22,11 +30,7 @@ export const GET = async (request: NextRequest) => {

// When the home page is saved, it's url slug might be like `/home`. If the home page matches the slug, invalidate
// the home page path.
const {entity} = await getEntityFromPath("/")
if (entity?.path === path) tagsInvalidated.push("paths:/")

const menu = await getMenu()
if (!!getActiveTrail(menu, path).length) tagsInvalidated.push("menu:main")
if ((await getHomePagePath()) === path) tagsInvalidated.push("paths:/")

tagsInvalidated.map(tag => revalidateTag(tag))

Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "basic-starter",
"version": "1.3.1",
"version": "1.4.1",
"private": true,
"license": "MIT",
"scripts": {
Expand All @@ -15,13 +15,13 @@
"dependencies": {
"@formkit/auto-animate": "^0.8.2",
"@heroicons/react": "^2.1.5",
"@mui/base": "5.0.0-beta.40",
"@next/third-parties": "^14.2.11",
"@mui/base": "5.0.0-beta.58",
"@next/third-parties": "^14.2.13",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.56.2",
"@types/node": "^22.5.5",
"@types/react": "^18.3.6",
"@types/node": "^22.6.1",
"@types/react": "^18.3.8",
"autoprefixer": "^10.4.20",
"axios": "^1.7.7",
"critters": "^0.0.24",
Expand All @@ -31,7 +31,7 @@
"graphql-tag": "^2.12.6",
"html-react-parser": "^5.1.16",
"jsona": "^1.12.1",
"next": "^14.2.11",
"next": "^14.2.13",
"next-drupal": "^1.6.0",
"postcss": "^8.4.47",
"react": "^18.3.1",
Expand All @@ -46,7 +46,7 @@
"react-tiny-oembed": "^1.1.0",
"sharp": "^0.33.5",
"tailwind-merge": "^2.5.2",
"tailwindcss": "^3.4.11",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2",
"usehooks-ts": "^3.1.0"
},
Expand All @@ -56,8 +56,8 @@
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
"@graphql-codegen/typescript-operations": "4.2.3",
"@types/qs": "^6.9.16",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.11",
"eslint": "^8.57.1",
"eslint-config-next": "^14.2.13",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-prettier": "^5.2.1",
Expand Down
7 changes: 1 addition & 6 deletions src/components/layout/global-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ import {StanfordGlobalMessage} from "@/lib/gql/__generated__/drupal.d"
import {JSX} from "react"

const GlobalMessage = async () => {
let configPage: StanfordGlobalMessage | undefined
try {
configPage = await getConfigPage<StanfordGlobalMessage>("StanfordGlobalMessage")
} catch (e) {
return null
}
const configPage = await getConfigPage<StanfordGlobalMessage>("StanfordGlobalMessage")

if (!configPage || !configPage.suGlobalMsgEnabled) {
return null
Expand Down
21 changes: 14 additions & 7 deletions src/components/node/stanford-news/page-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,27 @@ const StanfordNews = async ({node, ...props}: {node: NodeStanfordNews}) => {
<hr className="mx-auto mb-100 w-1/2 text-black-40" />

{imageUrl && (
<figure className="relative mx-auto mb-100 aspect-[16/9] lg:w-10/12">
<Image className="object-cover" src={buildUrl(imageUrl).toString()} alt={imageAlt || ""} fill />

<figure className="mb-100 table w-full">
<span className="relative mx-auto block aspect-[16/9] lg:w-10/12">
<Image className="object-cover" src={buildUrl(imageUrl).toString()} alt={imageAlt || ""} fill />
</span>
{node.suNewsBannerMediaCaption && (
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
<figcaption className="table-caption caption-bottom text-center">
{node.suNewsBannerMediaCaption}
</figcaption>
)}
</figure>
)}

{node.suNewsBanner?.__typename === "MediaVideo" && (
<figure className="relative mx-auto mb-100 aspect-[16/9] w-10/12">
<Oembed url={node.suNewsBanner.mediaOembedVideo} />
<figure className="mb-100 table w-full">
<span className="relative mx-auto block aspect-[16/9] w-10/12">
<Oembed url={node.suNewsBanner.mediaOembedVideo} />
</span>
{node.suNewsBannerMediaCaption && (
<figcaption className="caption text-center">{node.suNewsBannerMediaCaption}</figcaption>
<figcaption className="table-caption caption-bottom text-center">
{node.suNewsBannerMediaCaption}
</figcaption>
)}
</figure>
)}
Expand Down
9 changes: 7 additions & 2 deletions src/components/paragraph/stanford-lists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ const ListParagraph = async ({paragraph}: Props) => {
</div>

{paragraph.suListDescription?.processed && <div>{formatHtml(paragraph.suListDescription.processed)}</div>}
{viewItems && viewId && displayId && (

{viewItems.length === 0 && behaviors.list_paragraph?.empty_message && (
<p>{behaviors.list_paragraph.empty_message}</p>
)}

{viewItems.length > 0 && viewId && displayId && (
<View
items={viewItems}
viewId={viewId}
Expand Down Expand Up @@ -108,7 +113,7 @@ const getViewItems = cache(
if (viewId === "sul_people" && displayId === "table_list_all") limit = 0
const {items, totalItems} = await getViewPagedItems(viewId, displayId, contextualFilter, 30, page)
if (limit) {
return {items: items.slice(0, limit), totalItems}
return {items: items?.slice(0, limit), totalItems}
}
return {items, totalItems}
}
Expand Down
1 change: 1 addition & 0 deletions src/components/paragraph/sul-collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const CollectionCard = ({
superHeader={superHeader}
body={body}
link={link}
headingLevel="h3"
/>
)
}
Expand Down
1 change: 1 addition & 0 deletions src/components/paragraph/sul-featured-collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const CollectionCard = ({
superHeader={superHeader}
body={body}
link={link}
headingLevel="h3"
/>
)
}
Expand Down
122 changes: 62 additions & 60 deletions src/lib/gql/__generated__/drupal.d.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/lib/gql/__generated__/queries.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/lib/gql/fetcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const getConfigPage = async <T extends ConfigPagesUnion>(
try {
query = await graphqlClient({next: {tags: ["config-pages"]}}).ConfigPages()
} catch (e) {
console.error("Unable to fetch config pages")
console.error("Unable to fetch config pages", e instanceof Error ? e.message : undefined)
return
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/gql/fragments-fields.drupal.gql
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ fragment FragmentMediaGoogleForm on MediaGoogleForm {

fragment FragmentMediaImage on MediaImage {
...FragmentMediaInterface
sulImageCredit
mediaImage {
url
alt
Expand Down
Loading

0 comments on commit 4a77208

Please sign in to comment.