-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from SU-SWS/1.x
Release 1.3.0
- Loading branch information
Showing
44 changed files
with
2,251 additions
and
893 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g' | grep \.tsx$) | ||
[ -z "$FILES" ] && exit 0 | ||
|
||
# Prettify all selected files | ||
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write | ||
|
||
# Add back the modified/prettified files to staging | ||
echo "$FILES" | xargs git add | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# .github/workflows/release.yml | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
if: github.event.pull_request.merged | ||
steps: | ||
- name: Get Next Release | ||
id: tag | ||
uses: K-Phoen/semver-release-action@master | ||
with: | ||
release_strategy: none | ||
release_branch: main | ||
tag_format: "%major%.%minor%.%patch%" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Release | ||
if: ${{ steps.tag.outputs.tag }} | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ${{ steps.tag.outputs.tag }} | ||
tag: ${{ steps.tag.outputs.tag }} | ||
commit: ${{ github.sha }} | ||
generateReleaseNotes: true | ||
makeLatest: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSameLine": false, | ||
"bracketSpacing": false, | ||
"printWidth": 500, | ||
"semi": false, | ||
"singleAttributePerLine": true, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "es5", | ||
"plugins": ["prettier-plugin-tailwindcss"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,111 @@ | ||
import NodePageDisplay from "@/components/node"; | ||
import {notFound, redirect} from "next/navigation"; | ||
import {Metadata} from "next"; | ||
import {getNodeMetadata} from "./metadata"; | ||
import LibraryHeader from "@/components/node/sul-library/library-header"; | ||
import InternalHeaderBanner from "@/components/patterns/internal-header-banner"; | ||
import SecondaryMenu from "@/components/menu/secondary-menu"; | ||
import {isPreviewMode} from "@/lib/drupal/is-draft-mode"; | ||
import UnpublishedBanner from "@/components/patterns/unpublished-banner"; | ||
import {getAllNodePaths, getEntityFromPath, getMenu} from "@/lib/gql/fetcher"; | ||
import {NodeUnion} from "@/lib/gql/__generated__/drupal.d"; | ||
|
||
export const revalidate = false; | ||
export const dynamic = 'force-static'; | ||
import NodePageDisplay from "@/components/node" | ||
import {notFound, redirect} from "next/navigation" | ||
import {Metadata} from "next" | ||
import {getNodeMetadata} from "./metadata" | ||
import LibraryHeader from "@/components/node/sul-library/library-header" | ||
import InternalHeaderBanner from "@/components/patterns/internal-header-banner" | ||
import SecondaryMenu from "@/components/menu/secondary-menu" | ||
import {isPreviewMode} from "@/lib/drupal/is-draft-mode" | ||
import {getAllNodePaths, getEntityFromPath, getMenu} from "@/lib/gql/fetcher" | ||
import {NodeUnion} from "@/lib/gql/__generated__/drupal.d" | ||
import EditorAlertBanner from "@/components/patterns/elements/editor-alert-banner" | ||
|
||
export const revalidate = false | ||
export const dynamic = "force-static" | ||
|
||
const NodePage = async ({params, previewMode}: PageProps) => { | ||
const path = getPathFromContext({params}); | ||
const {redirect: routeRedirect, entity} = await getEntityFromPath<NodeUnion>(path, previewMode); | ||
const path = getPathFromContext({params}) | ||
const {redirect: routeRedirect, entity} = await getEntityFromPath<NodeUnion>(path, previewMode) | ||
|
||
if (routeRedirect) redirect(routeRedirect.url); | ||
if (!entity) notFound(); | ||
if (routeRedirect) redirect(routeRedirect.url) | ||
if (!entity) notFound() | ||
|
||
const menuItems = await getMenu() | ||
|
||
const fullWidth = (entity.__typename === 'NodeStanfordPage' && entity.layoutSelection?.id === 'stanford_basic_page_full') || | ||
(entity.__typename === 'NodeSulLibrary' && entity.layoutSelection?.id === 'sul_library_full_width'); | ||
const fullWidth = (entity.__typename === "NodeStanfordPage" && entity.layoutSelection?.id === "stanford_basic_page_full") || (entity.__typename === "NodeSulLibrary" && entity.layoutSelection?.id === "sul_library_full_width") | ||
|
||
return ( | ||
<main id="main-content" className="mb-50"> | ||
{!entity.status && | ||
<UnpublishedBanner/> | ||
} | ||
{entity.__typename === 'NodeSulLibrary' && | ||
<LibraryHeader node={entity}/> | ||
} | ||
|
||
{entity.__typename === 'NodeStanfordNews' && | ||
<main | ||
id="main-content" | ||
className="mb-50" | ||
> | ||
{!entity.status && <EditorAlertBanner message="Unpublished Content" />} | ||
{entity.__typename === "NodeSulLibrary" && <LibraryHeader node={entity} />} | ||
|
||
{entity.__typename === "NodeStanfordNews" && ( | ||
<InternalHeaderBanner> | ||
<div | ||
className="flex flex-col w-full max-w-[calc(100vw-10rem)] md:max-w-[calc(100vw-20rem)] 3xl:max-w-[calc(1500px-20rem)] mx-auto mt-80 md:mt-100 mb-50 p-0"> | ||
<h1 | ||
className="text-white order-2"> | ||
{entity.title} | ||
</h1> | ||
|
||
{entity.suNewsTopics && | ||
<div className="mb-20 order-1"> | ||
{entity.suNewsTopics.slice(0, 1).map(topic => | ||
<span key={topic.id} className="text-illuminating-dark font-semibold">{topic.name}</span> | ||
)} | ||
<div className="mx-auto mb-50 mt-80 flex w-full max-w-[calc(100vw-10rem)] flex-col p-0 md:mt-100 md:max-w-[calc(100vw-20rem)] 3xl:max-w-[calc(1500px-20rem)]"> | ||
<h1 className="order-2 text-white">{entity.title}</h1> | ||
|
||
{entity.suNewsTopics && ( | ||
<div className="order-1 mb-20"> | ||
{entity.suNewsTopics.slice(0, 1).map(topic => ( | ||
<span | ||
key={topic.id} | ||
className="font-semibold text-illuminating-dark" | ||
> | ||
{topic.name} | ||
</span> | ||
))} | ||
</div> | ||
} | ||
)} | ||
</div> | ||
</InternalHeaderBanner> | ||
} | ||
)} | ||
|
||
{!(entity.__typename === 'NodeSulLibrary' || entity.__typename === 'NodeStanfordNews') && | ||
{!(entity.__typename === "NodeSulLibrary" || entity.__typename === "NodeStanfordNews") && ( | ||
<InternalHeaderBanner> | ||
<h1 | ||
className="w-full max-w-[calc(100vw-10rem)] md:max-w-[calc(100vw-20rem)] 3xl:max-w-[calc(1500px-20rem)] mx-auto relative text-white mt-80 md:mt-100 mb-50 p-0"> | ||
{entity.title} | ||
</h1> | ||
<h1 className="relative mx-auto mb-50 mt-80 w-full max-w-[calc(100vw-10rem)] p-0 text-white md:mt-100 md:max-w-[calc(100vw-20rem)] 3xl:max-w-[calc(1500px-20rem)]">{entity.title}</h1> | ||
</InternalHeaderBanner> | ||
} | ||
)} | ||
|
||
{fullWidth && | ||
{fullWidth && ( | ||
<div> | ||
<NodePageDisplay node={entity}/> | ||
<NodePageDisplay node={entity} /> | ||
</div> | ||
} | ||
)} | ||
|
||
{!fullWidth && | ||
<div className="centered flex flex-col lg:flex-row justify-between gap-[8rem]"> | ||
<div className="flex-1 order-last"> | ||
<NodePageDisplay node={entity}/> | ||
{!fullWidth && ( | ||
<div className="centered flex flex-col justify-between gap-[8rem] lg:flex-row"> | ||
<div className="order-last flex-1"> | ||
<NodePageDisplay node={entity} /> | ||
</div> | ||
|
||
<SecondaryMenu menuItems={menuItems} currentPath={entity.path}/> | ||
<SecondaryMenu | ||
menuItems={menuItems} | ||
currentPath={entity.path} | ||
/> | ||
</div> | ||
} | ||
)} | ||
</main> | ||
) | ||
} | ||
|
||
export const generateMetadata = async ({params}: PageProps): Promise<Metadata> => { | ||
if (isPreviewMode()) return {}; | ||
const path = getPathFromContext({params}); | ||
const {entity} = await getEntityFromPath<NodeUnion>(path); | ||
if (isPreviewMode()) return {} | ||
const path = getPathFromContext({params}) | ||
const {entity} = await getEntityFromPath<NodeUnion>(path) | ||
return entity ? getNodeMetadata(entity) : {} | ||
} | ||
|
||
export const generateStaticParams = async (): Promise<PageProps["params"][]> => { | ||
if (process.env.BUILD_COMPLETE !== 'true') return [] | ||
const nodePaths = await getAllNodePaths(); | ||
return nodePaths.map(path => ({slug: path.split('/').filter(part => !!part)})); | ||
if (process.env.BUILD_COMPLETE !== "true") return [] | ||
const nodePaths = await getAllNodePaths() | ||
return nodePaths.map(path => ({slug: path.split("/").filter(part => !!part)})) | ||
} | ||
|
||
const getPathFromContext = (context: PageProps, prefix = ""): string => { | ||
let {slug} = context.params | ||
|
||
slug = Array.isArray(slug) ? slug.map((s) => encodeURIComponent(s)).join("/") : slug | ||
slug = slug.replace(/^\//, ''); | ||
slug = Array.isArray(slug) ? slug.map(s => encodeURIComponent(s)).join("/") : slug | ||
slug = slug.replace(/^\//, "") | ||
return prefix ? `${prefix}/${slug}` : `/${slug}` | ||
} | ||
|
||
type PageProps = { | ||
params: { slug: string | string[] } | ||
params: {slug: string | string[]} | ||
searchParams?: Record<string, string | string[] | undefined> | ||
previewMode?: boolean | ||
} | ||
|
||
|
||
export default NodePage; | ||
export default NodePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
import {ReactNode} from "react"; | ||
import {isPreviewMode} from "@/lib/drupal/is-draft-mode"; | ||
import Editori11y from "@/components/editori11y"; | ||
import {ExclamationCircleIcon} from "@heroicons/react/20/solid"; | ||
import {ReactNode} from "react" | ||
import {isPreviewMode} from "@/lib/drupal/is-draft-mode" | ||
import Editori11y from "@/components/editori11y" | ||
import EditorAlertBanner from "@/components/patterns/elements/editor-alert-banner" | ||
|
||
const RootLayout = ({children}: { children: ReactNode }) => { | ||
const RootLayout = ({children}: {children: ReactNode}) => { | ||
const previewMode = isPreviewMode() | ||
return ( | ||
<> | ||
{previewMode && | ||
{previewMode && ( | ||
<> | ||
<div className="bg-illuminating py-10 text-3xl font-bold"> | ||
<div className="centered-container flex gap-10"><ExclamationCircleIcon width={20}/>Previewing Content</div> | ||
</div> | ||
<Editori11y/> | ||
<EditorAlertBanner message="Previewing Content" /> | ||
<Editori11y /> | ||
</> | ||
} | ||
)} | ||
{children} | ||
</> | ||
) | ||
} | ||
export default RootLayout; | ||
export default RootLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.