Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove asset detail popup in asset configure's camera feed #8855

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Components/Assets/AssetConfigure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ const AssetConfigure = ({ assetId, facilityId }: AssetConfigureProps) => {
}}
backUrl={`/facility/${facilityId}/assets/${assetId}`}
>
<ConfigureCamera asset={asset} onUpdated={() => refetch()} />
<ConfigureCamera
asset={asset}
onUpdated={() => refetch()}
hideMonitorAsset={true}
/>
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
</Page>
);
};
Expand Down
25 changes: 16 additions & 9 deletions src/Components/CameraFeed/CameraFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ interface Props {
shortcutsDisabled?: boolean;
onMove?: () => void;
operate: ReturnType<typeof useOperateCamera>["operate"];
//Monitor Hide or Show
hideMonitorAsset?: boolean;
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
}

export default function CameraFeed(props: Props) {
Expand Down Expand Up @@ -145,6 +147,8 @@ export default function CameraFeed(props: Props) {
/>
);

const hideMonitorAsset = props.hideMonitorAsset || false;
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved

return (
<div ref={playerWrapperRef} className="flex h-full flex-col justify-center">
<div
Expand Down Expand Up @@ -183,15 +187,18 @@ export default function CameraFeed(props: Props) {
{props.children}
</div>
<div className="flex w-full flex-col items-end justify-end md:flex-row md:items-center md:gap-4">
<div className="flex items-center gap-2">
<span className="text-xs font-bold md:text-sm">
{props.asset.name}
</span>
<MonitorAssetPopover
asset={props.asset}
className="absolute z-[100] mt-2 w-56 -translate-x-full -translate-y-4 rounded-md bg-white md:w-[350px] md:-translate-x-full md:-translate-y-2"
/>
</div>
{!hideMonitorAsset && (
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
<div className="flex items-center gap-2">
<span className="text-xs font-bold md:text-sm">
{props.asset.name}
</span>
<MonitorAssetPopover
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
asset={props.asset}
className="absolute z-[100] mt-2 w-56 -translate-x-full -translate-y-4 rounded-md bg-white md:w-[350px] md:-translate-x-full md:-translate-y-2"
/>
</div>
)}

{!isIOS && (
<div
className={classNames(
Expand Down
11 changes: 10 additions & 1 deletion src/Components/CameraFeed/ConfigureCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField";
interface Props {
asset: AssetData;
onUpdated: () => void;
//show or hide camera pop-up
hideMonitorAsset?: boolean;
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
}

type OnvifPreset = { name: string; value: number };
Expand All @@ -58,6 +60,7 @@ export default function ConfigureCamera(props: Props) {
}>();
const [presetName, setPresetName] = useState("");
const [showUnlinkConfirmation, setShowUnlinkConfirmation] = useState(false);
const hideMonitorAsset = props.hideMonitorAsset || false;
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved

const assetBedsQuery = useQuery(routes.listAssetBeds, {
query: { asset: props.asset.id, limit: 50 },
Expand Down Expand Up @@ -106,7 +109,12 @@ export default function ConfigureCamera(props: Props) {
if (!["DistrictAdmin", "StateAdmin"].includes(authUser.user_type)) {
return (
<div className="w-full overflow-hidden rounded-lg bg-white shadow">
<CameraFeed asset={props.asset} key={key} operate={operate} />
<CameraFeed
asset={props.asset}
key={key}
operate={operate}
hideMonitorAsset={hideMonitorAsset}
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
);
}
Expand Down Expand Up @@ -246,6 +254,7 @@ export default function ConfigureCamera(props: Props) {
);
}
}}
hideMonitorAsset={hideMonitorAsset}
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
>
<div className="flex items-center gap-2">
<Listbox
Expand Down
Loading