(false);
@@ -52,7 +52,7 @@ const LocationSelector = (props: Props) => {
setState({ ...state, position: new LatLng(lat, lng), initilized: true });
},
(error) => {
- handleError(error, "Error getting current position");
+ handleError(error, "Failed to get current position");
},
);
} else {
@@ -62,6 +62,11 @@ const LocationSelector = (props: Props) => {
}, [popoverOpen]);
useEffect(() => {
+ if (!state.position) {
+ setState({ ...state, placeholder: "" });
+ return;
+ }
+
// Fetch reverse geocoding data.
fetch(`https://nominatim.openstreetmap.org/reverse?lat=${state.position.lat}&lon=${state.position.lng}&format=json`)
.then((response) => response.json())
@@ -96,7 +101,7 @@ const LocationSelector = (props: Props) => {
{props.location.placeholder}
-
+
>
)}
@@ -106,25 +111,34 @@ const LocationSelector = (props: Props) => {
+ [{state.position.lat.toFixed(3)}, {state.position.lng.toFixed(3)}]
+
+ ) : null
+ }
onChange={(e) => setState((state) => ({ ...state, placeholder: e.target.value }))}
/>
diff --git a/web/src/components/MemoLocationView.tsx b/web/src/components/MemoLocationView.tsx
new file mode 100644
index 00000000..71d0c9f7
--- /dev/null
+++ b/web/src/components/MemoLocationView.tsx
@@ -0,0 +1,35 @@
+import { LatLng } from "leaflet";
+import { MapPinIcon } from "lucide-react";
+import { useState } from "react";
+import { Location } from "@/types/proto/api/v1/memo_service";
+import LeafletMap from "./LeafletMap";
+import { Popover, PopoverContent, PopoverTrigger } from "./ui/Popover";
+
+interface Props {
+ location: Location;
+}
+
+const MemoLocationView: React.FC = (props: Props) => {
+ const { location } = props;
+ const [popoverOpen, setPopoverOpen] = useState(false);
+
+ return (
+
+
+
+
+
+ {location.placeholder ? location.placeholder : `[${location.latitude}, ${location.longitude}]`}
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default MemoLocationView;
diff --git a/web/src/components/MemoView.tsx b/web/src/components/MemoView.tsx
index ff856353..63e669cf 100644
--- a/web/src/components/MemoView.tsx
+++ b/web/src/components/MemoView.tsx
@@ -1,6 +1,6 @@
import { Tooltip } from "@mui/joy";
import clsx from "clsx";
-import { BookmarkIcon, MapPinIcon, MessageCircleMoreIcon } from "lucide-react";
+import { BookmarkIcon, MessageCircleMoreIcon } from "lucide-react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { Link, useLocation } from "react-router-dom";
import useCurrentUser from "@/hooks/useCurrentUser";
@@ -16,6 +16,7 @@ import { isSuperUser } from "@/utils/user";
import MemoActionMenu from "./MemoActionMenu";
import MemoContent from "./MemoContent";
import MemoEditor from "./MemoEditor";
+import MemoLocationView from "./MemoLocationView";
import MemoReactionistView from "./MemoReactionListView";
import MemoRelationListView from "./MemoRelationListView";
import MemoResourceListView from "./MemoResourceListView";
@@ -198,14 +199,7 @@ const MemoView: React.FC = (props: Props) => {
onDoubleClick={handleMemoContentDoubleClick}
compact={props.compact && workspaceMemoRelatedSetting.enableAutoCompact}
/>
- {memo.location && (
-
-
-
- {memo.location.placeholder ? memo.location.placeholder : `[${memo.location.latitude}, ${memo.location.longitude}]`}
-
-
- )}
+ {memo.location && }