From 7e0d41cc7abb2bfdb24d1b117d9669cedd069c38 Mon Sep 17 00:00:00 2001 From: pluja Date: Wed, 28 May 2025 08:51:59 +0000 Subject: [PATCH] Release 202505280851 --- web/src/constants/eventTypes.ts | 30 +++++++++++++---- web/src/constants/project.ts | 2 +- .../pages/admin/services/[slug]/edit.astro | 30 +++++++++++++---- web/src/pages/service/[slug].astro | 33 ++++++++++++++++++- 4 files changed, 81 insertions(+), 14 deletions(-) diff --git a/web/src/constants/eventTypes.ts b/web/src/constants/eventTypes.ts index f7af342..890e601 100644 --- a/web/src/constants/eventTypes.ts +++ b/web/src/constants/eventTypes.ts @@ -15,6 +15,8 @@ type EventTypeInfo = { } icon: string color: ComponentProps['color'] + isSolved: boolean + showBanner: boolean } export const { @@ -36,6 +38,8 @@ export const { }, icon: 'ri:question-fill', color: 'gray', + isSolved: false, + showBanner: false, }), [ { @@ -46,8 +50,10 @@ export const { classNames: { dot: 'bg-amber-900 text-amber-300 ring-amber-900/50', }, - icon: 'ri:error-warning-fill', + icon: 'ri:alert-fill', color: 'yellow', + isSolved: false, + showBanner: true, }, { id: 'WARNING_SOLVED', @@ -55,10 +61,12 @@ export const { label: 'Warning Solved', description: 'A previously reported warning has been solved', classNames: { - dot: 'bg-green-900 text-green-300 ring-green-900/50', + dot: 'bg-amber-900 text-amber-300 ring-amber-900/50', }, - icon: 'ri:check-fill', + icon: 'ri:alert-fill', color: 'green', + isSolved: true, + showBanner: false, }, { id: 'ALERT', @@ -68,8 +76,10 @@ export const { classNames: { dot: 'bg-red-900 text-red-300 ring-red-900/50', }, - icon: 'ri:alert-fill', + icon: 'ri:spam-fill', color: 'red', + isSolved: false, + showBanner: true, }, { id: 'ALERT_SOLVED', @@ -77,10 +87,12 @@ export const { label: 'Alert Solved', description: 'A previously reported alert has been solved', classNames: { - dot: 'bg-green-900 text-green-300 ring-green-900/50', + dot: 'bg-red-900 text-red-300 ring-red-900/50', }, - icon: 'ri:check-fill', + icon: 'ri:spam-fill', color: 'green', + isSolved: true, + showBanner: false, }, { id: 'INFO', @@ -92,6 +104,8 @@ export const { }, icon: 'ri:information-fill', color: 'sky', + isSolved: false, + showBanner: false, }, { id: 'NORMAL', @@ -103,6 +117,8 @@ export const { }, icon: 'ri:notification-fill', color: 'green', + isSolved: false, + showBanner: false, }, { id: 'UPDATE', @@ -114,6 +130,8 @@ export const { }, icon: 'ri:pencil-fill', color: 'sky', + isSolved: false, + showBanner: false, }, ] as const satisfies EventTypeInfo[] ) diff --git a/web/src/constants/project.ts b/web/src/constants/project.ts index 8fadc87..bcfca66 100644 --- a/web/src/constants/project.ts +++ b/web/src/constants/project.ts @@ -1 +1 @@ -export const SUPPORT_EMAIL = 'support@kycnot.me' +export const SUPPORT_EMAIL = 'contact@kycnot.me' diff --git a/web/src/pages/admin/services/[slug]/edit.astro b/web/src/pages/admin/services/[slug]/edit.astro index fa4a563..abce1aa 100644 --- a/web/src/pages/admin/services/[slug]/edit.astro +++ b/web/src/pages/admin/services/[slug]/edit.astro @@ -685,9 +685,14 @@ if (!service) return Astro.rewrite('/404') label="Started At" name="startedAt" inputProps={{ - type: 'date', + type: 'datetime-local', required: true, - value: new Date(event.startedAt).toISOString().split('T')[0], + value: new Date( + new Date(event.startedAt).getTime() - + new Date(event.startedAt).getTimezoneOffset() * 60000 + ) + .toISOString() + .slice(0, 16), }} error={eventUpdateInputErrors.startedAt} /> @@ -696,7 +701,15 @@ if (!service) return Astro.rewrite('/404') label="Ended At" name="endedAt" inputProps={{ - value: event.endedAt ? new Date(event.endedAt).toISOString().split('T')[0] : '', + type: 'datetime-local', + value: event.endedAt + ? new Date( + new Date(event.endedAt).getTime() - + new Date(event.endedAt).getTimezoneOffset() * 60000 + ) + .toISOString() + .slice(0, 16) + : '', }} error={eventUpdateInputErrors.endedAt} description="- Empty: Event is ongoing.\n- Filled: Event with specific end date.\n- Same as start date: One-time event." @@ -756,9 +769,11 @@ if (!service) return Astro.rewrite('/404') label="Started At" name="startedAt" inputProps={{ - type: 'date', + type: 'datetime-local', required: true, - value: new Date().toISOString().split('T')[0], + value: new Date(Date.now() - new Date().getTimezoneOffset() * 60000) + .toISOString() + .slice(0, 16), }} error={eventInputErrors.startedAt} /> @@ -767,7 +782,10 @@ if (!service) return Astro.rewrite('/404') label="Ended At" name="endedAt" inputProps={{ - value: new Date().toISOString().split('T')[0], + type: 'datetime-local', + value: new Date(Date.now() - new Date().getTimezoneOffset() * 60000) + .toISOString() + .slice(0, 16), }} error={eventInputErrors.endedAt} description="- Empty: Event is ongoing.\n- Filled: Event with specific end date.\n- Same as start date: One-time event." diff --git a/web/src/pages/service/[slug].astro b/web/src/pages/service/[slug].astro index c1d2e47..21a02c5 100644 --- a/web/src/pages/service/[slug].astro +++ b/web/src/pages/service/[slug].astro @@ -1,5 +1,5 @@ --- -import { VerificationStepStatus } from '@prisma/client' +import { VerificationStepStatus, EventType } from '@prisma/client' import { Icon } from 'astro-icon/components' import { Markdown } from 'astro-remote' import { Schema } from 'astro-seo-schema' @@ -380,6 +380,10 @@ const ogImageTemplateData = { } satisfies OgImageAllTemplatesWithProps const serviceVisibilityInfo = getServiceVisibilityInfo(service.serviceVisibility) + +const activeAlertOrWarningEvents = service.events.filter( + (event) => getEventTypeInfo(event.type).showBanner && (event.endedAt === null || event.endedAt >= now) +) --- + { + activeAlertOrWarningEvents.length > 0 && ( + e.type === EventType.ALERT) + ? 'bg-red-900/50 text-red-300 hover:bg-red-800/60' + : 'bg-yellow-900/50 text-yellow-300 hover:bg-yellow-800/60' + )} + > + e.type === EventType.ALERT) + ? 'ri:alert-fill' + : 'ri:alarm-warning-fill' + } + class="me-1.5 inline-block size-4 align-[-0.15em]" + /> + {activeAlertOrWarningEvents.some((e) => e.type === EventType.ALERT) + ? 'There is an active alert for this service. Click to see details.' + : 'There is an active warning for this service. Click to see details.'} + + ) + } + { (serviceVisibilityInfo.value === 'UNLISTED' || serviceVisibilityInfo.value === 'ARCHIVED') && (
@@ -1182,6 +1212,7 @@ const serviceVisibilityInfo = getServiceVisibilityInfo(service.serviceVisibility

+ {typeInfo.isSolved && } {event.title}