-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace next Draft Mode with custom cookie and preview route
- Loading branch information
Showing
23 changed files
with
140 additions
and
121 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 was deleted.
Oops, something went wrong.
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
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,32 @@ | ||
import NodePage from "@components/nodes/pages/node-page"; | ||
import UnpublishedBanner from "@components/elements/unpublished-banner"; | ||
import {NodeUnion} from "@lib/gql/__generated__/drupal.d"; | ||
import {getEntityFromPath} from "@lib/gql/gql-queries"; | ||
import {notFound} from "next/navigation"; | ||
import Editori11y from "@components/tools/editorially"; | ||
import {getPathFromContext, isPreviewMode, PageProps} from "@lib/drupal/utils"; | ||
|
||
const Page = async ({params}: PageProps) => { | ||
const path = getPathFromContext({params}) | ||
if (!isPreviewMode()) notFound(); | ||
|
||
const { entity, error} = await getEntityFromPath<NodeUnion>(path, true) | ||
|
||
if (error) throw new Error(error); | ||
if (!entity) notFound(); | ||
|
||
return ( | ||
<> | ||
<Editori11y/> | ||
<UnpublishedBanner status={false}> | ||
Preview Mode | ||
</UnpublishedBanner> | ||
<UnpublishedBanner status={entity.status}> | ||
Unpublished Page | ||
</UnpublishedBanner> | ||
<NodePage node={entity}/> | ||
</> | ||
) | ||
} | ||
|
||
export default Page; |
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,18 @@ | ||
import {getConfigPage} from "@lib/gql/gql-queries"; | ||
import {StanfordBasicSiteSetting} from "@lib/gql/__generated__/drupal"; | ||
import Script from "next/script"; | ||
import {GoogleAnalytics} from "@next/third-parties/google"; | ||
import {isPreviewMode} from "@lib/drupal/utils"; | ||
|
||
const UserAnalytics = async () => { | ||
if (isPreviewMode()) return; | ||
const siteSettingsConfig = await getConfigPage<StanfordBasicSiteSetting>('StanfordBasicSiteSetting') | ||
if (!siteSettingsConfig?.suGoogleAnalytics) return; | ||
return ( | ||
<> | ||
<Script async src="//siteimproveanalytics.com/js/siteanalyze_80352.js"/> | ||
<GoogleAnalytics gaId={siteSettingsConfig?.suGoogleAnalytics}/> | ||
</> | ||
) | ||
} | ||
export default UserAnalytics; |
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
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
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.