diff --git a/package-lock.json b/package-lock.json index 7d4ae293..1fe687eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "utopia-ui", - "version": "3.0.20", + "version": "3.0.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "utopia-ui", - "version": "3.0.20", + "version": "3.0.26", "license": "GPL-3.0-only", "dependencies": { "@heroicons/react": "^2.0.17", diff --git a/package.json b/package.json index af771eaa..57b0144d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "utopia-ui", - "version": "3.0.20", + "version": "3.0.26", "description": "Reuseable React Components to build mapping apps for real life communities and networks", "repository": "https://github.com/utopia-os/utopia-ui", "homepage:": "https://utopia-os.org/", diff --git a/src/Components/Input/TextInput.tsx b/src/Components/Input/TextInput.tsx index 0ab98c15..54217e7c 100644 --- a/src/Components/Input/TextInput.tsx +++ b/src/Components/Input/TextInput.tsx @@ -13,6 +13,8 @@ type InputTextProps = { defaultValue?: string placeholder?: string autocomplete?: string + pattern?: string + required?: boolean updateFormValue?: (value: string) => void } @@ -26,6 +28,8 @@ export function TextInput({ defaultValue, placeholder, autocomplete, + pattern, + required = true, updateFormValue, }: InputTextProps) { const [inputValue, setInputValue] = useState(defaultValue || '') @@ -50,7 +54,8 @@ export function TextInput({ ) : null}
{title}
diff --git a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx index 8ba7f09b..33999ffc 100644 --- a/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx +++ b/src/Components/Map/Subcomponents/ItemPopupComponents/TextView.tsx @@ -1,7 +1,5 @@ +/* eslint-disable no-console */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/restrict-plus-operands */ /* eslint-disable @typescript-eslint/no-unsafe-return */ @@ -13,7 +11,7 @@ import remarkBreaks from 'remark-breaks' import { useAddFilterTag } from '#components/Map/hooks/useFilter' import { useTags } from '#components/Map/hooks/useTags' -import { Item } from '#src/types' +import { Item, Tag } from '#src/types' import { decodeTag } from '#utils/FormatTags' import { getValue } from '#utils/GetValue' import { hashTagRegex } from '#utils/HashTagRegex' @@ -76,47 +74,54 @@ export const TextView = ({ }) } - // eslint-disable-next-line react/prop-types const CustomH1 = ({ children }) =>

{children}

- // eslint-disable-next-line react/prop-types + const CustomH2 = ({ children }) =>

{children}

- // eslint-disable-next-line react/prop-types + const CustomH3 = ({ children }) =>

{children}

- // eslint-disable-next-line react/prop-types + const CustomH4 = ({ children }) =>

{children}

- // eslint-disable-next-line react/prop-types + const CustomH5 = ({ children }) =>
{children}
- // eslint-disable-next-line react/prop-types + const CustomH6 = ({ children }) =>
{children}
- // eslint-disable-next-line react/prop-types + const CustomParagraph = ({ children }) =>

{children}

