mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-10 21:25:24 +03:00
optional color
This commit is contained in:
parent
a0eb2138f4
commit
08b3574bb9
@ -177,11 +177,7 @@ export default function MasksAndZones({
|
||||
setAllPolygons([...(editingPolygons ?? [])]);
|
||||
setHoveredPolygonIndex(null);
|
||||
setUnsavedChanges(false);
|
||||
addMessage(
|
||||
"masks_zones",
|
||||
"Restart required (masks/zones changed)",
|
||||
"text-danger",
|
||||
);
|
||||
addMessage("masks_zones", "Restart required (masks/zones changed)");
|
||||
}, [editingPolygons, setUnsavedChanges, addMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -153,7 +153,7 @@ export default function MotionTuner({
|
||||
|
||||
useEffect(() => {
|
||||
if (changedValue) {
|
||||
addMessage("motion_tuner", "Unsaved motion changes", "text-danger");
|
||||
addMessage("motion_tuner", "Unsaved motion tuner changes");
|
||||
} else {
|
||||
clearMessages("motion_tuner");
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
export type StatusMessage = {
|
||||
id: string;
|
||||
text: string;
|
||||
color: string;
|
||||
color?: string;
|
||||
};
|
||||
|
||||
export type StatusMessagesState = {
|
||||
@ -25,7 +25,7 @@ type StatusBarMessagesContextValue = {
|
||||
addMessage: (
|
||||
key: string,
|
||||
message: string,
|
||||
color: string,
|
||||
color?: string,
|
||||
messageId?: string,
|
||||
) => string;
|
||||
removeMessage: (key: string, messageId: string) => void;
|
||||
@ -45,9 +45,13 @@ export function StatusBarMessagesProvider({
|
||||
const addMessage = useCallback(
|
||||
(key: string, message: string, color: string, messageId?: string) => {
|
||||
const id = messageId || Date.now().toString();
|
||||
const msgColor = color || "text-danger";
|
||||
setMessagesState((prevMessages) => ({
|
||||
...prevMessages,
|
||||
[key]: [...(prevMessages[key] || []), { id, text: message, color }],
|
||||
[key]: [
|
||||
...(prevMessages[key] || []),
|
||||
{ id, text: message, color: msgColor },
|
||||
],
|
||||
}));
|
||||
return id;
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user