mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
some layout
This commit is contained in:
parent
3be1718022
commit
444cac6dc2
@ -128,6 +128,8 @@ export const Layer = ( {
|
|||||||
let color1 = markerDefaultColor;
|
let color1 = markerDefaultColor;
|
||||||
let color2 = "RGBA(35, 31, 32, 0.2)";
|
let color2 = "RGBA(35, 31, 32, 0.2)";
|
||||||
if (itemColorField) color1 = getValue(item, itemColorField);
|
if (itemColorField) color1 = getValue(item, itemColorField);
|
||||||
|
if(color1 == null) color1 = markerDefaultColor;
|
||||||
|
|
||||||
else if (tags && tags[0]) {
|
else if (tags && tags[0]) {
|
||||||
color1 = tags[0].color;
|
color1 = tags[0].color;
|
||||||
}
|
}
|
||||||
@ -149,7 +151,7 @@ export const Layer = ( {
|
|||||||
r && addPopup(item, r as Popup);
|
r && addPopup(item, r as Popup);
|
||||||
}} key={item.id + item.name}
|
}} key={item.id + item.name}
|
||||||
title={itemTitleField && item ? getValue(item, itemTitleField) : undefined}
|
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}
|
owner={itemOwnerField && item ? getValue(item, itemOwnerField) : undefined}
|
||||||
item={item}
|
item={item}
|
||||||
setItemFormPopup={setItemFormPopup}>
|
setItemFormPopup={setItemFormPopup}>
|
||||||
@ -163,7 +165,7 @@ export const Layer = ( {
|
|||||||
if (!(item.id in leafletRefs))
|
if (!(item.id in leafletRefs))
|
||||||
r && addPopup(item, r as Popup);
|
r && addPopup(item, r as Popup);
|
||||||
}} title={itemTitleField && item ? getValue(item, itemTitleField) : undefined}
|
}} 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}
|
owner={itemOwnerField && item ? getValue(item, itemOwnerField) : undefined}
|
||||||
item={item}
|
item={item}
|
||||||
setItemFormPopup={setItemFormPopup} />
|
setItemFormPopup={setItemFormPopup} />
|
||||||
|
|||||||
@ -6,9 +6,7 @@ import { LatLng } from "leaflet";
|
|||||||
import { Item } from "../../../../types";
|
import { Item } from "../../../../types";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { useHasUserPermission } from "../../hooks/usePermissions";
|
import { useHasUserPermission } from "../../hooks/usePermissions";
|
||||||
import { timeAgo } from "../../../../Utils/TimeAgo";
|
|
||||||
import { useAuth } from "../../../Auth";
|
import { useAuth } from "../../../Auth";
|
||||||
import { useEffect } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,9 @@ import { Link } from 'react-router-dom'
|
|||||||
import { getValue } from '../../../../Utils/GetValue'
|
import { getValue } from '../../../../Utils/GetValue'
|
||||||
import { Item } from '../../../../types'
|
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 (
|
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>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: a
|
|||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</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'>
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { HexColorPicker } from "react-colorful";
|
|||||||
import "./ColorPicker.css"
|
import "./ColorPicker.css"
|
||||||
import useClickOutside from "./useClickOutside";
|
import useClickOutside from "./useClickOutside";
|
||||||
|
|
||||||
export const ColorPicker = ({ color = "#000", onChange, className }) => {
|
export const ColorPicker = ({ color, onChange, className }) => {
|
||||||
const popover = useRef<HTMLDivElement>(null);
|
const popover = useRef<HTMLDivElement>(null);
|
||||||
const [isOpen, toggle] = useState(false);
|
const [isOpen, toggle] = useState(false);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user