mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
lint fixes
This commit is contained in:
parent
95f108c2f7
commit
d832185ee3
@ -17,12 +17,14 @@ import { BrowserRouter as Router, useLocation } from 'react-router-dom';
|
|||||||
// 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);
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const ContextWrapper = ({ children }) => {
|
export const ContextWrapper = ({ children }) => {
|
||||||
const isWrapped = useContext(ContextCheckContext);
|
const isWrapped = useContext(ContextCheckContext);
|
||||||
|
|
||||||
// Check if we are already inside a Router
|
// Check if we are already inside a Router
|
||||||
let location;
|
let location;
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
location = useLocation();
|
location = useLocation();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
location = null;
|
location = null;
|
||||||
@ -63,6 +65,7 @@ export const ContextWrapper = ({ children }) => {
|
|||||||
return children;
|
return children;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const Wrappers = ({ children }) => {
|
export const Wrappers = ({ children }) => {
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export default function NavBar({ appName, userType}: { appName: string, userType
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const profile = user && items.find(i => (i.user_created?.id === user.id) && i.layer?.itemType.name === userType);
|
const profile = user && items.find(i => (i.user_created?.id === user.id) && i.layer?.itemType.name === userType);
|
||||||
profile ? setUserProfile(profile) : setUserProfile({id: crypto.randomUUID(), name: user?.first_name, text: ""});
|
profile ? setUserProfile(profile) : setUserProfile({id: crypto.randomUUID(), name: user?.first_name, text: ""});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [user, items])
|
}, [user, items])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export const SetAssetsApi = ({assetsApi}:{assetsApi: AssetsApi}) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAssetsApi(assetsApi)
|
setAssetsApi(assetsApi)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [assetsApi])
|
}, [assetsApi])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import * as React from 'react';
|
|||||||
|
|
||||||
type route = {
|
type route = {
|
||||||
path: string;
|
path: string;
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
icon: JSX.Element;
|
icon: JSX.Element;
|
||||||
name: string;
|
name: string;
|
||||||
submenu?: route;
|
submenu?: route;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { Link, useLocation } from 'react-router-dom'
|
|||||||
|
|
||||||
|
|
||||||
function SidebarSubmenu({submenu, name, icon} : { path: string;
|
function SidebarSubmenu({submenu, name, icon} : { path: string;
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
icon: JSX.Element;
|
icon: JSX.Element;
|
||||||
name: string;
|
name: string;
|
||||||
submenu?: any | undefined}){
|
submenu?: any | undefined}){
|
||||||
@ -14,6 +15,7 @@ function SidebarSubmenu({submenu, name, icon} : { path: string;
|
|||||||
/** Open Submenu list if path found in routes, this is for directly loading submenu routes first time */
|
/** Open Submenu list if path found in routes, this is for directly loading submenu routes first time */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(submenu.filter(m => {return m.path === location.pathname})[0])setIsExpanded(true)
|
if(submenu.filter(m => {return m.path === location.pathname})[0])setIsExpanded(true)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -24,6 +24,7 @@ export const Sitemap = ({url}:{url:string}) => {
|
|||||||
|
|
||||||
setSitemap(generateSitemap());
|
setSitemap(generateSitemap());
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [items]);
|
}, [items]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const AssetContext = createContext<UseAssetManagerResult>({
|
|||||||
|
|
||||||
function useAssetsManager(): {
|
function useAssetsManager(): {
|
||||||
api: AssetsApi;
|
api: AssetsApi;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setAssetsApi: (api: AssetsApi) => void;
|
setAssetsApi: (api: AssetsApi) => void;
|
||||||
} {
|
} {
|
||||||
const [api, setApi] = useState<AssetsApi>({} as AssetsApi);
|
const [api, setApi] = useState<AssetsApi>({} as AssetsApi);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ export function LoginPage() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
const onLogin = async () => {
|
const onLogin = async () => {
|
||||||
await toast.promise(
|
await toast.promise(
|
||||||
login({ email: email, password: password }),
|
login({ email: email, password: password }),
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { toast } from 'react-toastify'
|
|||||||
import { useAuth } from './useAuth'
|
import { useAuth } from './useAuth'
|
||||||
import { MapOverlayPage} from '../Templates'
|
import { MapOverlayPage} from '../Templates'
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export function RequestPasswordPage({reset_url}) {
|
export function RequestPasswordPage({reset_url}) {
|
||||||
|
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
|
|||||||
@ -16,6 +16,7 @@ export function SignupPage() {
|
|||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
const onRegister = async () => {
|
const onRegister = async () => {
|
||||||
await toast.promise(
|
await toast.promise(
|
||||||
register({ email: email, password: password }, userName),
|
register({ email: email, password: password }, userName),
|
||||||
|
|||||||
@ -19,13 +19,18 @@ type AuthCredentials = {
|
|||||||
type AuthContextProps = {
|
type AuthContextProps = {
|
||||||
isAuthenticated: boolean,
|
isAuthenticated: boolean,
|
||||||
user: UserItem | null;
|
user: UserItem | null;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
login: (credentials: AuthCredentials) => Promise<UserItem | undefined>,
|
login: (credentials: AuthCredentials) => Promise<UserItem | undefined>,
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
register: (credentials: AuthCredentials, userName: string) => Promise<UserItem | undefined>,
|
register: (credentials: AuthCredentials, userName: string) => Promise<UserItem | undefined>,
|
||||||
loading: boolean,
|
loading: boolean,
|
||||||
logout: () => Promise<any>,
|
logout: () => Promise<any>,
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateUser: (user: UserItem) => any,
|
updateUser: (user: UserItem) => any,
|
||||||
token: string | null,
|
token: string | null,
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
requestPasswordReset: (email:string, reset_url: string) => Promise<any>,
|
requestPasswordReset: (email:string, reset_url: string) => Promise<any>,
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
passwordReset: (token:string, new_password:string) => Promise<any>
|
passwordReset: (token:string, new_password:string) => Promise<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +57,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
loadUser();
|
loadUser();
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
async function loadUser(): Promise<UserItem | undefined> {
|
async function loadUser(): Promise<UserItem | undefined> {
|
||||||
@ -88,7 +94,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
|||||||
const register = async (credentials: AuthCredentials, userName): Promise<UserItem | undefined> => {
|
const register = async (credentials: AuthCredentials, userName): Promise<UserItem | undefined> => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await userApi.register(credentials.email, credentials.password, userName)
|
/* const res = */ await userApi.register(credentials.email, credentials.password, userName)
|
||||||
return (await login(credentials));
|
return (await login(credentials));
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@ -109,6 +115,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
|||||||
|
|
||||||
const updateUser = async (user: UserItem) => {
|
const updateUser = async (user: UserItem) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { id, ...userRest } = user;
|
const { id, ...userRest } = user;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export function Modal({children, showOnStartup}:{children : React.ReactNode, sho
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(showOnStartup)
|
if(showOnStartup)
|
||||||
window.my_modal_3.showModal()
|
window.my_modal_3.showModal()
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ export function Quests() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setQuestsOpen(false);
|
setQuestsOpen(false);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const [profile, setProfie] = useState<Item>()
|
const [profile, setProfie] = useState<Item>()
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const QuestContext = createContext<UseQuestManagerResult>({
|
|||||||
|
|
||||||
function useQuestsManager(initialOpen: boolean): {
|
function useQuestsManager(initialOpen: boolean): {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setQuestsOpen: (open: boolean) => void;
|
setQuestsOpen: (open: boolean) => void;
|
||||||
} {
|
} {
|
||||||
const [open, setOpen] = useState<boolean>(initialOpen);
|
const [open, setOpen] = useState<boolean>(initialOpen);
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import * as React from 'react'
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { TagView } from '../Templates/TagView';
|
import { TagView } from '../Templates/TagView';
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
export const Autocomplete = ({ inputProps, suggestions, onSelected, pushFilteredSuggestions, setFocus }: { inputProps: any, suggestions: Array<any>, onSelected: (suggestion) => void, pushFilteredSuggestions?: Array<any>, setFocus?: boolean }) => {
|
export const Autocomplete = ({ inputProps, suggestions, onSelected, pushFilteredSuggestions, setFocus }: { inputProps: any, suggestions: Array<any>, onSelected: (suggestion) => void, pushFilteredSuggestions?: Array<any>, setFocus?: boolean }) => {
|
||||||
|
|
||||||
const [filteredSuggestions, setFilteredSuggestions] = React.useState<Array<any>>([]);
|
const [filteredSuggestions, setFilteredSuggestions] = React.useState<Array<any>>([]);
|
||||||
@ -19,6 +20,7 @@ export const Autocomplete = ({ inputProps, suggestions, onSelected, pushFiltered
|
|||||||
const inputRef = React.useRef<HTMLInputElement>();
|
const inputRef = React.useRef<HTMLInputElement>();
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const getSuggestionValue = suggestion => suggestion.name;
|
const getSuggestionValue = suggestion => suggestion.name;
|
||||||
|
|
||||||
const getSuggestions = value => {
|
const getSuggestions = value => {
|
||||||
|
|||||||
@ -5,11 +5,13 @@ interface ComboBoxProps {
|
|||||||
id?: string;
|
id?: string;
|
||||||
options: { value: string, label: string }[];
|
options: { value: string, label: string }[];
|
||||||
value: string;
|
value: string;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
onValueChange: (newValue: string) => void;
|
onValueChange: (newValue: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ComboBoxInput = ({ id, options, value, onValueChange }: ComboBoxProps) => {
|
const ComboBoxInput = ({ id, options, value, onValueChange }: ComboBoxProps) => {
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const [selectedValue, setSelectedValue] = useState(value);
|
const [selectedValue, setSelectedValue] = useState(value);
|
||||||
|
|
||||||
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ type SelectBoxProps = {
|
|||||||
containerStyle?: string;
|
containerStyle?: string;
|
||||||
defaultValue: string;
|
defaultValue: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateFormValue: (value: string ) => void;
|
updateFormValue: (value: string ) => void;
|
||||||
|
|
||||||
options: {name: string, value: string}[];
|
options: {name: string, value: string}[];
|
||||||
|
|||||||
@ -11,6 +11,7 @@ type TextAreaProps = {
|
|||||||
inputStyle?: string;
|
inputStyle?: string;
|
||||||
defaultValue: string;
|
defaultValue: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateFormValue?: (value: string) => void;
|
updateFormValue?: (value: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ export function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyl
|
|||||||
}
|
}
|
||||||
init.current = true;
|
init.current = true;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [ref]);
|
}, [ref]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ type InputTextProps = {
|
|||||||
defaultValue?: string;
|
defaultValue?: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
autocomplete?: string
|
autocomplete?: string
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateFormValue?: (value: string ) => void;
|
updateFormValue?: (value: string ) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export const ItemForm = ({ children, item, title, setPopupTitle }: { children?:
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPopupTitle&& title && setPopupTitle(title);
|
setPopupTitle&& title && setPopupTitle(title);
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [title])
|
}, [title])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -88,6 +88,7 @@ export const Layer = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
data && setItemsData({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef });
|
data && setItemsData({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef });
|
||||||
api && setItemsApi({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef });
|
api && setItemsApi({ data, children, name, menuIcon, menuText, menuColor, markerIcon, markerShape, markerDefaultColor, markerDefaultColor2, api, itemType, itemNameField, itemSubnameField, itemTextField, itemAvatarField, itemColorField, itemOwnerField, itemTagsField, itemOffersField, itemNeedsField, onlyOnePerOwner, customEditLink, customEditParameter, public_edit_items, listed, setItemFormPopup, itemFormPopup, clusterRef });
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [data, api])
|
}, [data, api])
|
||||||
|
|
||||||
useMapEvents({
|
useMapEvents({
|
||||||
@ -131,6 +132,7 @@ export const Layer = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
openPopup();
|
openPopup();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [leafletRefs, location])
|
}, [leafletRefs, location])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -143,6 +145,7 @@ export const Layer = ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [tagsReady])
|
}, [tagsReady])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -14,6 +14,7 @@ useEffect(() => {
|
|||||||
adminRole && setAdminRole(adminRole);
|
adminRole && setAdminRole(adminRole);
|
||||||
data && setPermissionData(data);
|
data && setPermissionData(data);
|
||||||
api && setPermissionApi(api);
|
api && setPermissionApi(api);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [api, data, adminRole, user])
|
}, [api, data, adminRole, user])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -13,6 +13,7 @@ export function FilterControl() {
|
|||||||
groupTypes.map(layer =>
|
groupTypes.map(layer =>
|
||||||
addVisibleGroupType(layer.value)
|
addVisibleGroupType(layer.value)
|
||||||
)
|
)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
import * as React from 'react'
|
|
||||||
import * as L from 'leaflet'
|
import * as L from 'leaflet'
|
||||||
import { useMap, useMapEvents } from 'react-leaflet'
|
import { useMap, useMapEvents } from 'react-leaflet'
|
||||||
import 'leaflet.locatecontrol'
|
import 'leaflet.locatecontrol'
|
||||||
@ -26,6 +25,7 @@ export const LocateControl = () => {
|
|||||||
setLc(L.control.locate().addTo(map));
|
setLc(L.control.locate().addTo(map));
|
||||||
init.current = true;
|
init.current = true;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useMapEvents({
|
useMapEvents({
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { useAddFilterTag, useFilterTags, useResetFilterTags } from '../../hooks/useFilter'
|
import { useAddFilterTag } from '../../hooks/useFilter'
|
||||||
import useWindowDimensions from '../../hooks/useWindowDimension';
|
import useWindowDimensions from '../../hooks/useWindowDimension';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
@ -15,7 +15,6 @@ import * as L from 'leaflet';
|
|||||||
import MarkerIconFactory from '../../../../Utils/MarkerIconFactory';
|
import MarkerIconFactory from '../../../../Utils/MarkerIconFactory';
|
||||||
import { decodeTag } from '../../../../Utils/FormatTags';
|
import { decodeTag } from '../../../../Utils/FormatTags';
|
||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import { useClusterRef } from '../../hooks/useClusterRef';
|
|
||||||
import { Item } from '../../../../types';
|
import { Item } from '../../../../types';
|
||||||
import { SidebarControl } from './SidebarControl';
|
import { SidebarControl } from './SidebarControl';
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ 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 { useEffect, useRef, useState } from 'react'
|
||||||
import { useAddItem, useItems, useRemoveItem, useUpdateItem } from '../hooks/useItems'
|
import { useAddItem, useItems, useRemoveItem, useUpdateItem } from '../hooks/useItems'
|
||||||
import { Geometry, LayerProps, Item, ItemsApi } from '../../../types'
|
import { Geometry, LayerProps, Item } from '../../../types'
|
||||||
import { TextAreaInput } from '../../Input/TextAreaInput'
|
import { TextAreaInput } from '../../Input/TextAreaInput'
|
||||||
import { TextInput } from '../../Input/TextInput'
|
import { TextInput } from '../../Input/TextInput'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
@ -25,6 +25,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
|
|
||||||
const [spinner, setSpinner] = useState(false);
|
const [spinner, setSpinner] = useState(false);
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const [popupTitle, setPopupTitle] = useState<string>("");
|
const [popupTitle, setPopupTitle] = useState<string>("");
|
||||||
|
|
||||||
const formRef = useRef<HTMLFormElement>(null);
|
const formRef = useRef<HTMLFormElement>(null);
|
||||||
@ -34,6 +35,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
const addItem = useAddItem();
|
const addItem = useAddItem();
|
||||||
const updateItem = useUpdateItem();
|
const updateItem = useUpdateItem();
|
||||||
const items = useItems();
|
const items = useItems();
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const removeItem = useRemoveItem();
|
const removeItem = useRemoveItem();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,6 @@ import { getValue } from "../../../../Utils/GetValue";
|
|||||||
import { useAssetApi } from '../../../AppShell/hooks/useAssets'
|
import { useAssetApi } from '../../../AppShell/hooks/useAssets'
|
||||||
import DialogModal from "../../../Templates/DialogModal";
|
import DialogModal from "../../../Templates/DialogModal";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useMap } from "react-leaflet";
|
|
||||||
import { useEffect } from "react";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback, itemNameField, itemSubnameField, itemAvatarField, loading, hideMenu = false, big = false, truncateSubname = true, hideSubname = false, showAddress = false }: {
|
export function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback, itemNameField, itemSubnameField, itemAvatarField, loading, hideMenu = false, big = false, truncateSubname = true, hideSubname = false, showAddress = false }: {
|
||||||
item: Item,
|
item: Item,
|
||||||
@ -39,7 +34,7 @@ export function HeaderView({ item, api, editCallback, deleteCallback, setPositio
|
|||||||
const title = itemNameField ? getValue(item, itemNameField) : item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField);
|
const title = itemNameField ? getValue(item, itemNameField) : item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField);
|
||||||
const subtitle = itemSubnameField ? getValue(item, itemSubnameField) : item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField);
|
const subtitle = itemSubnameField ? getValue(item, itemSubnameField) : item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField);
|
||||||
|
|
||||||
const [address, setAdress] = React.useState<string>("");
|
const [address, /* setAdress*/] = React.useState<string>("");
|
||||||
|
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import * as React from 'react'
|
|
||||||
import { TextInput } from '../../../Input'
|
|
||||||
import { Item } from '../../../../types'
|
import { Item } from '../../../../types'
|
||||||
|
|
||||||
export const PopupCheckboxInput = ({ dataField, label, item }:
|
export const PopupCheckboxInput = ({ dataField, label, item }:
|
||||||
|
|||||||
@ -5,7 +5,9 @@ import { Item } from '../../../../types'
|
|||||||
type StartEndInputProps = {
|
type StartEndInputProps = {
|
||||||
item?:Item,
|
item?:Item,
|
||||||
showLabels?: boolean
|
showLabels?: boolean
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateStartValue?: (value: string ) => void;
|
updateStartValue?: (value: string ) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateEndValue?: (value: string ) => void;
|
updateEndValue?: (value: string ) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,11 +28,14 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
|
|
||||||
item && text ? replacedText = fixUrls(text) : "";
|
item && text ? replacedText = fixUrls(text) : "";
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
replacedText ? replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, (url) => {
|
replacedText ? replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, (url) => {
|
||||||
let shortUrl = url;
|
let shortUrl = url;
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
if (url.match('^https:\/\/')) {
|
if (url.match('^https:\/\/')) {
|
||||||
shortUrl = url.split('https://')[1];
|
shortUrl = url.split('https://')[1];
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
if (url.match('^http:\/\/')) {
|
if (url.match('^http:\/\/')) {
|
||||||
shortUrl = url.split('http://')[1];
|
shortUrl = url.split('http://')[1];
|
||||||
}
|
}
|
||||||
@ -47,36 +50,47 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
return `[${match}](${match})`;
|
return `[${match}](${match})`;
|
||||||
}) : "";
|
}) : "";
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH1 = ({ children }) => (
|
const CustomH1 = ({ children }) => (
|
||||||
<h1 className="tw-text-xl tw-font-bold">{children}</h1>
|
<h1 className="tw-text-xl tw-font-bold">{children}</h1>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH2 = ({ children }) => (
|
const CustomH2 = ({ children }) => (
|
||||||
<h2 className="tw-text-lg tw-font-bold">{children}</h2>
|
<h2 className="tw-text-lg tw-font-bold">{children}</h2>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH3 = ({ children }) => (
|
const CustomH3 = ({ children }) => (
|
||||||
<h3 className="tw-text-base tw-font-bold">{children}</h3>
|
<h3 className="tw-text-base tw-font-bold">{children}</h3>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH4 = ({ children }) => (
|
const CustomH4 = ({ children }) => (
|
||||||
<h4 className="tw-text-base tw-font-bold">{children}</h4>
|
<h4 className="tw-text-base tw-font-bold">{children}</h4>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH5 = ({ children }) => (
|
const CustomH5 = ({ children }) => (
|
||||||
<h5 className="tw-text-sm tw-font-bold">{children}</h5>
|
<h5 className="tw-text-sm tw-font-bold">{children}</h5>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomH6 = ({ children }) => (
|
const CustomH6 = ({ children }) => (
|
||||||
<h6 className="tw-text-sm tw-font-bold">{children}</h6>
|
<h6 className="tw-text-sm tw-font-bold">{children}</h6>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomParagraph = ({ children }) => (
|
const CustomParagraph = ({ children }) => (
|
||||||
<p className="!tw-my-2">{children}</p>
|
<p className="!tw-my-2">{children}</p>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomUnorderdList = ({ children }) => (
|
const CustomUnorderdList = ({ children }) => (
|
||||||
<ul className="tw-list-disc tw-list-inside">{children}</ul>
|
<ul className="tw-list-disc tw-list-inside">{children}</ul>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomOrderdList = ({ children }) => (
|
const CustomOrderdList = ({ children }) => (
|
||||||
<ol className="tw-list-decimal tw-list-inside">{children}</ol>
|
<ol className="tw-list-decimal tw-list-inside">{children}</ol>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomHorizontalRow = ({ children }) => (
|
const CustomHorizontalRow = ({ children }) => (
|
||||||
<hr className="tw-border-current">{children}</hr>
|
<hr className="tw-border-current">{children}</hr>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomImage = ({ alt, src, title }) => (
|
const CustomImage = ({ alt, src, title }) => (
|
||||||
<img
|
<img
|
||||||
className="tw-max-w-full tw-rounded tw-shadow"
|
className="tw-max-w-full tw-rounded tw-shadow"
|
||||||
@ -85,12 +99,14 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
title={title}
|
title={title}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const CustomExternalLink = ({ href, children }) => (
|
const CustomExternalLink = ({ href, children }) => (
|
||||||
<a className='tw-font-bold tw-underline'
|
<a className='tw-font-bold tw-underline'
|
||||||
href={href}
|
href={href}
|
||||||
target='_blank'
|
target='_blank' rel="noreferrer"
|
||||||
> {children}</a>
|
> {children}</a>
|
||||||
);
|
);
|
||||||
|
/* eslint-disable react/prop-types */
|
||||||
const CustomHashTagLink = ({ children, tag, item }) => {
|
const CustomHashTagLink = ({ children, tag, item }) => {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
@ -102,7 +118,9 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
}}>{decodeTag(children)}</a>
|
}}>{decodeTag(children)}</a>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
/* eslint-enable react/prop-types */
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/display-name
|
||||||
const MemoizedVideoEmbed = memo(({ url }: { url: string }) => (
|
const MemoizedVideoEmbed = memo(({ url }: { url: string }) => (
|
||||||
<iframe
|
<iframe
|
||||||
className='tw-w-full'
|
className='tw-w-full'
|
||||||
@ -116,11 +134,14 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
<Markdown className={`tw-text-map tw-leading-map tw-text-sm`} remarkPlugins={[remarkBreaks]} components={{
|
<Markdown className={`tw-text-map tw-leading-map tw-text-sm`} remarkPlugins={[remarkBreaks]} components={{
|
||||||
p: CustomParagraph,
|
p: CustomParagraph,
|
||||||
a: ({ href, children }) => {
|
a: ({ href, children }) => {
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const isYouTubeVideo = href?.startsWith('https://www.youtube.com/watch?v=');
|
const isYouTubeVideo = href?.startsWith('https://www.youtube.com/watch?v=');
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const isRumbleVideo = href?.startsWith('https://rumble.com/embed/');
|
const isRumbleVideo = href?.startsWith('https://rumble.com/embed/');
|
||||||
|
|
||||||
|
|
||||||
if (isYouTubeVideo) {
|
if (isYouTubeVideo) {
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const videoId = href?.split('v=')[1].split('&')[0];
|
const videoId = href?.split('v=')[1].split('&')[0];
|
||||||
const youtubeEmbedUrl = `https://www.youtube-nocookie.com/embed/${videoId}`;
|
const youtubeEmbedUrl = `https://www.youtube-nocookie.com/embed/${videoId}`;
|
||||||
|
|
||||||
@ -133,6 +154,7 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
|||||||
<MemoizedVideoEmbed url={href!}></MemoizedVideoEmbed>
|
<MemoizedVideoEmbed url={href!}></MemoizedVideoEmbed>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
if (href?.startsWith("#")) {
|
if (href?.startsWith("#")) {
|
||||||
const tag = tags.find(t => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase());
|
const tag = tags.find(t => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase());
|
||||||
return <CustomHashTagLink tag={tag} item={item}>{children}</CustomHashTagLink>;
|
return <CustomHashTagLink tag={tag} item={item}>{children}</CustomHashTagLink>;
|
||||||
@ -181,7 +203,7 @@ function truncateText(text, limit) {
|
|||||||
// Split the text by paragraphs
|
// Split the text by paragraphs
|
||||||
const paragraphs = text.split('\n');
|
const paragraphs = text.split('\n');
|
||||||
|
|
||||||
for (let paragraph of paragraphs) {
|
for (const paragraph of paragraphs) {
|
||||||
if (length + paragraph.length > limit) {
|
if (length + paragraph.length > limit) {
|
||||||
truncated += paragraph.slice(0, limit - length) + '...';
|
truncated += paragraph.slice(0, limit - length) + '...';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { ItemFormPopupProps } from './ItemFormPopup'
|
|||||||
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 { timeAgo } from '../../../Utils/TimeAgo'
|
||||||
import { useEffect, useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { LatLng } from 'leaflet'
|
import { LatLng } from 'leaflet'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { useRemoveItem, useUpdateItem } from '../hooks/useItems'
|
import { useRemoveItem, useUpdateItem } from '../hooks/useItems'
|
||||||
@ -22,6 +22,7 @@ export interface ItemViewPopupProps {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/display-name
|
||||||
export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: any) => {
|
export const ItemViewPopup = React.forwardRef((props: ItemViewPopupProps, ref: any) => {
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
const [loading, setLoading] = React.useState<boolean>(false);
|
const [loading, setLoading] = React.useState<boolean>(false);
|
||||||
|
|||||||
@ -12,6 +12,7 @@ const setTagApi = useSetTagApi();
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
data && setTagData(data);
|
data && setTagData(data);
|
||||||
api && setTagApi(api);
|
api && setTagApi(api);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [api, data])
|
}, [api, data])
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ useEffect(() => {
|
|||||||
tag && addFilterTag(tag)
|
tag && addFilterTag(tag)
|
||||||
});}
|
});}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [location, tags]);
|
}, [location, tags]);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ export function UtopiaMapInner({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
layers.forEach(layer => addVisibleLayer(layer));
|
layers.forEach(layer => addVisibleLayer(layer));
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [layers]);
|
}, [layers]);
|
||||||
|
|
||||||
const init = useRef(false)
|
const init = useRef(false)
|
||||||
@ -63,6 +64,7 @@ export function UtopiaMapInner({
|
|||||||
}, 4000);
|
}, 4000);
|
||||||
init.current=true;
|
init.current=true;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
@ -90,6 +92,7 @@ export function UtopiaMapInner({
|
|||||||
document.querySelector('meta[property="og:description"]')?.setAttribute("content", `${document.querySelector('meta[name="description"]')?.getAttribute("content")}`);
|
document.querySelector('meta[property="og:description"]')?.setAttribute("content", `${document.querySelector('meta[name="description"]')?.getAttribute("content")}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
const onEachFeature = (feature: Feature<GeoJSONGeometry, any>, layer: L.Layer) => {
|
const onEachFeature = (feature: Feature<GeoJSONGeometry, any>, layer: L.Layer) => {
|
||||||
if (feature.properties) {
|
if (feature.properties) {
|
||||||
layer.bindPopup(feature.properties.name);
|
layer.bindPopup(feature.properties.name);
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
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>;
|
||||||
|
|||||||
@ -5,5 +5,6 @@ export const useDebounce = (callback, delay, deps) => {
|
|||||||
const { reset, clear } = useTimeout(callback, delay);
|
const { reset, clear } = useTimeout(callback, delay);
|
||||||
|
|
||||||
useEffect(reset, [...deps, reset]);
|
useEffect(reset, [...deps, reset]);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
useEffect(clear, []);
|
useEffect(clear, []);
|
||||||
}
|
}
|
||||||
@ -1,8 +1,9 @@
|
|||||||
|
/* eslint-disable no-case-declarations */
|
||||||
import { useCallback, useReducer, createContext, useContext } from "react";
|
import { useCallback, useReducer, createContext, useContext } from "react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { LayerProps, Tag } from "../../../types";
|
import { LayerProps, Tag } from "../../../types";
|
||||||
import { useLayers } from "./useLayers";
|
import { useLayers } from "./useLayers";
|
||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import useWindowDimensions from "./useWindowDimension";
|
import useWindowDimensions from "./useWindowDimension";
|
||||||
|
|
||||||
type ActionType =
|
type ActionType =
|
||||||
@ -43,16 +44,25 @@ function useFilterManager(initialTags: Tag[]): {
|
|||||||
searchPhrase: string;
|
searchPhrase: string;
|
||||||
visibleLayers: LayerProps[];
|
visibleLayers: LayerProps[];
|
||||||
visibleGroupTypes: string[];
|
visibleGroupTypes: string[];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addFilterTag: (tag: Tag) => void;
|
addFilterTag: (tag: Tag) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
removeFilterTag: (name: string) => void;
|
removeFilterTag: (name: string) => void;
|
||||||
resetFilterTags: () => void;
|
resetFilterTags: () => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setSearchPhrase: (phrase: string) => void;
|
setSearchPhrase: (phrase: string) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addVisibleLayer: (layer: LayerProps) => void;
|
addVisibleLayer: (layer: LayerProps) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
toggleVisibleLayer: (layer: LayerProps) => void;
|
toggleVisibleLayer: (layer: LayerProps) => void;
|
||||||
resetVisibleLayers: () => void;
|
resetVisibleLayers: () => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
isLayerVisible: (layer: LayerProps) => boolean;
|
isLayerVisible: (layer: LayerProps) => boolean;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addVisibleGroupType: (groupType: string) => void;
|
addVisibleGroupType: (groupType: string) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
toggleVisibleGroupType: (groupType: string) => void;
|
toggleVisibleGroupType: (groupType: string) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
isGroupTypeVisible: (groupType: string) => boolean;
|
isGroupTypeVisible: (groupType: string) => boolean;
|
||||||
} {
|
} {
|
||||||
const [filterTags, dispatchTags] = useReducer((state: Tag[], action: ActionType) => {
|
const [filterTags, dispatchTags] = useReducer((state: Tag[], action: ActionType) => {
|
||||||
@ -145,6 +155,7 @@ function useFilterManager(initialTags: Tag[]): {
|
|||||||
tag,
|
tag,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const removeFilterTag = useCallback((name: string) => {
|
const removeFilterTag = useCallback((name: string) => {
|
||||||
@ -171,6 +182,7 @@ function useFilterManager(initialTags: Tag[]): {
|
|||||||
type: "REMOVE_TAG",
|
type: "REMOVE_TAG",
|
||||||
name,
|
name,
|
||||||
});
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const resetFilterTags = useCallback(() => {
|
const resetFilterTags = useCallback(() => {
|
||||||
|
|||||||
@ -28,11 +28,17 @@ const ItemContext = createContext<UseItemManagerResult>({
|
|||||||
|
|
||||||
function useItemsManager(initialItems: Item[]): {
|
function useItemsManager(initialItems: Item[]): {
|
||||||
items: Item[];
|
items: Item[];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addItem: (item: Item) => void;
|
addItem: (item: Item) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
updateItem: (item: Item) => void;
|
updateItem: (item: Item) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
removeItem: (item: Item) => void;
|
removeItem: (item: Item) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
resetItems: (layer: LayerProps) => void;
|
resetItems: (layer: LayerProps) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setItemsApi: (layer: LayerProps) => void;
|
setItemsApi: (layer: LayerProps) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setItemsData: (layer: LayerProps) => void;
|
setItemsData: (layer: LayerProps) => void;
|
||||||
allItemsLoaded: boolean;
|
allItemsLoaded: boolean;
|
||||||
|
|
||||||
@ -47,6 +53,7 @@ function useItemsManager(initialItems: Item[]): {
|
|||||||
const [items, dispatch] = useReducer((state: Item[], action: ActionType) => {
|
const [items, dispatch] = useReducer((state: Item[], action: ActionType) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "ADD":
|
case "ADD":
|
||||||
|
// eslint-disable-next-line no-case-declarations
|
||||||
const exist = state.find((item) =>
|
const exist = state.find((item) =>
|
||||||
item.id === action.item.id ? true : false
|
item.id === action.item.id ? true : false
|
||||||
);
|
);
|
||||||
@ -92,6 +99,7 @@ function useItemsManager(initialItems: Item[]): {
|
|||||||
})
|
})
|
||||||
setallItemsLoaded(true);
|
setallItemsLoaded(true);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const setItemsData = useCallback((layer: LayerProps) => {
|
const setItemsData = useCallback((layer: LayerProps) => {
|
||||||
@ -100,6 +108,7 @@ function useItemsManager(initialItems: Item[]): {
|
|||||||
dispatch({ type: "ADD", item: { ...item, layer: layer } });
|
dispatch({ type: "ADD", item: { ...item, layer: layer } });
|
||||||
})
|
})
|
||||||
setallItemsLoaded(true);
|
setallItemsLoaded(true);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,11 +14,13 @@ const LayerContext = createContext<UseItemManagerResult>({
|
|||||||
|
|
||||||
function useLayerManager(initialLayers: LayerProps[]): {
|
function useLayerManager(initialLayers: LayerProps[]): {
|
||||||
layers: LayerProps[];
|
layers: LayerProps[];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addLayer: (layer: LayerProps) => void;
|
addLayer: (layer: LayerProps) => void;
|
||||||
} {
|
} {
|
||||||
const [layers, dispatch] = useReducer((state: LayerProps[], action: ActionType) => {
|
const [layers, dispatch] = useReducer((state: LayerProps[], action: ActionType) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "ADD LAYER":
|
case "ADD LAYER":
|
||||||
|
// eslint-disable-next-line no-case-declarations
|
||||||
const exist = state.find((layer) =>
|
const exist = state.find((layer) =>
|
||||||
layer.name === action.layer.name ? true : false
|
layer.name === action.layer.name ? true : false
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useCallback, useReducer, createContext, useContext, useEffect } from "react";
|
import { useCallback, useReducer, createContext, useContext } from "react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Item } from "../../../types";
|
import { Item } from "../../../types";
|
||||||
import { Marker, Popup } from "leaflet";
|
import { Marker, Popup } from "leaflet";
|
||||||
@ -25,7 +25,9 @@ const LeafletRefsContext = createContext<UseLeafletRefsManagerResult>({
|
|||||||
|
|
||||||
function useLeafletRefsManager(initialLeafletRefs: {}): {
|
function useLeafletRefsManager(initialLeafletRefs: {}): {
|
||||||
leafletRefs: Record<string,LeafletRef>;
|
leafletRefs: Record<string,LeafletRef>;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addMarker: (item: Item, marker: Marker) => void;
|
addMarker: (item: Item, marker: Marker) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
addPopup: (item: Item, popup: Popup) => void;
|
addPopup: (item: Item, popup: Popup) => void;
|
||||||
} {
|
} {
|
||||||
|
|
||||||
|
|||||||
@ -19,14 +19,19 @@ const PermissionContext = createContext<UsePermissionManagerResult>({
|
|||||||
|
|
||||||
function usePermissionsManager(initialPermissions: Permission[]): {
|
function usePermissionsManager(initialPermissions: Permission[]): {
|
||||||
permissions: Permission[];
|
permissions: Permission[];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setPermissionApi: (api: ItemsApi<any>) => void;
|
setPermissionApi: (api: ItemsApi<any>) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setPermissionData: (data: Permission[]) => void;
|
setPermissionData: (data: Permission[]) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
setAdminRole: (adminRole: string) => void;
|
setAdminRole: (adminRole: string) => void;
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
hasUserPermission: (collectionName: string, action: PermissionAction, item?: Item, layer?: LayerProps) => boolean;
|
hasUserPermission: (collectionName: string, action: PermissionAction, item?: Item, layer?: LayerProps) => boolean;
|
||||||
} {
|
} {
|
||||||
const [permissions, dispatch] = useReducer((state: Permission[], action: ActionType) => {
|
const [permissions, dispatch] = useReducer((state: Permission[], action: ActionType) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "ADD":
|
case "ADD":
|
||||||
|
// eslint-disable-next-line no-case-declarations
|
||||||
const exist = state.find((permission) =>
|
const exist = state.find((permission) =>
|
||||||
permission.id === action.permission.id ? true : false
|
permission.id === action.permission.id ? true : false
|
||||||
);
|
);
|
||||||
@ -111,6 +116,7 @@ function usePermissionsManager(initialPermissions: Permission[]): {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[permissions, user]
|
[permissions, user]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react'
|
||||||
import { createContext, useContext, useEffect, useState } from "react";
|
import { createContext, useContext, useEffect, useState } from "react";
|
||||||
import { Geometry, Item, LayerProps } from '../../../types';
|
import { Geometry, Item, LayerProps } from '../../../types';
|
||||||
import { useUpdateItem } from "./useItems";
|
import { useUpdateItem } from "./useItems";
|
||||||
@ -5,7 +6,6 @@ import { toast } from "react-toastify";
|
|||||||
import { useHasUserPermission } from "./usePermissions";
|
import { useHasUserPermission } from "./usePermissions";
|
||||||
import { LatLng } from "leaflet";
|
import { LatLng } from "leaflet";
|
||||||
import { ItemFormPopupProps } from "../Subcomponents/ItemFormPopup";
|
import { ItemFormPopupProps } from "../Subcomponents/ItemFormPopup";
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
type PolygonClickedProps = {
|
type PolygonClickedProps = {
|
||||||
position: LatLng
|
position: LatLng
|
||||||
@ -39,6 +39,7 @@ function useSelectPositionManager(): {
|
|||||||
if (selectPosition && markerClicked && 'text' in selectPosition && markerClicked.id !==selectPosition.id) {
|
if (selectPosition && markerClicked && 'text' in selectPosition && markerClicked.id !==selectPosition.id) {
|
||||||
itemUpdateParent({ ...selectPosition, parent: markerClicked.id })
|
itemUpdateParent({ ...selectPosition, parent: markerClicked.id })
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [markerClicked])
|
}, [markerClicked])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -54,6 +55,7 @@ function useSelectPositionManager(): {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [mapClicked])
|
}, [mapClicked])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-unused-vars */
|
||||||
import { useCallback, useReducer, createContext, useContext, useState } from "react";
|
import { useCallback, useReducer, createContext, useContext, useState } from "react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Item, ItemsApi, Tag } from "../../../types";
|
import { Item, ItemsApi, Tag } from "../../../types";
|
||||||
@ -34,6 +35,7 @@ function useTagsManager(initialTags: Tag[]): {
|
|||||||
const [tags, dispatch] = useReducer((state: Tag[], action: ActionType) => {
|
const [tags, dispatch] = useReducer((state: Tag[], action: ActionType) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "ADD":
|
case "ADD":
|
||||||
|
// eslint-disable-next-line no-case-declarations
|
||||||
const exist = state.find((tag) =>
|
const exist = state.find((tag) =>
|
||||||
tag.name.toLocaleLowerCase() === action.tag.name.toLocaleLowerCase() ? true : false
|
tag.name.toLocaleLowerCase() === action.tag.name.toLocaleLowerCase() ? true : false
|
||||||
);
|
);
|
||||||
@ -67,6 +69,7 @@ function useTagsManager(initialTags: Tag[]): {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const setTagData = useCallback((data: Tag[]) => {
|
const setTagData = useCallback((data: Tag[]) => {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { useMap } from "react-leaflet"
|
|||||||
|
|
||||||
export const setItemLocation = () => {
|
export const setItemLocation = () => {
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars, react-hooks/rules-of-hooks
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-constant-condition */
|
||||||
import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems'
|
import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems'
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { getValue } from '../../Utils/GetValue';
|
import { getValue } from '../../Utils/GetValue';
|
||||||
@ -56,6 +57,7 @@ export function ProfileForm({ userType }: { userType: string }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -68,6 +70,7 @@ export function ProfileForm({ userType }: { userType: string }) {
|
|||||||
|
|
||||||
!item && setItem({ id: crypto.randomUUID(), name: user ? user.first_name : "", text: "", layer: layer, new: true })
|
!item && setItem({ id: crypto.randomUUID(), name: user ? user.first_name : "", text: "", layer: layer, new: true })
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [items])
|
}, [items])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -114,6 +117,7 @@ export function ProfileForm({ userType }: { userType: string }) {
|
|||||||
start: item?.start ?? "",
|
start: item?.start ?? "",
|
||||||
end: item?.end ?? ""
|
end: item?.end ?? ""
|
||||||
});
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item, tags, items]);
|
}, [item, tags, items]);
|
||||||
|
|
||||||
const [template, setTemplate] = useState<string>("")
|
const [template, setTemplate] = useState<string>("")
|
||||||
|
|||||||
@ -81,6 +81,7 @@ export function ProfileView({ userType, attestationApi }: { userType: string , a
|
|||||||
item && setRelations(current => [...current, item])
|
item && setRelations(current => [...current, item])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item, items])
|
}, [item, items])
|
||||||
|
|
||||||
|
|
||||||
@ -112,6 +113,7 @@ export function ProfileView({ userType, attestationApi }: { userType: string , a
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
||||||
const getFirstAncestor = (item: Item): Item | undefined => {
|
const getFirstAncestor = (item: Item): Item | undefined => {
|
||||||
@ -125,18 +127,20 @@ export function ProfileView({ userType, attestationApi }: { userType: string , a
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
selectPosition && map.closePopup();
|
selectPosition && map.closePopup();
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [selectPosition])
|
}, [selectPosition])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTemplate(item?.layer?.itemType.template || userType);
|
setTemplate(item?.layer?.itemType.template || userType);
|
||||||
}, [userType, item])
|
}, [userType, item])
|
||||||
|
|
||||||
const [urlParams, setUrlParams] = useState(new URLSearchParams(location.search));
|
const [/* urlParams, */ setUrlParams] = useState(new URLSearchParams(location.search));
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHasUserPermission, usePermissions } from "../../Map/hooks/usePermissions";
|
import { useHasUserPermission } from "../../Map/hooks/usePermissions";
|
||||||
import DialogModal from "../../Templates/DialogModal";
|
import DialogModal from "../../Templates/DialogModal";
|
||||||
import { useItems } from "../../Map/hooks/useItems";
|
import { useItems } from "../../Map/hooks/useItems";
|
||||||
import { HeaderView } from "../../Map/Subcomponents/ItemPopupComponents/HeaderView";
|
import { HeaderView } from "../../Map/Subcomponents/ItemPopupComponents/HeaderView";
|
||||||
|
|||||||
@ -131,6 +131,7 @@ export const AvatarWidget: React.FC<AvatarWidgetProps> = ({ avatar, setAvatar })
|
|||||||
setCropping(false);
|
setCropping(false);
|
||||||
setImage("");
|
setImage("");
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [crop]);
|
}, [crop]);
|
||||||
|
|
||||||
const resizeBlob = useCallback(async (blob: Blob) => {
|
const resizeBlob = useCallback(async (blob: Blob) => {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { HexColorPicker } from "react-colorful";
|
|||||||
import "./ColorPicker.css"
|
import "./ColorPicker.css"
|
||||||
import useClickOutside from "../hooks/useClickOutside";
|
import useClickOutside from "../hooks/useClickOutside";
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const ColorPicker = ({ color, onChange, className }) => {
|
export const ColorPicker = ({ color, onChange, className }) => {
|
||||||
const popover = useRef<HTMLDivElement>(null);
|
const popover = useRef<HTMLDivElement>(null);
|
||||||
const [isOpen, toggle] = useState(false);
|
const [isOpen, toggle] = useState(false);
|
||||||
|
|||||||
@ -59,6 +59,7 @@ const ContactInfo = ({ email, telephone, name, avatar, link }: { email: string,
|
|||||||
|
|
||||||
export default ContactInfo;
|
export default ContactInfo;
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const ConditionalLink = ({ url, children }) => {
|
const ConditionalLink = ({ url, children }) => {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react/prop-types */
|
||||||
import { TextInput } from "../../Input"
|
import { TextInput } from "../../Input"
|
||||||
import { AvatarWidget } from "./AvatarWidget"
|
import { AvatarWidget } from "./AvatarWidget"
|
||||||
import { ColorPicker } from "./ColorPicker"
|
import { ColorPicker } from "./ColorPicker"
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import SocialShareBar from './SocialShareBar';
|
import SocialShareBar from './SocialShareBar';
|
||||||
|
|
||||||
|
|
||||||
const flags = {
|
/* const flags = {
|
||||||
de: (
|
de: (
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 3" className="tw-w-5 tw-h-3">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 3" className="tw-w-5 tw-h-3">
|
||||||
<rect width="5" height="3" fill="#FFCE00" />
|
<rect width="5" height="3" fill="#FFCE00" />
|
||||||
@ -16,7 +16,7 @@ const flags = {
|
|||||||
<rect width="5" height="1" fill="#ED2939" />
|
<rect width="5" height="1" fill="#ED2939" />
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
};
|
}; */
|
||||||
|
|
||||||
const statusMapping = {
|
const statusMapping = {
|
||||||
'in_planning': 'in Planung',
|
'in_planning': 'in Planung',
|
||||||
@ -24,6 +24,7 @@ const statusMapping = {
|
|||||||
'active': 'aktiv'
|
'active': 'aktiv'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const SubHeader = ({ type, status, url, title }) => (
|
const SubHeader = ({ type, status, url, title }) => (
|
||||||
<div>
|
<div>
|
||||||
<div className='tw-float-left tw-mt-2 tw-mb-4 tw-flex tw-items-center'>
|
<div className='tw-float-left tw-mt-2 tw-mb-4 tw-flex tw-items-center'>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const RelationCard = ({ title, description, imageSrc }) => (
|
const RelationCard = ({ title, description, imageSrc }) => (
|
||||||
<div className={`tw-mb-6 ${imageSrc ? 'md:tw-flex md:tw-space-x-4' : ''}`}>
|
<div className={`tw-mb-6 ${imageSrc ? 'md:tw-flex md:tw-space-x-4' : ''}`}>
|
||||||
{imageSrc && (
|
{imageSrc && (
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import SocialShareButton from './SocialShareButton';
|
import SocialShareButton from './SocialShareButton';
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const SocialShareBar = ({url, title, platforms = ['facebook', 'twitter', 'linkedin', 'xing', 'email']}) => {
|
const SocialShareBar = ({url, title, platforms = ['facebook', 'twitter', 'linkedin', 'xing', 'email']}) => {
|
||||||
return (
|
return (
|
||||||
<div className="tw-flex tw-place-content-end tw-justify-end tw-space-x-2 tw-grow tw-min-w-fit tw-pl-2">
|
<div className="tw-flex tw-place-content-end tw-justify-end tw-space-x-2 tw-grow tw-min-w-fit tw-pl-2">
|
||||||
|
|||||||
@ -49,6 +49,7 @@ const platformConfigs = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
const SocialShareButton = ({ platform, url, title }) => {
|
const SocialShareButton = ({ platform, url, title }) => {
|
||||||
const config = platformConfigs[platform];
|
const config = platformConfigs[platform];
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { Autocomplete } from '../../Input/Autocomplete';
|
|||||||
import { randomColor } from '../../../Utils/RandomColor';
|
import { randomColor } from '../../../Utils/RandomColor';
|
||||||
import { decodeTag, encodeTag } from '../../../Utils/FormatTags';
|
import { decodeTag, encodeTag } from '../../../Utils/FormatTags';
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate}) => {
|
export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate}) => {
|
||||||
|
|
||||||
const [input, setInput] = useState('');
|
const [input, setInput] = useState('');
|
||||||
@ -31,6 +32,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
|||||||
const { key } = e;
|
const { key } = e;
|
||||||
const trimmedInput = input.trim();
|
const trimmedInput = input.trim();
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
if ((key === 'Enter' || key === ',' ) && trimmedInput.length && !defaultTags.some(tag => tag.name.toLocaleLowerCase() === trimmedInput.toLocaleLowerCase())) {
|
if ((key === 'Enter' || key === ',' ) && trimmedInput.length && !defaultTags.some(tag => tag.name.toLocaleLowerCase() === trimmedInput.toLocaleLowerCase())) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const newTag = tags.find(t => t.name === trimmedInput.toLocaleLowerCase())
|
const newTag = tags.find(t => t.name === trimmedInput.toLocaleLowerCase())
|
||||||
@ -40,6 +42,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
|||||||
setPushFilteredSuggestions([]);
|
setPushFilteredSuggestions([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
if (key === "Backspace" && !input.length && defaultTags.length && isKeyReleased) {
|
if (key === "Backspace" && !input.length && defaultTags.length && isKeyReleased) {
|
||||||
const defaultTagsCopy = [...defaultTags];
|
const defaultTagsCopy = [...defaultTags];
|
||||||
const poppedTag = defaultTagsCopy.pop();
|
const poppedTag = defaultTagsCopy.pop();
|
||||||
@ -61,6 +64,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
|||||||
|
|
||||||
|
|
||||||
const onSelected = (tag) => {
|
const onSelected = (tag) => {
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
if(!defaultTags.some(t => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) {
|
if(!defaultTags.some(t => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) {
|
||||||
const newTag = tags.find(t => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())
|
const newTag = tags.find(t => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())
|
||||||
newTag && onUpdate([...currentTags, newTag]);
|
newTag && onUpdate([...currentTags, newTag]);
|
||||||
@ -79,6 +83,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
|||||||
className: 'tw-bg-transparent tw-w-fit tw-mt-5 tw-h-fit'
|
className: 'tw-bg-transparent tw-w-fit tw-mt-5 tw-h-fit'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable react/prop-types */
|
||||||
return (
|
return (
|
||||||
<div onClick={()=> {
|
<div onClick={()=> {
|
||||||
setFocusInput(true);
|
setFocusInput(true);
|
||||||
@ -99,4 +104,5 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
/* eslint-enable react/prop-types */
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react'
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Item, Tag } from "../../../types"
|
import { Item, Tag } from "../../../types"
|
||||||
import { TextAreaInput, TextInput } from "../../Input"
|
import { TextAreaInput, TextInput } from "../../Input"
|
||||||
@ -55,6 +56,7 @@ export const OnepagerForm = ({ item, state, setState }: {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [state.groupType])
|
}, [state.groupType])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export const OnepagerView = ({item, userType}:{item: Item, userType: string}) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setProfileOwner(items.find(i => (i.user_created?.id === item.user_created?.id) && i.layer?.itemType.name === userType));
|
setProfileOwner(items.find(i => (i.user_created?.id === item.user_created?.id) && i.layer?.itemType.name === userType));
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item, items])
|
}, [item, items])
|
||||||
|
|
||||||
const typeMapping = {
|
const typeMapping = {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { TextAreaInput } from "../../Input";
|
import { TextAreaInput } from "../../Input";
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const SimpleForm = ({ state, setState }) => {
|
export const SimpleForm = ({ state, setState }) => {
|
||||||
return (
|
return (
|
||||||
<TextAreaInput
|
<TextAreaInput
|
||||||
placeholder="About me ..."
|
placeholder="About me ..."
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
defaultValue={state?.text || ""}
|
defaultValue={state?.text || ""}
|
||||||
updateFormValue={(v) => setState(prevState => ({
|
updateFormValue={(v) => setState(prevState => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react/prop-types */
|
||||||
import { useCallback, useEffect, useState } from "react"
|
import { useCallback, useEffect, useState } from "react"
|
||||||
import { TextAreaInput } from "../../Input"
|
import { TextAreaInput } from "../../Input"
|
||||||
import { PopupStartEndInput, TextView } from "../../Map"
|
import { PopupStartEndInput, TextView } from "../../Map"
|
||||||
@ -7,6 +8,7 @@ import { TagsWidget } from "../Subcomponents/TagsWidget"
|
|||||||
import { useNavigate } from "react-router-dom"
|
import { useNavigate } from "react-router-dom"
|
||||||
import { useUpdateItem } from "../../Map/hooks/useItems"
|
import { useUpdateItem } from "../../Map/hooks/useItems"
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const TabsForm = ({ item, state, setState, updatePermission, linkItem, unlinkItem, loading, setUrlParams }) => {
|
export const TabsForm = ({ item, state, setState, updatePermission, linkItem, unlinkItem, loading, setUrlParams }) => {
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState<number>(1);
|
const [activeTab, setActiveTab] = useState<number>(1);
|
||||||
@ -22,12 +24,14 @@ export const TabsForm = ({ item, state, setState, updatePermission, linkItem, un
|
|||||||
const newUrl = location.pathname + "?" + params.toString();
|
const newUrl = location.pathname + "?" + params.toString();
|
||||||
window.history.pushState({}, '', newUrl);
|
window.history.pushState({}, '', newUrl);
|
||||||
setUrlParams(params);
|
setUrlParams(params);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
const urlTab = params.get("tab");
|
const urlTab = params.get("tab");
|
||||||
setActiveTab(urlTab ? Number(urlTab) : 1);
|
setActiveTab(urlTab ? Number(urlTab) : 1);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [location.search]);
|
}, [location.search]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -9,15 +9,15 @@ import { Link, useNavigate } from 'react-router-dom'
|
|||||||
import { useItems } from '../../Map/hooks/useItems'
|
import { useItems } from '../../Map/hooks/useItems'
|
||||||
import { useAssetApi } from '../../AppShell/hooks/useAssets'
|
import { useAssetApi } from '../../AppShell/hooks/useAssets'
|
||||||
import { timeAgo } from '../../../Utils/TimeAgo'
|
import { timeAgo } from '../../../Utils/TimeAgo'
|
||||||
import { useAuth } from '../../Auth'
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
export const TabsView = ({ attestations, userType, item, offers, needs, relations, updatePermission, loading, linkItem, unlinkItem, setUrlParams }: { attestations: Array<any>, userType: string, item: Item, offers: Array<Tag>, needs: Array<Tag>, relations: Array<Item>, updatePermission: boolean, loading: boolean, linkItem: (id: string) => Promise<void>, unlinkItem: (id: string) => Promise<void>, setUrlParams: any }) => {
|
export const TabsView = ({ attestations, userType, item, offers, needs, relations, updatePermission, loading, linkItem, unlinkItem, setUrlParams }: { attestations: Array<any>, userType: string, item: Item, offers: Array<Tag>, needs: Array<Tag>, relations: Array<Item>, updatePermission: boolean, loading: boolean, linkItem: (id: string) => Promise<void>, unlinkItem: (id: string) => Promise<void>, setUrlParams: any }) => {
|
||||||
|
|
||||||
const addFilterTag = useAddFilterTag();
|
const addFilterTag = useAddFilterTag();
|
||||||
const [activeTab, setActiveTab] = useState<number>();
|
const [activeTab, setActiveTab] = useState<number>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [addItemPopupType, setAddItemPopupType] = useState<string>("");
|
const [addItemPopupType, /* setAddItemPopupType */] = useState<string>("");
|
||||||
|
|
||||||
const items = useItems();
|
const items = useItems();
|
||||||
const assetsApi = useAssetApi();
|
const assetsApi = useAssetApi();
|
||||||
@ -43,6 +43,7 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
|
|||||||
const newUrl = location.pathname + "?" + params.toString();
|
const newUrl = location.pathname + "?" + params.toString();
|
||||||
window.history.pushState({}, '', newUrl);
|
window.history.pushState({}, '', newUrl);
|
||||||
setUrlParams(params);
|
setUrlParams(params);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
|
|||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
const urlTab = params.get("tab");
|
const urlTab = params.get("tab");
|
||||||
setActiveTab(urlTab ? Number(urlTab) : 1);
|
setActiveTab(urlTab ? Number(urlTab) : 1);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [location.search]);
|
}, [location.search]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,20 +1,14 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { CardPage, MapOverlayPage } from '../Templates'
|
import { MapOverlayPage } from '../Templates'
|
||||||
import { useItems } from '../Map/hooks/useItems'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { useLocation, useNavigate } from 'react-router-dom'
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Item, UserItem } from '../../types';
|
import { UserItem } from '../../types';
|
||||||
import { getValue } from '../../Utils/GetValue';
|
|
||||||
import { useMap } from 'react-leaflet';
|
|
||||||
import { LatLng } from 'leaflet';
|
|
||||||
import { TextView } from '../Map';
|
|
||||||
import useWindowDimensions from '../Map/hooks/useWindowDimension';
|
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { useAuth } from '../Auth';
|
import { useAuth } from '../Auth';
|
||||||
import { TextInput } from '../Input';
|
import { TextInput } from '../Input';
|
||||||
|
|
||||||
export function UserSettings() {
|
export function UserSettings() {
|
||||||
const { user, updateUser, loading, token } = useAuth();
|
const { user, updateUser, loading, /* token */ } = useAuth();
|
||||||
|
|
||||||
const [id, setId] = useState<string>("");
|
const [id, setId] = useState<string>("");
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { Item, Tag } from '../../types';
|
import * as React from 'react'
|
||||||
|
import { Item } from '../../types';
|
||||||
import { encodeTag } from '../../Utils/FormatTags';
|
import { encodeTag } from '../../Utils/FormatTags';
|
||||||
import { hashTagRegex } from '../../Utils/HashTagRegex';
|
import { hashTagRegex } from '../../Utils/HashTagRegex';
|
||||||
import { randomColor } from '../../Utils/RandomColor';
|
import { randomColor } from '../../Utils/RandomColor';
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
|
import * as React from 'react'
|
||||||
import { MapOverlayPage } from './MapOverlayPage'
|
import { MapOverlayPage } from './MapOverlayPage'
|
||||||
import { useItems } from '../Map/hooks/useItems'
|
import { useItems } from '../Map/hooks/useItems'
|
||||||
import { useAssetApi } from '../AppShell/hooks/useAssets'
|
import { useAssetApi } from '../AppShell/hooks/useAssets'
|
||||||
import { EmojiPicker } from './EmojiPicker';
|
import { EmojiPicker } from './EmojiPicker';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
import { Item, ItemsApi } from '../../types';
|
import { Item, ItemsApi } from '../../types';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
@ -20,6 +20,7 @@ export const AttestationForm = ({api}:{api?:ItemsApi<any>}) => {
|
|||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
const to_user_ids = params.get("to");
|
const to_user_ids = params.get("to");
|
||||||
setUsers(items.filter(i => to_user_ids?.includes(i.id)))
|
setUsers(items.filter(i => to_user_ids?.includes(i.id)))
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [items, location])
|
}, [items, location])
|
||||||
|
|
||||||
const [inputValue, setInputValue] = useState('');
|
const [inputValue, setInputValue] = useState('');
|
||||||
|
|||||||
@ -17,6 +17,7 @@ export const CircleLayout = ({ items,radius, fontSize } : {items: any, radius: n
|
|||||||
child.style.transform = `translate(${x}px, ${y}px)`;
|
child.style.transform = `translate(${x}px, ${y}px)`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [items]);
|
}, [items]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -52,6 +52,7 @@ const DialogModal = ({
|
|||||||
<dialog className={`${className ? className: ""} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`}
|
<dialog className={`${className ? className: ""} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`}
|
||||||
|
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
// eslint-disable-next-line react/no-unknown-property
|
||||||
onCancel={onClose}
|
onCancel={onClose}
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside &&onClose()
|
ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside &&onClose()
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
export const EmojiPicker = ({selectedEmoji, selectedColor, selectedShape, setSelectedEmoji, setSelectedColor, setSelectedShape}) => {
|
export const EmojiPicker = ({selectedEmoji, selectedColor, selectedShape, setSelectedEmoji, setSelectedColor, setSelectedShape}) => {
|
||||||
|
|
||||||
|
|
||||||
@ -7,7 +8,7 @@ export const EmojiPicker = ({selectedEmoji, selectedColor, selectedShape, setSel
|
|||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
const emojis = [
|
const emojis = [
|
||||||
'❤️', '🙏', '👍', '🌻',, '✨', '☀️',
|
'❤️', '🙏', '👍', '🌻', '✨', '☀️',
|
||||||
'🔥', '🪵', '💧', '🎶', '🎨','🍄',
|
'🔥', '🪵', '💧', '🎶', '🎨','🍄',
|
||||||
'📝', '✉️', '🧩','💡', '🎓', '💬',
|
'📝', '✉️', '🧩','💡', '🎓', '💬',
|
||||||
'🛠', '💻', '🕹', '🖨', '🚐', '🛒',
|
'🛠', '💻', '🕹', '🖨', '🚐', '🛒',
|
||||||
|
|||||||
@ -26,6 +26,7 @@ export function MapOverlayPage({ children, className, backdrop, card = true }: {
|
|||||||
L.DomEvent.disableClickPropagation(backdropRef.current)
|
L.DomEvent.disableClickPropagation(backdropRef.current)
|
||||||
L.DomEvent.disableScrollPropagation(backdropRef.current)
|
L.DomEvent.disableScrollPropagation(backdropRef.current)
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [overlayRef, backdropRef])
|
}, [overlayRef, backdropRef])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ export const MarketView = () => {
|
|||||||
})
|
})
|
||||||
console.log(offers);
|
console.log(offers);
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [items])
|
}, [items])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import { ReactNode, useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Item} from '../../types';
|
||||||
import { Item, ItemsApi, LayerProps } from '../../types';
|
import { PopupStartEndInput } from '../Map';
|
||||||
import { getValue } from '../../Utils/GetValue';
|
|
||||||
import { PopupStartEndInput, StartEndView, TextView } from '../Map';
|
|
||||||
import { PlusButton } from '../Profile/Subcomponents/PlusButton';
|
import { PlusButton } from '../Profile/Subcomponents/PlusButton';
|
||||||
import { TextInput, TextAreaInput } from '../Input';
|
import { TextInput, TextAreaInput } from '../Input';
|
||||||
import { useAddTag, useGetItemTags, useTags } from '../Map/hooks/useTags';
|
import { useAddTag, useGetItemTags, useTags } from '../Map/hooks/useTags';
|
||||||
@ -11,10 +9,8 @@ import { hashTagRegex } from '../../Utils/HashTagRegex';
|
|||||||
import { randomColor } from '../../Utils/RandomColor';
|
import { randomColor } from '../../Utils/RandomColor';
|
||||||
import { useAuth } from '../Auth';
|
import { useAuth } from '../Auth';
|
||||||
import { useLayers } from '../Map/hooks/useLayers';
|
import { useLayers } from '../Map/hooks/useLayers';
|
||||||
import { HeaderView } from '../Map/Subcomponents/ItemPopupComponents/HeaderView';
|
|
||||||
import { MapOverlayPage } from './MapOverlayPage';
|
import { MapOverlayPage } from './MapOverlayPage';
|
||||||
import { useAddItem, useItems, useRemoveItem } from '../Map/hooks/useItems';
|
import { useAddItem, useItems, useRemoveItem } from '../Map/hooks/useItems';
|
||||||
import { DateUserInfo } from './DateUserInfo';
|
|
||||||
import { ItemCard } from './ItemCard';
|
import { ItemCard } from './ItemCard';
|
||||||
import { Control } from '../Map/Subcomponents/Controls/Control';
|
import { Control } from '../Map/Subcomponents/Controls/Control';
|
||||||
import { SearchControl } from '../Map/Subcomponents/Controls/SearchControl';
|
import { SearchControl } from '../Map/Subcomponents/Controls/SearchControl';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { MapOverlayPage } from './MapOverlayPage'
|
import { MapOverlayPage } from './MapOverlayPage'
|
||||||
import { useItems } from '../Map/hooks/useItems'
|
import { useItems } from '../Map/hooks/useItems'
|
||||||
import { useAssetApi } from '../AppShell/hooks/useAssets'
|
import { useAssetApi } from '../AppShell/hooks/useAssets'
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import * as React from 'react'
|
|||||||
import { decodeTag } from '../../Utils/FormatTags'
|
import { decodeTag } from '../../Utils/FormatTags'
|
||||||
import { Tag } from '../../types'
|
import { Tag } from '../../types'
|
||||||
|
|
||||||
export const TagView = ({ tag, heighlight, onClick, count }: { tag: Tag, heighlight?: boolean, onClick?: (e) => void, count?: number }) => {
|
export const TagView = ({ tag, heighlight, onClick, count }: { tag: Tag, heighlight?: boolean, onClick?: (/* e */) => void, count?: number }) => {
|
||||||
return (
|
return (
|
||||||
// Use your imagination to render suggestions.
|
// Use your imagination to render suggestions.
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/prop-types
|
||||||
function ErrorText({styleClass, children}){
|
function ErrorText({styleClass, children}){
|
||||||
return(
|
return(
|
||||||
<p className={`tw-text-center tw-text-error ${styleClass}`}>{children}</p>
|
<p className={`tw-text-center tw-text-error ${styleClass}`}>{children}</p>
|
||||||
|
|||||||
@ -14,10 +14,8 @@ const addIcon = (icon: string) => {
|
|||||||
switch (icon) {
|
switch (icon) {
|
||||||
case "point":
|
case "point":
|
||||||
return '<svg fill="#fff" class="circle-icon" width="13"xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256z"/></svg>';
|
return '<svg fill="#fff" class="circle-icon" width="13"xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256z"/></svg>';
|
||||||
break;
|
|
||||||
case "calendar":
|
case "calendar":
|
||||||
return '<svg fill="#fff" class="calendar-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
|
return '<svg fill="#fff" class="calendar-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
|
||||||
break;
|
|
||||||
case "user":
|
case "user":
|
||||||
return '<svg fill="#fff" class="user-icon" xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z"/></svg>'
|
return '<svg fill="#fff" class="user-icon" xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z"/></svg>'
|
||||||
case "fire":
|
case "fire":
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
export const urlRegex = /(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm
|
export const urlRegex = /(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm
|
||||||
export const mailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi;
|
export const mailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi;
|
||||||
|
|
||||||
@ -6,6 +7,7 @@ export function fixUrls(message: string): string {
|
|||||||
|
|
||||||
message = message.replace(urlRegex, function (url) {
|
message = message.replace(urlRegex, function (url) {
|
||||||
let hyperlink = url.replace(' ', '');
|
let hyperlink = url.replace(' ', '');
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
if (!hyperlink.match('^https?:\/\/')) {
|
if (!hyperlink.match('^https?:\/\/')) {
|
||||||
hyperlink = 'https://' + hyperlink;
|
hyperlink = 'https://' + hyperlink;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ export {TextInput, TextAreaInput, SelectBox} from './Components/Input'
|
|||||||
import "./index.css"
|
import "./index.css"
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
interface Window {
|
interface Window {
|
||||||
my_modal_3: any;
|
my_modal_3: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
|
import * as React from 'react'
|
||||||
import { ItemFormPopupProps } from "./Components/Map/Subcomponents/ItemFormPopup";
|
import { ItemFormPopupProps } from "./Components/Map/Subcomponents/ItemFormPopup";
|
||||||
|
|
||||||
export interface UtopiaMapProps {
|
export interface UtopiaMapProps {
|
||||||
@ -72,6 +75,7 @@ export class Item {
|
|||||||
parent?:string;
|
parent?:string;
|
||||||
subname?: string;
|
subname?: string;
|
||||||
public_edit?: boolean;
|
public_edit?: boolean;
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
constructor(id:string,name:string,text:string,position:Geometry, layer?: LayerProps, api?: ItemsApi<any>){
|
constructor(id:string,name:string,text:string,position:Geometry, layer?: LayerProps, api?: ItemsApi<any>){
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user