From f8b53b77edbaa62da226118e1518196a5af3e53f Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Thu, 9 Nov 2023 20:08:05 +0530 Subject: [PATCH] quick patch: hide not working sort filter --- src/Components/Facility/LiveFeedScreen.tsx | 67 ---------------------- 1 file changed, 67 deletions(-) diff --git a/src/Components/Facility/LiveFeedScreen.tsx b/src/Components/Facility/LiveFeedScreen.tsx index b9a2eabdc03..a47d4a0c955 100644 --- a/src/Components/Facility/LiveFeedScreen.tsx +++ b/src/Components/Facility/LiveFeedScreen.tsx @@ -14,9 +14,6 @@ import { AssetData } from "../Assets/AssetTypes"; import { Popover, Transition } from "@headlessui/react"; import { FieldLabel } from "../Form/FormFields/FormField"; import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField"; -import { useTranslation } from "react-i18next"; -import { SortOption } from "../Common/SortDropdown"; -import { SelectFormField } from "../Form/FormFields/SelectFormField"; import LiveFeedTile from "./LiveFeedTile"; import { getCameraConfig } from "../../Utils/transformUtils"; import { getPermittedFacility, listAssets } from "../../Redux/actions"; @@ -24,45 +21,11 @@ import { useDispatch } from "react-redux"; const PER_PAGE_LIMIT = 6; -const SORT_OPTIONS: SortOption[] = [ - { isAscending: true, value: "bed__name" }, - { isAscending: false, value: "-bed__name" }, - { isAscending: false, value: "-created_date" }, - { isAscending: true, value: "created_date" }, -]; - interface Props { facilityId: string; } -const getOrderingList = async ( - facilityId: string, - setOrdering: (order: string) => void -) => { - const orderData = localStorage.getItem("live-feed-order"); - if (orderData) { - const order = JSON.parse(orderData); - const orderValue = order.find((item: any) => item.facility === facilityId); - setOrdering(orderValue.order); - } -}; - -const setOrderingList = async (facilityId: string, order: string) => { - const orderData = localStorage.getItem("live-feed-order") || "[]"; - const orderList = JSON.parse(orderData); - const index = orderList.findIndex( - (item: any) => item.facility === facilityId - ); - if (index !== -1) { - orderList[index].order = order; - } else { - orderList.push({ facility: facilityId, order }); - } - localStorage.setItem("live-feed-order", JSON.stringify(orderList)); -}; - export default function LiveFeedScreen({ facilityId }: Props) { - const { t } = useTranslation(); const dispatch = useDispatch(); const [isFullscreen, setFullscreen] = useFullscreen(); const sidebar = useContext(SidebarShrinkContext); @@ -73,7 +36,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { const { qParams, updateQuery, removeFilter, updatePage } = useFilters({ limit: PER_PAGE_LIMIT, }); - const [ordering, setOrdering] = useState("bed__name"); const [refresh_presets_hash, setRefreshPresetsHash] = useState( Number(new Date()) @@ -88,10 +50,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { }; }, []); - useEffect(() => { - getOrderingList(facilityId, setOrdering); - }, [facilityId]); - useEffect(() => { async function fetchFacilityOrObject() { if (facility) return facility; @@ -112,7 +70,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { asset_class: "ONVIF", facility: facilityId || "", location: qParams.location, - ordering: qParams.ordering || ordering, bed_is_occupied: qParams.bed_is_occupied, }; @@ -204,30 +161,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { )} - { - updateQuery({ ordering: value }); - setOrderingList(facilityId, value); - }} - options={SORT_OPTIONS} - optionLabel={({ value }) => t("SortOptions." + value)} - optionIcon={({ isAscending }) => ( - - )} - optionValue={({ value }) => value} - labelClassName="text-sm" - errorClassName="hidden" - />