This commit is contained in:
2025-02-07 15:44:35 +05:00
parent 6c4cebd783
commit 0f3d415036
4 changed files with 39 additions and 39 deletions
+1 -1
View File
@@ -1 +1 @@
VITE_SERVER_API=http://192.168.1.120:4002
VITE_SERVER_API=http://192.168.1.175:4002
+1 -1
View File
@@ -1 +1 @@
VITE_SERVER_API=http://194.26.138.94:4002/
VITE_SERVER_API=https://3d.irth.ae/api
@@ -8,12 +8,12 @@ import ChevronDownIcon from "../icons/ChevronDownIcon";
import { useEffect, useState } from "react";
import useFavoritesStore from "../../store/useFavoritesStore";
import HeartFilledIcon from "../icons/HeartFilledIcon";
import apartaments from "../../data/apartments.json";
// import apartaments from "../../data/apartments.json";
import useSphere from "../../store/useSphere";
import { ISphere } from "../../types/apartmentSphere";
// import { ISphere } from "../../types/apartmentSphere";
import useModal from "../../store/useModal";
import UnitModalForSearchPage from "../modals/UnitModalForSearchPage";
import { isMobile } from "react-device-detect";
// import { isMobile } from "react-device-detect";
import Button3 from "../Button3";
interface Props {
@@ -25,7 +25,7 @@ function VirtualTourCard({ unit, type }: Props) {
const navigate = useNavigate();
const [isShow, setIsShow] = useState<boolean>(false);
const { favoriteUnits, setFavoriteUnits } = useFavoritesStore();
const { selectedSphere, setSelectedSphere } = useSphere();
const { selectedSphere } = useSphere();
const { modal, setModal } = useModal();
function getMainImage(): string {
@@ -157,15 +157,15 @@ function VirtualTourCard({ unit, type }: Props) {
}
}
function handleClickRoomType(roomType: string) {
const foundSphere = apartaments
.find((apartament) => apartament.id === type)
?.spheres.find((sphere) => sphere.roomType === roomType);
// function handleClickRoomType(roomType: string) {
// const foundSphere = apartaments
// .find((apartament) => apartament.id === type)
// ?.spheres.find((sphere) => sphere.roomType === roomType);
if (!foundSphere) return;
// if (!foundSphere) return;
setSelectedSphere(foundSphere as ISphere);
}
// setSelectedSphere(foundSphere as ISphere);
// }
useEffect(() => {
console.log("selectedSphere", selectedSphere);
@@ -260,7 +260,7 @@ function VirtualTourCard({ unit, type }: Props) {
</div>
<div className="flex items-start justify-between max-sm:hidden">
<div className="flex flex-wrap gap-1 pt-2 pr-2">
{!isMobile &&
{/* {!isMobile &&
apartaments
.find((apartament) => apartament.id === type)
?.spheres.map((sphere) => sphere.roomType)
@@ -274,7 +274,7 @@ function VirtualTourCard({ unit, type }: Props) {
>
{value}
</button>
))}
))} */}
</div>
<button
className="max-sm:hidden bg-[#FFFFFFCC] rounded-b-lg flex items-center justify-between gap-2 px-4 py-3 pl-6 min-w-[112px] outline-none hover:bg-white hover:text-[#0D1922] transition-colors"
+24 -24
View File
@@ -1,10 +1,10 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { useEffect, useState } from "react";
import { Canvas } from "@react-three/fiber";
// import { Canvas } from "@react-three/fiber";
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
import VirtualTourWrapper from "../components/virtualTour/VirtualTourWrapper";
// import VirtualTourWrapper from "../components/virtualTour/VirtualTourWrapper";
import { IAppartmentComplex } from "../types/apartmentSphere";
import ButtomPanelCompassVirtualTour from "../components/virtualTour/ButtomPanelCompassVirualTour";
// import ButtomPanelCompassVirtualTour from "../components/virtualTour/ButtomPanelCompassVirualTour";
import _apartment from "../data/apartments.json";
import useModal from "../store/useModal";
import LoaderModal from "../components/modals/LoaderModal";
@@ -17,19 +17,18 @@ import Button3 from "../components/Button3";
const apartments = _apartment as IAppartmentComplex[];
const tours = [
{ type: "studio-flex", name: "STD-FLEX-13_sp-1" },
{ type: "studio-2", name: "Studio2_31_sp-010000" },
{ type: "1br-type-c", name: "BDR-1-C_10000" },
{ type: "2br-type-b", name: "BDR-2-B_21_010000" },
{ type: "studio-flex", name: "STD_Flex" },
{ type: "studio-2", name: "STD2" },
{ type: "1br-type-c", name: "BDR1" },
{ type: "2br-type-b", name: "BDR2" },
];
const VirtualTour = () => {
const [isLoading, setIsLoading] = useState(isMobile ? false : true);
const [currentApartment, setCurrentApartment] =
useState<IAppartmentComplex | null>(null);
const [, setCurrentApartment] = useState<IAppartmentComplex | null>(null);
const { unitType } = useParams();
const { setModal } = useModal();
const [isLoadedAllSpheres, setIsLoadedAllSpheres] = useState(false);
const [isLoadedAllSpheres] = useState(true);
const navigate = useNavigate();
const [searchParams] = useSearchParams();
const [unit, setUnit] = useState<IUnit>();
@@ -38,9 +37,7 @@ const VirtualTour = () => {
console.log('searchParams.get("unitNo")', searchParams.get("unitNo"));
try {
const result: IUnit[] = await api
.get(`units?unitNo=${searchParams.get("unitNo")}`)
.json();
const result: IUnit[] = await api.get(`units?unitNo=${searchParams.get("unitNo")}`).json();
setUnit(result[0]);
} catch (error) {
@@ -49,9 +46,7 @@ const VirtualTour = () => {
}
useEffect(() => {
const foundApartment = apartments.find(
(apartment) => apartment.id === unitType
);
const foundApartment = apartments.find((apartment) => apartment.id === unitType);
if (foundApartment) {
setCurrentApartment(foundApartment);
@@ -98,11 +93,7 @@ const VirtualTour = () => {
<VirtualTourCard unit={unit} type={unitType} />
) : (
<div className="absolute top-[calc(58px+1rem)] left-4 z-[99999993]">
<Button3
icon={<ArrowLeftIcon />}
onlyIcon
onClick={() => navigate(-1)}
/>
<Button3 icon={<ArrowLeftIcon />} onlyIcon onClick={() => navigate(-1)} />
</div>
)}
{/* <VirtualTourTopPanel /> */}
@@ -110,7 +101,7 @@ const VirtualTour = () => {
appartmentSphere={currentAppartmentSphere}
apartment={currentApartment}
/> */}
{!isMobile ? (
{/* {isMobile ? (
<Canvas camera={{ fov: 90 }}>
{currentApartment && (
<VirtualTourWrapper
@@ -128,10 +119,19 @@ const VirtualTour = () => {
className="absolute h-[calc(100vh-54px)] w-screen top-[54px] left-0"
// allow="fullscreen; accelerometer; gyroscope; magnetometer; vr; xr; xr-spatial-tracking; autoplay; camera; microphone"
></iframe>
)}
)} */}
<iframe
src={`/tours/${tours.find((tour) => tour.type === unitType)?.name}/index.html?${
unit ? "hct=Down&sct=Up" : "hct=Up&sct=Down"
}`}
allowFullScreen
className="absolute h-[calc(100dvh-54px)] w-screen top-[54px] left-0"
// allow="fullscreen; accelerometer; gyroscope; magnetometer; vr; xr; xr-spatial-tracking; autoplay; camera; microphone"
></iframe>
{/* <VirtualTourLoader /> */}
{!isMobile && <ButtomPanelCompassVirtualTour />}
{/* {!isMobile && <ButtomPanelCompassVirtualTour />} */}
</div>
);
};