Skip to content

Commit 568d745

Browse files
authored
cms: add published column to categories (#121)
1 parent d93c8d4 commit 568d745

File tree

10 files changed

+3217
-2
lines changed

10 files changed

+3217
-2
lines changed

app/src/app/(frontend)/[locale]/(app)/layout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export default async function AppLayout({ children }: { children: React.ReactNod
4242
depth: 1,
4343
limit: 0,
4444
locale,
45+
where: {
46+
published: {
47+
equals: true,
48+
},
49+
},
4550
},
4651
},
4752
}),

app/src/cms/collections/Categories.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ export const Categories: CollectionConfig = {
3434
required: true,
3535
min: 0,
3636
},
37+
{
38+
name: "published",
39+
type: "checkbox",
40+
defaultValue: false,
41+
admin: {
42+
position: "sidebar",
43+
description: "Uncheck to hide this category from the public view.",
44+
},
45+
},
3746
{
3847
name: "cover",
3948
type: "upload",

app/src/containers/categories/back.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export const CategoriesBack = () => {
3131
depth: 1,
3232
limit: 0,
3333
locale,
34+
where: {
35+
published: {
36+
equals: true,
37+
},
38+
},
3439
},
3540
},
3641
}),

app/src/containers/categories/list.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ export const CategoriesList = () => {
1717
query: {
1818
depth: 1,
1919
limit: 0,
20-
locale, // Replace with the actual locale if needed
20+
locale,
21+
where: {
22+
published: {
23+
equals: true,
24+
},
25+
},
2126
},
2227
},
2328
}),

app/src/containers/landscapes/indicator.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export const LandscapesIndicator = () => {
2929
query: {
3030
depth: 1,
3131
locale,
32+
where: {
33+
published: {
34+
equals: true,
35+
},
36+
},
3237
},
3338
},
3439
},

0 commit comments

Comments
 (0)