lint fixes

This commit is contained in:
Ulf Gebhardt 2024-11-08 19:36:35 +01:00
parent f339315067
commit fefc015b70
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
111 changed files with 586 additions and 517 deletions

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-commonjs
module.exports = { module.exports = {
env: { env: {
browser: true, browser: true,
@ -29,10 +30,12 @@ module.exports = {
'react-hooks', 'react-hooks',
], ],
settings: { settings: {
// 'import/resolver': { 'import/resolver': {
// typescript: true, typescript: true,
// node: true, node: {
// }, extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
react: { react: {
version: 'detect', version: 'detect',
}, },
@ -83,13 +86,16 @@ module.exports = {
'import/no-relative-parent-imports': [ 'import/no-relative-parent-imports': [
'error', 'error',
{ {
ignore: [ ignore: ['#[src,root,components,utils]/*'],
'#[src,root,components,pages,assets,layouts,queries,stores,plugins,context,types]/*',
],
}, },
], ],
'import/no-self-import': 'error', 'import/no-self-import': 'error',
'import/no-unresolved': 'error', 'import/no-unresolved': [
'error',
{
ignore: ['react'],
},
],
'import/no-useless-path-segments': 'error', 'import/no-useless-path-segments': 'error',
'import/no-webpack-loader-syntax': 'error', 'import/no-webpack-loader-syntax': 'error',
'import/consistent-type-specifier-style': 'error', 'import/consistent-type-specifier-style': 'error',

28
package-lock.json generated
View File

@ -31,10 +31,10 @@
}, },
"devDependencies": { "devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@types/geojson": "^7946.0.14",
"@types/leaflet": "^1.7.11", "@types/leaflet": "^1.7.11",
"@types/react": "^18.2.0", "@types/react": "^18.2.0",
"@types/react-dom": "^18.0.5", "@types/react-dom": "^18.0.5",
"@types/react-leaflet": "^2.8.2",
"@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0", "@typescript-eslint/parser": "^5.62.0",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
@ -402,10 +402,11 @@
} }
}, },
"node_modules/@types/geojson": { "node_modules/@types/geojson": {
"version": "7946.0.8", "version": "7946.0.14",
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.8.tgz", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz",
"integrity": "sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA==", "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==",
"dev": true "dev": true,
"license": "MIT"
}, },
"node_modules/@types/hast": { "node_modules/@types/hast": {
"version": "3.0.3", "version": "3.0.3",
@ -430,10 +431,11 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/leaflet": { "node_modules/@types/leaflet": {
"version": "1.7.11", "version": "1.9.14",
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.7.11.tgz", "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.14.tgz",
"integrity": "sha512-VwAYom2pfIAf/pLj1VR5aLltd4tOtHyvfaJlNYCoejzP2nu52PrMi1ehsLRMUS+bgafmIIKBV1cMfKeS+uJ0Vg==", "integrity": "sha512-sx2q6MDJaajwhKeVgPSvqXd8rhNJSTA3tMidQGduZn9S6WBYxDkCpSpV5xXEmSg7Cgdk/5vJGhVF1kMYLzauBg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@types/geojson": "*" "@types/geojson": "*"
} }
@ -479,16 +481,6 @@
"@types/react": "*" "@types/react": "*"
} }
}, },
"node_modules/@types/react-leaflet": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/@types/react-leaflet/-/react-leaflet-2.8.2.tgz",
"integrity": "sha512-Iel8Vd1bSCD38Yhiqcmm/+9hjPEdd39LFE3tBMbOytq3QAQsC3LDrbo6ifoh8JbpqPbCsQPo9Wx5OELHixEShg==",
"dev": true,
"dependencies": {
"@types/leaflet": "*",
"@types/react": "*"
}
},
"node_modules/@types/semver": { "node_modules/@types/semver": {
"version": "7.5.8", "version": "7.5.8",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz",

View File

@ -19,10 +19,10 @@
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"devDependencies": { "devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@types/geojson": "^7946.0.14",
"@types/leaflet": "^1.7.11", "@types/leaflet": "^1.7.11",
"@types/react": "^18.2.0", "@types/react": "^18.2.0",
"@types/react-dom": "^18.0.5", "@types/react-dom": "^18.0.5",
"@types/react-leaflet": "^2.8.2",
"@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0", "@typescript-eslint/parser": "^5.62.0",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
@ -71,5 +71,11 @@
"remark-breaks": "^4.0.0", "remark-breaks": "^4.0.0",
"tributejs": "^5.1.3", "tributejs": "^5.1.3",
"tw-elements": "^1.0.0" "tw-elements": "^1.0.0"
},
"imports": {
"#components/*": "./src/Components/*",
"#utils/*": "./src/Utils/*",
"#src/*": "./src/*",
"#root/*": "./*"
} }
} }

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-commonjs
module.exports = { module.exports = {
plugins: { plugins: {
tailwindcss: {}, tailwindcss: {},

View File

@ -1,8 +1,8 @@
import * as React from 'react' import { AssetsApi } from '#src/types'
import { ContextWrapper } from './ContextWrapper'
import NavBar from './NavBar' import NavBar from './NavBar'
import { SetAppState } from './SetAppState' import { SetAppState } from './SetAppState'
import { AssetsApi } from '../../types'
import { ContextWrapper } from './ContextWrapper'
export function AppShell({ export function AppShell({
appName, appName,

View File

@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions */ /* eslint-disable @typescript-eslint/consistent-type-definitions */
import * as React from 'react'
type ContentProps = { type ContentProps = {
children?: React.ReactNode children?: React.ReactNode
} }

View File

@ -1,18 +1,20 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { ToastContainer } from 'react-toastify'
import { QuestsProvider } from '../Gaming/hooks/useQuests'
import { ClusterRefProvider } from '../Map/hooks/useClusterRef'
import { FilterProvider } from '../Map/hooks/useFilter'
import { ItemsProvider } from '../Map/hooks/useItems'
import { LayersProvider } from '../Map/hooks/useLayers'
import { LeafletRefsProvider } from '../Map/hooks/useLeafletRefs'
import { PermissionsProvider } from '../Map/hooks/usePermissions'
import { SelectPositionProvider } from '../Map/hooks/useSelectPosition'
import { TagsProvider } from '../Map/hooks/useTags'
import { AppStateProvider } from './hooks/useAppState'
import { useContext, createContext } from 'react' import { useContext, createContext } from 'react'
import { BrowserRouter as Router, useLocation } from 'react-router-dom' import { BrowserRouter as Router, useLocation } from 'react-router-dom'
import { ToastContainer } from 'react-toastify'
import { QuestsProvider } from '#components/Gaming/hooks/useQuests'
import { ClusterRefProvider } from '#components/Map/hooks/useClusterRef'
import { FilterProvider } from '#components/Map/hooks/useFilter'
import { ItemsProvider } from '#components/Map/hooks/useItems'
import { LayersProvider } from '#components/Map/hooks/useLayers'
import { LeafletRefsProvider } from '#components/Map/hooks/useLeafletRefs'
import { PermissionsProvider } from '#components/Map/hooks/usePermissions'
import { SelectPositionProvider } from '#components/Map/hooks/useSelectPosition'
import { TagsProvider } from '#components/Map/hooks/useTags'
import { AppStateProvider } from './hooks/useAppState'
// Helper context to determine if the ContextWrapper is already present. // Helper context to determine if the ContextWrapper is already present.
const ContextCheckContext = createContext(false) const ContextCheckContext = createContext(false)

View File

@ -9,13 +9,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
import { useAuth } from '../Auth'
import { Link, useLocation } from 'react-router-dom'
import { toast } from 'react-toastify'
import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon' import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useItems } from '../Map/hooks/useItems' import { Link, useLocation } from 'react-router-dom'
import { Item } from '../../types' import { toast } from 'react-toastify'
import { useAuth } from '#components/Auth'
import { useItems } from '#components/Map/hooks/useItems'
import { Item } from '#src/types'
export default function NavBar({ appName, userType }: { appName: string; userType: string }) { export default function NavBar({ appName, userType }: { appName: string; userType: string }) {
const { isAuthenticated, user, logout } = useAuth() const { isAuthenticated, user, logout } = useAuth()

View File

@ -1,7 +1,9 @@
import { useSetAppState } from './hooks/useAppState'
import { AssetsApi } from '../../types'
import { useEffect } from 'react' import { useEffect } from 'react'
import { AssetsApi } from '#src/types'
import { useSetAppState } from './hooks/useAppState'
export const SetAppState = ({ export const SetAppState = ({
assetsApi, assetsApi,
userType, userType,

View File

@ -5,12 +5,12 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon'
import { useRef, useState, useEffect } from 'react' import { useRef, useState, useEffect } from 'react'
import { NavLink, useLocation } from 'react-router-dom' import { NavLink, useLocation } from 'react-router-dom'
import { Sidenav, initTE } from 'tw-elements' import { Sidenav, initTE } from 'tw-elements'
import SidebarSubmenu from './SidebarSubmenu' import SidebarSubmenu from './SidebarSubmenu'
import ChevronRightIcon from '@heroicons/react/24/outline/ChevronRightIcon'
import * as React from 'react'
type route = { type route = {
path: string path: string

View File

@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useItems } from '../Map/hooks/useItems'
import { useItems } from '#components/Map/hooks/useItems'
export const Sitemap = ({ url }: { url: string }) => { export const Sitemap = ({ url }: { url: string }) => {
const [sitemap, setSitemap] = useState('') const [sitemap, setSitemap] = useState('')

View File

@ -1,7 +1,8 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useState, createContext, useContext } from 'react' import { useCallback, useState, createContext, useContext } from 'react'
import * as React from 'react'
import { AssetsApi } from '../../../types' import { AssetsApi } from '#src/types'
interface AppState { interface AppState {
assetsApi: AssetsApi assetsApi: AssetsApi

View File

@ -1,8 +1,9 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useState, createContext, useContext } from 'react' import { useCallback, useState, createContext, useContext } from 'react'
import * as React from 'react' import { AssetsApi } from '#src/types'
import { AssetsApi } from '../../../types'
type UseAssetManagerResult = ReturnType<typeof useAssetsManager> type UseAssetManagerResult = ReturnType<typeof useAssetsManager>

View File

@ -6,8 +6,10 @@
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom' import { Link, useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
import { useAuth } from './useAuth' import { useAuth } from './useAuth'
import { MapOverlayPage } from '../Templates'
export function LoginPage() { export function LoginPage() {
const [email, setEmail] = useState<string>('') const [email, setEmail] = useState<string>('')

View File

@ -4,8 +4,10 @@
import { useState } from 'react' import { useState } from 'react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
import { useAuth } from './useAuth' import { useAuth } from './useAuth'
import { MapOverlayPage } from '../Templates'
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
export function RequestPasswordPage({ resetUrl }) { export function RequestPasswordPage({ resetUrl }) {

View File

@ -2,10 +2,11 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import { useState } from 'react' import { useState } from 'react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
import { useAuth } from './useAuth' import { useAuth } from './useAuth'
import { MapOverlayPage } from '../Templates'
export function SetNewPasswordPage() { export function SetNewPasswordPage() {
const [password, setPassword] = useState<string>('') const [password, setPassword] = useState<string>('')

View File

@ -5,10 +5,11 @@
/* eslint-disable @typescript-eslint/no-misused-promises */ /* eslint-disable @typescript-eslint/no-misused-promises */
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { MapOverlayPage } from '#components/Templates/MapOverlayPage'
import { useAuth } from './useAuth' import { useAuth } from './useAuth'
import { MapOverlayPage } from '../Templates'
export function SignupPage() { export function SignupPage() {
const [email, setEmail] = useState<string>('') const [email, setEmail] = useState<string>('')

View File

@ -6,8 +6,8 @@
/* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { createContext, useState, useContext, useEffect } from 'react' import { createContext, useState, useContext, useEffect } from 'react'
import * as React from 'react'
import { UserApi, UserItem } from '../../types' import { UserApi, UserItem } from '#src/types'
interface AuthProviderProps { interface AuthProviderProps {
userApi: UserApi userApi: UserApi

View File

@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import * as React from 'react'
import { useEffect } from 'react' import { useEffect } from 'react'
export function Modal({ export function Modal({

View File

@ -1,9 +1,11 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'
import { useAuth } from '../Auth'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useItems } from '../Map/hooks/useItems'
import { Item } from '../../types' import { useAuth } from '#components/Auth'
import { useItems } from '#components/Map/hooks/useItems'
import { Item } from '#src/types'
import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'
export function Quests() { export function Quests() {
const questsOpen = useQuestsOpen() const questsOpen = useQuestsOpen()

View File

@ -1,6 +1,6 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useState, createContext, useContext } from 'react' import { useCallback, useState, createContext, useContext } from 'react'
import * as React from 'react'
type UseQuestManagerResult = ReturnType<typeof useQuestsManager> type UseQuestManagerResult = ReturnType<typeof useQuestsManager>

View File

@ -5,9 +5,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import * as React from 'react' import { useEffect, useRef, useState } from 'react'
import { useEffect } from 'react'
import { TagView } from '../Templates/TagView' import { TagView } from '#components/Templates/TagView'
export const Autocomplete = ({ export const Autocomplete = ({
inputProps, inputProps,
@ -22,8 +22,8 @@ export const Autocomplete = ({
pushFilteredSuggestions?: any[] pushFilteredSuggestions?: any[]
setFocus?: boolean setFocus?: boolean
}) => { }) => {
const [filteredSuggestions, setFilteredSuggestions] = React.useState<any[]>([]) const [filteredSuggestions, setFilteredSuggestions] = useState<any[]>([])
const [heighlightedSuggestion, setHeighlightedSuggestion] = React.useState<number>(0) const [heighlightedSuggestion, setHeighlightedSuggestion] = useState<number>(0)
useEffect(() => { useEffect(() => {
pushFilteredSuggestions && setFilteredSuggestions(pushFilteredSuggestions) pushFilteredSuggestions && setFilteredSuggestions(pushFilteredSuggestions)
@ -33,7 +33,7 @@ export const Autocomplete = ({
setFocus && inputRef.current?.focus() setFocus && inputRef.current?.focus()
}, [setFocus]) }, [setFocus])
const inputRef = React.useRef<HTMLInputElement>() const inputRef = useRef<HTMLInputElement>()
const getSuggestionValue = (suggestion) => suggestion.name const getSuggestionValue = (suggestion) => suggestion.name

View File

@ -1,5 +1,3 @@
import * as React from 'react'
interface ComboBoxProps { interface ComboBoxProps {
id?: string id?: string
options: string[] options: string[]

View File

@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions */ /* eslint-disable @typescript-eslint/consistent-type-definitions */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import { useState } from 'react'
import InformationCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon' import InformationCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon'
import * as React from 'react' import { useState } from 'react'
type SelectBoxProps = { type SelectBoxProps = {
labelTitle?: string labelTitle?: string

View File

@ -2,10 +2,10 @@
/* eslint-disable @typescript-eslint/consistent-indexed-object-style */ /* eslint-disable @typescript-eslint/consistent-indexed-object-style */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
import * as React from 'react'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import Tribute from 'tributejs' import Tribute from 'tributejs'
import { useTags } from '../Map/hooks/useTags'
import { useTags } from '#components/Map/hooks/useTags'
type TextAreaProps = { type TextAreaProps = {
labelTitle?: string labelTitle?: string

View File

@ -2,7 +2,6 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import * as React from 'react'
type InputTextProps = { type InputTextProps = {
labelTitle?: string labelTitle?: string

View File

@ -1,7 +1,7 @@
import * as React from 'react' import { node, string } from 'prop-types'
import { Item } from '../../types' import { Children, cloneElement, isValidElement, useEffect } from 'react'
import * as PropTypes from 'prop-types'
import { useEffect } from 'react' import { Item } from '#src/types'
export const ItemForm = ({ export const ItemForm = ({
children, children,
@ -23,9 +23,9 @@ export const ItemForm = ({
return ( return (
<div> <div>
{children {children
? React.Children.toArray(children).map((child) => ? Children.toArray(children).map((child) =>
React.isValidElement<{ item: Item; test: string }>(child) isValidElement<{ item: Item; test: string }>(child)
? React.cloneElement(child, { item, test: 'test' }) ? cloneElement(child, { item, test: 'test' })
: '', : '',
) )
: ''} : ''}
@ -34,8 +34,8 @@ export const ItemForm = ({
} }
ItemForm.propTypes = { ItemForm.propTypes = {
children: PropTypes.node, children: node,
__TYPE: PropTypes.string, __TYPE: string,
} }
ItemForm.defaultProps = { ItemForm.defaultProps = {

View File

@ -1,13 +1,14 @@
import * as React from 'react' import { node, string } from 'prop-types'
import { Item } from '../../types' import { Children, cloneElement, isValidElement } from 'react'
import * as PropTypes from 'prop-types'
import { Item } from '#src/types'
export const ItemView = ({ children, item }: { children?: React.ReactNode; item?: Item }) => { export const ItemView = ({ children, item }: { children?: React.ReactNode; item?: Item }) => {
return ( return (
<div> <div>
{children {children
? React.Children.toArray(children).map((child) => ? Children.toArray(children).map((child) =>
React.isValidElement<{ item: Item }>(child) ? React.cloneElement(child, { item }) : '', isValidElement<{ item: Item }>(child) ? cloneElement(child, { item }) : '',
) )
: ''} : ''}
</div> </div>
@ -15,8 +16,8 @@ export const ItemView = ({ children, item }: { children?: React.ReactNode; item?
} }
ItemView.propTypes = { ItemView.propTypes = {
children: PropTypes.node, children: node,
__TYPE: PropTypes.string, __TYPE: string,
} }
ItemView.defaultProps = { ItemView.defaultProps = {

View File

@ -7,29 +7,30 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as React from 'react' import { Popup } from 'leaflet'
import { Children, isValidElement, useEffect, useState } from 'react'
import { Marker, Tooltip, useMap, useMapEvents } from 'react-leaflet' import { Marker, Tooltip, useMap, useMapEvents } from 'react-leaflet'
import { Item, LayerProps, Tag } from '../../types' import { useLocation } from 'react-router-dom'
import MarkerIconFactory from '../../Utils/MarkerIconFactory'
import { ItemViewPopup } from './Subcomponents/ItemViewPopup' import { Item, LayerProps, Tag } from '#src/types'
import { useAllItemsLoaded, useItems, useSetItemsApi, useSetItemsData } from './hooks/useItems' import { encodeTag } from '#utils/FormatTags'
import { useEffect, useState } from 'react' import { getValue } from '#utils/GetValue'
import { ItemFormPopup } from './Subcomponents/ItemFormPopup' import { hashTagRegex } from '#utils/HashTagRegex'
import MarkerIconFactory from '#utils/MarkerIconFactory'
import { randomColor } from '#utils/RandomColor'
import { import {
useFilterTags, useFilterTags,
useIsGroupTypeVisible, useIsGroupTypeVisible,
useIsLayerVisible, useIsLayerVisible,
useVisibleGroupType, useVisibleGroupType,
} from './hooks/useFilter' } from './hooks/useFilter'
import { useAddTag, useAllTagsLoaded, useGetItemTags, useTags } from './hooks/useTags' import { useAllItemsLoaded, useItems, useSetItemsApi, useSetItemsData } from './hooks/useItems'
import { useAddMarker, useAddPopup, useLeafletRefs } from './hooks/useLeafletRefs' import { useAddMarker, useAddPopup, useLeafletRefs } from './hooks/useLeafletRefs'
import { Popup } from 'leaflet'
import { useLocation } from 'react-router-dom'
import { getValue } from '../../Utils/GetValue'
import { hashTagRegex } from '../../Utils/HashTagRegex'
import { randomColor } from '../../Utils/RandomColor'
import { encodeTag } from '../../Utils/FormatTags'
import { useSelectPosition, useSetMarkerClicked } from './hooks/useSelectPosition' import { useSelectPosition, useSetMarkerClicked } from './hooks/useSelectPosition'
import { useAddTag, useAllTagsLoaded, useGetItemTags, useTags } from './hooks/useTags'
import { ItemFormPopup } from './Subcomponents/ItemFormPopup'
import { ItemViewPopup } from './Subcomponents/ItemViewPopup'
export const Layer = ({ export const Layer = ({
data, data,
@ -335,11 +336,11 @@ export const Layer = ({
position={[latitude, longitude]} position={[latitude, longitude]}
> >
{children && {children &&
React.Children.toArray(children).some( Children.toArray(children).some(
(child) => React.isValidElement(child) && child.props.__TYPE === 'ItemView', (child) => isValidElement(child) && child.props.__TYPE === 'ItemView',
) ? ( ) ? (
React.Children.toArray(children).map((child) => Children.toArray(children).map((child) =>
React.isValidElement(child) && child.props.__TYPE === 'ItemView' ? ( isValidElement(child) && child.props.__TYPE === 'ItemView' ? (
<ItemViewPopup <ItemViewPopup
ref={(r) => { ref={(r) => {
if (!(item.id in leafletRefs && leafletRefs[item.id].popup === r)) { if (!(item.id in leafletRefs && leafletRefs[item.id].popup === r)) {
@ -383,11 +384,11 @@ export const Layer = ({
{itemFormPopup && {itemFormPopup &&
itemFormPopup.layer.name === name && itemFormPopup.layer.name === name &&
(children && (children &&
React.Children.toArray(children).some( Children.toArray(children).some(
(child) => React.isValidElement(child) && child.props.__TYPE === 'ItemForm', (child) => isValidElement(child) && child.props.__TYPE === 'ItemForm',
) ? ( ) ? (
React.Children.toArray(children).map((child) => Children.toArray(children).map((child) =>
React.isValidElement(child) && child.props.__TYPE === 'ItemForm' ? ( isValidElement(child) && child.props.__TYPE === 'ItemForm' ? (
<ItemFormPopup <ItemFormPopup
key={setItemFormPopup?.name} key={setItemFormPopup?.name}
position={itemFormPopup.position} position={itemFormPopup.position}

View File

@ -1,8 +1,9 @@
import * as React from 'react'
import { useEffect } from 'react' import { useEffect } from 'react'
import { ItemsApi, Permission } from '../../types'
import { useAuth } from '#components/Auth'
import { ItemsApi, Permission } from '#src/types'
import { useSetPermissionData, useSetPermissionApi, useSetAdminRole } from './hooks/usePermissions' import { useSetPermissionData, useSetPermissionApi, useSetAdminRole } from './hooks/usePermissions'
import { useAuth } from '../Auth'
export function Permissions({ export function Permissions({
data, data,

View File

@ -1,9 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import * as React from 'react' import { useLayers } from '#components/Map/hooks/useLayers'
import { useLayers } from '../hooks/useLayers' import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import { useHasUserPermission } from '../hooks/usePermissions'
export default function AddButton({ export default function AddButton({
triggerAction, triggerAction,

View File

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import * as L from 'leaflet' import { DomEvent } from 'leaflet'
import * as React from 'react' import { createRef, useEffect } from 'react'
export const Control = ({ export const Control = ({
position, position,
@ -13,12 +13,12 @@ export const Control = ({
zIndex: string zIndex: string
absolute: boolean absolute: boolean
}) => { }) => {
const controlContainerRef = React.createRef<HTMLDivElement>() const controlContainerRef = createRef<HTMLDivElement>()
React.useEffect(() => { useEffect(() => {
if (controlContainerRef.current !== null) { if (controlContainerRef.current !== null) {
L.DomEvent.disableClickPropagation(controlContainerRef.current) DomEvent.disableClickPropagation(controlContainerRef.current)
L.DomEvent.disableScrollPropagation(controlContainerRef.current) DomEvent.disableScrollPropagation(controlContainerRef.current)
} }
}, [controlContainerRef]) }, [controlContainerRef])

View File

@ -1,11 +1,11 @@
import * as React from 'react' import { useEffect } from 'react'
import { import {
useAddVisibleGroupType, useAddVisibleGroupType,
useIsGroupTypeVisible, useIsGroupTypeVisible,
useToggleVisibleGroupType, useToggleVisibleGroupType,
useVisibleGroupType, useVisibleGroupType,
} from '../../hooks/useFilter' } from '#components/Map/hooks/useFilter'
import { useEffect } from 'react'
export function FilterControl() { export function FilterControl() {
const [open, setOpen] = React.useState(false) const [open, setOpen] = React.useState(false)

View File

@ -1,5 +1,6 @@
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { useAuth } from '../../../Auth'
import { useAuth } from '#components/Auth'
export const GratitudeControl = () => { export const GratitudeControl = () => {
const navigate = useNavigate() const navigate = useNavigate()

View File

@ -1,9 +1,10 @@
import * as React from 'react' import { useState } from 'react'
import { useLayers } from '../../hooks/useLayers'
import { useIsLayerVisible, useToggleVisibleLayer } from '../../hooks/useFilter' import { useIsLayerVisible, useToggleVisibleLayer } from '#components/Map/hooks/useFilter'
import { useLayers } from '#components/Map/hooks/useLayers'
export function LayerControl() { export function LayerControl() {
const [open, setOpen] = React.useState(false) const [open, setOpen] = useState(false)
const layers = useLayers() const layers = useLayers()

View File

@ -4,12 +4,13 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import * as L from 'leaflet' import { control } from 'leaflet'
import { useMap, useMapEvents } from 'react-leaflet'
import 'leaflet.locatecontrol'
import 'leaflet.locatecontrol/dist/L.Control.Locate.css'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useMap, useMapEvents } from 'react-leaflet'
// eslint-disable-next-line import/no-unassigned-import
import 'leaflet.locatecontrol'
// eslint-disable-next-line import/no-unassigned-import
import 'leaflet.locatecontrol/dist/L.Control.Locate.css'
// Converts leaflet.locatecontrol to a React Component // Converts leaflet.locatecontrol to a React Component
export const LocateControl = () => { export const LocateControl = () => {
@ -25,7 +26,7 @@ export const LocateControl = () => {
useEffect(() => { useEffect(() => {
if (!init.current) { if (!init.current) {
// @ts-ignore // @ts-ignore
setLc(L.control.locate().addTo(map)) setLc(control.locate().addTo(map))
init.current = true init.current = true
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps

View File

@ -1,5 +1,4 @@
import * as React from 'react' import { useQuestsOpen, useSetQuestOpen } from '#components/Gaming/hooks/useQuests'
import { useQuestsOpen, useSetQuestOpen } from '../../../Gaming/hooks/useQuests'
export function QuestControl() { export function QuestControl() {
const questsOpen = useQuestsOpen() const questsOpen = useQuestsOpen()

View File

@ -10,24 +10,24 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import * as React from 'react'
import { useAddFilterTag } from '../../hooks/useFilter'
import useWindowDimensions from '../../hooks/useWindowDimension'
import axios from 'axios' import axios from 'axios'
import { LatLng, LatLngBounds, marker } from 'leaflet'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useMap, useMapEvents } from 'react-leaflet' import { useMap, useMapEvents } from 'react-leaflet'
import { LatLng, LatLngBounds } from 'leaflet'
import { useDebounce } from '../../hooks/useDebounce'
import { useTags } from '../../hooks/useTags'
import { useItems } from '../../hooks/useItems'
import { useLeafletRefs } from '../../hooks/useLeafletRefs'
import { getValue } from '../../../../Utils/GetValue'
import { LocateControl } from './LocateControl'
import * as L from 'leaflet'
import MarkerIconFactory from '../../../../Utils/MarkerIconFactory'
import { decodeTag } from '../../../../Utils/FormatTags'
import { useLocation, useNavigate } from 'react-router-dom' import { useLocation, useNavigate } from 'react-router-dom'
import { Item } from '../../../../types'
import { useDebounce } from '#components/Map/hooks/useDebounce'
import { useAddFilterTag } from '#components/Map/hooks/useFilter'
import { useItems } from '#components/Map/hooks/useItems'
import { useLeafletRefs } from '#components/Map/hooks/useLeafletRefs'
import { useTags } from '#components/Map/hooks/useTags'
import useWindowDimensions from '#components/Map/hooks/useWindowDimension'
import { Item } from '#src/types'
import { decodeTag } from '#utils/FormatTags'
import { getValue } from '#utils/GetValue'
import MarkerIconFactory from '#utils/MarkerIconFactory'
import { LocateControl } from './LocateControl'
import { SidebarControl } from './SidebarControl' import { SidebarControl } from './SidebarControl'
export const SearchControl = () => { export const SearchControl = () => {
@ -206,7 +206,7 @@ export const SearchControl = () => {
key={Math.random()} key={Math.random()}
onClick={() => { onClick={() => {
searchInput.current?.blur() searchInput.current?.blur()
L.marker(new LatLng(geo.geometry.coordinates[1], geo.geometry.coordinates[0]), { marker(new LatLng(geo.geometry.coordinates[1], geo.geometry.coordinates[0]), {
icon: MarkerIconFactory('circle', '#777', 'RGBA(35, 31, 32, 0.2)', 'point'), icon: MarkerIconFactory('circle', '#777', 'RGBA(35, 31, 32, 0.2)', 'point'),
}) })
.addTo(map) .addTo(map)
@ -272,7 +272,7 @@ export const SearchControl = () => {
<div <div
className='tw-flex tw-flex-row hover:tw-font-bold tw-cursor-pointer' className='tw-flex tw-flex-row hover:tw-font-bold tw-cursor-pointer'
onClick={() => { onClick={() => {
L.marker( marker(
new LatLng(extractCoordinates(value)![0], extractCoordinates(value)![1]), new LatLng(extractCoordinates(value)![0], extractCoordinates(value)![1]),
{ {
icon: MarkerIconFactory('circle', '#777', 'RGBA(35, 31, 32, 0.2)', 'point'), icon: MarkerIconFactory('circle', '#777', 'RGBA(35, 31, 32, 0.2)', 'point'),

View File

@ -1,6 +1,5 @@
import * as React from 'react' import { useFilterTags, useRemoveFilterTag } from '#components/Map/hooks/useFilter'
import { useFilterTags, useRemoveFilterTag } from '../../hooks/useFilter' import { decodeTag } from '#utils/FormatTags'
import { decodeTag } from '../../../../Utils/FormatTags'
export const TagsControl = () => { export const TagsControl = () => {
const filterTags = useFilterTags() const filterTags = useFilterTags()

View File

@ -7,28 +7,19 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as React from 'react' import { Children, cloneElement, isValidElement, useEffect, useRef, useState } from 'react'
import { LatLng } from 'leaflet'
import { Popup as LeafletPopup, useMap } from 'react-leaflet' import { Popup as LeafletPopup, useMap } from 'react-leaflet'
import { useEffect, useRef, useState } from 'react'
import { useAddItem, useItems, useRemoveItem, useUpdateItem } from '../hooks/useItems'
import { Geometry, LayerProps, Item } from '../../../types'
import { TextAreaInput } from '../../Input/TextAreaInput'
import { TextInput } from '../../Input/TextInput'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { useResetFilterTags } from '../hooks/useFilter'
import { hashTagRegex } from '../../../Utils/HashTagRegex'
import { randomColor } from '../../../Utils/RandomColor'
import { useAddTag, useTags } from '../hooks/useTags'
import { useAuth } from '../../Auth'
export interface ItemFormPopupProps { import { useAuth } from '#components/Auth/useAuth'
position: LatLng import { TextAreaInput } from '#components/Input/TextAreaInput'
layer: LayerProps import { TextInput } from '#components/Input/TextInput'
item?: Item import { useResetFilterTags } from '#components/Map/hooks/useFilter'
children?: React.ReactNode import { useAddItem, useItems, useRemoveItem, useUpdateItem } from '#components/Map/hooks/useItems'
setItemFormPopup?: React.Dispatch<React.SetStateAction<ItemFormPopupProps | null>> import { useAddTag, useTags } from '#components/Map/hooks/useTags'
} import { Geometry, Item, ItemFormPopupProps } from '#src/types'
import { hashTagRegex } from '#utils/HashTagRegex'
import { randomColor } from '#utils/RandomColor'
export function ItemFormPopup(props: ItemFormPopupProps) { export function ItemFormPopup(props: ItemFormPopupProps) {
const [spinner, setSpinner] = useState(false) const [spinner, setSpinner] = useState(false)
@ -168,13 +159,13 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
)} )}
{props.children ? ( {props.children ? (
React.Children.toArray(props.children).map((child) => Children.toArray(props.children).map((child) =>
React.isValidElement<{ isValidElement<{
item: Item item: Item
test: string test: string
setPopupTitle: React.Dispatch<React.SetStateAction<string>> setPopupTitle: React.Dispatch<React.SetStateAction<string>>
}>(child) }>(child)
? React.cloneElement(child, { ? cloneElement(child, {
item: props.item, item: props.item,
key: props.position.toString(), key: props.position.toString(),
setPopupTitle, setPopupTitle,

View File

@ -9,14 +9,15 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import * as React from 'react' import { useState } from 'react'
import { Item, ItemsApi } from '../../../../types'
import { useHasUserPermission } from '../../hooks/usePermissions'
import { getValue } from '../../../../Utils/GetValue'
import { useAppState } from '../../../AppShell/hooks/useAppState'
import DialogModal from '../../../Templates/DialogModal'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import DialogModal from '#components/Templates/DialogModal'
import { Item, ItemsApi } from '#src/types'
import { getValue } from '#utils/GetValue'
export function HeaderView({ export function HeaderView({
item, item,
api, api,
@ -48,7 +49,7 @@ export function HeaderView({
truncateSubname?: boolean truncateSubname?: boolean
showAddress?: boolean showAddress?: boolean
}) { }) {
const [modalOpen, setModalOpen] = React.useState<boolean>(false) const [modalOpen, setModalOpen] = useState<boolean>(false)
const hasUserPermission = useHasUserPermission() const hasUserPermission = useHasUserPermission()
const navigate = useNavigate() const navigate = useNavigate()
@ -72,7 +73,7 @@ export function HeaderView({
? getValue(item, 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>('') const [address] = useState<string>('')
const params = new URLSearchParams(window.location.search) const params = new URLSearchParams(window.location.search)

View File

@ -1,9 +1,10 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { getValue } from '../../../../Utils/GetValue'
import { Item } from '../../../../types' import { useGetItemTags } from '#components/Map/hooks/useTags'
import { useGetItemTags } from '../../hooks/useTags' import { Item } from '#src/types'
import { getValue } from '#utils/GetValue'
export const PopupButton = ({ export const PopupButton = ({
url, url,

View File

@ -1,4 +1,4 @@
import { Item } from '../../../../types' import { Item } from '#src/types'
export const PopupCheckboxInput = ({ export const PopupCheckboxInput = ({
dataField, dataField,

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
import * as React from 'react' import { TextInput } from '#components/Input'
import { TextInput } from '../../../Input' import { Item } from '#src/types'
import { Item } from '../../../../types'
interface StartEndInputProps { interface StartEndInputProps {
item?: Item item?: Item

View File

@ -1,6 +1,5 @@
import * as React from 'react' import { TextAreaInput } from '#components/Input'
import { TextAreaInput } from '../../../Input' import { Item } from '#src/types'
import { Item } from '../../../../types'
export const PopupTextAreaInput = ({ export const PopupTextAreaInput = ({
dataField, dataField,

View File

@ -1,6 +1,5 @@
import * as React from 'react' import { TextInput } from '#components/Input'
import { TextInput } from '../../../Input' import { Item } from '#src/types'
import { Item } from '../../../../types'
export const PopupTextInput = ({ export const PopupTextInput = ({
dataField, dataField,

View File

@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
import * as React from 'react' import { Item } from '#src/types'
import { Item } from '../../../../types'
export const StartEndView = ({ item }: { item?: Item }) => { export const StartEndView = ({ item }: { item?: Item }) => {
return ( return (

View File

@ -7,16 +7,17 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import { Item } from '../../../../types'
import { useTags } from '../../hooks/useTags'
import { useAddFilterTag } from '../../hooks/useFilter'
import { hashTagRegex } from '../../../../Utils/HashTagRegex'
import { fixUrls, mailRegex } from '../../../../Utils/ReplaceURLs'
import Markdown from 'react-markdown'
import { getValue } from '../../../../Utils/GetValue'
import remarkBreaks from 'remark-breaks'
import { decodeTag } from '../../../../Utils/FormatTags'
import { memo } from 'react' import { memo } from 'react'
import Markdown from 'react-markdown'
import remarkBreaks from 'remark-breaks'
import { useAddFilterTag } from '#components/Map/hooks/useFilter'
import { useTags } from '#components/Map/hooks/useTags'
import { Item } from '#src/types'
import { decodeTag } from '#utils/FormatTags'
import { getValue } from '#utils/GetValue'
import { hashTagRegex } from '#utils/HashTagRegex'
import { fixUrls, mailRegex } from '#utils/ReplaceURLs'
export const TextView = ({ export const TextView = ({
item, item,

View File

@ -7,19 +7,19 @@
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as React from 'react' import { LatLng } from 'leaflet'
import { Children, cloneElement, forwardRef, isValidElement, useState } from 'react'
import { Popup as LeafletPopup, useMap } from 'react-leaflet' import { Popup as LeafletPopup, useMap } from 'react-leaflet'
import { Item } from '../../../types' import { useNavigate } from 'react-router-dom'
import { ItemFormPopupProps } from './ItemFormPopup' import { toast } from 'react-toastify'
import { useRemoveItem, useUpdateItem } from '#components/Map/hooks/useItems'
import { useSetSelectPosition } from '#components/Map/hooks/useSelectPosition'
import { Item, ItemFormPopupProps } from '#src/types'
import { timeAgo } from '#utils/TimeAgo'
import { HeaderView } from './ItemPopupComponents/HeaderView' import { HeaderView } from './ItemPopupComponents/HeaderView'
import { TextView } from './ItemPopupComponents/TextView' import { TextView } from './ItemPopupComponents/TextView'
import { timeAgo } from '../../../Utils/TimeAgo'
import { useState } from 'react'
import { LatLng } from 'leaflet'
import { useNavigate } from 'react-router-dom'
import { useRemoveItem, useUpdateItem } from '../hooks/useItems'
import { toast } from 'react-toastify'
import { useSetSelectPosition } from '../hooks/useSelectPosition'
export interface ItemViewPopupProps { export interface ItemViewPopupProps {
item: Item item: Item
@ -28,9 +28,9 @@ export interface ItemViewPopupProps {
} }
// eslint-disable-next-line react/display-name // eslint-disable-next-line react/display-name
export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: any) => { export const ItemViewPopup = forwardRef((props: ItemViewPopupProps, ref: any) => {
const map = useMap() const map = useMap()
const [loading, setLoading] = React.useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const removeItem = useRemoveItem() const removeItem = useRemoveItem()
const updadateItem = useUpdateItem() const updadateItem = useUpdateItem()
const navigate = useNavigate() const navigate = useNavigate()
@ -95,9 +95,9 @@ export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: a
/> />
<div className='tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade'> <div className='tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade'>
{props.children ? ( {props.children ? (
React.Children.toArray(props.children).map((child) => Children.toArray(props.children).map((child) =>
React.isValidElement<{ item: Item; test: string }>(child) isValidElement<{ item: Item; test: string }>(child)
? React.cloneElement(child, { item: props.item }) ? cloneElement(child, { item: props.item })
: '', : '',
) )
) : ( ) : (

View File

@ -1,9 +1,10 @@
import * as React from 'react'
import { useEffect } from 'react' import { useEffect } from 'react'
import { ItemsApi, Tag } from '../../types'
import { useSetTagData, useSetTagApi, useTags } from './hooks/useTags'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import { ItemsApi, Tag } from '#src/types'
import { useAddFilterTag, useFilterTags, useResetFilterTags } from './hooks/useFilter' import { useAddFilterTag, useFilterTags, useResetFilterTags } from './hooks/useFilter'
import { useSetTagData, useSetTagApi, useTags } from './hooks/useTags'
export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) { export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) {
const setTagData = useSetTagData() const setTagData = useSetTagData()

View File

@ -1,6 +1,8 @@
import { UtopiaMapProps } from '../../types' import { ContextWrapper } from '#components/AppShell/ContextWrapper'
import { ContextWrapper } from '../AppShell/ContextWrapper' import { UtopiaMapProps } from '#src/types'
import { UtopiaMapInner } from './UtopiaMapInner' import { UtopiaMapInner } from './UtopiaMapInner'
// eslint-disable-next-line import/no-unassigned-import
import 'react-toastify/dist/ReactToastify.css' import 'react-toastify/dist/ReactToastify.css'
function UtopiaMap(props: UtopiaMapProps) { function UtopiaMap(props: UtopiaMapProps) {

View File

@ -6,37 +6,49 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* 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'
import { UtopiaMapProps } from '../../types'
import './UtopiaMap.css'
import { LatLng } from 'leaflet' import { LatLng } from 'leaflet'
import {
Children,
cloneElement,
createRef,
isValidElement,
useEffect,
useRef,
useState,
} from 'react'
import { TileLayer, MapContainer, useMapEvents, GeoJSON } from 'react-leaflet'
// eslint-disable-next-line import/no-unassigned-import
import 'leaflet/dist/leaflet.css'
import MarkerClusterGroup from 'react-leaflet-cluster' import MarkerClusterGroup from 'react-leaflet-cluster'
import AddButton from './Subcomponents/AddButton'
import { useEffect, useRef, useState } from 'react'
import { ItemFormPopupProps } from './Subcomponents/ItemFormPopup'
import { SearchControl } from './Subcomponents/Controls/SearchControl'
import { Control } from './Subcomponents/Controls/Control'
import { Outlet } from 'react-router-dom' import { Outlet } from 'react-router-dom'
import { TagsControl } from './Subcomponents/Controls/TagsControl' import { toast } from 'react-toastify'
import { ItemFormPopupProps, UtopiaMapProps } from '#src/types'
// eslint-disable-next-line import/no-unassigned-import
import './UtopiaMap.css'
import { useClusterRef, useSetClusterRef } from './hooks/useClusterRef'
import { useAddVisibleLayer } from './hooks/useFilter'
import { useLayers } from './hooks/useLayers'
import { import {
useSelectPosition, useSelectPosition,
useSetMapClicked, useSetMapClicked,
useSetSelectPosition, useSetSelectPosition,
} from './hooks/useSelectPosition' } from './hooks/useSelectPosition'
import { useClusterRef, useSetClusterRef } from './hooks/useClusterRef' import AddButton from './Subcomponents/AddButton'
import { Feature, Geometry as GeoJSONGeometry } from 'geojson' import { Control } from './Subcomponents/Controls/Control'
import { FilterControl } from './Subcomponents/Controls/FilterControl' import { FilterControl } from './Subcomponents/Controls/FilterControl'
import { LayerControl } from './Subcomponents/Controls/LayerControl'
import { useLayers } from './hooks/useLayers'
import { useAddVisibleLayer } from './hooks/useFilter'
import { GratitudeControl } from './Subcomponents/Controls/GratitudeControl' import { GratitudeControl } from './Subcomponents/Controls/GratitudeControl'
import { SelectPosition } from './Subcomponents/SelectPosition' import { LayerControl } from './Subcomponents/Controls/LayerControl'
import { toast } from 'react-toastify' import { SearchControl } from './Subcomponents/Controls/SearchControl'
import { TagsControl } from './Subcomponents/Controls/TagsControl'
import { TextView } from './Subcomponents/ItemPopupComponents/TextView' import { TextView } from './Subcomponents/ItemPopupComponents/TextView'
import { SelectPosition } from './Subcomponents/SelectPosition'
const mapDivRef = React.createRef() import type { Feature, Geometry as GeoJSONGeometry } from 'geojson'
const mapDivRef = createRef()
export function UtopiaMapInner({ export function UtopiaMapInner({
height = '500px', height = '500px',
@ -147,13 +159,13 @@ export function UtopiaMapInner({
maxClusterRadius={50} maxClusterRadius={50}
removeOutsideVisibleBounds={false} removeOutsideVisibleBounds={false}
> >
{React.Children.toArray(children).map((child) => {Children.toArray(children).map((child) =>
React.isValidElement<{ isValidElement<{
setItemFormPopup: React.Dispatch<React.SetStateAction<ItemFormPopupProps>> setItemFormPopup: React.Dispatch<React.SetStateAction<ItemFormPopupProps>>
itemFormPopup: ItemFormPopupProps | null itemFormPopup: ItemFormPopupProps | null
clusterRef: React.MutableRefObject<undefined> clusterRef: React.MutableRefObject<undefined>
}>(child) }>(child)
? React.cloneElement(child, { setItemFormPopup, itemFormPopup, clusterRef }) ? cloneElement(child, { setItemFormPopup, itemFormPopup, clusterRef })
: child, : child,
)} )}
</MarkerClusterGroup> </MarkerClusterGroup>

View File

@ -1,7 +1,7 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react'
import { createContext, useContext, useState } from 'react' import { createContext, useContext, useState } from 'react'
type UseClusterRefManagerResult = ReturnType<typeof useClusterRefManager> type UseClusterRefManagerResult = ReturnType<typeof useClusterRefManager>

View File

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { useEffect } from 'react' import { useEffect } from 'react'
import { useTimeout } from './useTimeout' import { useTimeout } from './useTimeout'
export const useDebounce = (callback, delay, deps) => { export const useDebounce = (callback, delay, deps) => {

View File

@ -1,13 +1,15 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable no-case-declarations */ /* eslint-disable no-case-declarations */
import { useCallback, useReducer, createContext, useContext } from 'react' import { useCallback, useReducer, createContext, useContext, useState } from 'react'
import * as React from 'react'
import { LayerProps, Tag } from '../../../types'
import { useLayers } from './useLayers'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { LayerProps, Tag } from '#src/types'
import { useLayers } from './useLayers'
import useWindowDimensions from './useWindowDimension' import useWindowDimensions from './useWindowDimension'
type ActionType = type ActionType =
@ -118,7 +120,7 @@ function useFilterManager(initialTags: Tag[]): {
[], [],
) )
const [searchPhrase, searchPhraseSet] = React.useState<string>('') const [searchPhrase, searchPhraseSet] = useState<string>('')
const addFilterTag = useCallback((tag: Tag) => { const addFilterTag = useCallback((tag: Tag) => {
const params = new URLSearchParams(location.search) const params = new URLSearchParams(location.search)

View File

@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
@ -7,9 +8,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-misused-promises */ /* eslint-disable @typescript-eslint/no-misused-promises */
import { useCallback, useReducer, createContext, useContext, useState } from 'react' import { useCallback, useReducer, createContext, useContext, useState } from 'react'
import * as React from 'react'
import { Item, LayerProps } from '../../../types'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { Item, LayerProps } from '#src/types'
import { useAddLayer } from './useLayers' import { useAddLayer } from './useLayers'
type ActionType = type ActionType =

View File

@ -1,7 +1,8 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
import { useCallback, useReducer, createContext, useContext } from 'react' import { useCallback, useReducer, createContext, useContext } from 'react'
import * as React from 'react'
import { LayerProps } from '../../../types' import { LayerProps } from '#src/types'
interface ActionType { interface ActionType {
type: 'ADD LAYER' type: 'ADD LAYER'

View File

@ -1,9 +1,10 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/ban-types */ /* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-empty-function */ /* 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' import { Marker, Popup } from 'leaflet'
import { useCallback, useReducer, createContext, useContext } from 'react'
import { Item } from '#src/types'
interface LeafletRef { interface LeafletRef {
item: Item item: Item

View File

@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-misused-promises */ /* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
@ -6,10 +7,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { useCallback, useReducer, createContext, useContext } from 'react' import { useCallback, useReducer, createContext, useContext, useState } from 'react'
import * as React from 'react'
import { Item, ItemsApi, LayerProps, Permission, PermissionAction } from '../../../types' import { useAuth } from '#components/Auth/useAuth'
import { useAuth } from '../../Auth' import { Item, ItemsApi, LayerProps, Permission, PermissionAction } from '#src/types'
type ActionType = { type: 'ADD'; permission: Permission } | { type: 'REMOVE'; id: string } type ActionType = { type: 'ADD'; permission: Permission } | { type: 'REMOVE'; id: string }
@ -51,7 +52,7 @@ function usePermissionsManager(initialPermissions: Permission[]): {
} }
}, initialPermissions) }, initialPermissions)
const [adminRole, setAdminRole] = React.useState<string | null>(null) const [adminRole, setAdminRole] = useState<string | null>(null)
const { user } = useAuth() const { user } = useAuth()
const setPermissionApi = useCallback(async (api: ItemsApi<Permission>) => { const setPermissionApi = useCallback(async (api: ItemsApi<Permission>) => {

View File

@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
/* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
@ -7,14 +8,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* 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'
import { useUpdateItem } from './useItems'
import { toast } from 'react-toastify'
import { useHasUserPermission } from './usePermissions'
import { LatLng } from 'leaflet' import { LatLng } from 'leaflet'
import { ItemFormPopupProps } from '../Subcomponents/ItemFormPopup' import { createContext, useContext, useEffect, useState } from 'react'
import { toast } from 'react-toastify'
import { Geometry, Item, LayerProps, ItemFormPopupProps } from '#src/types'
import { useUpdateItem } from './useItems'
import { useHasUserPermission } from './usePermissions'
interface PolygonClickedProps { interface PolygonClickedProps {
position: LatLng position: LatLng

View File

@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-misused-promises */ /* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
@ -9,10 +10,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { useCallback, useReducer, createContext, useContext, useState } from 'react' import { useCallback, useReducer, createContext, useContext, useState } from 'react'
import * as React from 'react'
import { Item, ItemsApi, Tag } from '../../../types' import { Item, ItemsApi, Tag } from '#src/types'
import { hashTagRegex } from '../../../Utils/HashTagRegex' import { getValue } from '#utils/GetValue'
import { getValue } from '../../../Utils/GetValue' import { hashTagRegex } from '#utils/HashTagRegex'
type ActionType = { type: 'ADD'; tag: Tag } | { type: 'REMOVE'; id: string } type ActionType = { type: 'ADD'; tag: Tag } | { type: 'REMOVE'; id: string }
@ -55,7 +56,7 @@ function useTagsManager(initialTags: Tag[]): {
} }
}, initialTags) }, initialTags)
const [api, setApi] = React.useState<ItemsApi<Tag>>({} as ItemsApi<Tag>) const [api, setApi] = useState<ItemsApi<Tag>>({} as ItemsApi<Tag>)
const setTagApi = useCallback(async (api: ItemsApi<Tag>) => { const setTagApi = useCallback(async (api: ItemsApi<Tag>) => {
setApi(api) setApi(api)

View File

@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */
import { useMap } from 'react-leaflet' import { useMap } from 'react-leaflet'
export const setItemLocation = () => { export const setItemLocation = () => {

View File

@ -5,23 +5,25 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { getValue } from '../../Utils/GetValue'
import { useAuth } from '../Auth'
import { useAddTag, useGetItemTags, useTags } from '../Map/hooks/useTags'
import { useLocation, useNavigate } from 'react-router-dom' import { useLocation, useNavigate } from 'react-router-dom'
import { Item, Tag } from '../../types'
import { MapOverlayPage } from '../Templates' import { useAppState } from '#components/AppShell/hooks/useAppState'
import { useLayers } from '../Map/hooks/useLayers' import { useAuth } from '#components/Auth'
import { useHasUserPermission } from '../Map/hooks/usePermissions' import { useItems, useUpdateItem, useAddItem } from '#components/Map/hooks/useItems'
import { OnepagerForm } from './Templates/OnepagerForm' import { useLayers } from '#components/Map/hooks/useLayers'
import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import { useAddTag, useGetItemTags, useTags } from '#components/Map/hooks/useTags'
import { MapOverlayPage } from '#components/Templates'
import { Item, Tag } from '#src/types'
import { getValue } from '#utils/GetValue'
import { linkItem, onUpdateItem, unlinkItem } from './itemFunctions' import { linkItem, onUpdateItem, unlinkItem } from './itemFunctions'
import { FormHeader } from './Subcomponents/FormHeader'
import { FlexForm } from './Templates/FlexForm'
import { OnepagerForm } from './Templates/OnepagerForm'
import { SimpleForm } from './Templates/SimpleForm' import { SimpleForm } from './Templates/SimpleForm'
import { TabsForm } from './Templates/TabsForm' import { TabsForm } from './Templates/TabsForm'
import { FormHeader } from './Subcomponents/FormHeader'
import { useAppState } from '../AppShell/hooks/useAppState'
import { FlexForm } from './Templates/FlexForm'
export function ProfileForm() { export function ProfileForm() {
const [state, setState] = useState({ const [state, setState] = useState({

View File

@ -7,26 +7,28 @@
/* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* 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'
import { useEffect, useState } from 'react'
import { Item, ItemsApi, Tag } from '../../types'
import { useMap } from 'react-leaflet'
import { LatLng } from 'leaflet' import { LatLng } from 'leaflet'
import { useHasUserPermission } from '../Map/hooks/usePermissions' import { useEffect, useState } from 'react'
import { HeaderView } from '../Map/Subcomponents/ItemPopupComponents/HeaderView' import { useMap } from 'react-leaflet'
import { useSelectPosition, useSetSelectPosition } from '../Map/hooks/useSelectPosition' import { useLocation, useNavigate } from 'react-router-dom'
import { useClusterRef } from '../Map/hooks/useClusterRef'
import { useLeafletRefs } from '../Map/hooks/useLeafletRefs' import { useAppState } from '#components/AppShell/hooks/useAppState'
import { getValue } from '../../Utils/GetValue' import { useClusterRef } from '#components/Map/hooks/useClusterRef'
import { TabsView } from './Templates/TabsView' import { useItems, useRemoveItem, useUpdateItem } from '#components/Map/hooks/useItems'
import { useLeafletRefs } from '#components/Map/hooks/useLeafletRefs'
import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import { useSelectPosition, useSetSelectPosition } from '#components/Map/hooks/useSelectPosition'
import { useTags } from '#components/Map/hooks/useTags'
import { HeaderView } from '#components/Map/Subcomponents/ItemPopupComponents/HeaderView'
import { MapOverlayPage } from '#components/Templates'
import { Item, ItemsApi, Tag } from '#src/types'
import { getValue } from '#utils/GetValue'
import { handleDelete, linkItem, unlinkItem } from './itemFunctions'
import { FlexView } from './Templates/FlexView'
import { OnepagerView } from './Templates/OnepagerView' import { OnepagerView } from './Templates/OnepagerView'
import { SimpleView } from './Templates/SimpleView' import { SimpleView } from './Templates/SimpleView'
import { handleDelete, linkItem, unlinkItem } from './itemFunctions' import { TabsView } from './Templates/TabsView'
import { useTags } from '../Map/hooks/useTags'
import { FlexView } from './Templates/FlexView'
import { useAppState } from '../AppShell/hooks/useAppState'
export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any> }) { export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any> }) {
const [item, setItem] = useState<Item>() const [item, setItem] = useState<Item>()

View File

@ -3,14 +3,15 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { useState } from 'react' import { useState } from 'react'
import { useHasUserPermission } from '../../Map/hooks/usePermissions'
import DialogModal from '../../Templates/DialogModal' import { TextInput } from '#components/Input'
import { useItems } from '../../Map/hooks/useItems' import { useItems } from '#components/Map/hooks/useItems'
import { HeaderView } from '../../Map/Subcomponents/ItemPopupComponents/HeaderView' import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import { Item } from '../../../types' import { useGetItemTags } from '#components/Map/hooks/useTags'
import { TextInput } from '../../Input' import { HeaderView } from '#components/Map/Subcomponents/ItemPopupComponents/HeaderView'
import { getValue } from '../../../Utils/GetValue' import DialogModal from '#components/Templates/DialogModal'
import { useGetItemTags } from '../../Map/hooks/useTags' import { Item } from '#src/types'
import { getValue } from '#utils/GetValue'
export function ActionButton({ export function ActionButton({
item, item,

View File

@ -1,14 +1,18 @@
/* eslint-disable react/prop-types */
/* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
import * as React from 'react'
import { useState, useCallback, useRef } from 'react' import { useState, useCallback, useRef } from 'react'
import ReactCrop, { Crop, centerCrop, makeAspectCrop } from 'react-image-crop' import { ReactCrop, centerCrop, makeAspectCrop } from 'react-image-crop'
import { useAppState } from '../../AppShell/hooks/useAppState'
import { useAppState } from '#components/AppShell/hooks/useAppState'
// eslint-disable-next-line import/no-unassigned-import
import 'react-image-crop/dist/ReactCrop.css' import 'react-image-crop/dist/ReactCrop.css'
import DialogModal from '../../Templates/DialogModal' import DialogModal from '#components/Templates/DialogModal'
import type { Crop } from 'react-image-crop'
interface AvatarWidgetProps { interface AvatarWidgetProps {
avatar: string avatar: string

View File

@ -3,10 +3,11 @@
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-empty-function */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { useCallback, useEffect, useRef, useState } from 'react' import { useCallback, useEffect, useRef, useState } from 'react'
import * as React from 'react'
import { HexColorPicker } from 'react-colorful' import { HexColorPicker } from 'react-colorful'
// eslint-disable-next-line import/no-unassigned-import
import './ColorPicker.css' import './ColorPicker.css'
import useClickOutside from '../hooks/useClickOutside' import useClickOutside from '#components/Profile/hooks/useClickOutside'
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
export const ColorPicker = ({ color, onChange, className }) => { export const ColorPicker = ({ color, onChange, className }) => {
@ -16,7 +17,7 @@ export const ColorPicker = ({ color, onChange, className }) => {
const close = useCallback(() => toggle(false), []) const close = useCallback(() => toggle(false), [])
useClickOutside(popover, close) useClickOutside(popover, close)
const colorPickerRef = React.useRef<HTMLDivElement>(null) const colorPickerRef = useRef<HTMLDivElement>(null)
useEffect(() => { useEffect(() => {
// Füge dem Color-Picker explizit Event-Listener hinzu // Füge dem Color-Picker explizit Event-Listener hinzu

View File

@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import * as React from 'react' import { TextInput } from '#components/Input'
import { TextInput } from '../../Input' import { FormState } from '#src/types'
import { FormState } from '../Templates/OnepagerForm'
export const ContactInfoForm = ({ export const ContactInfoForm = ({
state, state,

View File

@ -3,11 +3,12 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
import { Link } from 'react-router-dom'
import { useAppState } from '../../AppShell/hooks/useAppState'
import { Item } from '../../../types'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useItems } from '../../Map/hooks/useItems' import { Link } from 'react-router-dom'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import { useItems } from '#components/Map/hooks/useItems'
import { Item } from '#src/types'
export const ContactInfoView = ({ item, heading }: { item: Item; heading: string }) => { export const ContactInfoView = ({ item, heading }: { item: Item; heading: string }) => {
const appState = useAppState() const appState = useAppState()

View File

@ -3,7 +3,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable react/prop-types */ /* eslint-disable react/prop-types */
import { TextInput } from '../../Input' import { TextInput } from '#components/Input'
import { AvatarWidget } from './AvatarWidget' import { AvatarWidget } from './AvatarWidget'
import { ColorPicker } from './ColorPicker' import { ColorPicker } from './ColorPicker'

View File

@ -1,4 +1,5 @@
import { Item } from '../../../types' import { Item } from '#src/types'
import SocialShareBar from './SocialShareBar' import SocialShareBar from './SocialShareBar'
export const GroupSubHeaderView = ({ export const GroupSubHeaderView = ({

View File

@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import * as React from 'react'
import ComboBoxInput from '../../Input/ComboBoxInput'
import { Item } from '../../../types'
import { useEffect } from 'react' import { useEffect } from 'react'
import { FormState } from '../Templates/OnepagerForm'
import ComboBoxInput from '#components/Input/ComboBoxInput'
import { Item, FormState } from '#src/types'
interface groupType { interface groupType {
groupTypes_id: { groupTypes_id: {

View File

@ -6,9 +6,10 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { useEffect } from 'react' import { useEffect } from 'react'
import { getValue } from '../../../Utils/GetValue'
import { Item } from '../../../types' import { useAppState } from '#components/AppShell/hooks/useAppState'
import { useAppState } from '../../AppShell/hooks/useAppState' import { Item } from '#src/types'
import { getValue } from '#utils/GetValue'
export function LinkedItemsHeaderView({ export function LinkedItemsHeaderView({
item, item,

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import { LayerProps } from '../../../types' import { useHasUserPermission } from '#components/Map/hooks/usePermissions'
import { useHasUserPermission } from '../../Map/hooks/usePermissions' import { LayerProps } from '#src/types'
export function PlusButton({ export function PlusButton({
layer, layer,

View File

@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import * as React from 'react' import { PopupStartEndInput } from '#components/Map'
import { PopupStartEndInput } from '../../Map' import { Item } from '#src/types'
import { Item } from '../../../types'
export const ProfileStartEndForm = ({ export const ProfileStartEndForm = ({
item, item,

View File

@ -1,6 +1,5 @@
import * as React from 'react' import { StartEndView } from '#components/Map'
import { StartEndView } from '../../Map' import { Item } from '#src/types'
import { Item } from '../../../types'
export const ProfileStartEndView = ({ item }: { item: Item }) => { export const ProfileStartEndView = ({ item }: { item: Item }) => {
return ( return (

View File

@ -2,12 +2,12 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react'
import { TextAreaInput } from '../../Input'
import { FormState } from '../Templates/OnepagerForm'
import { getValue } from '../../../Utils/GetValue'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { TextAreaInput } from '#components/Input'
import { FormState } from '#src/types'
import { getValue } from '#utils/GetValue'
export const ProfileTextForm = ({ export const ProfileTextForm = ({
state, state,
setState, setState,

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Item } from '../../../types' import { TextView } from '#components/Map'
import { getValue } from '../../../Utils/GetValue' import { Item } from '#src/types'
import { TextView } from '../../Map' import { getValue } from '#utils/GetValue'
export const ProfileTextView = ({ export const ProfileTextView = ({
item, item,

View File

@ -1,4 +1,5 @@
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import SocialShareButton from './SocialShareButton' import SocialShareButton from './SocialShareButton'
const SocialShareBar = ({ const SocialShareBar = ({

View File

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
import * as React from 'react' import { cloneElement } from 'react'
const platformConfigs = { const platformConfigs = {
facebook: { facebook: {
@ -106,7 +106,7 @@ const SocialShareButton = ({
}} }}
title={`share link on ${platform}`} title={`share link on ${platform}`}
> >
{React.cloneElement(icon, { className: 'tw-w-4 tw-h-4 tw-fill-current' })} {cloneElement(icon, { className: 'tw-w-4 tw-h-4 tw-fill-current' })}
</a> </a>
) )
} }

View File

@ -4,13 +4,13 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import * as React from 'react'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useTags } from '../../Map/hooks/useTags'
import { Tag } from '../../../types' import { Autocomplete } from '#components/Input/Autocomplete'
import { Autocomplete } from '../../Input/Autocomplete' import { useTags } from '#components/Map/hooks/useTags'
import { randomColor } from '../../../Utils/RandomColor' import { Tag } from '#src/types'
import { decodeTag, encodeTag } from '../../../Utils/FormatTags' import { decodeTag, encodeTag } from '#utils/FormatTags'
import { randomColor } from '#utils/RandomColor'
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
export const TagsWidget = ({ placeholder, containerStyle, defaultTags, onUpdate }) => { export const TagsWidget = ({ placeholder, containerStyle, defaultTags, onUpdate }) => {

View File

@ -2,13 +2,12 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import * as React from 'react'
import { Item } from '../../../types' import { ContactInfoForm } from '#components/Profile/Subcomponents/ContactInfoForm'
import { FormState } from './OnepagerForm' import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubheaderForm'
import { GroupSubheaderForm } from '../Subcomponents/GroupSubheaderForm' import { ProfileStartEndForm } from '#components/Profile/Subcomponents/ProfileStartEndForm'
import { ContactInfoForm } from '../Subcomponents/ContactInfoForm' import { ProfileTextForm } from '#components/Profile/Subcomponents/ProfileTextForm'
import { ProfileTextForm } from '../Subcomponents/ProfileTextForm' import { Item, FormState } from '#src/types'
import { ProfileStartEndForm } from '../Subcomponents/ProfileStartEndForm'
const componentMap = { const componentMap = {
groupSubheaders: GroupSubheaderForm, groupSubheaders: GroupSubheaderForm,

View File

@ -1,11 +1,12 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import { GroupSubHeaderView } from '../Subcomponents/GroupSubHeaderView'
import { ProfileTextView } from '../Subcomponents/ProfileTextView' import { ContactInfoView } from '#components/Profile/Subcomponents/ContactInfoView'
import { ContactInfoView } from '../Subcomponents/ContactInfoView' import { GroupSubHeaderView } from '#components/Profile/Subcomponents/GroupSubHeaderView'
import { Item } from '../../../types' import { ProfileStartEndView } from '#components/Profile/Subcomponents/ProfileStartEndView'
import { ProfileStartEndView } from '../Subcomponents/ProfileStartEndView' import { ProfileTextView } from '#components/Profile/Subcomponents/ProfileTextView'
import { Item } from '#src/types'
const componentMap = { const componentMap = {
groupSubheaders: GroupSubHeaderView, groupSubheaders: GroupSubHeaderView,

View File

@ -1,28 +1,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import * as React from 'react' import { TextAreaInput } from '#components/Input'
import { Item, Tag } from '../../../types' import { ContactInfoForm } from '#components/Profile/Subcomponents/ContactInfoForm'
import { TextAreaInput } from '../../Input' import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubheaderForm'
import { GroupSubheaderForm } from '../Subcomponents/GroupSubheaderForm' import { FormState, Item } from '#src/types'
import { ContactInfoForm } from '../Subcomponents/ContactInfoForm'
export interface FormState {
color: string
id: string
group_type: string
status: string
name: string
subname: string
text: string
contact: string
telephone: string
next_appointment: string
image: string
marker_icon: string
offers: Tag[]
needs: Tag[]
relations: Item[]
}
export const OnepagerForm = ({ export const OnepagerForm = ({
item, item,

View File

@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import { Item } from '../../../types' import { TextView } from '#components/Map'
import { TextView } from '../../Map' import { ContactInfoView } from '#components/Profile/Subcomponents/ContactInfoView'
import { ContactInfoView } from '../Subcomponents/ContactInfoView' import { GroupSubHeaderView } from '#components/Profile/Subcomponents/GroupSubHeaderView'
import { GroupSubHeaderView } from '../Subcomponents/GroupSubHeaderView' import { Item } from '#src/types'
export const OnepagerView = ({ item }: { item: Item }) => { export const OnepagerView = ({ item }: { item: Item }) => {
return ( return (

View File

@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { TextAreaInput } from '../../Input' import { TextAreaInput } from '#components/Input'
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
export const SimpleForm = ({ state, setState }) => { export const SimpleForm = ({ state, setState }) => {

View File

@ -1,6 +1,5 @@
import * as React from 'react' import { TextView } from '#components/Map'
import { TextView } from '../../Map' import { Item } from '#src/types'
import { Item } from '../../../types'
export const SimpleView = ({ item }: { item: Item }) => { export const SimpleView = ({ item }: { item: Item }) => {
return ( return (

View File

@ -7,13 +7,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable react/prop-types */ /* eslint-disable react/prop-types */
import { useCallback, useEffect, useState } from 'react' import { useCallback, useEffect, useState } from 'react'
import { TextAreaInput } from '../../Input'
import { PopupStartEndInput, TextView } from '../../Map'
import { ActionButton } from '../Subcomponents/ActionsButton'
import { LinkedItemsHeaderView } from '../Subcomponents/LinkedItemsHeaderView'
import { TagsWidget } from '../Subcomponents/TagsWidget'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { useUpdateItem } from '../../Map/hooks/useItems'
import { TextAreaInput } from '#components/Input'
import { PopupStartEndInput, TextView } from '#components/Map'
import { useUpdateItem } from '#components/Map/hooks/useItems'
import { ActionButton } from '#components/Profile/Subcomponents/ActionsButton'
import { LinkedItemsHeaderView } from '#components/Profile/Subcomponents/LinkedItemsHeaderView'
import { TagsWidget } from '#components/Profile/Subcomponents/TagsWidget'
export const TabsForm = ({ export const TabsForm = ({
item, item,

View File

@ -6,17 +6,18 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { StartEndView, TextView } from '../../Map'
import { TagView } from '../../Templates/TagView'
import { LinkedItemsHeaderView } from '../Subcomponents/LinkedItemsHeaderView'
import { ActionButton } from '../Subcomponents/ActionsButton'
import { useCallback, useEffect, useRef, useState } from 'react' import { useCallback, useEffect, useRef, useState } from 'react'
import { useAddFilterTag } from '../../Map/hooks/useFilter'
import { Item, Tag } from '../../../types'
import { Link, useNavigate } from 'react-router-dom' import { Link, useNavigate } from 'react-router-dom'
import { useItems } from '../../Map/hooks/useItems'
import { useAppState } from '../../AppShell/hooks/useAppState' import { useAppState } from '#components/AppShell/hooks/useAppState'
import { timeAgo } from '../../../Utils/TimeAgo' import { StartEndView, TextView } from '#components/Map'
import { useAddFilterTag } from '#components/Map/hooks/useFilter'
import { useItems } from '#components/Map/hooks/useItems'
import { ActionButton } from '#components/Profile/Subcomponents/ActionsButton'
import { LinkedItemsHeaderView } from '#components/Profile/Subcomponents/LinkedItemsHeaderView'
import { TagView } from '#components/Templates/TagView'
import { Item, Tag } from '#src/types'
import { timeAgo } from '#utils/TimeAgo'
export const TabsView = ({ export const TabsView = ({
attestations, attestations,

View File

@ -1,14 +1,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import * as React from 'react' import { useEffect, useState } from 'react'
import { MapOverlayPage } from '../Templates'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { useState } from 'react'
import { UserItem } from '../../types'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { useAuth } from '../Auth'
import { TextInput } from '../Input' import { useAuth } from '#components/Auth'
import { TextInput } from '#components/Input'
import { MapOverlayPage } from '#components/Templates'
import { UserItem } from '#src/types'
export function UserSettings() { export function UserSettings() {
const { user, updateUser, loading /* token */ } = useAuth() const { user, updateUser, loading /* token */ } = useAuth()
@ -21,7 +21,7 @@ export function UserSettings() {
const navigate = useNavigate() const navigate = useNavigate()
React.useEffect(() => { useEffect(() => {
setId(user?.id ? user.id : '') setId(user?.id ? user.id : '')
setEmail(user?.email ? user.email : '') setEmail(user?.email ? user.email : '')
setPassword(user?.password ? user.password : '') setPassword(user?.password ? user.password : '')

View File

@ -9,13 +9,13 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as React from 'react'
import { Item } from '../../types'
import { encodeTag } from '../../Utils/FormatTags'
import { hashTagRegex } from '../../Utils/HashTagRegex'
import { randomColor } from '../../Utils/RandomColor'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { Item } from '#src/types'
import { encodeTag } from '#utils/FormatTags'
import { hashTagRegex } from '#utils/HashTagRegex'
import { randomColor } from '#utils/RandomColor'
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
export const submitNewItem = async ( export const submitNewItem = async (

View File

@ -7,16 +7,17 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as React from 'react'
import { MapOverlayPage } from './MapOverlayPage'
import { useItems } from '../Map/hooks/useItems'
import { useAppState } from '../AppShell/hooks/useAppState'
import { EmojiPicker } from './EmojiPicker'
import { useNavigate } from 'react-router-dom'
import { useRef, useState, useEffect } from 'react' import { useRef, useState, useEffect } from 'react'
import { Item, ItemsApi } from '../../types' import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { useAppState } from '#components/AppShell/hooks/useAppState'
import { useItems } from '#components/Map/hooks/useItems'
import { Item, ItemsApi } from '#src/types'
import { EmojiPicker } from './EmojiPicker'
import { MapOverlayPage } from './MapOverlayPage'
export const AttestationForm = ({ api }: { api?: ItemsApi<any> }) => { export const AttestationForm = ({ api }: { api?: ItemsApi<any> }) => {
const items = useItems() const items = useItems()
const appState = useAppState() const appState = useAppState()

View File

@ -1,5 +1,5 @@
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import * as React from 'react'
import { TitleCard } from './TitleCard' import { TitleCard } from './TitleCard'
export function CardPage({ export function CardPage({

View File

@ -4,8 +4,9 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/prefer-optional-chain */
import { useState } from 'react' import { useState } from 'react'
import { timeAgo } from '../../Utils/TimeAgo'
import { Item } from '../../types' import { Item } from '#src/types'
import { timeAgo } from '#utils/TimeAgo'
export const DateUserInfo = ({ item }: { item: Item }) => { export const DateUserInfo = ({ item }: { item: Item }) => {
const [infoExpanded, setInfoExpanded] = useState<boolean>(false) const [infoExpanded, setInfoExpanded] = useState<boolean>(false)

View File

@ -1,4 +1,3 @@
import * as React from 'react'
import { MouseEvent, useEffect, useRef } from 'react' import { MouseEvent, useEffect, useRef } from 'react'
const isClickInsideRectangle = (e: MouseEvent, element: HTMLElement) => { const isClickInsideRectangle = (e: MouseEvent, element: HTMLElement) => {

View File

@ -4,13 +4,15 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/restrict-plus-operands */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { DateUserInfo } from './DateUserInfo'
import { StartEndView, TextView } from '../Map'
import { HeaderView } from '../Map/Subcomponents/ItemPopupComponents/HeaderView'
import { Item } from '../../types'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { getValue } from '../../Utils/GetValue'
import useWindowDimensions from '../Map/hooks/useWindowDimension' import { StartEndView, TextView } from '#components/Map'
import useWindowDimensions from '#components/Map/hooks/useWindowDimension'
import { HeaderView } from '#components/Map/Subcomponents/ItemPopupComponents/HeaderView'
import { Item } from '#src/types'
import { getValue } from '#utils/GetValue'
import { DateUserInfo } from './DateUserInfo'
export const ItemCard = ({ export const ItemCard = ({
i, i,

View File

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-template-expressions */
import * as L from 'leaflet' import { DomEvent } from 'leaflet'
import * as React from 'react' import { createRef, useEffect } from 'react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
export function MapOverlayPage({ export function MapOverlayPage({
@ -20,17 +20,17 @@ export function MapOverlayPage({
const navigate = useNavigate() const navigate = useNavigate()
const overlayRef = React.createRef<HTMLDivElement>() const overlayRef = createRef<HTMLDivElement>()
const backdropRef = React.createRef<HTMLDivElement>() const backdropRef = createRef<HTMLDivElement>()
React.useEffect(() => { useEffect(() => {
if (overlayRef.current !== null) { if (overlayRef.current !== null) {
L.DomEvent.disableClickPropagation(overlayRef.current) DomEvent.disableClickPropagation(overlayRef.current)
L.DomEvent.disableScrollPropagation(overlayRef.current) DomEvent.disableScrollPropagation(overlayRef.current)
} }
if (backdropRef.current !== null && backdrop) { if (backdropRef.current !== null && backdrop) {
L.DomEvent.disableClickPropagation(backdropRef.current) DomEvent.disableClickPropagation(backdropRef.current)
L.DomEvent.disableScrollPropagation(backdropRef.current) DomEvent.disableScrollPropagation(backdropRef.current)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [overlayRef, backdropRef]) }, [overlayRef, backdropRef])

View File

@ -4,13 +4,15 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { useItems } from '../Map/hooks/useItems' import { useNavigate } from 'react-router-dom'
import { Tag } from '../../types'
import { useTags } from '../Map/hooks/useTags' import { useItems } from '#components/Map/hooks/useItems'
import { getValue } from '../../Utils/GetValue' import { useTags } from '#components/Map/hooks/useTags'
import { Tag } from '#src/types'
import { getValue } from '#utils/GetValue'
import { MapOverlayPage } from './MapOverlayPage' import { MapOverlayPage } from './MapOverlayPage'
import { TagView } from './TagView' import { TagView } from './TagView'
import { useNavigate } from 'react-router-dom'
function groupAndCount(arr) { function groupAndCount(arr) {
const grouped = arr.reduce((acc, obj) => { const grouped = arr.reduce((acc, obj) => {

View File

@ -1,10 +1,11 @@
import * as React from 'react'
import { useState } from 'react'
import { add, format, parse, startOfToday, sub } from 'date-fns'
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline' import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/outline'
import { MapOverlayPage } from './MapOverlayPage' import { add, format, parse, startOfToday, sub } from 'date-fns'
import { useState } from 'react'
import { LUNAR_MONTH, getLastNewMoon, getNextNewMoon } from '#utils/Moon'
import { CircleLayout } from './CircleLayout' import { CircleLayout } from './CircleLayout'
import { LUNAR_MONTH, getLastNewMoon, getNextNewMoon } from '../../Utils/Moon' import { MapOverlayPage } from './MapOverlayPage'
export const MoonCalendar = () => { export const MoonCalendar = () => {
const today = startOfToday() const today = startOfToday()

View File

@ -6,23 +6,25 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-call */
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { Item } from '../../types'
import { PopupStartEndInput } from '../Map'
import { PlusButton } from '../Profile/Subcomponents/PlusButton'
import { TextInput, TextAreaInput } from '../Input'
import { useAddTag, useGetItemTags, useTags } from '../Map/hooks/useTags'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { hashTagRegex } from '../../Utils/HashTagRegex'
import { randomColor } from '../../Utils/RandomColor' import { useAuth } from '#components/Auth/useAuth'
import { useAuth } from '../Auth' import { TextInput, TextAreaInput } from '#components/Input'
import { useLayers } from '../Map/hooks/useLayers' import { PopupStartEndInput } from '#components/Map'
import { MapOverlayPage } from './MapOverlayPage' import { useFilterTags } from '#components/Map/hooks/useFilter'
import { useAddItem, useItems, useRemoveItem } from '../Map/hooks/useItems' import { useAddItem, useItems, useRemoveItem } from '#components/Map/hooks/useItems'
import { useLayers } from '#components/Map/hooks/useLayers'
import { useAddTag, useGetItemTags, useTags } from '#components/Map/hooks/useTags'
import { Control } from '#components/Map/Subcomponents/Controls/Control'
import { SearchControl } from '#components/Map/Subcomponents/Controls/SearchControl'
import { TagsControl } from '#components/Map/Subcomponents/Controls/TagsControl'
import { PlusButton } from '#components/Profile/Subcomponents/PlusButton'
import { Item } from '#src/types'
import { hashTagRegex } from '#utils/HashTagRegex'
import { randomColor } from '#utils/RandomColor'
import { ItemCard } from './ItemCard' import { ItemCard } from './ItemCard'
import { Control } from '../Map/Subcomponents/Controls/Control' import { MapOverlayPage } from './MapOverlayPage'
import { SearchControl } from '../Map/Subcomponents/Controls/SearchControl'
import { TagsControl } from '../Map/Subcomponents/Controls/TagsControl'
import { useFilterTags } from '../Map/hooks/useFilter'
export const OverlayItemsIndexPage = ({ export const OverlayItemsIndexPage = ({
url, url,

Some files were not shown because too many files have changed in this diff Show More