From 74f6c8ff33852170f4f5f68c684a5df2897fde1f Mon Sep 17 00:00:00 2001 From: bender Date: Mon, 23 Mar 2026 22:00:01 +0000 Subject: [PATCH] Add src/app/quote-calculator/page.tsx --- src/app/quote-calculator/page.tsx | 227 ++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 src/app/quote-calculator/page.tsx diff --git a/src/app/quote-calculator/page.tsx b/src/app/quote-calculator/page.tsx new file mode 100644 index 0000000..fc23191 --- /dev/null +++ b/src/app/quote-calculator/page.tsx @@ -0,0 +1,227 @@ +"use client"; + +import React, { useState, useCallback, useEffect } from "react"; +import ReactLenis from "lenis/react"; +import NavbarLayoutFloatingInline from "@/components/navbar/NavbarLayoutFloatingInline"; +import FooterCard from "@/components/sections/footer/FooterCard"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import { Instagram, Facebook, Linkedin } from "lucide-react"; + +export default function QuoteCalculatorPage() { + const [departurePort, setDeparturePort] = useState(""); + const [arrivalPort, setArrivalPort] = useState(""); + const [cargoType, setCargoType] = useState(""); + const [weight, setWeight] = useState(0); + const [volume, setVolume] = useState(0); + const [isCharter, setIsCharter] = useState(false); + const [estimatedCost, setEstimatedCost] = useState(0); + + const calculateCost = useCallback(() => { + let baseCost = 1000; // Base cost + let factor = 1; + + if (departurePort && arrivalPort) { + // Simple logic for demonstration + if (departurePort !== arrivalPort) { + factor *= 1.5; + } + if (departurePort === "Shanghai" && arrivalPort === "New York") factor *= 2.5; + if (departurePort === "Rotterdam" && arrivalPort === "Dubai") factor *= 2.0; + } + + if (cargoType === "Perishable") factor *= 1.8; + if (cargoType === "Hazardous") factor *= 2.5; + + factor += (weight / 1000) * 0.5; // Weight in tons + factor += (volume / 10) * 0.3; // Volume in CBM + + if (isCharter) { + factor *= 3; // Charter is more expensive + } + + setEstimatedCost(baseCost * factor); + }, [departurePort, arrivalPort, cargoType, weight, volume, isCharter]); + + useEffect(() => { + calculateCost(); + }, [calculateCost]); + + const handleRequestDetailedOffer = () => { + alert("Your detailed offer request has been submitted! We will contact you soon."); + // In a real app, this would submit data to a backend or redirect to a contact form with pre-filled details. + }; + + const navbarNavItems = [ + { name: "About", id: "about" }, + { name: "Services", id: "services" }, + { name: "Destinations", id: "destinations" }, + { name: "Reviews", id: "reviews" }, + { name: "Get Quote", id: "/quote-calculator" }, // New link + { name: "Contact", id: "contact" }, + ]; + + return ( + + + + +
+
+

+ Intelligent Quote Calculator +

+

+ Get an instant estimation for your cargo shipment. +

+ +
+ {/* Input Fields */} +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + setWeight(parseFloat(e.target.value))} + min="0" + /> +
+
+ + setVolume(parseFloat(e.target.value))} + min="0" + /> +
+
+ +
+ setIsCharter(e.target.checked)} + /> + +
+ + {/* Instant Cost Estimation */} +
+

+ Estimated Cost: +

+

+ ${estimatedCost.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} +

+
+ + {/* Request Detailed Offer Button */} +
+ +
+
+
+
+ + +
+
+ ); +} \ No newline at end of file