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 ?? [])]);
|
setAllPolygons([...(editingPolygons ?? [])]);
|
||||||
setHoveredPolygonIndex(null);
|
setHoveredPolygonIndex(null);
|
||||||
setUnsavedChanges(false);
|
setUnsavedChanges(false);
|
||||||
addMessage(
|
addMessage("masks_zones", "Restart required (masks/zones changed)");
|
||||||
"masks_zones",
|
|
||||||
"Restart required (masks/zones changed)",
|
|
||||||
"text-danger",
|
|
||||||
);
|
|
||||||
}, [editingPolygons, setUnsavedChanges, addMessage]);
|
}, [editingPolygons, setUnsavedChanges, addMessage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -153,7 +153,7 @@ export default function MotionTuner({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (changedValue) {
|
if (changedValue) {
|
||||||
addMessage("motion_tuner", "Unsaved motion changes", "text-danger");
|
addMessage("motion_tuner", "Unsaved motion tuner changes");
|
||||||
} else {
|
} else {
|
||||||
clearMessages("motion_tuner");
|
clearMessages("motion_tuner");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
export type StatusMessage = {
|
export type StatusMessage = {
|
||||||
id: string;
|
id: string;
|
||||||
text: string;
|
text: string;
|
||||||
color: string;
|
color?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StatusMessagesState = {
|
export type StatusMessagesState = {
|
||||||
@ -25,7 +25,7 @@ type StatusBarMessagesContextValue = {
|
|||||||
addMessage: (
|
addMessage: (
|
||||||
key: string,
|
key: string,
|
||||||
message: string,
|
message: string,
|
||||||
color: string,
|
color?: string,
|
||||||
messageId?: string,
|
messageId?: string,
|
||||||
) => string;
|
) => string;
|
||||||
removeMessage: (key: string, messageId: string) => void;
|
removeMessage: (key: string, messageId: string) => void;
|
||||||
@ -45,9 +45,13 @@ export function StatusBarMessagesProvider({
|
|||||||
const addMessage = useCallback(
|
const addMessage = useCallback(
|
||||||
(key: string, message: string, color: string, messageId?: string) => {
|
(key: string, message: string, color: string, messageId?: string) => {
|
||||||
const id = messageId || Date.now().toString();
|
const id = messageId || Date.now().toString();
|
||||||
|
const msgColor = color || "text-danger";
|
||||||
setMessagesState((prevMessages) => ({
|
setMessagesState((prevMessages) => ({
|
||||||
...prevMessages,
|
...prevMessages,
|
||||||
[key]: [...(prevMessages[key] || []), { id, text: message, color }],
|
[key]: [
|
||||||
|
...(prevMessages[key] || []),
|
||||||
|
{ id, text: message, color: msgColor },
|
||||||
|
],
|
||||||
}));
|
}));
|
||||||
return id;
|
return id;
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user