mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +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 && (
|
||||
<PopupButton
|
||||
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'}
|
||||
target={layer.itemType.custom_profile_url ? '_parent' : '_self'}
|
||||
/>
|
||||
)}
|
||||
{layer.itemType.show_text && <TextView truncate></TextView>}
|
||||
|
||||
@ -15,18 +15,20 @@ export const PopupButton = ({
|
||||
parameterField,
|
||||
text,
|
||||
item,
|
||||
target,
|
||||
}: {
|
||||
url: string
|
||||
parameterField?: string
|
||||
text: string
|
||||
item?: Item
|
||||
target?: string
|
||||
}) => {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const getItemTags = useGetItemTags()
|
||||
const parameter = get(item, parameterField ?? 'id')
|
||||
|
||||
return (
|
||||
<Link to={`${url}/${parameter || item?.id}?${params}`} target='_parent'>
|
||||
<Link to={`${url}/${parameter || item?.id}?${params}`} target={target ?? '_self'}>
|
||||
<button
|
||||
style={{
|
||||
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