From 9bc07a330cd50c12928e619cfafd99a3229258d5 Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Sat, 27 Apr 2024 07:26:54 +0200 Subject: [PATCH] changed date presentation --- src/Components/Map/Subcomponents/ItemViewPopup.tsx | 10 ++++++++-- src/Components/Templates/OverlayItemsIndexPage.tsx | 11 ++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Components/Map/Subcomponents/ItemViewPopup.tsx b/src/Components/Map/Subcomponents/ItemViewPopup.tsx index a40c7d66..9331c50e 100644 --- a/src/Components/Map/Subcomponents/ItemViewPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemViewPopup.tsx @@ -31,6 +31,8 @@ export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: a const setSelectPosition = useSetSelectPosition(); + const [infoExpanded, setInfoExpanded] = useState(false); + const handleEdit = (event: React.MouseEvent) => { event.stopPropagation(); map.closePopup(); @@ -83,8 +85,12 @@ export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: a
-

{`${props.item.date_updated && props.item.date_updated != props.item.date_created ? "updated" : "posted" } ${props.item && props.item.user_created && props.item.user_created.first_name ? `by ${props.item.user_created.first_name}` : ""} ${props.item.date_updated ? timeAgo(props.item.date_updated) : timeAgo(props.item.date_created!)}`}

- + { + infoExpanded ? +

{`${props.item.date_updated && props.item.date_updated != props.item.date_created ? "updated" : "posted" } ${props.item && props.item.user_created && props.item.user_created.first_name ? `by ${props.item.user_created.first_name}` : ""} ${props.item.date_updated ? timeAgo(props.item.date_updated) : timeAgo(props.item.date_created!)}`}

+ : +

setInfoExpanded(true)}>ⓘ

+ }
{ //** */ } diff --git a/src/Components/Templates/OverlayItemsIndexPage.tsx b/src/Components/Templates/OverlayItemsIndexPage.tsx index 39839d58..58c1c3de 100644 --- a/src/Components/Templates/OverlayItemsIndexPage.tsx +++ b/src/Components/Templates/OverlayItemsIndexPage.tsx @@ -26,6 +26,7 @@ type breadcrumb = { export const OverlayItemsIndexPage = ({ url, layerName, parameterField, breadcrumbs, itemNameField, itemTextField, itemImageField, itemSymbolField, itemSubnameField, plusButton = true, children }: { layerName: string, url: string, parameterField: string, breadcrumbs: Array, itemNameField: string, itemTextField: string, itemImageField: string, itemSymbolField: string, itemSubnameField: string, plusButton?: boolean, children?: ReactNode }) => { console.log(itemSymbolField); + const [infoExpanded, setInfoExpanded] = useState(0); const [loading, setLoading] = useState(false); const [addItemPopupType, setAddItemPopupType] = useState(""); @@ -136,10 +137,14 @@ export const OverlayItemsIndexPage = ({ url, layerName, parameterField, breadcru
-
- -

{`${i.date_updated && i.date_updated != i.date_created ? "updated" : "posted" } ${i && i.user_created && i.user_created.first_name ? `by ${i.user_created.first_name}` : ""} ${i.date_updated ? timeAgo(i.date_updated) : timeAgo(i.date_created!)}`}

+
e.stopPropagation()}> + { + infoExpanded == k ? +

setInfoExpanded(0)} >{`${i.date_updated && i.date_updated != i.date_created ? "updated" : "posted" } ${i && i.user_created && i.user_created.first_name ? `by ${i.user_created.first_name}` : ""} ${i.date_updated ? timeAgo(i.date_updated) : timeAgo(i.date_created!)}`}

+ : +

setInfoExpanded(k)}>ⓘ

+ }
{ //** */ }