optimistic severity toggle

This commit is contained in:
Josh Hawkins 2024-04-04 09:41:57 -05:00
parent f91116df52
commit 9ae1021009

View File

@ -203,6 +203,7 @@ export default function EventView({
const [severityToggle, setSeverityToggle] = useOptimisticState( const [severityToggle, setSeverityToggle] = useOptimisticState(
severity, severity,
setSeverity, setSeverity,
100,
); );
if (!config) { if (!config) {
@ -225,7 +226,7 @@ export default function EventView({
} // don't allow the severity to be unselected } // don't allow the severity to be unselected
> >
<ToggleGroupItem <ToggleGroupItem
className={`${severity == "alert" ? "" : "text-gray-500"}`} className={`${severityToggle == "alert" ? "" : "text-gray-500"}`}
value="alert" value="alert"
aria-label="Select alerts" aria-label="Select alerts"
> >
@ -235,7 +236,7 @@ export default function EventView({
</div> </div>
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem <ToggleGroupItem
className={`${severity == "detection" ? "" : "text-gray-500"}`} className={`${severityToggle == "detection" ? "" : "text-gray-500"}`}
value="detection" value="detection"
aria-label="Select detections" aria-label="Select detections"
> >
@ -247,7 +248,7 @@ export default function EventView({
</ToggleGroupItem> </ToggleGroupItem>
<ToggleGroupItem <ToggleGroupItem
className={`px-3 py-4 rounded-2xl ${ className={`px-3 py-4 rounded-2xl ${
severity == "significant_motion" ? "" : "text-gray-500" severityToggle == "significant_motion" ? "" : "text-gray-500"
}`} }`}
value="significant_motion" value="significant_motion"
aria-label="Select motion" aria-label="Select motion"