Skip to content

Commit

Permalink
untracked ConsultationFeedTab.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahendar0701 committed Oct 28, 2024
1 parent c944522 commit e060ef2
Showing 1 changed file with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { ConsultationTabProps } from "./index";
import useQuery from "../../../Utils/request/useQuery";
import CameraFeed from "../../CameraFeed/CameraFeed";
Expand All @@ -23,7 +23,6 @@ import {
GetStatusResponse,
} from "../../CameraFeed/routes";
import StillWatching from "../../CameraFeed/StillWatching";
import routes from "@/Redux/api";

export const ConsultationFeedTab = (props: ConsultationTabProps) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -51,23 +50,7 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => {
}
}, []);

const bedObjectId = props.consultationData.current_bed?.bed_object?.id || "";
const bedsQuery = useQuery(routes.listAssetBeds, {
query: {
bed_object: bedObjectId,
limit: 50,
},
});

const bedLocationId = bed?.location_object?.id;

const matchingAsset = useMemo(() => {
return bedsQuery.data?.results.find(
(bedItem) => bedItem.asset_object?.location_object?.id === bedLocationId,
)?.asset_object;
}, [bedsQuery.data, bedLocationId]);

const asset = preset?.asset_bed?.asset_object ?? matchingAsset;
const asset = preset?.asset_bed.asset_object;

const { key, operate } = useOperateCamera(asset?.id ?? "");

Expand Down Expand Up @@ -166,10 +149,6 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => {
return <Loading />;
}

if (bedsQuery.loading) {
return <div>Loading bed/asset...</div>;
}

if (!bed || !asset) {
return <span>No bed/asset linked allocated</span>;
}
Expand Down

0 comments on commit e060ef2

Please sign in to comment.