announcements style

This commit is contained in:
pluja
2025-05-20 10:20:09 +00:00
parent dabc4e5c47
commit af7ebe813b
13 changed files with 456 additions and 337 deletions

View File

@@ -4,7 +4,6 @@ import { z } from 'astro:schema'
import { groupBy, orderBy } from 'lodash-es'
import seedrandom from 'seedrandom'
import AnnouncementBanner from '../components/AnnouncementBanner.astro'
import Button from '../components/Button.astro'
import Pagination from '../components/Pagination.astro'
import ServiceFiltersPill from '../components/ServiceFiltersPill.astro'
@@ -186,8 +185,7 @@ if (redirectUrl) return Astro.redirect(redirectUrl.toString())
export type ServicesFiltersObject = typeof filters
const currentDate = new Date()
const [categories, [services, totalServices, hadToIncludeCommunityContributed], activeAnnouncements] =
const [categories, [services, totalServices, hadToIncludeCommunityContributed]] =
await Astro.locals.banners.tryMany([
[
'Unable to load category filters.',
@@ -411,28 +409,6 @@ const [categories, [services, totalServices, hadToIncludeCommunityContributed],
},
[[] as [], 0, false] as const,
],
[
'Unable to load announcements.',
() =>
prisma.announcement.findMany({
where: {
isActive: true,
startDate: { lte: currentDate },
OR: [{ endDate: null }, { endDate: { gt: currentDate } }],
},
select: {
id: true,
title: true,
content: true,
type: true,
startDate: true,
endDate: true,
isActive: true,
},
orderBy: [{ type: 'desc' }, { createdAt: 'desc' }],
}),
[],
],
])
const attributes = await Astro.locals.banners.try(
@@ -528,8 +504,6 @@ export type ServicesFiltersOptions = typeof filtersOptions
},
]}
>
<AnnouncementBanner announcements={activeAnnouncements} />
<div class="flex flex-col gap-4 sm:flex-row sm:gap-8">
<div
class='[&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-night-700 flex items-stretch sm:hidden [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-2 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-green-500 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-2'