From 5694dbf21807bfb0b80fdf6964c88ddb93063709 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Thu, 13 Aug 2026 17:00:51 -0400 Subject: [PATCH] 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 --- src/app/(payload)/admin/importMap.js | 2 ++ src/components/static/GoToFrontendLink.tsx | 12 ++++++++++++ src/payload.config.ts | 4 +--- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/components/static/GoToFrontendLink.tsx diff --git a/src/app/(payload)/admin/importMap.js b/src/app/(payload)/admin/importMap.js index 9033883..1b64b0b 100644 --- a/src/app/(payload)/admin/importMap.js +++ b/src/app/(payload)/admin/importMap.js @@ -30,6 +30,7 @@ import { default as default_2f6c866ab4d4d51b3789f090b84b85c7 } from '@/component import { default as default_508743824696caae2894ebf34c2e68bb } from '@/components/graphics/AppIcon' import { default as default_e752fee78378294ff03f91dba0a75a04 } from '@/components/graphics/AppLogo' 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' export const importMap = { @@ -65,5 +66,6 @@ export const importMap = { "@/components/graphics/AppIcon#default": default_508743824696caae2894ebf34c2e68bb, "@/components/graphics/AppLogo#default": default_e752fee78378294ff03f91dba0a75a04, "@/components/static/BeforeDashboardText#default": default_05548cb43495e62d80b80ec4d9f0f7e9, + "@/components/static/GoToFrontendLink#default": default_459d6b6f5ead73c736013da63a5ace3f, "@payloadcms/next/rsc#CollectionCards": CollectionCards_f9c02e79a4aed9a3924487c0cd4cafb1 } diff --git a/src/components/static/GoToFrontendLink.tsx b/src/components/static/GoToFrontendLink.tsx new file mode 100644 index 0000000..d3ec60f --- /dev/null +++ b/src/components/static/GoToFrontendLink.tsx @@ -0,0 +1,12 @@ +import Link from "next/link"; +import { Button } from "@payloadcms/ui"; + +export const GoToFrontendLink = () => { + return ( + + + + ); +}; + +export default GoToFrontendLink; \ No newline at end of file diff --git a/src/payload.config.ts b/src/payload.config.ts index 6c7c608..52e72a6 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -45,9 +45,6 @@ import { UserNotifications } from "@/collections/users/UserNotifications"; import { nodemailerAdapter } from "@payloadcms/email-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 dirname = path.dirname(filename); @@ -72,6 +69,7 @@ export default buildConfig({ components: { beforeDashboard: ["@/components/static/BeforeDashboardText"], header: ["@/components/static/VersionOverlay"], + beforeNav: ["@/components/static/GoToFrontendLink"], graphics: { Logo: "@/components/graphics/AppLogo", Icon: "@/components/graphics/AppIcon",