chore: thread missing Link components to Button
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
export { AdminLayout } from './layouts/Admin'
|
||||
export { DocumentLayout } from './layouts/Document'
|
||||
export { RootLayout } from './layouts/Root'
|
||||
export { Dashboard as DashboardPage } from './views/Dashboard'
|
||||
export { Login } from './views/Login'
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import type { SanitizedConfig } from 'payload/types'
|
||||
|
||||
import { DocumentHeader } from '@payloadcms/ui'
|
||||
import '@payloadcms/ui/scss/app.scss'
|
||||
import React, { Fragment } from 'react'
|
||||
|
||||
import { initPage } from '../../utilities/initPage'
|
||||
|
||||
export const metadata = {
|
||||
description: 'Generated by Next.js',
|
||||
title: 'Next.js',
|
||||
}
|
||||
|
||||
export const DocumentLayout = async ({
|
||||
children,
|
||||
collectionSlug,
|
||||
config: configPromise,
|
||||
globalSlug,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
collectionSlug?: string
|
||||
config: Promise<SanitizedConfig>
|
||||
globalSlug?: string
|
||||
}) => {
|
||||
const { collectionConfig, globalConfig, req } = await initPage({
|
||||
collectionSlug,
|
||||
config: configPromise,
|
||||
globalSlug,
|
||||
})
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<DocumentHeader
|
||||
collectionConfig={collectionConfig}
|
||||
config={req.payload.config}
|
||||
globalConfig={globalConfig}
|
||||
i18n={req.i18n}
|
||||
/>
|
||||
{children}
|
||||
</Fragment>
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import type { CollectionRouteHandler } from '../types'
|
||||
|
||||
export const find: CollectionRouteHandler = async ({ collection, req }) => {
|
||||
const { searchParams } = req
|
||||
|
||||
// parse using `qs` to handle `where` queries
|
||||
const { depth, draft, limit, page, sort, where } = qs.parse(searchParams.toString()) as {
|
||||
depth?: string
|
||||
|
||||
@@ -19,10 +19,7 @@ import { auth } from './auth'
|
||||
import { getRequestLanguage } from './getRequestLanguage'
|
||||
|
||||
type Args = {
|
||||
collectionSlug?: string
|
||||
config: Promise<SanitizedConfig> | SanitizedConfig
|
||||
globalSlug?: string
|
||||
localeParam?: string
|
||||
redirectUnauthenticatedUser?: boolean
|
||||
route?: string
|
||||
searchParams?: { [key: string]: string | string[] | undefined }
|
||||
@@ -30,13 +27,12 @@ type Args = {
|
||||
|
||||
export const initPage = async ({
|
||||
config: configPromise,
|
||||
localeParam,
|
||||
redirectUnauthenticatedUser = false,
|
||||
route,
|
||||
searchParams,
|
||||
}: Args): Promise<InitPageResult> => {
|
||||
const headers = getHeaders()
|
||||
|
||||
const localeParam = searchParams?.locale as string
|
||||
const { cookies, permissions, user } = await auth({
|
||||
config: configPromise,
|
||||
headers,
|
||||
|
||||
@@ -14,9 +14,9 @@ const chars = {
|
||||
const baseClass = 'query-inspector'
|
||||
|
||||
const Bracket = ({
|
||||
type,
|
||||
comma = false,
|
||||
position,
|
||||
type,
|
||||
}: {
|
||||
comma?: boolean
|
||||
position: 'end' | 'start'
|
||||
@@ -49,7 +49,7 @@ export const RenderJSON = ({
|
||||
parentType = 'object',
|
||||
trailingComma = false,
|
||||
}: Args) => {
|
||||
const objectKeys = Object.keys(object)
|
||||
const objectKeys = object ? Object.keys(object) : []
|
||||
const objectLength = objectKeys.length
|
||||
const [isOpen, setIsOpen] = React.useState<boolean>(true)
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@ import queryString from 'qs'
|
||||
import React, { Fragment } from 'react'
|
||||
|
||||
import type { AdminViewProps } from '../Root'
|
||||
import type { GenerateEditViewMetadata } from './getMetaBySegment'
|
||||
|
||||
import { GenerateEditViewMetadata, getMetaBySegment } from './getMetaBySegment'
|
||||
import { getMetaBySegment } from './getMetaBySegment'
|
||||
import { getViewsFromConfig } from './getViewsFromConfig'
|
||||
|
||||
export const generateMetadata: GenerateEditViewMetadata = async (args) => getMetaBySegment(args)
|
||||
@@ -178,6 +179,7 @@ export const Document: React.FC<AdminViewProps> = async ({
|
||||
locale: locale.code,
|
||||
uploadEdits: undefined,
|
||||
}
|
||||
console.log('server code', `${action}?${queryString.stringify(formQueryParams)}`)
|
||||
|
||||
const componentProps: ServerSideEditViewProps = {
|
||||
id,
|
||||
@@ -208,7 +210,7 @@ export const Document: React.FC<AdminViewProps> = async ({
|
||||
/>
|
||||
<HydrateClientUser permissions={permissions} user={user} />
|
||||
<SetDocumentInfo
|
||||
action={action}
|
||||
action={`${action}?${queryString.stringify(formQueryParams)}`}
|
||||
apiURL={apiURL}
|
||||
collectionSlug={collectionConfig?.slug}
|
||||
disableActions={false}
|
||||
|
||||
@@ -48,7 +48,7 @@ export const ForgotPassword: React.FC<AdminViewProps> = ({ initPageResult }) =>
|
||||
/>
|
||||
</p>
|
||||
<br />
|
||||
<Button buttonStyle="secondary" el="link" to={admin}>
|
||||
<Button Link={Link} buttonStyle="secondary" el="link" to={admin}>
|
||||
{i18n.t('general:backToDashboard')}
|
||||
</Button>
|
||||
</Fragment>
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
SetViewActions,
|
||||
UnpublishMany,
|
||||
} from '@payloadcms/ui/elements'
|
||||
import Link from 'next/link'
|
||||
import { formatFilesize } from 'payload/utilities'
|
||||
import React, { Fragment, useEffect } from 'react'
|
||||
|
||||
@@ -156,7 +157,7 @@ export const DefaultListView: React.FC = () => {
|
||||
<div className={`${baseClass}__no-results`}>
|
||||
<p>{i18n.t('general:noResults', { label: getTranslation(labels?.plural, i18n) })}</p>
|
||||
{hasCreatePermission && newDocumentURL && (
|
||||
<Button el="link" to={newDocumentURL}>
|
||||
<Button Link={Link} el="link" to={newDocumentURL}>
|
||||
{i18n.t('general:createNewLabel', {
|
||||
label: getTranslation(labels?.singular, i18n),
|
||||
})}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
import { Button, Gutter, useConfig, useStepNav, useTranslation } from '@payloadcms/ui'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
|
||||
// import Meta from '../../utilities/Meta'
|
||||
@@ -41,7 +42,7 @@ const NotFound: React.FC<{
|
||||
<Gutter className={`${baseClass}__wrap`}>
|
||||
<h1>{t('general:nothingFound')}</h1>
|
||||
<p>{t('general:sorryNotFound')}</p>
|
||||
<Button className={`${baseClass}__button`} el="link" to={`${admin}`}>
|
||||
<Button Link={Link} className={`${baseClass}__button`} el="link" to={`${admin}`}>
|
||||
{t('general:backToDashboard')}
|
||||
</Button>
|
||||
</Gutter>
|
||||
|
||||
@@ -61,7 +61,7 @@ export const ResetPassword: React.FC<AdminViewProps> = ({ initPageResult, params
|
||||
/>
|
||||
</p>
|
||||
<br />
|
||||
<Button buttonStyle="secondary" el="link" to={admin}>
|
||||
<Button Link={Link} buttonStyle="secondary" el="link" to={admin}>
|
||||
{i18n.t('general:backToDashboard')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client'
|
||||
import { Button, useTranslation } from '@payloadcms/ui'
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
|
||||
export const UnauthorizedClient: React.FC<{ logoutRoute: string }> = ({ logoutRoute }) => {
|
||||
@@ -10,7 +11,7 @@ export const UnauthorizedClient: React.FC<{ logoutRoute: string }> = ({ logoutRo
|
||||
<h2>{t('error:unauthorized')}</h2>
|
||||
<p>{t('error:notAllowedToAccessPage')}</p>
|
||||
<br />
|
||||
<Button el="link" to={logoutRoute}>
|
||||
<Button Link={Link} el="link" to={logoutRoute}>
|
||||
{t('authentication:logOut')}
|
||||
</Button>
|
||||
</React.Fragment>
|
||||
|
||||
Reference in New Issue
Block a user