mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
fixed linting
This commit is contained in:
parent
7d3d8c006d
commit
3dc533676e
@ -83,7 +83,7 @@ export function SideBar ({ routes, bottomRoutes }: { routes: route[], bottomRout
|
|||||||
}}>
|
}}>
|
||||||
{route.icon}<span className="group-[&[data-te-sidenav-slim-collapsed='true']]:data-[te-sidenav-slim='false']:tw-hidden" data-te-sidenav-slim="false">{route.name}</span>
|
{route.icon}<span className="group-[&[data-te-sidenav-slim-collapsed='true']]:data-[te-sidenav-slim='false']:tw-hidden" data-te-sidenav-slim="false">{route.name}</span>
|
||||||
{
|
{
|
||||||
location.pathname.includes(route.path) && route.path.length > 1 || location.pathname === route.path
|
(location.pathname.includes(route.path) && route.path.length > 1) || location.pathname === route.path
|
||||||
? (<span className="tw-absolute tw-inset-y-0 tw-left-0 tw-w-1 tw-rounded-tr-md tw-rounded-br-md tw-bg-primary "
|
? (<span className="tw-absolute tw-inset-y-0 tw-left-0 tw-w-1 tw-rounded-tr-md tw-rounded-br-md tw-bg-primary "
|
||||||
aria-hidden="true"></span>)
|
aria-hidden="true"></span>)
|
||||||
: null
|
: null
|
||||||
@ -117,7 +117,7 @@ export function SideBar ({ routes, bottomRoutes }: { routes: route[], bottomRout
|
|||||||
}}>
|
}}>
|
||||||
{route.icon}<span className="group-[&[data-te-sidenav-slim-collapsed='true']]:data-[te-sidenav-slim='false']:tw-hidden" data-te-sidenav-slim="false">{route.name}</span>
|
{route.icon}<span className="group-[&[data-te-sidenav-slim-collapsed='true']]:data-[te-sidenav-slim='false']:tw-hidden" data-te-sidenav-slim="false">{route.name}</span>
|
||||||
{
|
{
|
||||||
location.pathname.includes(route.path) && route.path.length > 1 || location.pathname === route.path
|
(location.pathname.includes(route.path) && route.path.length > 1) || location.pathname === route.path
|
||||||
? (<span className="tw-absolute tw-inset-y-0 tw-left-0 tw-w-1 tw-rounded-tr-md tw-rounded-br-md tw-bg-primary "
|
? (<span className="tw-absolute tw-inset-y-0 tw-left-0 tw-w-1 tw-rounded-tr-md tw-rounded-br-md tw-bg-primary "
|
||||||
aria-hidden="true"></span>)
|
aria-hidden="true"></span>)
|
||||||
: null
|
: null
|
||||||
|
|||||||
@ -155,7 +155,7 @@ export const Layer = ({
|
|||||||
?.filter(item =>
|
?.filter(item =>
|
||||||
filterTags.length === 0 ? item : filterTags.some(tag => getItemTags(item).some(filterTag => filterTag.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())))
|
filterTags.length === 0 ? item : filterTags.some(tag => getItemTags(item).some(filterTag => filterTag.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())))
|
||||||
?.filter(item => item.layer && isLayerVisible(item.layer))
|
?.filter(item => item.layer && isLayerVisible(item.layer))
|
||||||
.filter(item => item.group_type && isGroupTypeVisible(item.group_type) || visibleGroupTypes.length === 0)
|
.filter(item => (item.group_type && isGroupTypeVisible(item.group_type)) || visibleGroupTypes.length === 0)
|
||||||
.map((item: Item) => {
|
.map((item: Item) => {
|
||||||
if (getValue(item, itemLongitudeField) && getValue(item, itemLatitudeField)) {
|
if (getValue(item, itemLongitudeField) && getValue(item, itemLatitudeField)) {
|
||||||
if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField)
|
if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField)
|
||||||
|
|||||||
@ -60,7 +60,7 @@ export const SearchControl = () => {
|
|||||||
setItemsResults(items.filter(item => {
|
setItemsResults(items.filter(item => {
|
||||||
if (item.layer?.itemNameField) item.name = getValue(item, item.layer.itemNameField)
|
if (item.layer?.itemNameField) item.name = getValue(item, item.layer.itemNameField)
|
||||||
if (item.layer?.itemTextField) item.text = getValue(item, item.layer.itemTextField)
|
if (item.layer?.itemTextField) item.text = getValue(item, item.layer.itemTextField)
|
||||||
return value.length > 2 && ((item.layer?.listed && item.name?.toLowerCase().includes(value.toLowerCase()) || item.text?.toLowerCase().includes(value.toLowerCase())))
|
return value.length > 2 && (((item.layer?.listed && item.name?.toLowerCase().includes(value.toLowerCase())) || item.text?.toLowerCase().includes(value.toLowerCase())))
|
||||||
}))
|
}))
|
||||||
let phrase = value
|
let phrase = value
|
||||||
if (value.startsWith('#')) phrase = value.substring(1)
|
if (value.startsWith('#')) phrase = value.substring(1)
|
||||||
@ -101,7 +101,7 @@ export const SearchControl = () => {
|
|||||||
</div>
|
</div>
|
||||||
<LocateControl />
|
<LocateControl />
|
||||||
</div>
|
</div>
|
||||||
{hideSuggestions || Array.from(geoResults).length === 0 && itemsResults.length === 0 && tagsResults.length === 0 && !isGeoCoordinate(value) || value.length === 0
|
{hideSuggestions || (Array.from(geoResults).length === 0 && itemsResults.length === 0 && tagsResults.length === 0 && !isGeoCoordinate(value)) || value.length === 0
|
||||||
? ''
|
? ''
|
||||||
: <div className='tw-card tw-card-body tw-bg-base-100 tw-p-4 tw-mt-2 tw-shadow-xl tw-overflow-y-auto tw-max-h-[calc(100dvh-152px)] tw-absolute tw-z-3000'>
|
: <div className='tw-card tw-card-body tw-bg-base-100 tw-p-4 tw-mt-2 tw-shadow-xl tw-overflow-y-auto tw-max-h-[calc(100dvh-152px)] tw-absolute tw-z-3000'>
|
||||||
{tagsResults.length > 0 &&
|
{tagsResults.length > 0 &&
|
||||||
|
|||||||
@ -20,33 +20,35 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
|
|
||||||
if (item && text && truncate) text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100)
|
if (item && text && truncate) text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100)
|
||||||
|
|
||||||
item && text ? replacedText = fixUrls(text) : ''
|
if (item && text) replacedText = fixUrls(text)
|
||||||
|
|
||||||
// eslint-disable-next-line no-useless-escape
|
// eslint-disable-next-line no-useless-escape
|
||||||
replacedText ? replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, (url) => {
|
if (replacedText) {
|
||||||
let shortUrl = url
|
replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s)]+(?!\))/g, (url) => {
|
||||||
// eslint-disable-next-line no-useless-escape
|
let shortUrl = url
|
||||||
if (url.match('^https:\/\/')) {
|
// eslint-disable-next-line no-useless-escape
|
||||||
shortUrl = url.split('https://')[1]
|
if (url.match('^https:\/\/')) {
|
||||||
}
|
shortUrl = url.split('https://')[1]
|
||||||
// eslint-disable-next-line no-useless-escape
|
}
|
||||||
if (url.match('^http:\/\/')) {
|
// eslint-disable-next-line no-useless-escape
|
||||||
shortUrl = url.split('http://')[1]
|
if (url.match('^http:\/\/')) {
|
||||||
}
|
shortUrl = url.split('http://')[1]
|
||||||
return `[${shortUrl}](${url})`
|
}
|
||||||
}) : ''
|
return `[${shortUrl}](${url})`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
replacedText
|
if (replacedText) {
|
||||||
? replacedText = replacedText.replace(mailRegex, (url) => {
|
replacedText = replacedText.replace(mailRegex, (url) => {
|
||||||
return `[${url}](mailto:${url})`
|
return `[${url}](mailto:${url})`
|
||||||
})
|
})
|
||||||
: ''
|
}
|
||||||
|
|
||||||
replacedText
|
if (replacedText) {
|
||||||
? replacedText = replacedText.replace(hashTagRegex, (match) => {
|
replacedText = replacedText.replace(hashTagRegex, (match) => {
|
||||||
return `[${match}](${match})`
|
return `[${match}](${match})`
|
||||||
})
|
})
|
||||||
: ''
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line react/prop-types
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH1 = ({ children }) => (
|
const CustomH1 = ({ children }) => (
|
||||||
|
|||||||
@ -13,12 +13,12 @@ function hsvToHex (h, s, v) {
|
|||||||
const t = v * (1 - (1 - f) * s)
|
const t = v * (1 - (1 - f) * s)
|
||||||
|
|
||||||
switch (i % 6) {
|
switch (i % 6) {
|
||||||
case 0: r = v, g = t, b = p; break
|
case 0: r = v; g = t; b = p; break
|
||||||
case 1: r = q, g = v, b = p; break
|
case 1: r = q; g = v; b = p; break
|
||||||
case 2: r = p, g = v, b = t; break
|
case 2: r = p; g = v; b = t; break
|
||||||
case 3: r = p, g = q, b = v; break
|
case 3: r = p; g = q; b = v; break
|
||||||
case 4: r = t, g = p, b = v; break
|
case 4: r = t; g = p; b = v; break
|
||||||
case 5: r = v, g = p, b = q; break
|
case 5: r = v; g = p; b = q; break
|
||||||
}
|
}
|
||||||
|
|
||||||
return rgbToHex(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255))
|
return rgbToHex(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user