mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
New icons
This commit is contained in:
parent
22b10df91d
commit
004d98e0d9
@ -95,17 +95,28 @@ const F2fMapDialog = ({
|
|||||||
/>
|
/>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Tooltip
|
{interactive ? (
|
||||||
enterTouchDelay={0}
|
<Tooltip
|
||||||
placement='top'
|
enterTouchDelay={0}
|
||||||
title={t(
|
placement='top'
|
||||||
'To protect your privacy, your selection will be slightly randomized without losing accuracy',
|
title={t(
|
||||||
)}
|
'To protect your privacy, your selection will be slightly randomized without losing accuracy',
|
||||||
>
|
)}
|
||||||
<Button color='primary' variant='contained' onClick={onSave} disabled={!position}>
|
>
|
||||||
{interactive ? t('Save') : t('Close')}
|
<Button color='primary' variant='contained' onClick={onSave} disabled={!position}>
|
||||||
|
{t('Save')}
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
color='primary'
|
||||||
|
variant='contained'
|
||||||
|
onClick={() => onClose()}
|
||||||
|
disabled={!position}
|
||||||
|
>
|
||||||
|
{t('Close')}
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
)}
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
@ -544,6 +544,7 @@ const MakerForm = ({
|
|||||||
if (pos) handleAddLocation(pos);
|
if (pos) handleAddLocation(pos);
|
||||||
setOpenWorldmap(false);
|
setOpenWorldmap(false);
|
||||||
}}
|
}}
|
||||||
|
zoom={maker.latitude && maker.longitude ? 6 : undefined}
|
||||||
/>
|
/>
|
||||||
<Collapse in={limits.list.length == 0}>
|
<Collapse in={limits.list.length == 0}>
|
||||||
<div style={{ display: limits.list.length == 0 ? '' : 'none' }}>
|
<div style={{ display: limits.list.length == 0 ? '' : 'none' }}>
|
||||||
|
@ -1,10 +1,18 @@
|
|||||||
import React, { useContext, useEffect, useState } from 'react';
|
import React, { useContext, useEffect, useState } from 'react';
|
||||||
import { apiClient } from '../../services/api';
|
import { apiClient } from '../../services/api';
|
||||||
import { MapContainer, GeoJSON, useMapEvents, Circle, TileLayer, Tooltip } from 'react-leaflet';
|
import {
|
||||||
|
MapContainer,
|
||||||
|
GeoJSON,
|
||||||
|
useMapEvents,
|
||||||
|
Circle,
|
||||||
|
TileLayer,
|
||||||
|
Tooltip,
|
||||||
|
Marker,
|
||||||
|
} from 'react-leaflet';
|
||||||
import { useTheme, LinearProgress } from '@mui/material';
|
import { useTheme, LinearProgress } from '@mui/material';
|
||||||
import { UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
import { UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||||
import { GeoJsonObject } from 'geojson';
|
import { GeoJsonObject } from 'geojson';
|
||||||
import { LeafletMouseEvent } from 'leaflet';
|
import { Icon, LeafletMouseEvent, Point } from 'leaflet';
|
||||||
import { PublicOrder } from '../../models';
|
import { PublicOrder } from '../../models';
|
||||||
import OrderTooltip from '../Charts/helpers/OrderTooltip';
|
import OrderTooltip from '../Charts/helpers/OrderTooltip';
|
||||||
|
|
||||||
@ -43,6 +51,37 @@ const Map = ({
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const RobotMarker = (
|
||||||
|
key: string | number,
|
||||||
|
position: [number, number],
|
||||||
|
orderType: number,
|
||||||
|
order?: PublicOrder,
|
||||||
|
) => {
|
||||||
|
const color = orderType == 1 ? 'Blue' : 'Lilac';
|
||||||
|
return (
|
||||||
|
<Marker
|
||||||
|
key={key}
|
||||||
|
position={position}
|
||||||
|
icon={
|
||||||
|
new Icon({
|
||||||
|
iconUrl: `../../../static/assets/vector/Location_robot_${color}.svg`,
|
||||||
|
iconAnchor: [18, 32],
|
||||||
|
iconSize: [32, 32],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
eventHandlers={{
|
||||||
|
click: (_event: LeafletMouseEvent) => order?.id && onOrderClicked(order.id),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{order && (
|
||||||
|
<Tooltip direction='top'>
|
||||||
|
<OrderTooltip order={order} />
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</Marker>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const LocationMarker = () => {
|
const LocationMarker = () => {
|
||||||
useMapEvents({
|
useMapEvents({
|
||||||
click(event: LeafletMouseEvent) {
|
click(event: LeafletMouseEvent) {
|
||||||
@ -52,35 +91,13 @@ const Map = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const color = orderType == 1 ? theme.palette.primary.main : theme.palette.secondary.main;
|
return position ? RobotMarker('marker', position, orderType || 0) : <></>;
|
||||||
|
|
||||||
return position ? (
|
|
||||||
<Circle center={position} pathOptions={{ fillColor: color, color }} radius={10000}></Circle>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getOrderMarkers = () => {
|
const getOrderMarkers = () => {
|
||||||
return orders.map((order) => {
|
return orders.map((order) => {
|
||||||
if (!order.latitude || !order.longitude) return <></>;
|
if (!order.latitude || !order.longitude) return <></>;
|
||||||
|
return RobotMarker('marker', [order.latitude, order.longitude], orderType || 0, order);
|
||||||
const color = order.type == 1 ? theme.palette.primary.main : theme.palette.secondary.main;
|
|
||||||
return (
|
|
||||||
<Circle
|
|
||||||
key={order.id}
|
|
||||||
center={[order.latitude, order.longitude]}
|
|
||||||
pathOptions={{ fillColor: color, color }}
|
|
||||||
radius={10000}
|
|
||||||
eventHandlers={{
|
|
||||||
click: (_event: LeafletMouseEvent) => onOrderClicked(order.id),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Tooltip direction='top'>
|
|
||||||
<OrderTooltip order={order} />
|
|
||||||
</Tooltip>
|
|
||||||
</Circle>
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user