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.
|
||||
const ContextCheckContext = createContext(false);
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const ContextWrapper = ({ children }) => {
|
||||
const isWrapped = useContext(ContextCheckContext);
|
||||
|
||||
// Check if we are already inside a Router
|
||||
let location;
|
||||
try {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
location = useLocation();
|
||||
} catch (e) {
|
||||
location = null;
|
||||
@ -63,6 +65,7 @@ export const ContextWrapper = ({ children }) => {
|
||||
return children;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const Wrappers = ({ children }) => {
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ export default function NavBar({ appName, userType}: { appName: string, userType
|
||||
useEffect(() => {
|
||||
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: ""});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [user, items])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -7,6 +7,7 @@ export const SetAssetsApi = ({assetsApi}:{assetsApi: AssetsApi}) => {
|
||||
|
||||
useEffect(() => {
|
||||
setAssetsApi(assetsApi)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [assetsApi])
|
||||
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import * as React from 'react';
|
||||
|
||||
type route = {
|
||||
path: string;
|
||||
// eslint-disable-next-line no-undef
|
||||
icon: JSX.Element;
|
||||
name: string;
|
||||
submenu?: route;
|
||||
|
||||
@ -4,6 +4,7 @@ import { Link, useLocation } from 'react-router-dom'
|
||||
|
||||
|
||||
function SidebarSubmenu({submenu, name, icon} : { path: string;
|
||||
// eslint-disable-next-line no-undef
|
||||
icon: JSX.Element;
|
||||
name: string;
|
||||
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 */
|
||||
useEffect(() => {
|
||||
if(submenu.filter(m => {return m.path === location.pathname})[0])setIsExpanded(true)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
@ -24,6 +24,7 @@ export const Sitemap = ({url}:{url:string}) => {
|
||||
|
||||
setSitemap(generateSitemap());
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items]);
|
||||
|
||||
return (
|
||||
|
||||
@ -16,6 +16,7 @@ const AssetContext = createContext<UseAssetManagerResult>({
|
||||
|
||||
function useAssetsManager(): {
|
||||
api: AssetsApi;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setAssetsApi: (api: AssetsApi) => void;
|
||||
} {
|
||||
const [api, setApi] = useState<AssetsApi>({} as AssetsApi);
|
||||
|
||||
@ -13,6 +13,7 @@ export function LoginPage() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const onLogin = async () => {
|
||||
await toast.promise(
|
||||
login({ email: email, password: password }),
|
||||
|
||||
@ -4,6 +4,7 @@ import { toast } from 'react-toastify'
|
||||
import { useAuth } from './useAuth'
|
||||
import { MapOverlayPage} from '../Templates'
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export function RequestPasswordPage({reset_url}) {
|
||||
|
||||
const [email, setEmail] = useState<string>("");
|
||||
|
||||
@ -16,6 +16,7 @@ export function SignupPage() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const onRegister = async () => {
|
||||
await toast.promise(
|
||||
register({ email: email, password: password }, userName),
|
||||
|
||||
@ -19,13 +19,18 @@ type AuthCredentials = {
|
||||
type AuthContextProps = {
|
||||
isAuthenticated: boolean,
|
||||
user: UserItem | null;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
login: (credentials: AuthCredentials) => Promise<UserItem | undefined>,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
register: (credentials: AuthCredentials, userName: string) => Promise<UserItem | undefined>,
|
||||
loading: boolean,
|
||||
logout: () => Promise<any>,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateUser: (user: UserItem) => any,
|
||||
token: string | null,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
requestPasswordReset: (email:string, reset_url: string) => Promise<any>,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
passwordReset: (token:string, new_password:string) => Promise<any>
|
||||
}
|
||||
|
||||
@ -52,6 +57,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
||||
setLoading(true);
|
||||
loadUser();
|
||||
setLoading(false)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
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> => {
|
||||
setLoading(true);
|
||||
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));
|
||||
} catch (error: any) {
|
||||
setLoading(false);
|
||||
@ -109,6 +115,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
||||
|
||||
const updateUser = async (user: UserItem) => {
|
||||
setLoading(true);
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { id, ...userRest } = user;
|
||||
|
||||
try {
|
||||
|
||||
@ -6,6 +6,7 @@ export function Modal({children, showOnStartup}:{children : React.ReactNode, sho
|
||||
useEffect(() => {
|
||||
if(showOnStartup)
|
||||
window.my_modal_3.showModal()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ export function Quests() {
|
||||
|
||||
useEffect(() => {
|
||||
setQuestsOpen(false);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
const [profile, setProfie] = useState<Item>()
|
||||
|
||||
@ -13,6 +13,7 @@ const QuestContext = createContext<UseQuestManagerResult>({
|
||||
|
||||
function useQuestsManager(initialOpen: boolean): {
|
||||
open: boolean;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setQuestsOpen: (open: boolean) => void;
|
||||
} {
|
||||
const [open, setOpen] = useState<boolean>(initialOpen);
|
||||
|
||||
@ -2,6 +2,7 @@ import * as React from 'react'
|
||||
import { useEffect } from 'react';
|
||||
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 }) => {
|
||||
|
||||
const [filteredSuggestions, setFilteredSuggestions] = React.useState<Array<any>>([]);
|
||||
@ -19,6 +20,7 @@ export const Autocomplete = ({ inputProps, suggestions, onSelected, pushFiltered
|
||||
const inputRef = React.useRef<HTMLInputElement>();
|
||||
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const getSuggestionValue = suggestion => suggestion.name;
|
||||
|
||||
const getSuggestions = value => {
|
||||
|
||||
@ -5,11 +5,13 @@ interface ComboBoxProps {
|
||||
id?: string;
|
||||
options: { value: string, label: string }[];
|
||||
value: string;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
onValueChange: (newValue: string) => void;
|
||||
}
|
||||
|
||||
const ComboBoxInput = ({ id, options, value, onValueChange }: ComboBoxProps) => {
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [selectedValue, setSelectedValue] = useState(value);
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
|
||||
@ -10,6 +10,7 @@ type SelectBoxProps = {
|
||||
containerStyle?: string;
|
||||
defaultValue: string;
|
||||
placeholder?: string;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateFormValue: (value: string ) => void;
|
||||
|
||||
options: {name: string, value: string}[];
|
||||
|
||||
@ -11,6 +11,7 @@ type TextAreaProps = {
|
||||
inputStyle?: string;
|
||||
defaultValue: string;
|
||||
placeholder?: string;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateFormValue?: (value: string) => void;
|
||||
}
|
||||
|
||||
@ -54,6 +55,7 @@ export function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyl
|
||||
}
|
||||
init.current = true;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [ref]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@ -11,6 +11,7 @@ type InputTextProps = {
|
||||
defaultValue?: string;
|
||||
placeholder?: string;
|
||||
autocomplete?: string
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateFormValue?: (value: string ) => void;
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ export const ItemForm = ({ children, item, title, setPopupTitle }: { children?:
|
||||
useEffect(() => {
|
||||
setPopupTitle&& title && setPopupTitle(title);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [title])
|
||||
|
||||
return (
|
||||
|
||||
@ -88,6 +88,7 @@ export const Layer = ({
|
||||
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 });
|
||||
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])
|
||||
|
||||
useMapEvents({
|
||||
@ -131,6 +132,7 @@ export const Layer = ({
|
||||
|
||||
useEffect(() => {
|
||||
openPopup();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [leafletRefs, location])
|
||||
|
||||
useEffect(() => {
|
||||
@ -143,6 +145,7 @@ export const Layer = ({
|
||||
}
|
||||
})
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [tagsReady])
|
||||
|
||||
return (
|
||||
|
||||
@ -14,6 +14,7 @@ useEffect(() => {
|
||||
adminRole && setAdminRole(adminRole);
|
||||
data && setPermissionData(data);
|
||||
api && setPermissionApi(api);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [api, data, adminRole, user])
|
||||
|
||||
return (
|
||||
|
||||
@ -13,6 +13,7 @@ export function FilterControl() {
|
||||
groupTypes.map(layer =>
|
||||
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 { useMap, useMapEvents } from 'react-leaflet'
|
||||
import 'leaflet.locatecontrol'
|
||||
@ -26,6 +25,7 @@ export const LocateControl = () => {
|
||||
setLc(L.control.locate().addTo(map));
|
||||
init.current = true;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
useMapEvents({
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as React from 'react'
|
||||
import { useAddFilterTag, useFilterTags, useResetFilterTags } from '../../hooks/useFilter'
|
||||
import { useAddFilterTag } from '../../hooks/useFilter'
|
||||
import useWindowDimensions from '../../hooks/useWindowDimension';
|
||||
import axios from 'axios';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
@ -15,7 +15,6 @@ import * as L from 'leaflet';
|
||||
import MarkerIconFactory from '../../../../Utils/MarkerIconFactory';
|
||||
import { decodeTag } from '../../../../Utils/FormatTags';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { useClusterRef } from '../../hooks/useClusterRef';
|
||||
import { Item } from '../../../../types';
|
||||
import { SidebarControl } from './SidebarControl';
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { LatLng } from '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, ItemsApi } from '../../../types'
|
||||
import { Geometry, LayerProps, Item } from '../../../types'
|
||||
import { TextAreaInput } from '../../Input/TextAreaInput'
|
||||
import { TextInput } from '../../Input/TextInput'
|
||||
import { toast } from 'react-toastify'
|
||||
@ -25,6 +25,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
|
||||
const [spinner, setSpinner] = useState(false);
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [popupTitle, setPopupTitle] = useState<string>("");
|
||||
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
@ -34,6 +35,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
const addItem = useAddItem();
|
||||
const updateItem = useUpdateItem();
|
||||
const items = useItems();
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const removeItem = useRemoveItem();
|
||||
|
||||
|
||||
|
||||
@ -5,11 +5,6 @@ import { getValue } from "../../../../Utils/GetValue";
|
||||
import { useAssetApi } from '../../../AppShell/hooks/useAssets'
|
||||
import DialogModal from "../../../Templates/DialogModal";
|
||||
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 }: {
|
||||
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 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);
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import * as React from 'react'
|
||||
import { TextInput } from '../../../Input'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
export const PopupCheckboxInput = ({ dataField, label, item }:
|
||||
|
||||
@ -5,7 +5,9 @@ import { Item } from '../../../../types'
|
||||
type StartEndInputProps = {
|
||||
item?:Item,
|
||||
showLabels?: boolean
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateStartValue?: (value: string ) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateEndValue?: (value: string ) => void;
|
||||
}
|
||||
|
||||
|
||||
@ -28,11 +28,14 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
||||
|
||||
item && text ? replacedText = fixUrls(text) : "";
|
||||
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
replacedText ? replacedText = replacedText.replace(/(?<!\]?\()https?:\/\/[^\s\)]+(?!\))/g, (url) => {
|
||||
let shortUrl = url;
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
if (url.match('^https:\/\/')) {
|
||||
shortUrl = url.split('https://')[1];
|
||||
}
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
if (url.match('^http:\/\/')) {
|
||||
shortUrl = url.split('http://')[1];
|
||||
}
|
||||
@ -47,36 +50,47 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
||||
return `[${match}](${match})`;
|
||||
}) : "";
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomH1 = ({ children }) => (
|
||||
<h1 className="tw-text-xl tw-font-bold">{children}</h1>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomH2 = ({ children }) => (
|
||||
<h2 className="tw-text-lg tw-font-bold">{children}</h2>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomH3 = ({ children }) => (
|
||||
<h3 className="tw-text-base tw-font-bold">{children}</h3>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomH4 = ({ children }) => (
|
||||
<h4 className="tw-text-base tw-font-bold">{children}</h4>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomH5 = ({ children }) => (
|
||||
<h5 className="tw-text-sm tw-font-bold">{children}</h5>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomH6 = ({ children }) => (
|
||||
<h6 className="tw-text-sm tw-font-bold">{children}</h6>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomParagraph = ({ children }) => (
|
||||
<p className="!tw-my-2">{children}</p>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomUnorderdList = ({ children }) => (
|
||||
<ul className="tw-list-disc tw-list-inside">{children}</ul>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomOrderdList = ({ children }) => (
|
||||
<ol className="tw-list-decimal tw-list-inside">{children}</ol>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomHorizontalRow = ({ children }) => (
|
||||
<hr className="tw-border-current">{children}</hr>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomImage = ({ alt, src, title }) => (
|
||||
<img
|
||||
className="tw-max-w-full tw-rounded tw-shadow"
|
||||
@ -85,12 +99,14 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
||||
title={title}
|
||||
/>
|
||||
);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const CustomExternalLink = ({ href, children }) => (
|
||||
<a className='tw-font-bold tw-underline'
|
||||
href={href}
|
||||
target='_blank'
|
||||
target='_blank' rel="noreferrer"
|
||||
> {children}</a>
|
||||
);
|
||||
/* eslint-disable react/prop-types */
|
||||
const CustomHashTagLink = ({ children, tag, item }) => {
|
||||
return (
|
||||
<a
|
||||
@ -102,7 +118,9 @@ export const TextView = ({ item, truncate = false, itemTextField, rawText }: { i
|
||||
}}>{decodeTag(children)}</a>
|
||||
)
|
||||
};
|
||||
/* eslint-enable react/prop-types */
|
||||
|
||||
// eslint-disable-next-line react/display-name
|
||||
const MemoizedVideoEmbed = memo(({ url }: { url: string }) => (
|
||||
<iframe
|
||||
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={{
|
||||
p: CustomParagraph,
|
||||
a: ({ href, children }) => {
|
||||
// eslint-disable-next-line react/prop-types
|
||||
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/');
|
||||
|
||||
|
||||
if (isYouTubeVideo) {
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const videoId = href?.split('v=')[1].split('&')[0];
|
||||
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>
|
||||
);
|
||||
}
|
||||
// eslint-disable-next-line react/prop-types
|
||||
if (href?.startsWith("#")) {
|
||||
const tag = tags.find(t => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase());
|
||||
return <CustomHashTagLink tag={tag} item={item}>{children}</CustomHashTagLink>;
|
||||
@ -181,7 +203,7 @@ function truncateText(text, limit) {
|
||||
// Split the text by paragraphs
|
||||
const paragraphs = text.split('\n');
|
||||
|
||||
for (let paragraph of paragraphs) {
|
||||
for (const paragraph of paragraphs) {
|
||||
if (length + paragraph.length > limit) {
|
||||
truncated += paragraph.slice(0, limit - length) + '...';
|
||||
break;
|
||||
|
||||
@ -5,7 +5,7 @@ import { ItemFormPopupProps } from './ItemFormPopup'
|
||||
import { HeaderView } from './ItemPopupComponents/HeaderView'
|
||||
import { TextView } from './ItemPopupComponents/TextView'
|
||||
import { timeAgo } from '../../../Utils/TimeAgo'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { LatLng } from 'leaflet'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
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) => {
|
||||
const map = useMap();
|
||||
const [loading, setLoading] = React.useState<boolean>(false);
|
||||
|
||||
@ -12,6 +12,7 @@ const setTagApi = useSetTagApi();
|
||||
useEffect(() => {
|
||||
data && setTagData(data);
|
||||
api && setTagApi(api);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [api, data])
|
||||
|
||||
|
||||
@ -34,6 +35,7 @@ useEffect(() => {
|
||||
tag && addFilterTag(tag)
|
||||
});}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [location, tags]);
|
||||
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ export function UtopiaMapInner({
|
||||
|
||||
useEffect(() => {
|
||||
layers.forEach(layer => addVisibleLayer(layer));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [layers]);
|
||||
|
||||
const init = useRef(false)
|
||||
@ -63,6 +64,7 @@ export function UtopiaMapInner({
|
||||
}, 4000);
|
||||
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")}`);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const onEachFeature = (feature: Feature<GeoJSONGeometry, any>, layer: L.Layer) => {
|
||||
if (feature.properties) {
|
||||
layer.bindPopup(feature.properties.name);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import * as React from 'react'
|
||||
import { createContext, useContext, useState } from "react";
|
||||
|
||||
type UseClusterRefManagerResult = ReturnType<typeof useClusterRefManager>;
|
||||
|
||||
@ -5,5 +5,6 @@ export const useDebounce = (callback, delay, deps) => {
|
||||
const { reset, clear } = useTimeout(callback, delay);
|
||||
|
||||
useEffect(reset, [...deps, reset]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
useEffect(clear, []);
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
/* eslint-disable no-case-declarations */
|
||||
import { useCallback, useReducer, createContext, useContext } from "react";
|
||||
import * as React from "react";
|
||||
import { LayerProps, Tag } from "../../../types";
|
||||
import { useLayers } from "./useLayers";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import useWindowDimensions from "./useWindowDimension";
|
||||
|
||||
type ActionType =
|
||||
@ -43,16 +44,25 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
searchPhrase: string;
|
||||
visibleLayers: LayerProps[];
|
||||
visibleGroupTypes: string[];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addFilterTag: (tag: Tag) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
removeFilterTag: (name: string) => void;
|
||||
resetFilterTags: () => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setSearchPhrase: (phrase: string) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addVisibleLayer: (layer: LayerProps) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
toggleVisibleLayer: (layer: LayerProps) => void;
|
||||
resetVisibleLayers: () => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
isLayerVisible: (layer: LayerProps) => boolean;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addVisibleGroupType: (groupType: string) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
toggleVisibleGroupType: (groupType: string) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
isGroupTypeVisible: (groupType: string) => boolean;
|
||||
} {
|
||||
const [filterTags, dispatchTags] = useReducer((state: Tag[], action: ActionType) => {
|
||||
@ -145,6 +155,7 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
tag,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const removeFilterTag = useCallback((name: string) => {
|
||||
@ -171,6 +182,7 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
type: "REMOVE_TAG",
|
||||
name,
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const resetFilterTags = useCallback(() => {
|
||||
|
||||
@ -28,11 +28,17 @@ const ItemContext = createContext<UseItemManagerResult>({
|
||||
|
||||
function useItemsManager(initialItems: Item[]): {
|
||||
items: Item[];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addItem: (item: Item) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
updateItem: (item: Item) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
removeItem: (item: Item) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
resetItems: (layer: LayerProps) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setItemsApi: (layer: LayerProps) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setItemsData: (layer: LayerProps) => void;
|
||||
allItemsLoaded: boolean;
|
||||
|
||||
@ -47,6 +53,7 @@ function useItemsManager(initialItems: Item[]): {
|
||||
const [items, dispatch] = useReducer((state: Item[], action: ActionType) => {
|
||||
switch (action.type) {
|
||||
case "ADD":
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const exist = state.find((item) =>
|
||||
item.id === action.item.id ? true : false
|
||||
);
|
||||
@ -92,6 +99,7 @@ function useItemsManager(initialItems: Item[]): {
|
||||
})
|
||||
setallItemsLoaded(true);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
const setItemsData = useCallback((layer: LayerProps) => {
|
||||
@ -100,6 +108,7 @@ function useItemsManager(initialItems: Item[]): {
|
||||
dispatch({ type: "ADD", item: { ...item, layer: layer } });
|
||||
})
|
||||
setallItemsLoaded(true);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
@ -14,11 +14,13 @@ const LayerContext = createContext<UseItemManagerResult>({
|
||||
|
||||
function useLayerManager(initialLayers: LayerProps[]): {
|
||||
layers: LayerProps[];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addLayer: (layer: LayerProps) => void;
|
||||
} {
|
||||
const [layers, dispatch] = useReducer((state: LayerProps[], action: ActionType) => {
|
||||
switch (action.type) {
|
||||
case "ADD LAYER":
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const exist = state.find((layer) =>
|
||||
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 { Item } from "../../../types";
|
||||
import { Marker, Popup } from "leaflet";
|
||||
@ -25,7 +25,9 @@ const LeafletRefsContext = createContext<UseLeafletRefsManagerResult>({
|
||||
|
||||
function useLeafletRefsManager(initialLeafletRefs: {}): {
|
||||
leafletRefs: Record<string,LeafletRef>;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addMarker: (item: Item, marker: Marker) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
addPopup: (item: Item, popup: Popup) => void;
|
||||
} {
|
||||
|
||||
|
||||
@ -19,14 +19,19 @@ const PermissionContext = createContext<UsePermissionManagerResult>({
|
||||
|
||||
function usePermissionsManager(initialPermissions: Permission[]): {
|
||||
permissions: Permission[];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setPermissionApi: (api: ItemsApi<any>) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setPermissionData: (data: Permission[]) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
setAdminRole: (adminRole: string) => void;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
hasUserPermission: (collectionName: string, action: PermissionAction, item?: Item, layer?: LayerProps) => boolean;
|
||||
} {
|
||||
const [permissions, dispatch] = useReducer((state: Permission[], action: ActionType) => {
|
||||
switch (action.type) {
|
||||
case "ADD":
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const exist = state.find((permission) =>
|
||||
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]
|
||||
);
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import * as React from 'react'
|
||||
import { createContext, useContext, useEffect, useState } from "react";
|
||||
import { Geometry, Item, LayerProps } from '../../../types';
|
||||
import { useUpdateItem } from "./useItems";
|
||||
@ -5,7 +6,6 @@ import { toast } from "react-toastify";
|
||||
import { useHasUserPermission } from "./usePermissions";
|
||||
import { LatLng } from "leaflet";
|
||||
import { ItemFormPopupProps } from "../Subcomponents/ItemFormPopup";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
type PolygonClickedProps = {
|
||||
position: LatLng
|
||||
@ -39,6 +39,7 @@ function useSelectPositionManager(): {
|
||||
if (selectPosition && markerClicked && 'text' in selectPosition && markerClicked.id !==selectPosition.id) {
|
||||
itemUpdateParent({ ...selectPosition, parent: markerClicked.id })
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [markerClicked])
|
||||
|
||||
useEffect(() => {
|
||||
@ -54,6 +55,7 @@ function useSelectPositionManager(): {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [mapClicked])
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { useCallback, useReducer, createContext, useContext, useState } from "react";
|
||||
import * as React from "react";
|
||||
import { Item, ItemsApi, Tag } from "../../../types";
|
||||
@ -34,6 +35,7 @@ function useTagsManager(initialTags: Tag[]): {
|
||||
const [tags, dispatch] = useReducer((state: Tag[], action: ActionType) => {
|
||||
switch (action.type) {
|
||||
case "ADD":
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const exist = state.find((tag) =>
|
||||
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[]) => {
|
||||
|
||||
@ -2,6 +2,7 @@ import { useMap } from "react-leaflet"
|
||||
|
||||
export const setItemLocation = () => {
|
||||
|
||||
// eslint-disable-next-line no-unused-vars, react-hooks/rules-of-hooks
|
||||
const map = useMap();
|
||||
|
||||
return (
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-constant-condition */
|
||||
import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems'
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getValue } from '../../Utils/GetValue';
|
||||
@ -56,6 +57,7 @@ export function ProfileForm({ userType }: { userType: string }) {
|
||||
|
||||
useEffect(() => {
|
||||
item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item])
|
||||
|
||||
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 })
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items])
|
||||
|
||||
useEffect(() => {
|
||||
@ -114,6 +117,7 @@ export function ProfileForm({ userType }: { userType: string }) {
|
||||
start: item?.start ?? "",
|
||||
end: item?.end ?? ""
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item, tags, items]);
|
||||
|
||||
const [template, setTemplate] = useState<string>("")
|
||||
|
||||
@ -81,6 +81,7 @@ export function ProfileView({ userType, attestationApi }: { userType: string , a
|
||||
item && setRelations(current => [...current, item])
|
||||
})
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item, items])
|
||||
|
||||
|
||||
@ -112,6 +113,7 @@ export function ProfileView({ userType, attestationApi }: { userType: string , a
|
||||
);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item])
|
||||
|
||||
const getFirstAncestor = (item: Item): Item | undefined => {
|
||||
@ -125,18 +127,20 @@ export function ProfileView({ userType, attestationApi }: { userType: string , a
|
||||
|
||||
useEffect(() => {
|
||||
item && hasUserPermission("items", "update", item) && setUpdatePermission(true);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
selectPosition && map.closePopup();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectPosition])
|
||||
|
||||
useEffect(() => {
|
||||
setTemplate(item?.layer?.itemType.template || userType);
|
||||
}, [userType, item])
|
||||
|
||||
const [urlParams, setUrlParams] = useState(new URLSearchParams(location.search));
|
||||
const [/* urlParams, */ setUrlParams] = useState(new URLSearchParams(location.search));
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { useHasUserPermission, usePermissions } from "../../Map/hooks/usePermissions";
|
||||
import { useHasUserPermission } from "../../Map/hooks/usePermissions";
|
||||
import DialogModal from "../../Templates/DialogModal";
|
||||
import { useItems } from "../../Map/hooks/useItems";
|
||||
import { HeaderView } from "../../Map/Subcomponents/ItemPopupComponents/HeaderView";
|
||||
|
||||
@ -131,6 +131,7 @@ export const AvatarWidget: React.FC<AvatarWidgetProps> = ({ avatar, setAvatar })
|
||||
setCropping(false);
|
||||
setImage("");
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [crop]);
|
||||
|
||||
const resizeBlob = useCallback(async (blob: Blob) => {
|
||||
|
||||
@ -4,6 +4,7 @@ import { HexColorPicker } from "react-colorful";
|
||||
import "./ColorPicker.css"
|
||||
import useClickOutside from "../hooks/useClickOutside";
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const ColorPicker = ({ color, onChange, className }) => {
|
||||
const popover = useRef<HTMLDivElement>(null);
|
||||
const [isOpen, toggle] = useState(false);
|
||||
|
||||
@ -59,6 +59,7 @@ const ContactInfo = ({ email, telephone, name, avatar, link }: { email: string,
|
||||
|
||||
export default ContactInfo;
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const ConditionalLink = ({ url, children }) => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable react/prop-types */
|
||||
import { TextInput } from "../../Input"
|
||||
import { AvatarWidget } from "./AvatarWidget"
|
||||
import { ColorPicker } from "./ColorPicker"
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import SocialShareBar from './SocialShareBar';
|
||||
|
||||
|
||||
const flags = {
|
||||
/* const flags = {
|
||||
de: (
|
||||
<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" />
|
||||
@ -16,7 +16,7 @@ const flags = {
|
||||
<rect width="5" height="1" fill="#ED2939" />
|
||||
</svg>
|
||||
)
|
||||
};
|
||||
}; */
|
||||
|
||||
const statusMapping = {
|
||||
'in_planning': 'in Planung',
|
||||
@ -24,6 +24,7 @@ const statusMapping = {
|
||||
'active': 'aktiv'
|
||||
};
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const SubHeader = ({ type, status, url, title }) => (
|
||||
<div>
|
||||
<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 }) => (
|
||||
<div className={`tw-mb-6 ${imageSrc ? 'md:tw-flex md:tw-space-x-4' : ''}`}>
|
||||
{imageSrc && (
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import SocialShareButton from './SocialShareButton';
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const SocialShareBar = ({url, title, platforms = ['facebook', 'twitter', 'linkedin', 'xing', 'email']}) => {
|
||||
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">
|
||||
|
||||
@ -49,6 +49,7 @@ const platformConfigs = {
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const SocialShareButton = ({ platform, url, title }) => {
|
||||
const config = platformConfigs[platform];
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import { Autocomplete } from '../../Input/Autocomplete';
|
||||
import { randomColor } from '../../../Utils/RandomColor';
|
||||
import { decodeTag, encodeTag } from '../../../Utils/FormatTags';
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate}) => {
|
||||
|
||||
const [input, setInput] = useState('');
|
||||
@ -31,6 +32,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
||||
const { key } = e;
|
||||
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())) {
|
||||
e.preventDefault();
|
||||
const newTag = tags.find(t => t.name === trimmedInput.toLocaleLowerCase())
|
||||
@ -40,6 +42,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
||||
setPushFilteredSuggestions([]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
if (key === "Backspace" && !input.length && defaultTags.length && isKeyReleased) {
|
||||
const defaultTagsCopy = [...defaultTags];
|
||||
const poppedTag = defaultTagsCopy.pop();
|
||||
@ -61,6 +64,7 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
||||
|
||||
|
||||
const onSelected = (tag) => {
|
||||
// eslint-disable-next-line react/prop-types
|
||||
if(!defaultTags.some(t => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) {
|
||||
const newTag = tags.find(t => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())
|
||||
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'
|
||||
}
|
||||
|
||||
/* eslint-disable react/prop-types */
|
||||
return (
|
||||
<div onClick={()=> {
|
||||
setFocusInput(true);
|
||||
@ -99,4 +104,5 @@ export const TagsWidget = ({placeholder, containerStyle, defaultTags, onUpdate})
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
/* eslint-enable react/prop-types */
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
import * as React from 'react'
|
||||
import { useEffect } from "react";
|
||||
import { Item, Tag } from "../../../types"
|
||||
import { TextAreaInput, TextInput } from "../../Input"
|
||||
@ -55,6 +56,7 @@ export const OnepagerForm = ({ item, state, setState }: {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [state.groupType])
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ export const OnepagerView = ({item, userType}:{item: Item, userType: string}) =>
|
||||
|
||||
useEffect(() => {
|
||||
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])
|
||||
|
||||
const typeMapping = {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { TextAreaInput } from "../../Input";
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const SimpleForm = ({ state, setState }) => {
|
||||
return (
|
||||
<TextAreaInput
|
||||
placeholder="About me ..."
|
||||
// eslint-disable-next-line react/prop-types
|
||||
defaultValue={state?.text || ""}
|
||||
updateFormValue={(v) => setState(prevState => ({
|
||||
...prevState,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable react/prop-types */
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { TextAreaInput } from "../../Input"
|
||||
import { PopupStartEndInput, TextView } from "../../Map"
|
||||
@ -7,6 +8,7 @@ import { TagsWidget } from "../Subcomponents/TagsWidget"
|
||||
import { useNavigate } from "react-router-dom"
|
||||
import { useUpdateItem } from "../../Map/hooks/useItems"
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const TabsForm = ({ item, state, setState, updatePermission, linkItem, unlinkItem, loading, setUrlParams }) => {
|
||||
|
||||
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();
|
||||
window.history.pushState({}, '', newUrl);
|
||||
setUrlParams(params);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [location.pathname]);
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(location.search);
|
||||
const urlTab = params.get("tab");
|
||||
setActiveTab(urlTab ? Number(urlTab) : 1);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [location.search]);
|
||||
|
||||
return (
|
||||
|
||||
@ -9,15 +9,15 @@ import { Link, useNavigate } from 'react-router-dom'
|
||||
import { useItems } from '../../Map/hooks/useItems'
|
||||
import { useAssetApi } from '../../AppShell/hooks/useAssets'
|
||||
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 }) => {
|
||||
|
||||
const addFilterTag = useAddFilterTag();
|
||||
const [activeTab, setActiveTab] = useState<number>();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [addItemPopupType, setAddItemPopupType] = useState<string>("");
|
||||
const [addItemPopupType, /* setAddItemPopupType */] = useState<string>("");
|
||||
|
||||
const items = useItems();
|
||||
const assetsApi = useAssetApi();
|
||||
@ -43,6 +43,7 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
|
||||
const newUrl = location.pathname + "?" + params.toString();
|
||||
window.history.pushState({}, '', newUrl);
|
||||
setUrlParams(params);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [location.pathname]);
|
||||
|
||||
|
||||
@ -50,6 +51,7 @@ export const TabsView = ({ attestations, userType, item, offers, needs, relation
|
||||
const params = new URLSearchParams(location.search);
|
||||
const urlTab = params.get("tab");
|
||||
setActiveTab(urlTab ? Number(urlTab) : 1);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [location.search]);
|
||||
|
||||
return (
|
||||
|
||||
@ -1,20 +1,14 @@
|
||||
import * as React from 'react'
|
||||
import { CardPage, MapOverlayPage } from '../Templates'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { MapOverlayPage } from '../Templates'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useState } from 'react';
|
||||
import { Item, 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 { UserItem } from '../../types';
|
||||
import { toast } from 'react-toastify';
|
||||
import { useAuth } from '../Auth';
|
||||
import { TextInput } from '../Input';
|
||||
|
||||
export function UserSettings() {
|
||||
const { user, updateUser, loading, token } = useAuth();
|
||||
const { user, updateUser, loading, /* token */ } = useAuth();
|
||||
|
||||
const [id, setId] = 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 { hashTagRegex } from '../../Utils/HashTagRegex';
|
||||
import { randomColor } from '../../Utils/RandomColor';
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
|
||||
import * as React from 'react'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
import { useAssetApi } from '../AppShell/hooks/useAssets'
|
||||
import { EmojiPicker } from './EmojiPicker';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Item, ItemsApi } from '../../types';
|
||||
import { useEffect } from 'react';
|
||||
@ -20,6 +20,7 @@ export const AttestationForm = ({api}:{api?:ItemsApi<any>}) => {
|
||||
const params = new URLSearchParams(location.search);
|
||||
const to_user_ids = params.get("to");
|
||||
setUsers(items.filter(i => to_user_ids?.includes(i.id)))
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items, location])
|
||||
|
||||
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)`;
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items]);
|
||||
|
||||
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`}
|
||||
|
||||
ref={ref}
|
||||
// eslint-disable-next-line react/no-unknown-property
|
||||
onCancel={onClose}
|
||||
onClick={(e) =>
|
||||
ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside &&onClose()
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
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 emojis = [
|
||||
'❤️', '🙏', '👍', '🌻',, '✨', '☀️',
|
||||
'❤️', '🙏', '👍', '🌻', '✨', '☀️',
|
||||
'🔥', '🪵', '💧', '🎶', '🎨','🍄',
|
||||
'📝', '✉️', '🧩','💡', '🎓', '💬',
|
||||
'🛠', '💻', '🕹', '🖨', '🚐', '🛒',
|
||||
|
||||
@ -26,6 +26,7 @@ export function MapOverlayPage({ children, className, backdrop, card = true }: {
|
||||
L.DomEvent.disableClickPropagation(backdropRef.current)
|
||||
L.DomEvent.disableScrollPropagation(backdropRef.current)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [overlayRef, backdropRef])
|
||||
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ export const MarketView = () => {
|
||||
})
|
||||
console.log(offers);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [items])
|
||||
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { ReactNode, useEffect, useRef, useState } from 'react'
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { Item, ItemsApi, LayerProps } from '../../types';
|
||||
import { getValue } from '../../Utils/GetValue';
|
||||
import { PopupStartEndInput, StartEndView, TextView } from '../Map';
|
||||
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';
|
||||
@ -11,10 +9,8 @@ import { hashTagRegex } from '../../Utils/HashTagRegex';
|
||||
import { randomColor } from '../../Utils/RandomColor';
|
||||
import { useAuth } from '../Auth';
|
||||
import { useLayers } from '../Map/hooks/useLayers';
|
||||
import { HeaderView } from '../Map/Subcomponents/ItemPopupComponents/HeaderView';
|
||||
import { MapOverlayPage } from './MapOverlayPage';
|
||||
import { useAddItem, useItems, useRemoveItem } from '../Map/hooks/useItems';
|
||||
import { DateUserInfo } from './DateUserInfo';
|
||||
import { ItemCard } from './ItemCard';
|
||||
import { Control } from '../Map/Subcomponents/Controls/Control';
|
||||
import { SearchControl } from '../Map/Subcomponents/Controls/SearchControl';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useState } from 'react'
|
||||
import { useState } from 'react'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
import { useAssetApi } from '../AppShell/hooks/useAssets'
|
||||
|
||||
@ -2,7 +2,7 @@ import * as React from 'react'
|
||||
import { decodeTag } from '../../Utils/FormatTags'
|
||||
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 (
|
||||
// Use your imagination to render suggestions.
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import * as React from "react"
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
function ErrorText({styleClass, children}){
|
||||
return(
|
||||
<p className={`tw-text-center tw-text-error ${styleClass}`}>{children}</p>
|
||||
|
||||
@ -14,10 +14,8 @@ const addIcon = (icon: string) => {
|
||||
switch (icon) {
|
||||
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>';
|
||||
break;
|
||||
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>';
|
||||
break;
|
||||
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>'
|
||||
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 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) {
|
||||
let hyperlink = url.replace(' ', '');
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
if (!hyperlink.match('^https?:\/\/')) {
|
||||
hyperlink = 'https://' + hyperlink;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ export {TextInput, TextAreaInput, SelectBox} from './Components/Input'
|
||||
import "./index.css"
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
interface Window {
|
||||
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";
|
||||
|
||||
export interface UtopiaMapProps {
|
||||
@ -72,6 +75,7 @@ export class Item {
|
||||
parent?:string;
|
||||
subname?: string;
|
||||
public_edit?: boolean;
|
||||
// eslint-disable-next-line no-undef
|
||||
[key: string]: any;
|
||||
constructor(id:string,name:string,text:string,position:Geometry, layer?: LayerProps, api?: ItemsApi<any>){
|
||||
this.id = id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user