Cập nhật theme cho cảnh báo, giám sát

This commit is contained in:
2025-12-29 17:05:05 +07:00
parent 871360af49
commit bf261e70e4
6 changed files with 234 additions and 115 deletions

View File

@@ -84,7 +84,12 @@ const WarningScreen = () => {
});
const slice = resp.data?.alarms ?? [];
setAlarms((prev) => (append ? [...prev, ...slice] : slice));
// Sort alarms by level descending (higher level first: SOS > Danger > Warning > Info)
const sortedSlice = [...slice].sort(
(a, b) => (b.level ?? 0) - (a.level ?? 0)
);
setAlarms((prev) => (append ? [...prev, ...sortedSlice] : sortedSlice));
setOffset(nextOffset);
setHasMore(nextOffset + PAGE_SIZE < resp.data?.total!);
} catch (error) {