refactor: extract signals filter builder, add ESLint 10 config, fix low-hanging issues
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useApp } from '@/lib/context';
|
||||
import { fetchAlerts, createAlert, updateAlert, deleteAlert } from '@/lib/api';
|
||||
import { resolveName, resolveKey } from '@/lib/localization';
|
||||
|
||||
import type { AlertConfig } from '@/lib/types';
|
||||
|
||||
import { fetchAlerts, createAlert, updateAlert, deleteAlert } from '@/lib/api';
|
||||
import { useApp } from '@/lib/context';
|
||||
import { resolveName, resolveKey } from '@/lib/localization';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
@@ -121,6 +123,7 @@ function AlertForm({
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
aria-label={submitLabel}
|
||||
onClick={onSubmit}
|
||||
className="flex-1 bg-indigo-600 hover:bg-indigo-500 text-white text-sm rounded py-1.5"
|
||||
>
|
||||
@@ -128,6 +131,7 @@ function AlertForm({
|
||||
</button>
|
||||
{onCancel && (
|
||||
<button
|
||||
aria-label="Cancel"
|
||||
onClick={onCancel}
|
||||
className="px-3 py-1.5 text-sm text-gray-400 hover:text-white rounded hover:bg-gray-700"
|
||||
>
|
||||
@@ -224,7 +228,11 @@ export default function AlertPanel({ open, onClose }: Props) {
|
||||
>
|
||||
<div className="flex items-center justify-between px-4 py-3 border-b border-gray-700">
|
||||
<span className="font-semibold text-white">Alerts</span>
|
||||
<button onClick={onClose} className="text-gray-400 hover:text-white">
|
||||
<button
|
||||
aria-label="Close alerts panel"
|
||||
onClick={onClose}
|
||||
className="text-gray-400 hover:text-white"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
@@ -288,12 +296,14 @@ export default function AlertPanel({ open, onClose }: Props) {
|
||||
</div>
|
||||
<div className="flex gap-1 ml-2 shrink-0">
|
||||
<button
|
||||
aria-label="Edit alert"
|
||||
onClick={() => startEdit(a)}
|
||||
className="text-gray-500 hover:text-indigo-400"
|
||||
>
|
||||
✏️
|
||||
</button>
|
||||
<button
|
||||
aria-label="Delete alert"
|
||||
onClick={() => handleDelete(a.id)}
|
||||
className="text-gray-500 hover:text-red-400"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user