compress images

This commit is contained in:
2024-06-26 16:13:19 +05:00
parent 1a008c9a5d
commit 16190699b5
468 changed files with 347 additions and 431 deletions
@@ -25,7 +25,7 @@ const EastWingHighlighting = ({
viewBox="0 0 672 280"
>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -77,7 +77,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -103,7 +103,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -129,7 +129,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -155,7 +155,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Left"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -181,7 +181,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Left"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -207,7 +207,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -233,7 +233,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -259,7 +259,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -285,7 +285,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -311,7 +311,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -337,7 +337,7 @@ const EastWingHighlighting = ({
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Left"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -357,7 +357,7 @@ const EastWingHighlighting = ({
></path>
</svg>
<svg
data-type="2 BR Squared"
data-type="2 BR Squared-A Right"
className="opacity-0 hover:opacity-100 ease-in-out duration-300 transition-opacity cursor-pointer"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
@@ -11,6 +11,7 @@ import { IAparmentRes } from "../../../types/apartmentsRes";
import WestWingTopLevelsLayout from "./WestWingTopLevelsLayout";
import WestWingTopLevelsHighlighting from "./WestWingTopLevelsHighlighting";
import { apartmentsWithoutVirtualTour } from "../../../consts/apartmentsWithoutVirtualTour";
import { filterCurrentApartment } from "../../../calc/filterCurrentApartment";
interface IFloorSidebarProps {
currentFloor: IDesctiptionFloor | null;
@@ -28,9 +29,10 @@ const FloorSidebar = ({
const [hoveredApartment, setHoveredApartment] = useState<IAparmentRes | null>(
null
);
const [defaultApartments, setDefaultApartments] = useState<IAparmentRes[]>(
[]
);
const [hoveredApartmentType, setHoveredApartmentType] = useState<
string | null
>(null);
const [apartments, setApartments] = useState<IAparmentRes[]>([]);
const [is3DTourAvailable] = useState(true);
const { setModal } = useModal();
const descRef = useRef(null);
@@ -46,11 +48,18 @@ const FloorSidebar = ({
event: React.MouseEvent<SVGSVGElement, MouseEvent>
) {
const apartmentType = event.currentTarget.dataset.type;
const apartment = defaultApartments.find(
(aprt) => aprt.Unit_Type === apartmentType
);
if (!apartmentType) return;
setHoveredApartmentType(apartmentType);
if (!hoveredApartmentType) return;
const apartment = filterCurrentApartment(apartments, hoveredApartmentType);
if (apartment) {
setModal(<AboutComplexModal apartment={apartment} />);
setModal(
<AboutComplexModal
apartment={apartment}
apartmentType={hoveredApartmentType}
/>
);
setIsDescVisible(false);
}
}
@@ -63,9 +72,14 @@ const FloorSidebar = ({
event: React.MouseEvent<SVGSVGElement, MouseEvent>
): void {
const apartmentType = event.currentTarget.dataset.type;
const _hoveredApartment = defaultApartments.find(
(apart) => apart.Unit_Type === apartmentType
if (!apartmentType) return;
const unitType = apartmentType.split("-")[0];
setHoveredApartmentType(apartmentType);
const _hoveredApartment = apartments.find(
(apart) => apart.Unit_Type === unitType
);
if (_hoveredApartment) {
setHoveredApartment(_hoveredApartment);
} else {
@@ -84,9 +98,11 @@ const FloorSidebar = ({
useEffect(() => {
if (!currentFloor) return;
const _defaultApartment: IAparmentRes[] = apartmentsWithoutVirtualTour.map(
const defaultApartment: IAparmentRes[] = apartmentsWithoutVirtualTour.map(
(aprt, index) => {
const unitNo = `${currentFloor?.wing.slice(1)}-${index}`;
const unitNo = `${currentFloor?.wing.slice(0, 1)}-${
currentFloor.floor
}0${index}`;
return {
id: unitNo,
Floor: currentFloor.floor,
@@ -105,9 +121,7 @@ const FloorSidebar = ({
}
);
setDefaultApartments([..._defaultApartment, ...floorApartments]);
return () => {};
setApartments([...defaultApartment, ...floorApartments]);
}, [currentFloor, currentFloor?.floor, currentFloor?.wing, floorApartments]);
return (
@@ -18,7 +18,7 @@ function WestWingHighlighting({
return (
<>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-A Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -47,7 +47,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-A Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -104,7 +104,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -129,7 +129,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -179,7 +179,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -204,7 +204,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="2 BR Squared"
data-type="2 BR Squared-A Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -236,7 +236,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="2 BR Squared"
data-type="2 BR Squared-B"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -266,7 +266,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -291,7 +291,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -316,7 +316,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Flex"
data-type="Studio Flex-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -342,7 +342,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Flex"
data-type="Studio Flex-Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -368,7 +368,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Flex"
data-type="Studio Flex-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -394,7 +394,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Flex"
data-type="Studio Flex-Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -420,7 +420,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Flex"
data-type="Studio Flex-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -446,7 +446,7 @@ function WestWingHighlighting({
/>
</svg>
<svg
data-type="Studio Flex"
data-type="Studio Flex-Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -18,7 +18,7 @@ function WestWingTopLevelsHighlighting({
return (
<>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-A Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -45,7 +45,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-A Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -122,7 +122,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -147,7 +147,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -172,7 +172,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -197,7 +197,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -272,7 +272,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="2 BR Squared"
data-type="2 BR Squared-A Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -304,7 +304,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -329,7 +329,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="1 BR Squared"
data-type="1 BR Squared-C Right"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -354,7 +354,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="2 BR Squared"
data-type="2 BR Squared-B"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -384,7 +384,7 @@ function WestWingTopLevelsHighlighting({
/>
</svg>
<svg
data-type="Studio Squared"
data-type="Studio Squared-Left"
onMouseOut={handleOnMouseOut}
onMouseOver={handleOnMouseOver}
onClick={handleOnApartmentClick}
@@ -162,52 +162,59 @@ const SequenceWing = () => {
}, [isSidebar]);
useEffect(() => {
const zohoToken = localStorage.getItem("ACCESS_TOKEN");
const localStorageToken = `${localStorage.getItem("ACCESS_TOKEN")}`;
const perPage = 1000;
const getApartments = (token: string) =>
getFilteredApartments(
token,
setApartments,
initialRoveHomeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
perPage
);
setIsLoading(true);
getFilteredApartments(
zohoToken,
setApartments,
initialRoveHomeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
1000
)
getApartments(localStorageToken)
.then((res) => {
console.log("first2", res);
setIsLoading(false);
})
.catch((error) => {
const errorStatus = error.response.status;
if (errorStatus === 401) {
updateAccessToken().then((token) => {
if (token) {
getFilteredApartments(
token,
setApartments,
initialRoveHomeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
1000
);
}
});
updateAccessToken()
.then((token) => {
if (token) {
getApartments(token).then(() => {
setIsLoading(false);
});
}
})
.catch((error) => {
setIsLoading(false);
console.log("first2");
console.error("error", error);
});
} else {
setIsLoading(false);
console.log("first");
console.error("error", error);
}
})
.finally(() => {
setIsLoading(false);
});
}, [
setApartments,
apartmentTypeCheckboxes,
debouncedSliders,
sortList,
switchers,
viewCheckboxes,
sortList,
]);
useEffect(() => {