feat: remove hash
parent
16ef9bf3e7
commit
62bca079cb
|
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
/>
|
||||
))
|
||||
|
|
|
|||
Loading…
Reference in New Issue