- {maps.map((map) => (
-
onSelectMap(map.id)}
- >
-
-
-
{map.name}
- {map.description && (
-
{map.description}
+ {maps.map((map) => {
+ const isOwner = user && map.owner_id === user.id;
+ const isShared = !isOwner;
+
+ return (
+
onSelectMap(map.id)}
+ >
+
+
+
+
{map.name}
+ {isShared && (
+
+ Shared
+
+ )}
+
+ {map.description && (
+
{map.description}
+ )}
+
+ {new Date(map.updated_at).toLocaleDateString()}
+
+
+ {isOwner && (
+
)}
-
- {new Date(map.updated_at).toLocaleDateString()}
-
-
-
- ))}
+ );
+ })}
)}
diff --git a/public/src/components/map/MapView.tsx b/public/src/components/map/MapView.tsx
index bac98ac..a3de367 100644
--- a/public/src/components/map/MapView.tsx
+++ b/public/src/components/map/MapView.tsx
@@ -96,7 +96,11 @@ export function MapView({ mapId }: MapViewProps) {
<>
{/* Toolbar for drawing tools */}
- setShowShareDialog(true)} />
+ setShowShareDialog(true)}
+ readOnly={permission === 'read'}
+ />
{/* Layer switcher */}
@@ -124,11 +128,13 @@ export function MapView({ mapId }: MapViewProps) {
maxNativeZoom={layer.maxNativeZoom}
/>
- {/* Drawing handler for creating new items */}
-
+ {/* Drawing handler for creating new items - disabled for read-only */}
+ {permission !== 'read' && (
+
+ )}
{/* Render existing map items */}
-
+
diff --git a/public/src/components/map/ShareDialog.tsx b/public/src/components/map/ShareDialog.tsx
index 3a74c8f..9ce81e2 100644
--- a/public/src/components/map/ShareDialog.tsx
+++ b/public/src/components/map/ShareDialog.tsx
@@ -49,7 +49,7 @@ export function ShareDialog({ mapId, onClose }: ShareDialogProps) {
setLoading(true);
try {
await mapShareService.shareWithUser(mapId, {
- user_id: newUserId,
+ user_identifier: newUserId.trim(),
permission: newUserPermission,
});
setNewUserId('');
@@ -57,6 +57,7 @@ export function ShareDialog({ mapId, onClose }: ShareDialogProps) {
alert('Map shared successfully!');
} catch (error: any) {
console.error('Share error:', error);
+ // Show detailed error message
const message = error.response?.data?.detail || error.message || 'Failed to share map';
alert(message);
} finally {
@@ -158,15 +159,18 @@ export function ShareDialog({ mapId, onClose }: ShareDialogProps) {
{/* Add user form */}