mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
lint fixes
This commit is contained in:
parent
0dcbd6bb1c
commit
5807869721
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
import * as React from 'react'
|
||||
|
||||
type ContentProps = {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { ToastContainer } from 'react-toastify'
|
||||
import { QuestsProvider } from '../Gaming/hooks/useQuests'
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
import { useAuth } from '../Auth'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useRef, useState, useEffect } from 'react'
|
||||
import { NavLink, useLocation } from 'react-router-dom'
|
||||
import { Sidenav, initTE } from 'tw-elements'
|
||||
@ -5,9 +11,9 @@ import SidebarSubmenu from './SidebarSubmenu'
|
||||
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon'
|
||||
import * as React from 'react'
|
||||
|
||||
type route = {
|
||||
interface route {
|
||||
path: string
|
||||
// eslint-disable-next-line no-undef
|
||||
|
||||
icon: JSX.Element
|
||||
name: string
|
||||
submenu?: route
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import ChevronDownIcon from '@heroicons/react/24/outline/ChevronDownIcon'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
@ -8,7 +12,7 @@ function SidebarSubmenu({
|
||||
icon,
|
||||
}: {
|
||||
path: string
|
||||
// eslint-disable-next-line no-undef
|
||||
|
||||
icon: JSX.Element
|
||||
name: string
|
||||
submenu?: any | undefined
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useState, createContext, useContext } from 'react'
|
||||
|
||||
import * as React from 'react'
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link, useNavigate } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
|
||||
@ -1,19 +1,26 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { createContext, useState, useContext, useEffect } from 'react'
|
||||
import * as React from 'react'
|
||||
import { UserApi, UserItem } from '../../types'
|
||||
|
||||
type AuthProviderProps = {
|
||||
interface AuthProviderProps {
|
||||
userApi: UserApi
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
type AuthCredentials = {
|
||||
interface AuthCredentials {
|
||||
email: string
|
||||
password: string
|
||||
otp?: string | undefined
|
||||
}
|
||||
|
||||
type AuthContextProps = {
|
||||
interface AuthContextProps {
|
||||
isAuthenticated: boolean
|
||||
user: UserItem | null
|
||||
login: (credentials: AuthCredentials) => Promise<UserItem | undefined>
|
||||
@ -58,9 +65,9 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
||||
setToken(token)
|
||||
if (token) {
|
||||
const me = await userApi.getUser()
|
||||
setUser(me as UserItem)
|
||||
setUser(me)
|
||||
setLoading(false)
|
||||
return me as UserItem
|
||||
return me
|
||||
} else return undefined
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'
|
||||
import { useAuth } from '../Auth'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useState, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import * as React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import { TagView } from '../Templates/TagView'
|
||||
@ -10,12 +17,12 @@ export const Autocomplete = ({
|
||||
setFocus,
|
||||
}: {
|
||||
inputProps: any
|
||||
suggestions: Array<any>
|
||||
suggestions: any[]
|
||||
onSelected: (suggestion) => void
|
||||
pushFilteredSuggestions?: Array<any>
|
||||
pushFilteredSuggestions?: any[]
|
||||
setFocus?: boolean
|
||||
}) => {
|
||||
const [filteredSuggestions, setFilteredSuggestions] = React.useState<Array<any>>([])
|
||||
const [filteredSuggestions, setFilteredSuggestions] = React.useState<any[]>([])
|
||||
const [heighlightedSuggestion, setHeighlightedSuggestion] = React.useState<number>(0)
|
||||
|
||||
useEffect(() => {
|
||||
@ -28,7 +35,6 @@ export const Autocomplete = ({
|
||||
|
||||
const inputRef = React.useRef<HTMLInputElement>()
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const getSuggestionValue = (suggestion) => suggestion.name
|
||||
|
||||
const getSuggestions = (value) => {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { useState } from 'react'
|
||||
import * as React from 'react'
|
||||
|
||||
@ -9,7 +10,6 @@ interface ComboBoxProps {
|
||||
}
|
||||
|
||||
const ComboBoxInput = ({ id, options, value, onValueChange }: ComboBoxProps) => {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [selectedValue, setSelectedValue] = useState(value)
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useState } from 'react'
|
||||
import InformationCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon'
|
||||
import * as React from 'react'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/consistent-indexed-object-style */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import * as React from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import Tribute from 'tributejs'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { useEffect, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { Marker, Tooltip, useMap, useMapEvents } from 'react-leaflet'
|
||||
import { Item, LayerProps, Tag } from '../../types'
|
||||
@ -171,7 +180,7 @@ export const Layer = ({
|
||||
}
|
||||
let title = ''
|
||||
if (item.name) title = item.name
|
||||
else if (item.layer?.itemNameField) title = getValue(item, item.layer.itemNameField)
|
||||
else if (item.layer.itemNameField) title = getValue(item, item.layer.itemNameField)
|
||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||
}
|
||||
},
|
||||
@ -187,7 +196,7 @@ export const Layer = ({
|
||||
if (window.location.pathname.split('/')[1]) {
|
||||
const id = window.location.pathname.split('/')[1]
|
||||
const ref = leafletRefs[id]
|
||||
if (ref?.marker && ref.item.layer?.name === name) {
|
||||
if (ref.marker && ref.item.layer?.name === name) {
|
||||
ref.marker &&
|
||||
clusterRef.hasLayer(ref.marker) &&
|
||||
clusterRef?.zoomToShowLayer(ref.marker, () => {
|
||||
@ -195,7 +204,7 @@ export const Layer = ({
|
||||
})
|
||||
let title = ''
|
||||
if (ref.item.name) title = ref.item.name
|
||||
else if (ref.item.layer?.itemNameField)
|
||||
else if (ref.item.layer.itemNameField)
|
||||
title = getValue(ref.item.name, ref.item.layer.itemNameField)
|
||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||
document
|
||||
@ -233,7 +242,7 @@ export const Layer = ({
|
||||
{items &&
|
||||
items
|
||||
.filter((item) => item.layer?.name === name)
|
||||
?.filter((item) =>
|
||||
.filter((item) =>
|
||||
filterTags.length === 0
|
||||
? item
|
||||
: filterTags.some((tag) =>
|
||||
@ -243,7 +252,7 @@ export const Layer = ({
|
||||
),
|
||||
),
|
||||
)
|
||||
?.filter((item) => item.layer && isLayerVisible(item.layer))
|
||||
.filter((item) => item.layer && isLayerVisible(item.layer))
|
||||
.filter(
|
||||
(item) =>
|
||||
(item.group_type && isGroupTypeVisible(item.group_type)) ||
|
||||
@ -254,7 +263,7 @@ export const Layer = ({
|
||||
if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField)
|
||||
else item[itemTextField] = ''
|
||||
|
||||
if (item?.tags) {
|
||||
if (item.tags) {
|
||||
item[itemTextField] = item[itemTextField] + '\n\n'
|
||||
item.tags.map((tag) => {
|
||||
if (!item[itemTextField].includes(`#${encodeTag(tag)}`)) {
|
||||
@ -372,7 +381,7 @@ export const Layer = ({
|
||||
// {children}}
|
||||
}
|
||||
{itemFormPopup &&
|
||||
itemFormPopup.layer!.name === name &&
|
||||
itemFormPopup.layer.name === name &&
|
||||
(children &&
|
||||
React.Children.toArray(children).some(
|
||||
(child) => React.isValidElement(child) && child.props.__TYPE === 'ItemForm',
|
||||
@ -381,10 +390,10 @@ export const Layer = ({
|
||||
React.isValidElement(child) && child.props.__TYPE === 'ItemForm' ? (
|
||||
<ItemFormPopup
|
||||
key={setItemFormPopup?.name}
|
||||
position={itemFormPopup!.position}
|
||||
layer={itemFormPopup!.layer}
|
||||
position={itemFormPopup.position}
|
||||
layer={itemFormPopup.layer}
|
||||
setItemFormPopup={setItemFormPopup}
|
||||
item={itemFormPopup!.item}
|
||||
item={itemFormPopup.item}
|
||||
>
|
||||
{child}
|
||||
</ItemFormPopup>
|
||||
@ -395,10 +404,10 @@ export const Layer = ({
|
||||
) : (
|
||||
<>
|
||||
<ItemFormPopup
|
||||
position={itemFormPopup!.position}
|
||||
layer={itemFormPopup!.layer}
|
||||
position={itemFormPopup.position}
|
||||
layer={itemFormPopup.layer}
|
||||
setItemFormPopup={setItemFormPopup}
|
||||
item={itemFormPopup!.item}
|
||||
item={itemFormPopup.item}
|
||||
/>
|
||||
</>
|
||||
))}
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import * as React from 'react'
|
||||
import { useLayers } from '../hooks/useLayers'
|
||||
import { useHasUserPermission } from '../hooks/usePermissions'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as L from 'leaflet'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-ts-expect-error */
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as L from 'leaflet'
|
||||
import { useMap, useMapEvents } from 'react-leaflet'
|
||||
import 'leaflet.locatecontrol'
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { useAddFilterTag } from '../../hooks/useFilter'
|
||||
import useWindowDimensions from '../../hooks/useWindowDimension'
|
||||
@ -23,9 +35,9 @@ export const SearchControl = () => {
|
||||
const [popupOpen, setPopupOpen] = useState(false)
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
const [geoResults, setGeoResults] = useState<Array<any>>([])
|
||||
const [tagsResults, setTagsResults] = useState<Array<any>>([])
|
||||
const [itemsResults, setItemsResults] = useState<Array<Item>>([])
|
||||
const [geoResults, setGeoResults] = useState<any[]>([])
|
||||
const [tagsResults, setTagsResults] = useState<any[]>([])
|
||||
const [itemsResults, setItemsResults] = useState<Item[]>([])
|
||||
const [hideSuggestions, setHideSuggestions] = useState(true)
|
||||
|
||||
const map = useMap()
|
||||
@ -62,14 +74,14 @@ export const SearchControl = () => {
|
||||
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()))
|
||||
((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)
|
||||
setTagsResults(tags.filter((tag) => tag.name?.toLowerCase().includes(phrase.toLowerCase())))
|
||||
setTagsResults(tags.filter((tag) => tag.name.toLowerCase().includes(phrase.toLowerCase())))
|
||||
},
|
||||
500,
|
||||
[value],
|
||||
|
||||
@ -17,7 +17,7 @@ export const TagsControl = () => {
|
||||
<div className='tw-card-actions tw-justify-end'>
|
||||
<label
|
||||
className='tw-btn tw-btn-xs tw-btn-circle tw-absolute tw--right-2 tw--top-2 tw-bg-white tw-text-gray-600'
|
||||
onClick={() => removeFilterTag(tag.name!)}
|
||||
onClick={() => removeFilterTag(tag.name)}
|
||||
>
|
||||
✕
|
||||
</label>
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { LatLng } from 'leaflet'
|
||||
import { Popup as LeafletPopup, useMap } from 'react-leaflet'
|
||||
@ -24,7 +33,6 @@ export interface ItemFormPopupProps {
|
||||
export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
const [spinner, setSpinner] = useState(false)
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [popupTitle, setPopupTitle] = useState<string>('')
|
||||
|
||||
const formRef = useRef<HTMLFormElement>(null)
|
||||
@ -34,7 +42,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
const addItem = useAddItem()
|
||||
const updateItem = useUpdateItem()
|
||||
const items = useItems()
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
const removeItem = useRemoveItem()
|
||||
|
||||
const tags = useTags()
|
||||
@ -93,7 +101,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
try {
|
||||
props.layer.onlyOnePerOwner &&
|
||||
item &&
|
||||
(await props.layer.api?.updateItem!({ ...formItem, id: item?.id }))
|
||||
(await props.layer.api?.updateItem!({ ...formItem, id: item.id }))
|
||||
;(!props.layer.onlyOnePerOwner || !item) &&
|
||||
(await props.layer.api?.createItem!({
|
||||
...formItem,
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import * as React from 'react'
|
||||
import { Item, ItemsApi } from '../../../../types'
|
||||
import { useHasUserPermission } from '../../hooks/usePermissions'
|
||||
@ -50,16 +61,16 @@ export function HeaderView({
|
||||
`${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`
|
||||
: item.layer?.itemAvatarField &&
|
||||
item &&
|
||||
getValue(item, item.layer?.itemAvatarField) &&
|
||||
getValue(item, item.layer.itemAvatarField) &&
|
||||
assetsApi.url +
|
||||
getValue(item, item.layer?.itemAvatarField) +
|
||||
getValue(item, item.layer.itemAvatarField) +
|
||||
`${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`
|
||||
const title = itemNameField
|
||||
? getValue(item, itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField)
|
||||
const subtitle = itemSubnameField
|
||||
? getValue(item, itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField)
|
||||
|
||||
const [address] = React.useState<string>('')
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Link } from 'react-router-dom'
|
||||
import { getValue } from '../../../../Utils/GetValue'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import * as React from 'react'
|
||||
import { TextInput } from '../../../Input'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
type StartEndInputProps = {
|
||||
interface StartEndInputProps {
|
||||
item?: Item
|
||||
showLabels?: boolean
|
||||
updateStartValue?: (value: string) => void
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { Item } from '../../../../types'
|
||||
import { useTags } from '../../hooks/useTags'
|
||||
import { useAddFilterTag } from '../../hooks/useFilter'
|
||||
@ -31,7 +40,7 @@ export const TextView = ({
|
||||
} else if (itemTextField && item) {
|
||||
text = getValue(item, itemTextField)
|
||||
} else {
|
||||
text = item?.layer?.itemTextField && item ? getValue(item, item.layer?.itemTextField) : ''
|
||||
text = item?.layer?.itemTextField && item ? getValue(item, item.layer.itemTextField) : ''
|
||||
}
|
||||
|
||||
if (item && text && truncate) text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100)
|
||||
@ -106,10 +115,10 @@ export const TextView = ({
|
||||
return (
|
||||
<a
|
||||
style={{ color: tag ? tag.color : '#faa', fontWeight: 'bold', cursor: 'pointer' }}
|
||||
key={tag ? tag.name + item!.id : item.id}
|
||||
key={tag ? tag.name + item.id : item.id}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
addFilterTag(tag!)
|
||||
addFilterTag(tag)
|
||||
}}
|
||||
>
|
||||
{decodeTag(children)}
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { Popup as LeafletPopup, useMap } from 'react-leaflet'
|
||||
import { Item } from '../../../types'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
export const SelectPosition = ({ setSelectNewItemPosition }: { setSelectNewItemPosition }) => {
|
||||
return (
|
||||
<div className='tw-animate-pulseGrow tw-button tw-z-1000 tw-absolute tw-right-5 tw-top-4 tw-drop-shadow-md'>
|
||||
|
||||
@ -27,16 +27,16 @@ export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) {
|
||||
const decodedTags = urlTags ? decodeURIComponent(urlTags) : ''
|
||||
const decodedTagsArray = decodedTags.split(';')
|
||||
if (
|
||||
decodedTagsArray?.some(
|
||||
decodedTagsArray.some(
|
||||
(ut) => !filterTags.find((ft) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()),
|
||||
) ||
|
||||
filterTags?.some(
|
||||
filterTags.some(
|
||||
(ft) =>
|
||||
!decodedTagsArray?.find((ut) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()),
|
||||
!decodedTagsArray.find((ut) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()),
|
||||
)
|
||||
) {
|
||||
resetFilterTags()
|
||||
decodedTagsArray?.map((urlTag) => {
|
||||
decodedTagsArray.map((urlTag) => {
|
||||
const tag = tags.find((t) => t.name.toLocaleLowerCase() === urlTag.toLocaleLowerCase())
|
||||
tag && addFilterTag(tag)
|
||||
return null
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { TileLayer, MapContainer, useMapEvents, GeoJSON } from 'react-leaflet'
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
import * as React from 'react'
|
||||
@ -99,7 +107,6 @@ export function UtopiaMapInner({
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const onEachFeature = (feature: Feature<GeoJSONGeometry, any>, layer: L.Layer) => {
|
||||
if (feature.properties) {
|
||||
layer.bindPopup(feature.properties.name)
|
||||
@ -157,7 +164,7 @@ export function UtopiaMapInner({
|
||||
eventHandlers={{
|
||||
click: (e) => {
|
||||
if (selectNewItemPosition) {
|
||||
e.layer!.closePopup()
|
||||
e.layer.closePopup()
|
||||
setMapClicked({ position: e.latlng, setItemFormPopup })
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as React from 'react'
|
||||
import { createContext, useContext, useState } from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { useEffect } from 'react'
|
||||
import { useTimeout } from './useTimeout'
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable no-case-declarations */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
@ -121,7 +125,7 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
const urlTags = params.get('tags')
|
||||
const decodedTags = urlTags ? decodeURIComponent(urlTags) : ''
|
||||
|
||||
if (!decodedTags?.includes(tag.name)) {
|
||||
if (!decodedTags.includes(tag.name)) {
|
||||
params.set('tags', `${urlTags || ''}${urlTags ? ';' : ''}${tag.name}`)
|
||||
}
|
||||
if (windowDimensions.width < 786 && location.pathname.split('/').length > 2)
|
||||
@ -141,7 +145,7 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
const urlTags = params.get('tags')
|
||||
let newUrlTags = ''
|
||||
const tags = urlTags?.split(';')
|
||||
if (tags?.length === 0 && urlTags?.length && urlTags?.length > 0) tags[0] = urlTags
|
||||
if (tags?.length === 0 && urlTags?.length && urlTags.length > 0) tags[0] = urlTags
|
||||
tags?.map((urlTag) => {
|
||||
if (!(urlTag.toLocaleLowerCase() === name.toLocaleLowerCase())) {
|
||||
newUrlTags = newUrlTags + `${newUrlTags === '' ? urlTag : `;${urlTag}`}`
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
import { useCallback, useReducer, createContext, useContext, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item, LayerProps } from '../../../types'
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { LayerProps } from '../../../types'
|
||||
|
||||
type ActionType = { type: 'ADD LAYER'; layer: LayerProps }
|
||||
interface ActionType {
|
||||
type: 'ADD LAYER'
|
||||
layer: LayerProps
|
||||
}
|
||||
|
||||
type UseItemManagerResult = ReturnType<typeof useLayerManager>
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../../types'
|
||||
import { Marker, Popup } from 'leaflet'
|
||||
|
||||
type LeafletRef = {
|
||||
interface LeafletRef {
|
||||
item: Item
|
||||
marker: Marker
|
||||
popup: Popup
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item, ItemsApi, LayerProps, Permission, PermissionAction } from '../../../types'
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import * as React from 'react'
|
||||
import { createContext, useContext, useEffect, useState } from 'react'
|
||||
import { Geometry, Item, LayerProps } from '../../../types'
|
||||
@ -7,7 +16,7 @@ import { useHasUserPermission } from './usePermissions'
|
||||
import { LatLng } from 'leaflet'
|
||||
import { ItemFormPopupProps } from '../Subcomponents/ItemFormPopup'
|
||||
|
||||
type PolygonClickedProps = {
|
||||
interface PolygonClickedProps {
|
||||
position: LatLng
|
||||
setItemFormPopup: React.Dispatch<React.SetStateAction<ItemFormPopupProps | null>>
|
||||
}
|
||||
@ -51,15 +60,14 @@ function useSelectPositionManager(): {
|
||||
mapClicked &&
|
||||
mapClicked.setItemFormPopup({
|
||||
layer: selectPosition as LayerProps,
|
||||
position: mapClicked?.position,
|
||||
position: mapClicked.position,
|
||||
})
|
||||
setSelectPosition(null)
|
||||
}
|
||||
if ('text' in selectPosition) {
|
||||
const position =
|
||||
mapClicked?.position.lng &&
|
||||
new Geometry(mapClicked?.position.lng, mapClicked?.position.lat)
|
||||
position && itemUpdatePosition({ ...(selectPosition as Item), position })
|
||||
mapClicked?.position.lng && new Geometry(mapClicked.position.lng, mapClicked.position.lat)
|
||||
position && itemUpdatePosition({ ...selectPosition, position })
|
||||
setSelectPosition(null)
|
||||
}
|
||||
}
|
||||
@ -70,11 +78,11 @@ function useSelectPositionManager(): {
|
||||
const itemUpdateParent = async (updatedItem: Item) => {
|
||||
if (
|
||||
markerClicked?.layer?.api?.collectionName &&
|
||||
hasUserPermission(markerClicked?.layer?.api?.collectionName, 'update', markerClicked)
|
||||
hasUserPermission(markerClicked.layer.api.collectionName, 'update', markerClicked)
|
||||
) {
|
||||
let success = false
|
||||
try {
|
||||
await updatedItem?.layer?.api?.updateItem!({
|
||||
await updatedItem.layer?.api?.updateItem!({
|
||||
id: updatedItem.id,
|
||||
parent: updatedItem.parent,
|
||||
position: null,
|
||||
@ -99,7 +107,7 @@ function useSelectPositionManager(): {
|
||||
const itemUpdatePosition = async (updatedItem: Item) => {
|
||||
let success = false
|
||||
try {
|
||||
await updatedItem?.layer?.api?.updateItem!({
|
||||
await updatedItem.layer?.api?.updateItem!({
|
||||
id: updatedItem.id,
|
||||
position: updatedItem.position,
|
||||
})
|
||||
@ -118,12 +126,12 @@ function useSelectPositionManager(): {
|
||||
const newRelations = markerClicked.relations || []
|
||||
|
||||
if (!newRelations.some((r) => r.related_items_id === id)) {
|
||||
newRelations?.push({ items_id: markerClicked.id, related_items_id: id })
|
||||
newRelations.push({ items_id: markerClicked.id, related_items_id: id })
|
||||
const updatedItem = { id: markerClicked.id, relations: newRelations }
|
||||
|
||||
let success = false
|
||||
try {
|
||||
await markerClicked?.layer?.api?.updateItem!(updatedItem)
|
||||
await markerClicked.layer?.api?.updateItem!(updatedItem)
|
||||
success = true
|
||||
} catch (error) {
|
||||
toast.error(error.toString())
|
||||
|
||||
@ -1,3 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useCallback, useReducer, createContext, useContext, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item, ItemsApi, Tag } from '../../../types'
|
||||
@ -77,14 +87,14 @@ function useTagsManager(initialTags: Tag[]): {
|
||||
tag,
|
||||
})
|
||||
if (!tags.some((t) => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) {
|
||||
api?.createItem && api.createItem(tag)
|
||||
api.createItem && api.createItem(tag)
|
||||
}
|
||||
}
|
||||
|
||||
const getItemTags = useCallback(
|
||||
(item: Item) => {
|
||||
const text =
|
||||
item?.layer?.itemTextField && item ? getValue(item, item.layer?.itemTextField) : undefined
|
||||
item.layer?.itemTextField && item ? getValue(item, item.layer.itemTextField) : undefined
|
||||
const itemTagStrings = text?.match(hashTagRegex)
|
||||
const itemTags: Tag[] = []
|
||||
itemTagStrings?.map((tag) => {
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { useCallback, useEffect, useRef } from 'react'
|
||||
|
||||
export const useTimeout = (callback, delay) => {
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { useMap } from 'react-leaflet'
|
||||
|
||||
export const setItemLocation = () => {
|
||||
// eslint-disable-next-line no-unused-vars, react-hooks/rules-of-hooks
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const map = useMap()
|
||||
|
||||
return <div></div>
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable no-constant-condition */
|
||||
import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems'
|
||||
import { useEffect, useState } from 'react'
|
||||
@ -80,25 +87,25 @@ export function ProfileForm({ userType }: { userType: string }) {
|
||||
|
||||
useEffect(() => {
|
||||
const newColor =
|
||||
item.layer?.itemColorField && getValue(item, item.layer?.itemColorField)
|
||||
? getValue(item, item.layer?.itemColorField)
|
||||
item.layer?.itemColorField && getValue(item, item.layer.itemColorField)
|
||||
? getValue(item, item.layer.itemColorField)
|
||||
: getItemTags(item) && getItemTags(item)[0]?.color
|
||||
? getItemTags(item)[0].color
|
||||
: item?.layer?.markerDefaultColor
|
||||
: item.layer?.markerDefaultColor
|
||||
|
||||
const offers = (item?.offers ?? []).reduce((acc: Tag[], o) => {
|
||||
const offers = (item.offers ?? []).reduce((acc: Tag[], o) => {
|
||||
const offer = tags.find((t) => t.id === o.tags_id)
|
||||
if (offer) acc.push(offer)
|
||||
return acc
|
||||
}, [])
|
||||
|
||||
const needs = (item?.needs ?? []).reduce((acc: Tag[], o) => {
|
||||
const needs = (item.needs ?? []).reduce((acc: Tag[], o) => {
|
||||
const need = tags.find((t) => t.id === o.tags_id)
|
||||
if (need) acc.push(need)
|
||||
return acc
|
||||
}, [])
|
||||
|
||||
const relations = (item?.relations ?? []).reduce((acc: Item[], r) => {
|
||||
const relations = (item.relations ?? []).reduce((acc: Item[], r) => {
|
||||
const relatedItem = items.find((i) => i.id === r.related_items_id)
|
||||
if (relatedItem) acc.push(relatedItem)
|
||||
return acc
|
||||
@ -106,22 +113,22 @@ export function ProfileForm({ userType }: { userType: string }) {
|
||||
|
||||
setState({
|
||||
color: newColor,
|
||||
id: item?.id ?? '',
|
||||
groupType: item?.group_type ?? 'wuerdekompass',
|
||||
status: item?.status ?? 'active',
|
||||
name: item?.name ?? '',
|
||||
subname: item?.subname ?? '',
|
||||
text: item?.text ?? '',
|
||||
contact: item?.contact ?? '',
|
||||
telephone: item?.telephone ?? '',
|
||||
nextAppointment: item?.next_appointment ?? '',
|
||||
image: item?.image ?? '',
|
||||
markerIcon: item?.marker_icon ?? '',
|
||||
id: item.id ?? '',
|
||||
groupType: item.group_type ?? 'wuerdekompass',
|
||||
status: item.status ?? 'active',
|
||||
name: item.name ?? '',
|
||||
subname: item.subname ?? '',
|
||||
text: item.text ?? '',
|
||||
contact: item.contact ?? '',
|
||||
telephone: item.telephone ?? '',
|
||||
nextAppointment: item.next_appointment ?? '',
|
||||
image: item.image ?? '',
|
||||
markerIcon: item.marker_icon ?? '',
|
||||
offers,
|
||||
needs,
|
||||
relations,
|
||||
start: item?.start ?? '',
|
||||
end: item?.end ?? '',
|
||||
start: item.start ?? '',
|
||||
end: item.end ?? '',
|
||||
})
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item, tags, items])
|
||||
@ -180,7 +187,7 @@ export function ProfileForm({ userType }: { userType: string }) {
|
||||
style={
|
||||
true
|
||||
? {
|
||||
backgroundColor: `${item.layer?.itemColorField && getValue(item, item.layer?.itemColorField) ? getValue(item, item.layer?.itemColorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`,
|
||||
backgroundColor: `${item.layer?.itemColorField && getValue(item, item.layer.itemColorField) ? getValue(item, item.layer.itemColorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`,
|
||||
color: '#fff',
|
||||
}
|
||||
: { color: '#fff' }
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { MapOverlayPage } from '../Templates'
|
||||
import { useItems, useRemoveItem, useUpdateItem } from '../Map/hooks/useItems'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
@ -26,9 +35,9 @@ export function ProfileView({
|
||||
}) {
|
||||
const [item, setItem] = useState<Item>()
|
||||
const [updatePermission, setUpdatePermission] = useState<boolean>(false)
|
||||
const [relations, setRelations] = useState<Array<Item>>([])
|
||||
const [offers, setOffers] = useState<Array<Tag>>([])
|
||||
const [needs, setNeeds] = useState<Array<Tag>>([])
|
||||
const [relations, setRelations] = useState<Item[]>([])
|
||||
const [offers, setOffers] = useState<Tag[]>([])
|
||||
const [needs, setNeeds] = useState<Tag[]>([])
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
const [template, setTemplate] = useState<string>('')
|
||||
|
||||
@ -45,7 +54,7 @@ export function ProfileView({
|
||||
const clusterRef = useClusterRef()
|
||||
const leafletRefs = useLeafletRefs()
|
||||
|
||||
const [attestations, setAttestations] = useState<Array<any>>([])
|
||||
const [attestations, setAttestations] = useState<any[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
if (attestationApi) {
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { useState } from 'react'
|
||||
import { useHasUserPermission } from '../../Map/hooks/usePermissions'
|
||||
import DialogModal from '../../Templates/DialogModal'
|
||||
@ -52,7 +56,7 @@ export function ActionButton({
|
||||
setModalOpen(true)
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`,
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`,
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
@ -76,7 +80,7 @@ export function ActionButton({
|
||||
triggerAddButton()
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`,
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`,
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import * as React from 'react'
|
||||
import { useState, useCallback, useRef } from 'react'
|
||||
import ReactCrop, { Crop, centerCrop, makeAspectCrop } from 'react-image-crop'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
import { HexColorPicker } from 'react-colorful'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
import { Link } from 'react-router-dom'
|
||||
import { useAssetApi } from '../../AppShell/hooks/useAssets'
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable react/prop-types */
|
||||
import { TextInput } from '../../Input'
|
||||
import { AvatarWidget } from './AvatarWidget'
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { useEffect } from 'react'
|
||||
import { getValue } from '../../../Utils/GetValue'
|
||||
import { Item } from '../../../types'
|
||||
@ -27,14 +34,14 @@ export function LinkedItemsHeaderView({
|
||||
? assetsApi.url + getValue(item, itemAvatarField)
|
||||
: item.layer?.itemAvatarField &&
|
||||
item &&
|
||||
getValue(item, item.layer?.itemAvatarField) &&
|
||||
assetsApi.url + getValue(item, item.layer?.itemAvatarField)
|
||||
getValue(item, item.layer.itemAvatarField) &&
|
||||
assetsApi.url + getValue(item, item.layer.itemAvatarField)
|
||||
const title = itemNameField
|
||||
? getValue(item, itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField)
|
||||
const subtitle = itemSubnameField
|
||||
? getValue(item, itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField)
|
||||
|
||||
useEffect(() => {}, [item])
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { LayerProps } from '../../../types'
|
||||
import { useHasUserPermission } from '../../Map/hooks/usePermissions'
|
||||
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import SocialShareBar from './SocialShareBar'
|
||||
|
||||
/* const flags = {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const RelationCard = ({ title, description, imageSrc }) => (
|
||||
<div className={`tw-mb-6 ${imageSrc ? 'md:tw-flex md:tw-space-x-4' : ''}`}>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import SocialShareButton from './SocialShareButton'
|
||||
|
||||
const SocialShareBar = ({
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
|
||||
const platformConfigs = {
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTags } from '../../Map/hooks/useTags'
|
||||
@ -11,10 +17,10 @@ export const TagsWidget = ({ placeholder, containerStyle, defaultTags, onUpdate
|
||||
const [input, setInput] = useState('')
|
||||
const [isKeyReleased, setIsKeyReleased] = useState(false)
|
||||
const tags = useTags()
|
||||
const [pushFilteredSuggestions, setPushFilteredSuggestions] = useState<Array<any>>([])
|
||||
const [pushFilteredSuggestions, setPushFilteredSuggestions] = useState<any[]>([])
|
||||
|
||||
const [focusInput, setFocusInput] = useState<boolean>(false)
|
||||
const [currentTags, setCurrentTags] = useState<Array<Tag>>(defaultTags)
|
||||
const [currentTags, setCurrentTags] = useState<Tag[]>(defaultTags)
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentTags(defaultTags)
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import { Item, Tag } from '../../../types'
|
||||
@ -34,7 +37,7 @@ export const OnepagerForm = ({
|
||||
case 'wuerdekompass':
|
||||
setState((prevState) => ({
|
||||
...prevState,
|
||||
color: item?.layer?.menuColor || '#1A5FB4',
|
||||
color: item.layer?.menuColor || '#1A5FB4',
|
||||
markerIcon: 'group',
|
||||
image: '59e6a346-d1ee-4767-9e42-fc720fb535c9',
|
||||
}))
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Item } from '../../../types'
|
||||
import { TextView } from '../../Map'
|
||||
import ContactInfo from '../Subcomponents/ContactInfo'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { TextAreaInput } from '../../Input'
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable react/prop-types */
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { TextAreaInput } from '../../Input'
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { StartEndView, TextView } from '../../Map'
|
||||
import { TagView } from '../../Templates/TagView'
|
||||
import { LinkedItemsHeaderView } from '../Subcomponents/LinkedItemsHeaderView'
|
||||
@ -22,12 +30,12 @@ export const TabsView = ({
|
||||
linkItem,
|
||||
unlinkItem,
|
||||
}: {
|
||||
attestations: Array<any>
|
||||
attestations: any[]
|
||||
userType: string
|
||||
item: Item
|
||||
offers: Array<Tag>
|
||||
needs: Array<Tag>
|
||||
relations: Array<Item>
|
||||
offers: Tag[]
|
||||
needs: Tag[]
|
||||
relations: Item[]
|
||||
updatePermission: boolean
|
||||
loading: boolean
|
||||
linkItem: (id: string) => Promise<void>
|
||||
@ -110,7 +118,7 @@ export const TabsView = ({
|
||||
className={
|
||||
'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]'
|
||||
}
|
||||
aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'}`}
|
||||
aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'}`}
|
||||
checked={activeTab === 2 && true}
|
||||
onChange={() => updateActiveTab(2)}
|
||||
/>
|
||||
@ -175,8 +183,8 @@ export const TabsView = ({
|
||||
type='radio'
|
||||
name='my_tabs_2'
|
||||
role='tab'
|
||||
className={`tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer?.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`}
|
||||
aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`}
|
||||
className={`tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`}
|
||||
aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`}
|
||||
checked={activeTab === 3 && true}
|
||||
onChange={() => updateActiveTab(3)}
|
||||
/>
|
||||
@ -192,7 +200,7 @@ export const TabsView = ({
|
||||
<div className='tw-flex tw-flex-wrap tw-mb-4'>
|
||||
{offers.map((o) => (
|
||||
<TagView
|
||||
key={o?.id}
|
||||
key={o.id}
|
||||
tag={o}
|
||||
onClick={() => {
|
||||
addFilterTag(o)
|
||||
@ -209,7 +217,7 @@ export const TabsView = ({
|
||||
<h3 className='-tw-mb-2 tw-col-span-1'>Needs</h3>
|
||||
<div className='tw-flex tw-flex-wrap tw-mb-4'>
|
||||
{needs.map((n) => (
|
||||
<TagView key={n?.id} tag={n} onClick={() => addFilterTag(n)} />
|
||||
<TagView key={n.id} tag={n} onClick={() => addFilterTag(n)} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
@ -229,7 +237,7 @@ export const TabsView = ({
|
||||
name='my_tabs_2'
|
||||
role='tab'
|
||||
className='tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]'
|
||||
aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Relations'}`}
|
||||
aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Relations'}`}
|
||||
checked={activeTab === 7 && true}
|
||||
onChange={() => updateActiveTab(7)}
|
||||
/>
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as React from 'react'
|
||||
import { MapOverlayPage } from '../Templates'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useEffect } from 'react'
|
||||
|
||||
// Improved version of https://usehooks.com/useOnClickOutside/
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../types'
|
||||
import { encodeTag } from '../../Utils/FormatTags'
|
||||
@ -140,7 +151,7 @@ export const onUpdateItem = async (
|
||||
) => {
|
||||
let changedItem = {} as Item
|
||||
|
||||
const offerUpdates: Array<any> = []
|
||||
const offerUpdates: any[] = []
|
||||
// check for new offers
|
||||
await state.offers?.map((o) => {
|
||||
const existingOffer = item?.offers?.find((t) => t.tags_id === o.id)
|
||||
@ -150,7 +161,7 @@ export const onUpdateItem = async (
|
||||
return null
|
||||
})
|
||||
|
||||
const needsUpdates: Array<any> = []
|
||||
const needsUpdates: any[] = []
|
||||
|
||||
await state.needs?.map((n) => {
|
||||
const existingNeed = item?.needs?.find((t) => t.tags_id === n.id)
|
||||
@ -181,8 +192,8 @@ export const onUpdateItem = async (
|
||||
...(state.needs.length > 0 && { needs: needsUpdates }),
|
||||
}
|
||||
|
||||
const offersState: Array<any> = []
|
||||
const needsState: Array<any> = []
|
||||
const offersState: any[] = []
|
||||
const needsState: any[] = []
|
||||
|
||||
state.offers.map((o) => {
|
||||
offersState.push({ items_id: item?.id, tags_id: o.id })
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
@ -11,7 +20,7 @@ import { toast } from 'react-toastify'
|
||||
export const AttestationForm = ({ api }: { api?: ItemsApi<any> }) => {
|
||||
const items = useItems()
|
||||
const assetsApi = useAssetApi()
|
||||
const [users, setUsers] = useState<Array<Item>>()
|
||||
const [users, setUsers] = useState<Item[]>()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
@ -36,7 +45,7 @@ export const AttestationForm = ({ api }: { api?: ItemsApi<any> }) => {
|
||||
}
|
||||
|
||||
const sendAttestation = async () => {
|
||||
const to: Array<any> = []
|
||||
const to: any[] = []
|
||||
users?.map((u) => to.push({ directus_users_id: u.user_created.id }))
|
||||
|
||||
api?.createItem &&
|
||||
|
||||
@ -11,7 +11,7 @@ export function CardPage({
|
||||
title: string
|
||||
hideTitle?: boolean
|
||||
children?: React.ReactNode
|
||||
parents?: Array<{ name: string; path: string }>
|
||||
parents?: { name: string; path: string }[]
|
||||
}) {
|
||||
return (
|
||||
<main className='tw-flex-1 tw-overflow-y-auto tw-overflow-x-hidden tw-pt-2 tw-px-6 tw-min-w-80 tw-flex tw-justify-center'>
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
export const CircleLayout = ({
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import { useState } from 'react'
|
||||
import { timeAgo } from '../../Utils/TimeAgo'
|
||||
import { Item } from '../../types'
|
||||
|
||||
@ -7,7 +7,7 @@ const isClickInsideRectangle = (e: MouseEvent, element: HTMLElement) => {
|
||||
return e.clientX > r.left && e.clientX < r.right && e.clientY > r.top && e.clientY < r.bottom
|
||||
}
|
||||
|
||||
type Props = {
|
||||
interface Props {
|
||||
title: string
|
||||
isOpened: boolean
|
||||
onClose: () => void
|
||||
@ -43,7 +43,7 @@ const DialogModal = ({
|
||||
if (isOpened) {
|
||||
return (
|
||||
<dialog
|
||||
className={`${className || ''} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`}
|
||||
className={`${className ?? ''} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`}
|
||||
ref={ref}
|
||||
// eslint-disable-next-line react/no-unknown-property
|
||||
onCancel={onClose}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useState } from 'react'
|
||||
|
||||
export const EmojiPicker = ({
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { DateUserInfo } from './DateUserInfo'
|
||||
import { StartEndView, TextView } from '../Map'
|
||||
import { HeaderView } from '../Map/Subcomponents/ItemPopupComponents/HeaderView'
|
||||
@ -45,7 +51,7 @@ export const ItemCard = ({
|
||||
<div className='tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade'>
|
||||
{i.layer?.itemType.show_start_end && <StartEndView item={i}></StartEndView>}
|
||||
{i.layer?.itemType.show_text && (
|
||||
<TextView truncate item={i} itemTextField={i.layer?.itemTextField} />
|
||||
<TextView truncate item={i} itemTextField={i.layer.itemTextField} />
|
||||
)}
|
||||
</div>
|
||||
<DateUserInfo item={i}></DateUserInfo>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as L from 'leaflet'
|
||||
import * as React from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
import { Tag } from '../../types'
|
||||
@ -24,8 +29,8 @@ function groupAndCount(arr) {
|
||||
}
|
||||
|
||||
export const MarketView = () => {
|
||||
const [offers, setOffers] = useState<Array<Tag>>([])
|
||||
const [needs, setNeeds] = useState<Array<Tag>>([])
|
||||
const [offers, setOffers] = useState<Tag[]>([])
|
||||
const [needs, setNeeds] = useState<Tag[]>([])
|
||||
const navigate = useNavigate()
|
||||
|
||||
const items = useItems()
|
||||
@ -35,13 +40,13 @@ export const MarketView = () => {
|
||||
setOffers([])
|
||||
setNeeds([])
|
||||
items.map((i) => {
|
||||
i?.layer?.itemOffersField &&
|
||||
i.layer?.itemOffersField &&
|
||||
getValue(i, i.layer.itemOffersField)?.map((o) => {
|
||||
const tag = tags.find((t) => t.id === o.tags_id)
|
||||
tag && setOffers((current) => [...current, tag])
|
||||
return null
|
||||
})
|
||||
i?.layer?.itemNeedsField &&
|
||||
i.layer?.itemNeedsField &&
|
||||
getValue(i, i.layer.itemNeedsField)?.map((n) => {
|
||||
const tag = tags.find((t) => t.id === n.tags_id)
|
||||
tag && setNeeds((current) => [...current, tag])
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { Item } from '../../types'
|
||||
import { PopupStartEndInput } from '../Map'
|
||||
@ -122,7 +129,7 @@ export const OverlayItemsIndexPage = ({
|
||||
<div className='tw-overflow-scroll fade tw-flex-1'>
|
||||
<div className='tw-columns-1 md:tw-columns-2 lg:tw-columns-3 2xl:tw-columns-4 tw-gap-6 tw-pt-4'>
|
||||
{items
|
||||
?.filter((i) => i.layer?.name === layerName)
|
||||
.filter((i) => i.layer?.name === layerName)
|
||||
.filter((item) =>
|
||||
filterTags.length === 0
|
||||
? item
|
||||
@ -133,7 +140,7 @@ export const OverlayItemsIndexPage = ({
|
||||
),
|
||||
),
|
||||
)
|
||||
?.sort((a, b) => {
|
||||
.sort((a, b) => {
|
||||
// Convert date_created to milliseconds, handle undefined by converting to lowest possible date (0 milliseconds)
|
||||
const dateA = a.date_updated
|
||||
? new Date(a.date_updated).getTime()
|
||||
@ -147,7 +154,7 @@ export const OverlayItemsIndexPage = ({
|
||||
: 0
|
||||
return dateB - dateA // Subtracts milliseconds which are numbers
|
||||
})
|
||||
?.map((i, k) => (
|
||||
.map((i, k) => (
|
||||
<div key={k} className='tw-break-inside-avoid tw-mb-6'>
|
||||
<ItemCard
|
||||
i={i}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
import { useState } from 'react'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
@ -9,7 +10,7 @@ export const SelectUser = ({ userType }: { userType: string }) => {
|
||||
const users = items.filter((i) => i.layer?.itemType.name === userType)
|
||||
const assetsApi = useAssetApi()
|
||||
|
||||
const [selectedUsers, setSelectedUsers] = useState<Array<string>>([])
|
||||
const [selectedUsers, setSelectedUsers] = useState<string[]>([])
|
||||
|
||||
return (
|
||||
<MapOverlayPage backdrop className='tw-h-3/4 tw-w-80'>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as React from 'react'
|
||||
import { decodeTag } from '../../Utils/FormatTags'
|
||||
import { Tag } from '../../types'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import Subtitle from '../Typography/Subtitle'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as React from 'react'
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
export function getValue(obj, path) {
|
||||
if (!obj || typeof path !== 'string') return undefined
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as L from 'leaflet'
|
||||
|
||||
const createSvg = (shape: string, markerColor: string, borderColor: string) => {
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
const goldenRatioConjugate = 0.618033988749895
|
||||
|
||||
export const randomColor = () => {
|
||||
return hsvToHex((Math.random() + goldenRatioConjugate) % 1, 0.8, 0.7)
|
||||
}
|
||||
|
||||
function hsvToHex(h, s, v) {
|
||||
function hsvToHex(h: number, s: number, v: number) {
|
||||
let r, g, b
|
||||
const i = Math.floor(h * 6)
|
||||
const f = h * 6 - i
|
||||
@ -53,6 +58,6 @@ const rgbToHex = (r, g, b) =>
|
||||
[r, g, b]
|
||||
.map((x) => {
|
||||
const hex = x.toString(16)
|
||||
return hex.length === 1 ? '0' + hex : hex
|
||||
return hex.length === 1 ? `0${hex}` : hex
|
||||
})
|
||||
.join('')
|
||||
|
||||
@ -27,9 +27,9 @@ export async function reverseGeocode(lat: number, lon: number): Promise<string>
|
||||
const address = response.data.address
|
||||
|
||||
// Extrahiere Straße, Hausnummer und Ort
|
||||
const street = address.road || ''
|
||||
const houseNumber = address.house_number || ''
|
||||
const city = address.city || address.town || address.village || ''
|
||||
const street = address.road ?? ''
|
||||
const houseNumber = address.house_number ?? ''
|
||||
const city = address.city ?? address.town ?? address.village ?? ''
|
||||
|
||||
// Formatiere die Adresse
|
||||
const formattedAddress = `${street} ${houseNumber}, ${city}`.trim()
|
||||
|
||||
@ -39,8 +39,8 @@ export {
|
||||
export { TextInput, TextAreaInput, SelectBox } from './Components/Input'
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
interface Window {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
my_modal_3: any
|
||||
}
|
||||
}
|
||||
|
||||
13
src/types.ts
13
src/types.ts
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as React from 'react'
|
||||
import { ItemFormPopupProps } from './Components/Map/Subcomponents/ItemFormPopup'
|
||||
|
||||
@ -82,7 +83,7 @@ export class Geometry {
|
||||
}
|
||||
}
|
||||
|
||||
export type Relation = {
|
||||
export interface Relation {
|
||||
related_items_id: string
|
||||
[key: string]: any
|
||||
}
|
||||
@ -103,7 +104,7 @@ export class Item {
|
||||
parent?: string
|
||||
subname?: string
|
||||
public_edit?: boolean;
|
||||
// eslint-disable-next-line no-undef
|
||||
|
||||
[key: string]: any
|
||||
constructor(
|
||||
id: string,
|
||||
@ -127,7 +128,7 @@ export interface AssetsApi {
|
||||
url: string
|
||||
}
|
||||
|
||||
export type Profile = {
|
||||
export interface Profile {
|
||||
id?: string
|
||||
avatar?: string
|
||||
color?: string
|
||||
@ -136,7 +137,7 @@ export type Profile = {
|
||||
geoposition?: Geometry
|
||||
}
|
||||
|
||||
export type UserItem = {
|
||||
export interface UserItem {
|
||||
id?: string
|
||||
role?: any
|
||||
email?: string
|
||||
@ -156,7 +157,7 @@ export interface UserApi {
|
||||
passwordReset(token: string, new_password: string)
|
||||
}
|
||||
|
||||
export type PermissionCondition = {
|
||||
export interface PermissionCondition {
|
||||
user_created?: {
|
||||
_eq: string // Erwartet den speziellen Wert "$CURRENT_USER" oder eine spezifische UUID
|
||||
}
|
||||
@ -167,7 +168,7 @@ export type PermissionCondition = {
|
||||
|
||||
export type PermissionAction = 'create' | 'read' | 'update' | 'delete'
|
||||
|
||||
export type Permission = {
|
||||
export interface Permission {
|
||||
id?: string
|
||||
policy: any
|
||||
collection: string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user