Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
antontranelis committed Nov 2, 2024
1 parent 7d3d8c0 commit 3dc5336
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/Components/AppShell/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
{
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 "
aria-hidden="true"></span>)
: null
Expand Down Expand Up @@ -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>
{
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 "
aria-hidden="true"></span>)
: null
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Map/Layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Map/Subcomponents/Controls/SearchControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -101,7 +101,7 @@ export const SearchControl = () => {
</div>
<LocateControl />
</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'>
{tagsResults.length > 0 &&
Expand Down
40 changes: 21 additions & 19 deletions src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, (url) => {
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(/(?<!\]?\()https?:\/\/[^\s)]+(?!\))/g, (url) => {
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 }) => (
Expand Down
12 changes: 6 additions & 6 deletions src/Utils/RandomColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 3dc5336

Please sign in to comment.