Fix: Invalid query in slug route and NewsCard footer logic

This commit is contained in:
Carlos (Almeira) 2026-03-26 15:52:15 -05:00
parent 8e27335f71
commit c76ed914b1
2 changed files with 10 additions and 5 deletions

View File

@ -6,6 +6,8 @@ import { Calendar, User, ArrowLeft } from 'lucide-react';
import Link from 'next/link'; import Link from 'next/link';
async function fetchPostData(slugOrId: string) { async function fetchPostData(slugOrId: string) {
if (!slugOrId || typeof slugOrId !== 'string' || slugOrId.includes('.')) return null;
try { try {
const client = await createAdminClient(); const client = await createAdminClient();
const dbId = APPWRITE_ALMEIRA_CONFIG.databaseId; const dbId = APPWRITE_ALMEIRA_CONFIG.databaseId;
@ -25,7 +27,10 @@ async function fetchPostData(slugOrId: string) {
return null; return null;
} }
} catch (e) { } catch (e) {
console.error("Post detail fetch error", e); // En desarrollo o por favicon.ico etc, esto puede fallar. Solo logueamos si es error real.
if (!slugOrId.includes('favicon')) {
console.error("Post detail fetch error for slug:", slugOrId, e);
}
return null; return null;
} }
} }

View File

@ -24,8 +24,8 @@ export const NewsCard = ({
fecha, fecha,
imagenUrl, imagenUrl,
showCategory = false, showCategory = false,
showFooterDate = true, showFooterDate = false,
showFooterButton = true, showFooterButton = false,
footerText footerText
}: NewsCardProps) => { }: NewsCardProps) => {
// Formatear fecha // Formatear fecha
@ -74,10 +74,10 @@ export const NewsCard = ({
{fechaFormateada} {fechaFormateada}
</div> </div>
) : ( ) : (
footerText || "Ver más" footerText || ""
)} )}
</span> </span>
{showFooterButton && ( {showFooterButton && footerText && (
<div className="w-8 h-8 rounded-full bg-white/5 flex items-center justify-center border border-white/10 group-hover:bg-cyan-500 group-hover:border-cyan-400 group-hover:text-slate-950 transition-all"> <div className="w-8 h-8 rounded-full bg-white/5 flex items-center justify-center border border-white/10 group-hover:bg-cyan-500 group-hover:border-cyan-400 group-hover:text-slate-950 transition-all">
<ArrowUpRight size={16} className="transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5" /> <ArrowUpRight size={16} className="transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
</div> </div>