Refactor: Conditional sidebar support with AD_BANNER and full-width detail page
This commit is contained in:
parent
1926330b41
commit
f799c41ae7
@ -1,7 +1,7 @@
|
|||||||
import { APPWRITE_ALMEIRA_CONFIG } from '@/lib/appwrite';
|
import { APPWRITE_ALMEIRA_CONFIG } from '@/lib/appwrite';
|
||||||
import { createAdminClient } from '@/lib/appwrite.server';
|
import { createAdminClient } from '@/lib/appwrite.server';
|
||||||
import { Query } from 'node-appwrite';
|
import { Query } from 'node-appwrite';
|
||||||
import { GlobalSidebar } from '@/components/AdWrappers';
|
import { GlobalSidebar, hasSidebarContent } from '@/components/AdWrappers';
|
||||||
import { Calendar, User, ArrowLeft } from 'lucide-react';
|
import { Calendar, User, ArrowLeft } from 'lucide-react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ async function fetchPostData(slugOrId: string) {
|
|||||||
|
|
||||||
export default async function NoticiaDetail({ params }: { params: { slug: string } }) {
|
export default async function NoticiaDetail({ params }: { params: { slug: string } }) {
|
||||||
const post = await fetchPostData(params.slug);
|
const post = await fetchPostData(params.slug);
|
||||||
|
const hasSidebar = await hasSidebarContent();
|
||||||
|
|
||||||
if (!post) {
|
if (!post) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export async function hasSidebarContent(): Promise<boolean> {
|
|||||||
const { createAdminClient } = await import('@/lib/appwrite.server');
|
const { createAdminClient } = await import('@/lib/appwrite.server');
|
||||||
const client = await createAdminClient();
|
const client = await createAdminClient();
|
||||||
const typesRes = await client.databases.listDocuments(APPWRITE_ALMEIRA_CONFIG.databaseId, 'publication_types', []);
|
const typesRes = await client.databases.listDocuments(APPWRITE_ALMEIRA_CONFIG.databaseId, 'publication_types', []);
|
||||||
const validCodes = ['DISPLAY_SLIDER', 'EVENTO', 'CLASIFICADO'];
|
const validCodes = ['DISPLAY_SLIDER', 'EVENTO', 'CLASIFICADO', 'AD_BANNER'];
|
||||||
const validTypeIds = typesRes.documents.filter(t => validCodes.includes(t.codigo)).map(t => t.$id);
|
const validTypeIds = typesRes.documents.filter(t => validCodes.includes(t.codigo)).map(t => t.$id);
|
||||||
|
|
||||||
if (validTypeIds.length === 0) return false;
|
if (validTypeIds.length === 0) return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user