diff --git a/packages/client/src/components/Dropdown.tsx b/packages/client/src/components/Dropdown.tsx index 23f564385..c2a688de3 100644 --- a/packages/client/src/components/Dropdown.tsx +++ b/packages/client/src/components/Dropdown.tsx @@ -52,11 +52,17 @@ Dropdown.LinkItem = ({ children, ...rest }: JSX.IntrinsicElements["a"]) => { const router = useRouter(); // next/link doesn't support a "ref" prop. :( - function handleClick(e: any) { + function handleClick(e: React.MouseEvent) { e.preventDefault(); const target = e.target as HTMLAnchorElement; - router.push(target.href); + const href = target.href; + + if (e.shiftKey || e.ctrlKey) { + open(href, "_blank"); + } else { + router.push(target.href); + } } return ( @@ -65,7 +71,7 @@ Dropdown.LinkItem = ({ children, ...rest }: JSX.IntrinsicElements["a"]) => { {...rest} onClick={handleClick} className={classNames( - "text-gray-900 dark:text-gray-200 block hover:bg-gray-200 dark:hover:bg-dark-bg group rounded-md items-center w-full px-3 py-1.5 text-sm transition-all", + "text-gray-900 dark:text-gray-200 block hover:bg-gray-200 dark:hover:bg-dark-bg focus:bg-gray-200 dark:focus:bg-dark-bg rounded-md items-center w-full px-3 py-1.5 text-sm transition-all", rest.className, )} > diff --git a/packages/client/src/components/leo/ActiveCalls.tsx b/packages/client/src/components/leo/ActiveCalls.tsx index e7da8157e..e16899d85 100644 --- a/packages/client/src/components/leo/ActiveCalls.tsx +++ b/packages/client/src/components/leo/ActiveCalls.tsx @@ -46,7 +46,7 @@ export function ActiveCalls() { ? activeDeputy : null; - const isUnitAssigned = (call: Full911Call) => + const isUnitAssignedToCall = (call: Full911Call) => call.assignedUnits.some((v) => v.unit.id === unit?.id); const makeUnit = (unit: AssignedUnit) => @@ -113,7 +113,7 @@ export function ActiveCalls() { {calls.length <= 0 ? (

{t("no911Calls")}

) : ( -
+
@@ -129,52 +129,67 @@ export function ActiveCalls() { {calls .sort((a, b) => compareDesc(new Date(a.updatedAt), new Date(b.updatedAt))) - .map((call) => ( - - - - - - - - + + + + + + + - - ))} + {isUnitAssigned ? null : ( + + )} + + )} + + + + + ); + })}
{call.name}{call.location} - {call.description} - {format(new Date(call.updatedAt), "HH:mm:ss - yyyy-MM-dd")}{call.postal || common("none")}{call.assignedUnits.map(makeUnit).join(", ") || common("none")} - {isDispatch ? ( - <> - - - ) : ( - <> - - {isUnitAssigned(call) ? null : ( + .map((call) => { + const isUnitAssigned = isUnitAssignedToCall(call); + + return ( +
{call.name}{call.location} + {call.description} + {format(new Date(call.updatedAt), "HH:mm:ss - yyyy-MM-dd")}{call.postal || common("none")}{call.assignedUnits.map(makeUnit).join(", ") || common("none")} + {isDispatch ? ( + <> + + + ) : ( + <> - )} - - )} - - -