1
0
Fork 0

feat(admin): add GoToFrontendLink to admin nav

Register a beforeNav component linking the Payload admin panel back to the public frontend.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Jason Fraley 2026-08-13 17:00:51 -04:00
parent cabbe071d7
commit 5694dbf218
3 changed files with 15 additions and 3 deletions

View file

@ -30,6 +30,7 @@ import { default as default_2f6c866ab4d4d51b3789f090b84b85c7 } from '@/component
import { default as default_508743824696caae2894ebf34c2e68bb } from '@/components/graphics/AppIcon' import { default as default_508743824696caae2894ebf34c2e68bb } from '@/components/graphics/AppIcon'
import { default as default_e752fee78378294ff03f91dba0a75a04 } from '@/components/graphics/AppLogo' import { default as default_e752fee78378294ff03f91dba0a75a04 } from '@/components/graphics/AppLogo'
import { default as default_05548cb43495e62d80b80ec4d9f0f7e9 } from '@/components/static/BeforeDashboardText' import { default as default_05548cb43495e62d80b80ec4d9f0f7e9 } from '@/components/static/BeforeDashboardText'
import { default as default_459d6b6f5ead73c736013da63a5ace3f } from '@/components/static/GoToFrontendLink'
import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc' import { CollectionCards as CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } from '@payloadcms/next/rsc'
export const importMap = { export const importMap = {
@ -65,5 +66,6 @@ export const importMap = {
"@/components/graphics/AppIcon#default": default_508743824696caae2894ebf34c2e68bb, "@/components/graphics/AppIcon#default": default_508743824696caae2894ebf34c2e68bb,
"@/components/graphics/AppLogo#default": default_e752fee78378294ff03f91dba0a75a04, "@/components/graphics/AppLogo#default": default_e752fee78378294ff03f91dba0a75a04,
"@/components/static/BeforeDashboardText#default": default_05548cb43495e62d80b80ec4d9f0f7e9, "@/components/static/BeforeDashboardText#default": default_05548cb43495e62d80b80ec4d9f0f7e9,
"@/components/static/GoToFrontendLink#default": default_459d6b6f5ead73c736013da63a5ace3f,
"@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 "@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1
} }

View file

@ -0,0 +1,12 @@
import Link from "next/link";
import { Button } from "@payloadcms/ui";
export const GoToFrontendLink = () => {
return (
<Link href="/" className="absolute top-0 right-0 p-3.5 z-10">
<Button margin={false} buttonStyle="dashed">Go to Frontend</Button>
</Link>
);
};
export default GoToFrontendLink;

View file

@ -45,9 +45,6 @@ import { UserNotifications } from "@/collections/users/UserNotifications";
import { nodemailerAdapter } from "@payloadcms/email-nodemailer"; import { nodemailerAdapter } from "@payloadcms/email-nodemailer";
import nodemailer from "nodemailer"; import nodemailer from "nodemailer";
import { isTrusted, isDeveloper } from "@/utils/access-control/isRole"; // Used below for Users admin access
const filename = fileURLToPath(import.meta.url); const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename); const dirname = path.dirname(filename);
@ -72,6 +69,7 @@ export default buildConfig({
components: { components: {
beforeDashboard: ["@/components/static/BeforeDashboardText"], beforeDashboard: ["@/components/static/BeforeDashboardText"],
header: ["@/components/static/VersionOverlay"], header: ["@/components/static/VersionOverlay"],
beforeNav: ["@/components/static/GoToFrontendLink"],
graphics: { graphics: {
Logo: "@/components/graphics/AppLogo", Logo: "@/components/graphics/AppLogo",
Icon: "@/components/graphics/AppIcon", Icon: "@/components/graphics/AppIcon",