Skip to content

Commit

Permalink
feat: add common global
Browse files Browse the repository at this point in the history
  • Loading branch information
BohdanK-W32 committed Oct 26, 2023
1 parent d91f400 commit e5c5e22
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/globals/Common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { GlobalConfig } from 'payload/types';

import { translationField } from 'fields/translation';

import { generalGroup } from 'utils/groups';

const Common: GlobalConfig = {
slug: 'common',
label: {
en: 'Common (translation)',
ua: 'Загальне (переклад)',
},
admin: {
group: generalGroup,
},
versions: {
drafts: {
autosave: true,
},
max: 5,
},
fields: [translationField()],
};

export default Common;
5 changes: 5 additions & 0 deletions src/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface BlogCoverImage {
id: string;
alt?: string;
prefix?: string;
blurhash?: string;
updatedAt: string;
createdAt: string;
url?: string;
Expand All @@ -148,6 +149,7 @@ export interface BlogCoverImage {
height?: number;
sizes?: {
'700'?: {
blurhash?: string;
url?: string;
width?: number;
height?: number;
Expand All @@ -156,6 +158,7 @@ export interface BlogCoverImage {
filename?: string;
};
'800'?: {
blurhash?: string;
url?: string;
width?: number;
height?: number;
Expand All @@ -164,6 +167,7 @@ export interface BlogCoverImage {
filename?: string;
};
'1200'?: {
blurhash?: string;
url?: string;
width?: number;
height?: number;
Expand All @@ -172,6 +176,7 @@ export interface BlogCoverImage {
filename?: string;
};
'1600'?: {
blurhash?: string;
url?: string;
width?: number;
height?: number;
Expand Down
2 changes: 2 additions & 0 deletions src/payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import ServiceIcons from 'collections/media/ServiceIcons';
import TeamMemberPhotos from 'collections/media/TeamMemberPhotos';
import TechnologyLogos from 'collections/media/TechnologyLogos';

import Common from 'globals/Common';
import Footer from 'globals/Footer';
import GeneralInfo from 'globals/GeneralInfo';
import Languages from 'globals/Languages';
Expand Down Expand Up @@ -296,6 +297,7 @@ export default buildConfig({
globals: [
AboutPage.slug,
BlogPage.slug,
Common.slug,
ContactsPage.slug,
CookiesPolicyPage.slug,
HomePage.slug,
Expand Down

0 comments on commit e5c5e22

Please sign in to comment.