Skip to content

Self-improving AI Employees for everyone

Fix Google Maps nodes theme consistency and output panel detection

trohitg3783ac0303df
diff --git a/client/src/components/LocationParameterPanel.tsx b/client/src/components/LocationParameterPanel.tsx
index 3e8eb8d2..db20bd51 100644
--- a/client/src/components/LocationParameterPanel.tsx
+++ b/client/src/components/LocationParameterPanel.tsx
@@ -3,8 +3,10 @@ import Modal from './ui/Modal';
import LocationPanelLayout from './parameterPanel/LocationPanelLayout';
import { useParameterPanel } from '../hooks/useParameterPanel';
import { ExecutionService } from '../services/executionService';
+import { useAppTheme } from '../hooks/useAppTheme';
const LocationParameterPanel: React.FC = () => {
+ const theme = useAppTheme();
const {
selectedNode,
nodeDefinition,
@@ -55,11 +57,28 @@ const LocationParameterPanel: React.FC = () => {
return null;
}
+ // Action button style helper - matches main ParameterPanel
+ const actionButtonStyle = (color: string, isDisabled = false): React.CSSProperties => ({
+ height: '32px',
+ padding: '0 14px',
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ backgroundColor: isDisabled ? `${theme.colors.primary}15` : `${color}25`,
+ color: isDisabled ? theme.colors.primary : color,
+ border: `1px solid ${isDisabled ? `${theme.colors.primary}40` : `${color}60`}`,
+ borderRadius: theme.borderRadius.sm,
+ fontSize: '13px',
+ fontWeight: 600,
+ cursor: isDisabled ? 'not-allowed' : 'pointer',
+ transition: `all ${theme.transitions.fast}`,
+ });
+
// Header actions with node name and buttons in middle area
const headerActions = (
<div style={{
display: 'flex',
- gap: '12px',
+ gap: '16px',
alignItems: 'center'
}}>
{/* Node Name */}
@@ -67,14 +86,13 @@ const LocationParameterPanel: React.FC = () => {
display: 'flex',
alignItems: 'center',
gap: '8px',
- fontSize: '16px',
- fontWeight: '600',
- color: '#1f2937',
- fontFamily: 'system-ui, sans-serif'
+ fontSize: '15px',
+ fontWeight: 600,
+ color: theme.colors.text
}}>
<span>{nodeDefinition.icon}</span>
<span>{nodeDefinition.displayName}</span>
- {hasUnsavedChanges && <span style={{ color: '#f59e0b' }}>*</span>}
+ {hasUnsavedChanges && <span style={{ color: theme.accent.orange }}>*</span>}
</div>
{/* Buttons: Run, Save, Cancel */}
@@ -82,21 +100,7 @@ const LocationParameterPanel: React.FC = () => {
{/* Run Button */}
{canExecute && (
<button
- style={{
- padding: '8px 16px',
- backgroundColor: '#ff6d5a',
- color: 'white',
- border: 'none',
- borderRadius: '4px',
- fontSize: '14px',
- fontWeight: '500',
- cursor: isExecuting ? 'not-allowed' : 'pointer',
- opacity: isExecuting ? 0.7 : 1,
- display: 'flex',
- alignItems: 'center',
- gap: '6px',
- fontFamily: 'system-ui, sans-serif'
- }}
+ style={actionButtonStyle(theme.dracula.green, isExecuting)}
onClick={handleRun}
disabled={isExecuting}
title={isExecuting ? 'Execution in progress...' : 'Execute this node'}
@@ -107,17 +111,7 @@ const LocationParameterPanel: React.FC = () => {
{/* Save Button */}
<button
- style={{
- padding: '8px 16px',
- backgroundColor: hasUnsavedChanges ? '#3b82f6' : '#9ca3af',
- color: 'white',
- border: 'none',
- borderRadius: '4px',
- fontSize: '14px',
- fontWeight: '500',
- cursor: hasUnsavedChanges ? 'pointer' : 'not-allowed',
- fontFamily: 'system-ui, sans-serif'
- }}
+ style={actionButtonStyle(theme.dracula.purple, !hasUnsavedChanges)}
onClick={handleSave}
disabled={!hasUnsavedChanges}
>
@@ -126,17 +120,7 @@ const LocationParameterPanel: React.FC = () => {
{/* Cancel Button */}
<button
- style={{
- padding: '8px 16px',
- backgroundColor: '#6b7280',
- color: 'white',
- border: 'none',
- borderRadius: '4px',
- fontSize: '14px',
- fontWeight: '500',
- cursor: 'pointer',
- fontFamily: 'system-ui, sans-serif'
- }}
+ style={actionButtonStyle(theme.dracula.pink, false)}
onClick={handleCancel}
>
Cancel
diff --git a/client/src/components/maps/GoogleMapsPicker.tsx b/client/src/components/maps/GoogleMapsPicker.tsx
index bc002d5c..8b7e54a8 100644
--- a/client/src/components/maps/GoogleMapsPicker.tsx
+++ b/client/src/components/maps/GoogleMapsPicker.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react';
-import { theme } from '../../styles/theme';
import { loadGoogleMaps } from '../../utils/googleMapsLoader';
+import { useAppTheme } from '../../hooks/useAppTheme';
interface GoogleMapsPickerProps {
lat: number;
@@ -23,6 +23,7 @@ const GoogleMapsPicker: React.FC<GoogleMapsPickerProps> = ({
height = '100%',
width = '100%'
}) => {
+ const theme = useAppTheme();
const mapRef = useRef<HTMLDivElement>(null);
const mapInstanceRef = useRef<google.maps.Map | null>(null);
const markerRef = useRef<google.maps.Marker | null>(null);
@@ -107,7 +108,7 @@ const GoogleMapsPicker: React.FC<GoogleMapsPickerProps> = ({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- backgroundColor: '#f5f5f5',
+ backgroundColor: theme.colors.backgroundAlt,
color: theme.colors.textSecondary,
fontSize: theme.fontSize.sm,
textAlign: 'center',
diff --git a/client/src/components/maps/MapsPreviewPanel.tsx b/client/src/components/maps/MapsPreviewPanel.tsx
index abcd7e76..3b92762b 100644
--- a/client/src/components/maps/MapsPreviewPanel.tsx
+++ b/client/src/components/maps/MapsPreviewPanel.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import GoogleMapsPicker from './GoogleMapsPicker';
-import { theme } from '../../styles/theme';
+import { useAppTheme } from '../../hooks/useAppTheme';
interface MapsPreviewPanelProps {
lat: number;
@@ -23,14 +23,17 @@ const MapsPreviewPanel: React.FC<MapsPreviewPanelProps> = ({
title = 'Maps Preview',
description = 'Interactive map based on current parameters'
}) => {
+ const theme = useAppTheme();
+
return (
- <div style={{
- width: '100%',
- height: '100%',
- display: 'flex',
- flexDirection: 'column',
- backgroundColor: theme.colors.backgroundPanel
- }}>
+ <div
+ style={{
+ width: '100%',
+ height: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ backgroundColor: theme.colors.backgroundPanel
+ }}>
{/* Maps Header */}
<div style={{
padding: theme.spacing.lg,
@@ -47,7 +50,7 @@ const MapsPreviewPanel: React.FC<MapsPreviewPanelProps> = ({
alignItems: 'center',
gap: theme.spacing.sm
}}>
- 🗺️ {title}
+ {title}
</h3>
<p style={{
margin: `${theme.spacing.xs} 0 0 0`,
diff --git a/client/src/components/ui/MapSelector.tsx b/client/src/components/ui/MapSelector.tsx
index 8715fdd5..4c29b5de 100644
--- a/client/src/components/ui/MapSelector.tsx
+++ b/client/src/components/ui/MapSelector.tsx
@@ -1,6 +1,7 @@
import React, { useState, useCallback, useEffect, useRef } from 'react';
-import { theme } from '../../styles/theme';
import { loadGoogleMaps } from '../../utils/googleMapsLoader';
+import { useAppTheme } from '../../hooks/useAppTheme';
+import { useTheme } from '../../contexts/ThemeContext';
// Google Maps API Key from environment variable
const GOOGLE_MAPS_API_KEY = (import.meta as any).env?.VITE_GOOGLE_MAPS_API_KEY || 'YOUR_API_KEY_HERE';
@@ -13,13 +14,37 @@ interface MapSelectorProps {
apiKey?: string;
}
+// Dark mode styles for Google Maps (Dracula-inspired)
+const darkMapStyles: google.maps.MapTypeStyle[] = [
+ { elementType: 'geometry', stylers: [{ color: '#242f3e' }] },
+ { elementType: 'labels.text.stroke', stylers: [{ color: '#242f3e' }] },
+ { elementType: 'labels.text.fill', stylers: [{ color: '#746855' }] },
+ { featureType: 'administrative.locality', elementType: 'labels.text.fill', stylers: [{ color: '#d59563' }] },
+ { featureType: 'poi', elementType: 'labels.text.fill', stylers: [{ color: '#d59563' }] },
+ { featureType: 'poi.park', elementType: 'geometry', stylers: [{ color: '#263c3f' }] },
+ { featureType: 'poi.park', elementType: 'labels.text.fill', stylers: [{ color: '#6b9a76' }] },
+ { featureType: 'road', elementType: 'geometry', stylers: [{ color: '#38414e' }] },
+ { featureType: 'road', elementType: 'geometry.stroke', stylers: [{ color: '#212a37' }] },
+ { featureType: 'road', elementType: 'labels.text.fill', stylers: [{ color: '#9ca5b3' }] },
+ { featureType: 'road.highway', elementType: 'geometry', stylers: [{ color: '#746855' }] },
+ { featureType: 'road.highway', elementType: 'geometry.stroke', stylers: [{ color: '#1f2835' }] },
+ { featureType: 'road.highway', elementType: 'labels.text.fill', stylers: [{ color: '#f3d19c' }] },
+ { featureType: 'transit', elementType: 'geometry', stylers: [{ color: '#2f3948' }] },
+ { featureType: 'transit.station', elementType: 'labels.text.fill', stylers: [{ color: '#d59563' }] },
+ { featureType: 'water', elementType: 'geometry', stylers: [{ color: '#17263c' }] },
+ { featureType: 'water', elementType: 'labels.text.fill', stylers: [{ color: '#515c6d' }] },
+ { featureType: 'water', elementType: 'labels.text.stroke', stylers: [{ color: '#17263c' }] }
+];
+
// Google Maps Component for Location Selection
const GoogleMapsLocationPicker: React.FC<{
lat: number;
lng: number;
onLocationClick: (lat: number, lng: number) => void;
apiKey?: string;
-}> = ({ lat, lng, onLocationClick, apiKey }) => {
+ isDarkMode: boolean;
+ theme: ReturnType<typeof useAppTheme>;
+}> = ({ lat, lng, onLocationClick, apiKey, isDarkMode, theme }) => {
const mapRef = useRef<HTMLDivElement>(null);
const mapInstanceRef = useRef<google.maps.Map | null>(null);
const markerRef = useRef<google.maps.Marker | null>(null);
@@ -54,7 +79,9 @@ const GoogleMapsLocationPicker: React.FC<{
zoomControl: true,
mapTypeControl: true,
streetViewControl: true,
- fullscreenControl: true
+ fullscreenControl: true,
+ // Apply dark mode styles when in dark mode
+ styles: isDarkMode ? darkMapStyles : undefined
};
mapInstanceRef.current = new google.maps.Map(mapRef.current, mapOptions);
@@ -85,7 +112,7 @@ const GoogleMapsLocationPicker: React.FC<{
}
});
}
- }, [apiKey]);
+ }, [apiKey, isDarkMode]);
// Update marker position when coordinates change
useEffect(() => {
@@ -103,7 +130,7 @@ const GoogleMapsLocationPicker: React.FC<{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- backgroundColor: '#f5f5f5',
+ backgroundColor: theme.colors.backgroundAlt,
color: theme.colors.textSecondary,
fontSize: theme.fontSize.sm,
textAlign: 'center',
@@ -132,6 +159,8 @@ const MapSelector: React.FC<MapSelectorProps> = ({
onClose,
apiKey = GOOGLE_MAPS_API_KEY
}) => {
+ const theme = useAppTheme();
+ const { isDarkMode } = useTheme();
const [selectedPosition, setSelectedPosition] = useState<[number, number]>([
initialLatitude,
initialLongitude
@@ -166,11 +195,11 @@ const MapSelector: React.FC<MapSelectorProps> = ({
onClose();
}}
onMouseEnter={(e) => {
- e.currentTarget.style.backgroundColor = '#dc2626';
+ e.currentTarget.style.backgroundColor = theme.dracula.red;
e.currentTarget.style.transform = 'scale(1.1)';
}}
onMouseLeave={(e) => {
- e.currentTarget.style.backgroundColor = '#ef4444';
+ e.currentTarget.style.backgroundColor = theme.dracula.pink;
e.currentTarget.style.transform = 'scale(1)';
}}
style={{
@@ -180,13 +209,13 @@ const MapSelector: React.FC<MapSelectorProps> = ({
width: '44px',
height: '44px',
borderRadius: '50%',
- backgroundColor: '#ef4444',
+ backgroundColor: theme.dracula.pink,
color: 'white',
border: 'none',
fontSize: '20px',
fontWeight: 'bold',
cursor: 'pointer',
- boxShadow: '0 6px 16px rgba(239, 68, 68, 0.4)',
+ boxShadow: `0 6px 16px ${theme.dracula.pink}60`,
zIndex: 2002,
display: 'flex',
alignItems: 'center',
@@ -207,20 +236,21 @@ const MapSelector: React.FC<MapSelectorProps> = ({
right: '50px',
transform: 'translateY(-50%)',
height: '80vh',
- backgroundColor: 'white',
+ backgroundColor: theme.colors.backgroundPanel,
borderRadius: theme.borderRadius.lg,
- boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.4)',
+ boxShadow: theme.colors.shadowNode,
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
zIndex: 2001,
+ border: `1px solid ${theme.colors.border}`,
}}
>
{/* Header */}
<div style={{
padding: theme.spacing.md,
borderBottom: `1px solid ${theme.colors.border}`,
- backgroundColor: theme.colors.backgroundPanel,
+ backgroundColor: theme.colors.backgroundAlt,
}}>
<h3 style={{
margin: 0,
@@ -228,7 +258,7 @@ const MapSelector: React.FC<MapSelectorProps> = ({
fontWeight: theme.fontWeight.semibold,
color: theme.colors.text
}}>
- 📍 Select Location
+ Select Location
</h3>
<p style={{
margin: `${theme.spacing.xs} 0 0 0`,
@@ -254,7 +284,7 @@ const MapSelector: React.FC<MapSelectorProps> = ({
color: theme.colors.text,
fontWeight: theme.fontWeight.medium
}}>
- 📌 {selectedPosition[0].toFixed(6)}, {selectedPosition[1].toFixed(6)}
+ {selectedPosition[0].toFixed(6)}, {selectedPosition[1].toFixed(6)}
</div>
<div style={{
fontSize: theme.fontSize.xs,
@@ -272,6 +302,8 @@ const MapSelector: React.FC<MapSelectorProps> = ({
lng={selectedPosition[1]}
onLocationClick={handleMapClick}
apiKey={apiKey}
+ isDarkMode={isDarkMode}
+ theme={theme}
/>
</div>
</div>
diff --git a/client/src/components/ui/Modal.tsx b/client/src/components/ui/Modal.tsx
index c35eeac8..12974a2b 100644
--- a/client/src/components/ui/Modal.tsx
+++ b/client/src/components/ui/Modal.tsx
@@ -46,7 +46,6 @@ const Modal: React.FC<ModalProps> = ({
height: maxHeight,
display: 'flex',
flexDirection: 'column',
- fontFamily: 'system-ui, sans-serif',
overflow: 'hidden',
zIndex: 1001,
}}
diff --git a/client/src/components/ui/NodeOutputPanel.tsx b/client/src/components/ui/NodeOutputPanel.tsx
index dd4bb228..b3b94f1a 100644
--- a/client/src/components/ui/NodeOutputPanel.tsx
+++ b/client/src/components/ui/NodeOutputPanel.tsx
@@ -78,8 +78,16 @@ const NodeOutputPanel: React.FC<NodeOutputPanelProps> = ({
return parsed;
};
+ // Structured output types for different node responses
+ type AndroidOutput = { type: 'android'; data: any; service?: string; action?: string };
+ type WhatsAppHistoryOutput = { type: 'whatsapp_history'; messages: any[]; total: number; count: number; hasMore: boolean };
+ type MapsNearbyOutput = { type: 'maps_nearby'; places: any[]; searchParams: any; total: number };
+ type MapsGeocodeOutput = { type: 'maps_geocode'; locations: any[]; total: number };
+ type MapsCreateOutput = { type: 'maps_create'; mapUrl: string; center: { lat: number; lng: number }; zoom: number; mapType: string };
+ type StructuredOutput = AndroidOutput | WhatsAppHistoryOutput | MapsNearbyOutput | MapsGeocodeOutput | MapsCreateOutput;
+
// Extract the main response text from execution results
- const getMainResponse = (result: ExecutionResult): string | { type: string; data: any; service: string; action: string } | null => {
+ const getMainResponse = (result: ExecutionResult): string | StructuredOutput | null => {
const data = getOutputData(result);
// Python node output
if (data?.output !== undefined) {
@@ -103,6 +111,61 @@ const NodeOutputPanel: React.FC<NodeOutputPanelProps> = ({
if (data?.messages !== undefined && data?.total !== undefined) {
return { type: 'whatsapp_history', messages: data.messages, total: data.total, count: data.count || data.messages?.length, hasMore: data.has_more };
}
+ // Google Maps nearby places output
+ // Check nested result structure (from backend: { success, result: { results, search_parameters } })
+ if (data?.result?.results !== undefined && data?.result?.search_parameters !== undefined) {
+ return {
+ type: 'maps_nearby',
+ places: data.result.results,
+ searchParams: data.result.search_parameters,
+ total: data.result.total_results || data.result.results.length
+ };
+ }
+ // Also check top-level structure (if already unwrapped)
+ if (data?.results !== undefined && data?.search_parameters !== undefined) {
+ return {
+ type: 'maps_nearby',
+ places: data.results,
+ searchParams: data.search_parameters,
+ total: data.total_results || data.results.length
+ };
+ }
+ // Google Maps geocoding output
+ if (data?.result?.locations !== undefined && data?.result?.total_found !== undefined) {
+ return {
+ type: 'maps_geocode',
+ locations: data.result.locations,
+ total: data.result.total_found
+ };
+ }
+ // Geocode top-level fallback
+ if (data?.locations !== undefined && data?.total_found !== undefined) {
+ return {
+ type: 'maps_geocode',
+ locations: data.locations,
+ total: data.total_found
+ };
+ }
+ // Google Maps create map output
+ if (data?.result?.static_map_url !== undefined) {
+ return {
+ type: 'maps_create',
+ mapUrl: data.result.static_map_url,
+ center: data.result.center,
+ zoom: data.result.zoom,
+ mapType: data.result.map_type
+ };
+ }
+ // Create map top-level fallback
+ if (data?.static_map_url !== undefined) {
+ return {
+ type: 'maps_create',
+ mapUrl: data.static_map_url,
+ center: data.center,
+ zoom: data.zoom,
+ mapType: data.map_type
+ };
+ }
// Webhook trigger output
if (data?.method && data?.path !== undefined) {
let bodyData = data.json || (data.body ? (() => { try { return JSON.parse(data.body); } catch { return data.body; } })() : null);
@@ -517,6 +580,314 @@ const NodeOutputPanel: React.FC<NodeOutputPanelProps> = ({
)}
</div>
</div>
+ ) : mainResponse && typeof mainResponse === 'object' && (mainResponse as any).type === 'maps_nearby' ? (
+ /* Google Maps Nearby Places Response */
+ <div style={{
+ marginBottom: theme.spacing.md,
+ }}>
+ {/* Header with search params */}
+ <div style={{
+ padding: theme.spacing.md,
+ backgroundColor: theme.colors.backgroundElevated,
+ border: `1px solid #34a85340`,
+ borderRadius: `${theme.borderRadius.md} ${theme.borderRadius.md} 0 0`,
+ borderLeft: `3px solid #34a853`,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ }}>
+ <div style={{
+ fontSize: theme.fontSize.xs,
+ fontWeight: theme.fontWeight.semibold,
+ color: '#34a853',
+ textTransform: 'uppercase',
+ letterSpacing: '0.1em',
+ display: 'flex',
+ alignItems: 'center',
+ gap: theme.spacing.sm,
+ }}>
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="#34a853">
+ <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
+ </svg>
+ Nearby Places
+ </div>
+ <div style={{
+ fontSize: theme.fontSize.xs,
+ color: theme.colors.textSecondary,
+ display: 'flex',
+ gap: theme.spacing.md,
+ }}>
+ <span style={{ color: '#34a853' }}>{(mainResponse as any).total} places found</span>
+ {(mainResponse as any).searchParams?.type && (
+ <span>Type: {(mainResponse as any).searchParams.type}</span>
+ )}
+ {(mainResponse as any).searchParams?.keyword && (
+ <span>Keyword: {(mainResponse as any).searchParams.keyword}</span>
+ )}
+ </div>
+ </div>
+
+ {/* Places list */}
+ <div style={{
+ backgroundColor: theme.colors.backgroundElevated,
+ border: `1px solid #34a85340`,
+ borderTop: 'none',
+ borderRadius: `0 0 ${theme.borderRadius.md} ${theme.borderRadius.md}`,
+ maxHeight: '400px',
+ overflow: 'auto',
+ }}>
+ {(mainResponse as any).places?.length === 0 ? (
+ <div style={{
+ padding: theme.spacing.xl,
+ textAlign: 'center',
+ color: theme.colors.textMuted,
+ fontSize: theme.fontSize.sm,
+ }}>
+ No places found for this search
+ </div>
+ ) : (
+ (mainResponse as any).places?.map((place: any, idx: number) => (
+ <div
+ key={place.place_id || idx}
+ style={{
+ padding: theme.spacing.md,
+ borderBottom: idx < (mainResponse as any).places.length - 1 ? `1px solid ${theme.colors.border}` : 'none',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: theme.spacing.xs,
+ }}
+ >
+ {/* Place header */}
+ <div style={{
+ display: 'flex',
+ alignItems: 'flex-start',
+ justifyContent: 'space-between',
+ gap: theme.spacing.sm,
+ }}>
+ <div style={{ flex: 1 }}>
+ <div style={{
+ fontSize: theme.fontSize.sm,
+ fontWeight: theme.fontWeight.semibold,
+ color: theme.colors.text,
+ marginBottom: '2px',
+ }}>
+ {place.name}
+ </div>
+ {place.vicinity && (
+ <div style={{
+ fontSize: theme.fontSize.xs,
+ color: theme.colors.textMuted,
+ }}>
+ {place.vicinity}
+ </div>
+ )}
+ </div>
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: theme.spacing.sm,
+ }}>
+ {/* Rating */}
+ {place.rating && (
+ <div style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '4px',
+ padding: '2px 8px',
+ backgroundColor: theme.dracula.yellow + '20',
+ borderRadius: theme.borderRadius.sm,
+ }}>
+ <svg width="12" height="12" viewBox="0 0 24 24" fill={theme.dracula.yellow}>
+ <path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>
+ </svg>
+ <span style={{ fontSize: theme.fontSize.xs, color: theme.dracula.yellow, fontWeight: theme.fontWeight.medium }}>
+ {place.rating}
+ </span>
+ {place.user_ratings_total && (
+ <span style={{ fontSize: '10px', color: theme.colors.textMuted }}>
+ ({place.user_ratings_total})
+ </span>
+ )}
+ </div>
+ )}
+ {/* Open now */}
+ {place.opening_hours?.open_now !== undefined && (
+ <span style={{
+ fontSize: '10px',
+ padding: '2px 6px',
+ backgroundColor: place.opening_hours.open_now ? theme.dracula.green + '20' : theme.dracula.red + '20',
+ color: place.opening_hours.open_now ? theme.dracula.green : theme.dracula.red,
+ borderRadius: theme.borderRadius.sm,
+ fontWeight: theme.fontWeight.medium,
+ }}>
+ {place.opening_hours.open_now ? 'Open' : 'Closed'}
+ </span>
+ )}
+ {/* Price level */}
+ {place.price_level !== undefined && (
+ <span style={{
+ fontSize: theme.fontSize.xs,
+ color: theme.colors.textMuted,
+ }}>
+ {'$'.repeat(place.price_level + 1)}
+ </span>
+ )}
+ </div>
+ </div>
+ {/* Place types */}
+ {place.types && place.types.length > 0 && (
+ <div style={{
+ display: 'flex',
+ flexWrap: 'wrap',
+ gap: '4px',
+ marginTop: '4px',
+ }}>
+ {place.types.slice(0, 4).map((type: string) => (
+ <span key={type} style={{
+ fontSize: '10px',
+ padding: '2px 6px',
+ backgroundColor: theme.colors.backgroundAlt,
+ color: theme.colors.textSecondary,
+ borderRadius: theme.borderRadius.sm,
+ }}>
+ {type.replace(/_/g, ' ')}
+ </span>
+ ))}
+ </div>
+ )}
+ </div>
+ ))
+ )}
+ </div>
+ </div>
+ ) : mainResponse && typeof mainResponse === 'object' && (mainResponse as any).type === 'maps_geocode' ? (
+ /* Google Maps Geocoding Response */
+ <div style={{
+ marginBottom: theme.spacing.md,
+ }}>
+ <div style={{
+ padding: theme.spacing.md,
+ backgroundColor: theme.colors.backgroundElevated,
+ border: `1px solid #4285f440`,
+ borderRadius: `${theme.borderRadius.md} ${theme.borderRadius.md} 0 0`,
+ borderLeft: `3px solid #4285f4`,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ }}>
+ <div style={{
+ fontSize: theme.fontSize.xs,
+ fontWeight: theme.fontWeight.semibold,
+ color: '#4285f4',
+ textTransform: 'uppercase',
+ letterSpacing: '0.1em',
+ display: 'flex',
+ alignItems: 'center',
+ gap: theme.spacing.sm,
+ }}>
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="#4285f4">
+ <path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>
+ </svg>
+ Geocoded Locations
+ </div>
+ <span style={{ fontSize: theme.fontSize.xs, color: '#4285f4' }}>
+ {(mainResponse as any).total} location(s) found
+ </span>
+ </div>
+ <div style={{
+ backgroundColor: theme.colors.backgroundElevated,
+ border: `1px solid #4285f440`,
+ borderTop: 'none',
+ borderRadius: `0 0 ${theme.borderRadius.md} ${theme.borderRadius.md}`,
+ maxHeight: '300px',
+ overflow: 'auto',
+ }}>
+ {(mainResponse as any).locations?.map((loc: any, idx: number) => (
+ <div
+ key={idx}
+ style={{
+ padding: theme.spacing.md,
+ borderBottom: idx < (mainResponse as any).locations.length - 1 ? `1px solid ${theme.colors.border}` : 'none',
+ }}
+ >
+ <div style={{ fontWeight: theme.fontWeight.medium, color: theme.colors.text, marginBottom: '4px' }}>
+ {loc.formatted_address || loc.address}
+ </div>
+ <div style={{ fontSize: theme.fontSize.xs, color: theme.colors.textMuted }}>
+ Lat: {loc.lat?.toFixed(6)}, Lng: {loc.lng?.toFixed(6)}
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ ) : mainResponse && typeof mainResponse === 'object' && (mainResponse as any).type === 'maps_create' ? (
+ /* Google Maps Create Map Response */
+ <div style={{
+ marginBottom: theme.spacing.md,
+ backgroundColor: theme.colors.backgroundElevated,
+ border: `1px solid #ea433540`,
+ borderRadius: theme.borderRadius.md,
+ borderLeft: `3px solid #ea4335`,
+ overflow: 'hidden',
+ }}>
+ <div style={{
+ padding: theme.spacing.md,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ borderBottom: `1px solid ${theme.colors.border}`,
+ }}>
+ <div style={{
+ fontSize: theme.fontSize.xs,
+ fontWeight: theme.fontWeight.semibold,
+ color: '#ea4335',
+ textTransform: 'uppercase',
+ letterSpacing: '0.1em',
+ display: 'flex',
+ alignItems: 'center',
+ gap: theme.spacing.sm,
+ }}>
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="#ea4335">
+ <path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z"/>
+ </svg>
+ Map Created
+ </div>
+ <div style={{ fontSize: theme.fontSize.xs, color: theme.colors.textSecondary }}>
+ {(mainResponse as any).mapType} | Zoom: {(mainResponse as any).zoom}
+ </div>
+ </div>
+ <div style={{ padding: theme.spacing.md }}>
+ <div style={{ fontSize: theme.fontSize.sm, color: theme.colors.textMuted, marginBottom: theme.spacing.sm }}>
+ Center: {(mainResponse as any).center?.lat?.toFixed(4)}, {(mainResponse as any).center?.lng?.toFixed(4)}
+ </div>
+ <a
+ href={(mainResponse as any).mapUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ style={{
+ display: 'inline-flex',
+ alignItems: 'center',
+ gap: theme.spacing.sm,
+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,
+ backgroundColor: '#ea433520',
+ color: '#ea4335',
+ borderRadius: theme.borderRadius.sm,
+ border: `1px solid #ea433540`,
+ fontSize: theme.fontSize.xs,
+ fontWeight: theme.fontWeight.medium,
+ textDecoration: 'none',
+ cursor: 'pointer',
+ }}
+ >
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
+ <polyline points="15 3 21 3 21 9"/>
+ <line x1="10" y1="14" x2="21" y2="3"/>
+ </svg>
+ Open Map Preview
+ </a>
+ </div>
+ </div>
) : mainResponse && (
/* Standard Response (AI, etc) */
<div style={{
diff --git a/server/routers/websocket.py b/server/routers/websocket.py
index 6f833941..73af2ee0 100644
--- a/server/routers/websocket.py
+++ b/server/routers/websocket.py
@@ -1216,11 +1216,13 @@ async def handle_android_relay_reconnect(data: Dict[str, Any], websocket: WebSoc
# ============================================================================
async def handle_validate_maps_key(data: Dict[str, Any], websocket: WebSocket) -> Dict[str, Any]:
- """Validate Google Maps API key."""
+ """Validate Google Maps API key and save to database if valid."""
import httpx
broadcaster = get_status_broadcaster()
+ auth_service = container.auth_service()
api_key = data.get("api_key", "").strip()
+ session_id = data.get("session_id", "default")
if not api_key:
return {"success": False, "valid": False, "error": "api_key required"}
@@ -1240,6 +1242,13 @@ async def handle_validate_maps_key(data: Dict[str, Any], websocket: WebSocket) -
response_data = response.json()
if response_data.get("status") == "OK":
+ # Save the validated key to database
+ await auth_service.store_api_key(
+ provider="google_maps",
+ api_key=api_key,
+ models=[],
+ session_id=session_id
+ )
await broadcaster.update_api_key_status(
provider="google_maps",
valid=True,
@@ -1258,6 +1267,13 @@ async def handle_validate_maps_key(data: Dict[str, Any], websocket: WebSocket) -
else:
# Other statuses like ZERO_RESULTS still mean the key works
+ # Save the validated key to database
+ await auth_service.store_api_key(
+ provider="google_maps",
+ api_key=api_key,
+ models=[],
+ session_id=session_id
+ )
await broadcaster.update_api_key_status(
provider="google_maps",
valid=True,
diff --git a/server/services/node_executor.py b/server/services/node_executor.py
index 961979ab..ab40d7f3 100644
--- a/server/services/node_executor.py
+++ b/server/services/node_executor.py
@@ -234,7 +234,12 @@ class NodeExecutor:
elif node_type in GOOGLE_MAPS_TYPES:
if not result.get('api_key'):
- result['api_key'] = self.settings.google_maps_api_key
+ # Try database first, then fall back to environment variable
+ key = await self.ai_service.auth.get_api_key("google_maps", "default")
+ if key:
+ result['api_key'] = key
+ elif self.settings.google_maps_api_key:
+ result['api_key'] = self.settings.google_maps_api_key
return result