mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
fix popup button (#339)
This commit is contained in:
parent
1b0b51e91a
commit
94ec2e5576
@ -117,8 +117,11 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
|
|||||||
{layer.itemType.show_profile_button && (
|
{layer.itemType.show_profile_button && (
|
||||||
<PopupButton
|
<PopupButton
|
||||||
url={layer.itemType.custom_profile_url ?? '/item'}
|
url={layer.itemType.custom_profile_url ?? '/item'}
|
||||||
parameterField={'extended.external_profile_id'}
|
parameterField={
|
||||||
|
layer.itemType.custom_profile_url ? 'extended.external_profile_id' : 'id'
|
||||||
|
}
|
||||||
text={layer.itemType.botton_label ?? 'Profile'}
|
text={layer.itemType.botton_label ?? 'Profile'}
|
||||||
|
target={layer.itemType.custom_profile_url ? '_parent' : '_self'}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{layer.itemType.show_text && <TextView truncate></TextView>}
|
{layer.itemType.show_text && <TextView truncate></TextView>}
|
||||||
|
|||||||
@ -15,18 +15,20 @@ export const PopupButton = ({
|
|||||||
parameterField,
|
parameterField,
|
||||||
text,
|
text,
|
||||||
item,
|
item,
|
||||||
|
target,
|
||||||
}: {
|
}: {
|
||||||
url: string
|
url: string
|
||||||
parameterField?: string
|
parameterField?: string
|
||||||
text: string
|
text: string
|
||||||
item?: Item
|
item?: Item
|
||||||
|
target?: string
|
||||||
}) => {
|
}) => {
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
const getItemTags = useGetItemTags()
|
const getItemTags = useGetItemTags()
|
||||||
const parameter = get(item, parameterField ?? 'id')
|
const parameter = get(item, parameterField ?? 'id')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={`${url}/${parameter || item?.id}?${params}`} target='_parent'>
|
<Link to={`${url}/${parameter || item?.id}?${params}`} target={target ?? '_self'}>
|
||||||
<button
|
<button
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: `${item?.color ?? (item && (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (item?.layer?.markerDefaultColor ?? '#000')))}`,
|
backgroundColor: `${item?.color ?? (item && (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (item?.layer?.markerDefaultColor ?? '#000')))}`,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user