--- import { Icon } from 'astro-icon/components' import { cn } from '../lib/cn' import { prisma } from '../lib/prisma' import type { HTMLAttributes } from 'astro/types' type Props = Omit, 'href'> & { count?: number | null } const { count: propsCount, class: className, ...htmlProps } = Astro.props const user = Astro.locals.user const count = propsCount ?? (await Astro.locals.banners.try( 'Error getting unread notification count', async () => (user ? await prisma.notification.count({ where: { userId: user.id, read: false } }) : 0), 0 )) --- { user && ( 0 ? ` (${count} unread)` : ''}`} {...htmlProps} > {count > 0 ? (count > 99 ? '★' : count.toLocaleString()) : ''} ) }