- // eslint-disable-next-line react/prop-types + const CustomUnorderdList = ({ children }) => ( ) - // eslint-disable-next-line react/prop-types + const CustomOrderdList = ({ children }) => (
    {children}
) - // eslint-disable-next-line react/prop-types + const CustomHorizontalRow = ({ children }) =>
{children} // eslint-disable-next-line react/prop-types const CustomImage = ({ alt, src, title }) => ( {alt} ) - // eslint-disable-next-line react/prop-types + const CustomExternalLink = ({ href, children }) => ( {' '} {children} ) - /* eslint-disable react/prop-types */ - const CustomHashTagLink = ({ children, tag, item }) => { + + const CustomHashTagLink = ({ + children, + tag, + item, + }: { + children: string + tag: Tag + item?: Item + }) => { return ( { e.stopPropagation() addFilterTag(tag) @@ -126,7 +131,6 @@ export const TextView = ({ ) } - /* eslint-enable react/prop-types */ // eslint-disable-next-line react/display-name const MemoizedVideoEmbed = memo(({ url }: { url: string }) => ( @@ -144,32 +148,34 @@ export const TextView = ({ remarkPlugins={[remarkBreaks]} components={{ p: CustomParagraph, - a: ({ href, children }) => { - // eslint-disable-next-line react/prop-types + a: ({ href, children }: { href: string; children: string }) => { 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}` return } if (isRumbleVideo) { - return + return } - // eslint-disable-next-line react/prop-types + if (href?.startsWith('#')) { + console.log(href.slice(1).toLowerCase()) + console.log(tags) const tag = tags.find( (t) => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase(), ) - return ( - - {children} - - ) + if (tag) + return ( + + {children} + + ) + else return children } else { return {children} } diff --git a/src/Components/Profile/ProfileForm.tsx b/src/Components/Profile/ProfileForm.tsx index d57c8f0c..1e52a85c 100644 --- a/src/Components/Profile/ProfileForm.tsx +++ b/src/Components/Profile/ProfileForm.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-misused-promises */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ @@ -148,58 +147,63 @@ export function ProfileForm() { backdrop className='tw-mx-4 tw-mt-4 tw-mb-4 tw-overflow-x-hidden tw-w-[calc(100%-32px)] md:tw-w-[calc(50%-32px)] tw-max-w-3xl !tw-left-auto tw-top-0 tw-bottom-0' > -
- +
{ + e.preventDefault() + void onUpdateItem( + state, + item, + tags, + addTag, + setLoading, + navigate, + updateItem, + addItem, + user, + urlParams, + ) + }} + > +
+ - {template === 'onepager' && ( - - )} + {template === 'onepager' && ( + + )} - {template === 'simple' && } + {template === 'simple' && } - {template === 'flex' && ( - - )} + {template === 'flex' && ( + + )} - {template === 'tabs' && ( - linkItem(id, item, updateItem)} - unlinkItem={(id) => unlinkItem(id, item, updateItem)} - setUrlParams={setUrlParams} - > - )} + {template === 'tabs' && ( + linkItem(id, item, updateItem)} + unlinkItem={(id) => unlinkItem(id, item, updateItem)} + setUrlParams={setUrlParams} + > + )} -
- +
+ +
-
+
) diff --git a/src/Components/Profile/Subcomponents/ContactInfoForm.tsx b/src/Components/Profile/Subcomponents/ContactInfoForm.tsx index 9a87fc6a..ed5cea1e 100644 --- a/src/Components/Profile/Subcomponents/ContactInfoForm.tsx +++ b/src/Components/Profile/Subcomponents/ContactInfoForm.tsx @@ -22,6 +22,7 @@ export const ContactInfoForm = ({ setState((prevState) => ({ @@ -41,6 +42,9 @@ export const ContactInfoForm = ({ setState((prevState) => ({ diff --git a/src/Components/Profile/Subcomponents/FormHeader.tsx b/src/Components/Profile/Subcomponents/FormHeader.tsx index a20a778f..357ad7a4 100644 --- a/src/Components/Profile/Subcomponents/FormHeader.tsx +++ b/src/Components/Profile/Subcomponents/FormHeader.tsx @@ -44,6 +44,7 @@ export const FormHeader = ({ item, state, setState }) => { /> setState((prevState) => ({ diff --git a/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx b/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx index cd4084dd..afd43c2f 100644 --- a/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx +++ b/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx @@ -30,13 +30,16 @@ export const GroupSubheaderForm = ({ useEffect(() => { if (groupTypes && groupStates) { const groupType = groupTypes.find((gt) => gt.groupTypes_id.name === state.group_type) - // eslint-disable-next-line no-console - console.log(state.group_type) + const customImage = !groupTypes.some( + (gt) => gt.groupTypes_id.image === state.image || !state.image, + ) setState((prevState) => ({ ...prevState, color: groupType?.groupTypes_id.color || groupTypes[0].groupTypes_id.color, marker_icon: groupType?.groupTypes_id.markerIcon || groupTypes[0].groupTypes_id.markerIcon, - image: groupType?.groupTypes_id.image || groupTypes[0].groupTypes_id.image, + image: customImage + ? state.image + : groupType?.groupTypes_id.image || groupTypes[0].groupTypes_id.image, status: state.status || groupStates[0], group_type: state.group_type || groupTypes[0].groupTypes_id.name, }))