diff --git a/src/Components/AppShell/SideBar.tsx b/src/Components/AppShell/SideBar.tsx index 3448ad0a..d4509e0a 100644 --- a/src/Components/AppShell/SideBar.tsx +++ b/src/Components/AppShell/SideBar.tsx @@ -83,7 +83,7 @@ export function SideBar ({ routes, bottomRoutes }: { routes: route[], bottomRout }}> {route.icon}{route.name} { - 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 ? () : null @@ -117,7 +117,7 @@ export function SideBar ({ routes, bottomRoutes }: { routes: route[], bottomRout }}> {route.icon}{route.name} { - 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 ? () : null diff --git a/src/Components/Map/Layer.tsx b/src/Components/Map/Layer.tsx index f300a06e..1f0deaf7 100644 --- a/src/Components/Map/Layer.tsx +++ b/src/Components/Map/Layer.tsx @@ -155,7 +155,7 @@ export const Layer = ({ ?.filter(item => 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.group_type && isGroupTypeVisible(item.group_type) || visibleGroupTypes.length === 0) + .filter(item => (item.group_type && isGroupTypeVisible(item.group_type)) || visibleGroupTypes.length === 0) .map((item: Item) => { if (getValue(item, itemLongitudeField) && getValue(item, itemLatitudeField)) { if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField) diff --git a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx index 3041e528..73be8e7b 100644 --- a/src/Components/Map/Subcomponents/Controls/SearchControl.tsx +++ b/src/Components/Map/Subcomponents/Controls/SearchControl.tsx @@ -60,7 +60,7 @@ export const SearchControl = () => { setItemsResults(items.filter(item => { if (item.layer?.itemNameField) item.name = getValue(item, item.layer.itemNameField) 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 if (value.startsWith('#')) phrase = value.substring(1) @@ -101,7 +101,7 @@ export const SearchControl = () => { - {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 ? '' :
{tagsResults.length > 0 && diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index dd699818..0d36a98a 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -20,33 +20,35 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i 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 - replacedText ? replacedText = replacedText.replace(/(? { - let shortUrl = url - // eslint-disable-next-line no-useless-escape - if (url.match('^https:\/\/')) { - shortUrl = url.split('https://')[1] - } - // eslint-disable-next-line no-useless-escape - if (url.match('^http:\/\/')) { - shortUrl = url.split('http://')[1] - } - return `[${shortUrl}](${url})` - }) : '' + if (replacedText) { + replacedText = replacedText.replace(/(? { + let shortUrl = url + // eslint-disable-next-line no-useless-escape + if (url.match('^https:\/\/')) { + shortUrl = url.split('https://')[1] + } + // eslint-disable-next-line no-useless-escape + if (url.match('^http:\/\/')) { + shortUrl = url.split('http://')[1] + } + return `[${shortUrl}](${url})` + }) + } - replacedText - ? replacedText = replacedText.replace(mailRegex, (url) => { + if (replacedText) { + replacedText = replacedText.replace(mailRegex, (url) => { return `[${url}](mailto:${url})` }) - : '' + } - replacedText - ? replacedText = replacedText.replace(hashTagRegex, (match) => { + if (replacedText) { + replacedText = replacedText.replace(hashTagRegex, (match) => { return `[${match}](${match})` }) - : '' + } // eslint-disable-next-line react/prop-types const CustomH1 = ({ children }) => ( diff --git a/src/Utils/RandomColor.ts b/src/Utils/RandomColor.ts index c615099c..fe80c782 100644 --- a/src/Utils/RandomColor.ts +++ b/src/Utils/RandomColor.ts @@ -13,12 +13,12 @@ function hsvToHex (h, s, v) { const t = v * (1 - (1 - f) * s) switch (i % 6) { - case 0: r = v, g = t, b = p; break - case 1: r = q, g = v, b = p; break - case 2: r = p, g = v, b = t; break - case 3: r = p, g = q, b = v; break - case 4: r = t, g = p, b = v; break - case 5: r = v, g = p, b = q; break + case 0: r = v; g = t; b = p; break + case 1: r = q; g = v; b = p; break + case 2: r = p; g = v; b = t; break + case 3: r = p; g = q; b = v; break + case 4: r = t; g = p; b = v; break + case 5: r = v; g = p; b = q; break } return rgbToHex(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255))