diff --git a/package.json b/package.json index 996a7d3..43137f1 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,6 @@ "tw-animate-css": "^1.4.0", "typescript": "5.6.3", "vite": "^7.1.7", - "vite-plugin-manus-runtime": "^0.0.57", "vitest": "^2.1.4" }, "packageManager": "pnpm@10.4.1" diff --git a/src/components/ManusDialog.tsx b/src/components/ManusDialog.tsx deleted file mode 100644 index 0aeff4b..0000000 --- a/src/components/ManusDialog.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { useEffect, useState } from "react"; - -import { Button } from "@/components/ui/button"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogTitle, -} from "@/components/ui/dialog"; - -interface ManusDialogProps { - title?: string; - logo?: string; - open?: boolean; - onLogin: () => void; - onOpenChange?: (open: boolean) => void; - onClose?: () => void; -} - -export function ManusDialog({ - title, - logo, - open = false, - onLogin, - onOpenChange, - onClose, -}: ManusDialogProps) { - const [internalOpen, setInternalOpen] = useState(open); - - useEffect(() => { - if (!onOpenChange) { - setInternalOpen(open); - } - }, [open, onOpenChange]); - - const handleOpenChange = (nextOpen: boolean) => { - if (onOpenChange) { - onOpenChange(nextOpen); - } else { - setInternalOpen(nextOpen); - } - - if (!nextOpen) { - onClose?.(); - } - }; - - return ( - - - - {logo ? ( - - - - ) : null} - - {/* Title and subtitle */} - {title ? ( - - {title} - - ) : null} - - Please login with Manus to continue - - - - - {/* Login button */} - - Login with Manus - - - - - ); -} diff --git a/src/components/Map.tsx b/src/components/Map.tsx deleted file mode 100644 index 4849e05..0000000 --- a/src/components/Map.tsx +++ /dev/null @@ -1,155 +0,0 @@ -/** - * GOOGLE MAPS FRONTEND INTEGRATION - ESSENTIAL GUIDE - * - * USAGE FROM PARENT COMPONENT: - * ====== - * - * const mapRef = useRef(null); - * - * { - * mapRef.current = map; // Store to control map from parent anytime, google map itself is in charge of the re-rendering, not react state. - * - * - * ====== - * Available Libraries and Core Features: - * ------------------------------- - * 📍 MARKER (from `marker` library) - * - Attaches to map using { map, position } - * new google.maps.marker.AdvancedMarkerElement({ - * map, - * position: { lat: 37.7749, lng: -122.4194 }, - * title: "San Francisco", - * }); - * - * ------------------------------- - * 🏢 PLACES (from `places` library) - * - Does not attach directly to map; use data with your map manually. - * const place = new google.maps.places.Place({ id: PLACE_ID }); - * await place.fetchFields({ fields: ["displayName", "location"] }); - * map.setCenter(place.location); - * new google.maps.marker.AdvancedMarkerElement({ map, position: place.location }); - * - * ------------------------------- - * 🧭 GEOCODER (from `geocoding` library) - * - Standalone service; manually apply results to map. - * const geocoder = new google.maps.Geocoder(); - * geocoder.geocode({ address: "New York" }, (results, status) => { - * if (status === "OK" && results[0]) { - * map.setCenter(results[0].geometry.location); - * new google.maps.marker.AdvancedMarkerElement({ - * map, - * position: results[0].geometry.location, - * }); - * } - * }); - * - * ------------------------------- - * 📐 GEOMETRY (from `geometry` library) - * - Pure utility functions; not attached to map. - * const dist = google.maps.geometry.spherical.computeDistanceBetween(p1, p2); - * - * ------------------------------- - * 🛣️ ROUTES (from `routes` library) - * - Combines DirectionsService (standalone) + DirectionsRenderer (map-attached) - * const directionsService = new google.maps.DirectionsService(); - * const directionsRenderer = new google.maps.DirectionsRenderer({ map }); - * directionsService.route( - * { origin, destination, travelMode: "DRIVING" }, - * (res, status) => status === "OK" && directionsRenderer.setDirections(res) - * ); - * - * ------------------------------- - * 🌦️ MAP LAYERS (attach directly to map) - * - new google.maps.TrafficLayer().setMap(map); - * - new google.maps.TransitLayer().setMap(map); - * - new google.maps.BicyclingLayer().setMap(map); - * - * ------------------------------- - * ✅ SUMMARY - * - “map-attached” → AdvancedMarkerElement, DirectionsRenderer, Layers. - * - “standalone” → Geocoder, DirectionsService, DistanceMatrixService, ElevationService. - * - “data-only” → Place, Geometry utilities. - */ - -/// - -import { useEffect, useRef } from "react"; -import { usePersistFn } from "@/hooks/usePersistFn"; -import { cn } from "@/lib/utils"; - -declare global { - interface Window { - google?: typeof google; - } -} - -const API_KEY = import.meta.env.VITE_FRONTEND_FORGE_API_KEY; -const FORGE_BASE_URL = - import.meta.env.VITE_FRONTEND_FORGE_API_URL || - "https://forge.butterfly-effect.dev"; -const MAPS_PROXY_URL = `${FORGE_BASE_URL}/v1/maps/proxy`; - -function loadMapScript() { - return new Promise(resolve => { - const script = document.createElement("script"); - script.src = `${MAPS_PROXY_URL}/maps/api/js?key=${API_KEY}&v=weekly&libraries=marker,places,geocoding,geometry`; - script.async = true; - script.crossOrigin = "anonymous"; - script.onload = () => { - resolve(null); - script.remove(); // Clean up immediately - }; - script.onerror = () => { - console.error("Failed to load Google Maps script"); - }; - document.head.appendChild(script); - }); -} - -interface MapViewProps { - className?: string; - initialCenter?: google.maps.LatLngLiteral; - initialZoom?: number; - onMapReady?: (map: google.maps.Map) => void; -} - -export function MapView({ - className, - initialCenter = { lat: 37.7749, lng: -122.4194 }, - initialZoom = 12, - onMapReady, -}: MapViewProps) { - const mapContainer = useRef(null); - const map = useRef(null); - - const init = usePersistFn(async () => { - await loadMapScript(); - if (!mapContainer.current) { - console.error("Map container not found"); - return; - } - map.current = new window.google.maps.Map(mapContainer.current, { - zoom: initialZoom, - center: initialCenter, - mapTypeControl: true, - fullscreenControl: true, - zoomControl: true, - streetViewControl: true, - mapId: "DEMO_MAP_ID", - }); - if (onMapReady) { - onMapReady(map.current); - } - }); - - useEffect(() => { - init(); - }, [init]); - - return ( - - ); -} diff --git a/src/pages/NotFound.tsx b/src/pages/NotFound.tsx index 79a450d..b85536a 100644 --- a/src/pages/NotFound.tsx +++ b/src/pages/NotFound.tsx @@ -6,38 +6,33 @@ import { useLocation } from "wouter"; export default function NotFound() { const [, setLocation] = useLocation(); - const handleGoHome = () => { - setLocation("/"); - }; + const handleGoHome = () => setLocation("/"); return ( - - + + - - + + - 404 + 404 - + Page Not Found - + Sorry, the page you are looking for doesn't exist. It may have been moved or deleted. - + Go Home @@ -46,4 +41,4 @@ export default function NotFound() { ); -} +} \ No newline at end of file
+
Sorry, the page you are looking for doesn't exist. It may have been moved or deleted.