feat: remove hash

pull/113/head
lyc8503 2025-09-20 22:56:26 +08:00
parent 16ef9bf3e7
commit 62bca079cb
2 changed files with 43 additions and 61 deletions

View File

@ -5,30 +5,18 @@ import { MaintenanceConfig, MonitorTarget } from '@/types/config'
export default function MaintenanceAlert({
maintenance,
style,
hash,
}: {
maintenance: Omit<MaintenanceConfig, 'monitors'> & { monitors?: MonitorTarget[] }
style?: React.CSSProperties
hash?: string
}) {
const titleStyle: React.CSSProperties = {}
if (hash) {
titleStyle['textDecoration'] = 'underline'
titleStyle['cursor'] = 'pointer'
}
function updateHash() {
if (!hash) return
window.location.hash = hash
}
return (
<div id={hash}>
<Alert
icon={<IconAlertTriangle />}
title={
(
<span style={titleStyle} onClick={updateHash}>
<span style={titleStyle}>
{maintenance.title || 'Scheduled Maintenance'}
</span>
)
@ -69,6 +57,5 @@ export default function MaintenanceAlert({
</>
)}
</Alert>
</div>
)
}

View File

@ -119,11 +119,6 @@ export default function IncidentsPage() {
monitorFilteredIncidents.map((incident, i) => (
<MaintenanceAlert
key={i}
hash={[
new Date(incident.start).getFullYear(),
String(new Date(incident.start).getMonth() + 1).padStart(2, '0'),
monitorFilteredIncidents.length - i,
].join('-')}
maintenance={incident}
/>
))