some layout

This commit is contained in:
Anton 2024-01-09 08:32:40 +01:00
parent 3be1718022
commit 444cac6dc2
5 changed files with 8 additions and 8 deletions

View File

@ -128,6 +128,8 @@ export const Layer = ( {
let color1 = markerDefaultColor;
let color2 = "RGBA(35, 31, 32, 0.2)";
if (itemColorField) color1 = getValue(item, itemColorField);
if(color1 == null) color1 = markerDefaultColor;
else if (tags && tags[0]) {
color1 = tags[0].color;
}
@ -149,7 +151,7 @@ export const Layer = ( {
r && addPopup(item, r as Popup);
}} key={item.id + item.name}
title={itemTitleField && item ? getValue(item, itemTitleField) : undefined}
avatar={itemAvatarField && item ? assetsApi.url + getValue(item, itemAvatarField) : undefined}
avatar={itemAvatarField && item && getValue(item, itemAvatarField)? assetsApi.url + getValue(item, itemAvatarField) : undefined}
owner={itemOwnerField && item ? getValue(item, itemOwnerField) : undefined}
item={item}
setItemFormPopup={setItemFormPopup}>
@ -163,7 +165,7 @@ export const Layer = ( {
if (!(item.id in leafletRefs))
r && addPopup(item, r as Popup);
}} title={itemTitleField && item ? getValue(item, itemTitleField) : undefined}
avatar={itemAvatarField && item ? assetsApi.url + getValue(item, itemAvatarField) : undefined}
avatar={itemAvatarField && item && getValue(item, itemAvatarField)? assetsApi.url + getValue(item, itemAvatarField) : undefined}
owner={itemOwnerField && item ? getValue(item, itemOwnerField) : undefined}
item={item}
setItemFormPopup={setItemFormPopup} />

View File

@ -6,9 +6,7 @@ import { LatLng } from "leaflet";
import { Item } from "../../../../types";
import { toast } from "react-toastify";
import { useHasUserPermission } from "../../hooks/usePermissions";
import { timeAgo } from "../../../../Utils/TimeAgo";
import { useAuth } from "../../../Auth";
import { useEffect } from "react";

View File

@ -3,9 +3,9 @@ import { Link } from 'react-router-dom'
import { getValue } from '../../../../Utils/GetValue'
import { Item } from '../../../../types'
export const PopupButton = ({url, parameterField, text, color = 'oklch(var(--p))', colorField, item} : {url: string, parameterField?: string, text: string, color? : string, colorField?: string, item? : Item}) => {
export const PopupButton = ({url, parameterField, text, colorField, item} : {url: string, parameterField?: string, text: string, colorField?: string, item? : Item}) => {
return (
<Link to={`${url}/${parameterField? getValue(item,parameterField):``}`}><button style={{backgroundColor: `${colorField? getValue(item,colorField) : color}`}} className="tw-btn tw-text-white tw-btn-sm tw-float-right -tw-mt-2">{text}</button></Link>
<Link to={`${url}/${parameterField? getValue(item,parameterField):``}`}><button style={{backgroundColor: `${colorField && getValue(item,colorField)? getValue(item,colorField) : item?.layer?.markerDefaultColor}`}} className="tw-btn tw-text-white tw-btn-sm tw-float-right -tw-mt-2">{text}</button></Link>
)
}

View File

@ -42,7 +42,7 @@ export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: a
}
</div>
<div className='tw-flex -tw-mb-1 tw-flex-row'>
<div className='tw-flex -tw-mb-1 tw-flex-row-reverse tw-mr-2'>
{

View File

@ -4,7 +4,7 @@ import { HexColorPicker } from "react-colorful";
import "./ColorPicker.css"
import useClickOutside from "./useClickOutside";
export const ColorPicker = ({ color = "#000", onChange, className }) => {
export const ColorPicker = ({ color, onChange, className }) => {
const popover = useRef<HTMLDivElement>(null);
const [isOpen, toggle] = useState(false);