create address + fix location restaurant
This commit is contained in:
+184
-154
@@ -1,88 +1,123 @@
|
||||
.map-google-style {
|
||||
background-color: var(--background);
|
||||
font-family: 'irancell', system-ui, -apple-system, sans-serif;
|
||||
background-color: var(--background);
|
||||
font-family: "irancell", system-ui, -apple-system, sans-serif;
|
||||
}
|
||||
|
||||
/* Map tiles styling */
|
||||
.map-google-style .leaflet-tile-pane {
|
||||
filter: saturate(0.95) contrast(0.95) brightness(1.02);
|
||||
filter: saturate(0.95) contrast(0.95) brightness(1.02);
|
||||
}
|
||||
|
||||
/* Base font for all map elements */
|
||||
.map-google-style,
|
||||
.map-google-style .leaflet-container {
|
||||
font-family: 'irancell', system-ui, -apple-system, sans-serif !important;
|
||||
font-family: "irancell", system-ui, -apple-system, sans-serif !important;
|
||||
}
|
||||
|
||||
/* Improve tile loading appearance */
|
||||
.map-google-style .leaflet-tile-loading {
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
/* Custom popup style */
|
||||
.map-google-style .leaflet-popup-content-wrapper {
|
||||
border-radius: 16px;
|
||||
padding: 0;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.08),
|
||||
0 2px 4px rgba(0,0,0,0.05);
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
backdrop-filter: blur(8px);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border-radius: 16px;
|
||||
padding: 0;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
backdrop-filter: blur(8px);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-popup-content {
|
||||
margin: 16px 20px;
|
||||
line-height: 1.6;
|
||||
font-size: 14px;
|
||||
color: #1f2937;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
margin: 16px 20px;
|
||||
line-height: 1.6;
|
||||
font-size: 14px;
|
||||
color: #1f2937;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-popup-tip {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
backdrop-filter: blur(8px);
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.08);
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
backdrop-filter: blur(8px);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-popup-close-button {
|
||||
padding: 12px !important;
|
||||
color: #6b7280 !important;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.2s ease;
|
||||
padding: 12px !important;
|
||||
color: #6b7280 !important;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-popup-close-button:hover {
|
||||
opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Marker styles */
|
||||
.map-google-style .leaflet-marker-icon,
|
||||
.map-google-style .leaflet-marker-shadow {
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transform-origin: bottom center;
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transform-origin: bottom center;
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-marker-icon {
|
||||
filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
|
||||
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-marker-icon:hover {
|
||||
transform: scale(1.1) translateY(-4px);
|
||||
filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
|
||||
transform: scale(1.1) translateY(-4px);
|
||||
filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
|
||||
}
|
||||
|
||||
.map-google-style .leaflet-marker-icon:hover + .leaflet-marker-shadow {
|
||||
transform: scale(1.1) translateY(-4px);
|
||||
opacity: 0.6;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* Custom restaurant marker styles */
|
||||
.map-google-style .custom-restaurant-marker {
|
||||
background: transparent !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.map-google-style .custom-restaurant-marker img {
|
||||
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
|
||||
}
|
||||
|
||||
/* Restaurant popup smaller size */
|
||||
.map-google-style .restaurant-popup .leaflet-popup-content-wrapper {
|
||||
padding: 8px 25px 8px 12px;
|
||||
position: relative;
|
||||
min-height: 32px;
|
||||
}
|
||||
|
||||
.map-google-style .restaurant-popup .leaflet-popup-content {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.map-google-style .restaurant-popup .leaflet-popup-close-button {
|
||||
position: absolute !important;
|
||||
top: 4px !important;
|
||||
right: 4px !important;
|
||||
padding: 4px 6px !important;
|
||||
font-size: 16px !important;
|
||||
line-height: 1 !important;
|
||||
width: 20px !important;
|
||||
height: 20px !important;
|
||||
text-align: center !important;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/* Attribution styling */
|
||||
.map-google-style .leaflet-control-attribution {
|
||||
display: none;
|
||||
/* background: rgba(255,255,255,0.9) !important;
|
||||
display: none;
|
||||
/* background: rgba(255,255,255,0.9) !important;
|
||||
backdrop-filter: blur(8px);
|
||||
padding: 6px 12px !important;
|
||||
border-radius: 12px;
|
||||
@@ -95,179 +130,174 @@
|
||||
|
||||
/* Zoom controls */
|
||||
.map-zoom-controls {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
bottom: 40px;
|
||||
background: var(--background);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.08),
|
||||
0 2px 4px rgba(0,0,0,0.05);
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
overflow: hidden;
|
||||
backdrop-filter: blur(8px);
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
bottom: 40px;
|
||||
background: var(--background);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
backdrop-filter: blur(8px);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.zoom-button {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
color: #4b5563;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
color: #4b5563;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
.zoom-button:first-child {
|
||||
border-bottom: 1px solid rgba(0,0,0,0.08);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.zoom-button:hover {
|
||||
background-color: rgba(59, 130, 246, 0.05);
|
||||
color: #2563eb;
|
||||
background-color: rgba(59, 130, 246, 0.05);
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.zoom-button:active {
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
/* Selected location indicator */
|
||||
.selected-location-indicator {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
backdrop-filter: blur(8px);
|
||||
padding: 14px 24px;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.08),
|
||||
0 2px 4px rgba(0,0,0,0.05);
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
color: #1f2937;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.6;
|
||||
max-width: 90%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
z-index: 1000;
|
||||
animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
backdrop-filter: blur(8px);
|
||||
padding: 14px 24px;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
color: #1f2937;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
line-height: 1.6;
|
||||
max-width: 90%;
|
||||
width: auto;
|
||||
text-align: center;
|
||||
z-index: 1000;
|
||||
animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
transform: translate(-50%, 100%);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translate(-50%, 0);
|
||||
opacity: 1;
|
||||
}
|
||||
from {
|
||||
transform: translate(-50%, 100%);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translate(-50%, 0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loading state */
|
||||
.map-loading {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Container styling */
|
||||
.map-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(to bottom, #e5e7eb 0%, #f3f4f6 100%);
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(to bottom, #e5e7eb 0%, #f3f4f6 100%);
|
||||
}
|
||||
|
||||
/* Search box styling */
|
||||
.map-search-container {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 90%;
|
||||
max-width: 480px;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 90%;
|
||||
max-width: 480px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.map-search-input {
|
||||
width: 100%;
|
||||
padding: 14px 20px;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.08),
|
||||
0 2px 4px rgba(0,0,0,0.05);
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
backdrop-filter: blur(8px);
|
||||
color: #1f2937;
|
||||
width: 100%;
|
||||
padding: 14px 20px;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
backdrop-filter: blur(8px);
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.map-search-input:focus {
|
||||
box-shadow: 0 6px 24px rgba(0,0,0,0.12),
|
||||
0 2px 8px rgba(0,0,0,0.08);
|
||||
border-color: rgba(59, 130, 246, 0.5);
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
border-color: rgba(59, 130, 246, 0.5);
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
}
|
||||
|
||||
.map-search-input::placeholder {
|
||||
color: #6b7280;
|
||||
font-weight: 400;
|
||||
color: #6b7280;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.map-search-results {
|
||||
margin-top: 12px;
|
||||
background: var(--container);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.1),
|
||||
0 2px 8px rgba(0,0,0,0.05);
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
backdrop-filter: blur(8px);
|
||||
margin-top: 12px;
|
||||
background: var(--container);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.map-search-result-item {
|
||||
padding: 14px 20px;
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
border-bottom: 1px solid rgba(0,0,0,0.05);
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
color: var(--foreground);
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
padding: 14px 20px;
|
||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
color: var(--foreground);
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.map-search-result-item:last-child {
|
||||
border-bottom: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.map-search-result-item:hover {
|
||||
background-color: rgba(59, 130, 246, 0.05);
|
||||
color: #2563eb;
|
||||
background-color: rgba(59, 130, 246, 0.05);
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .map-search-result-item:hover {
|
||||
color: var(--disabled-text);
|
||||
color: var(--disabled-text);
|
||||
}
|
||||
|
||||
.map-search-result-item:active {
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ interface CustomMapProps {
|
||||
markers?: Array<{
|
||||
position: [number, number];
|
||||
title: string;
|
||||
icon?: L.Icon;
|
||||
icon?: L.Icon | L.DivIcon;
|
||||
}>;
|
||||
onPositionSelect?: (position: [number, number]) => void;
|
||||
onZoomChange?: (zoom: number) => void;
|
||||
@@ -79,6 +79,25 @@ function MarkerUpdater({ markers }: { markers?: CustomMapProps['markers'] }) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Component to auto-open popup for restaurant marker
|
||||
function MarkerWithAutoOpen({ position, icon, title }: { position: [number, number]; icon?: L.Icon | L.DivIcon; title: string }) {
|
||||
const markerRef = React.useRef<L.Marker>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (markerRef.current && title === 'موقعیت رستوران') {
|
||||
markerRef.current.openPopup();
|
||||
}
|
||||
}, [title]);
|
||||
|
||||
return (
|
||||
<Marker ref={markerRef} position={position} icon={icon}>
|
||||
<Popup className="restaurant-popup">
|
||||
<div className="text-xs font-medium">{title}</div>
|
||||
</Popup>
|
||||
</Marker>
|
||||
);
|
||||
}
|
||||
|
||||
const CustomMap: React.FC<CustomMapProps> = ({
|
||||
initialPosition,
|
||||
zoom = 13,
|
||||
@@ -276,15 +295,12 @@ const CustomMap: React.FC<CustomMapProps> = ({
|
||||
|
||||
{/* Custom markers */}
|
||||
{markers.map((marker, index) => (
|
||||
<Marker
|
||||
<MarkerWithAutoOpen
|
||||
key={`${marker.position}-${index}`}
|
||||
position={marker.position}
|
||||
icon={marker.icon}
|
||||
>
|
||||
<Popup>
|
||||
<div className="text-sm">{marker.title}</div>
|
||||
</Popup>
|
||||
</Marker>
|
||||
title={marker.title}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/* Selected position marker */}
|
||||
|
||||
Reference in New Issue
Block a user