Release 202505280851

This commit is contained in:
pluja
2025-05-28 08:51:59 +00:00
parent 70a097054b
commit 7e0d41cc7a
4 changed files with 81 additions and 14 deletions

View File

@@ -15,6 +15,8 @@ type EventTypeInfo<T extends string | null | undefined = string> = {
}
icon: string
color: ComponentProps<typeof BadgeSmall>['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<EventType>[]
)

View File

@@ -1 +1 @@
export const SUPPORT_EMAIL = 'support@kycnot.me'
export const SUPPORT_EMAIL = 'contact@kycnot.me'

View File

@@ -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."

View File

@@ -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)
)
---
<BaseLayout
@@ -480,6 +484,32 @@ const serviceVisibilityInfo = getServiceVisibilityInfo(service.serviceVisibility
}),
]}
>
{
activeAlertOrWarningEvents.length > 0 && (
<a
href="#events"
class={cn(
'mb-4 block rounded-md px-3 py-2 text-sm font-medium',
activeAlertOrWarningEvents.some((e) => 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'
)}
>
<Icon
name={
activeAlertOrWarningEvents.some((e) => 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.'}
</a>
)
}
{
(serviceVisibilityInfo.value === 'UNLISTED' || serviceVisibilityInfo.value === 'ARCHIVED') && (
<div class={cn('mb-4 rounded-md bg-yellow-900/50 px-3 py-2 text-sm text-yellow-400')}>
@@ -1182,6 +1212,7 @@ const serviceVisibilityInfo = getServiceVisibilityInfo(service.serviceVisibility
<div class="mt-3 max-w-md pe-8">
<h3 class="font-title text-lg leading-tight font-semibold text-pretty text-white">
{typeInfo.isSolved && <BadgeSmall text="Solved" icon="ri:check-line" color="green" />}
{event.title}
</h3>