From 0af9fd3829b867076db7889f3ee4c5acd4ae3191 Mon Sep 17 00:00:00 2001 From: antontranelis <31516529+antontranelis@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:38:43 +0100 Subject: [PATCH 1/3] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 108 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..8c96b1e7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,108 @@ +# Code of Conduct + +## Purpose + +Our community is dedicated to fostering an open, inclusive, and respectful environment. This Code of Conduct outlines our expectations for all participants and the steps for addressing any unacceptable behavior. By adhering to these guidelines, we can create a space where collaboration and learning thrive. + +--- + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Ensure that your contributions are relevant to the discussion and meeting agendas. +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Repeatedly deviating from the agenda during meetings, interrupting discussions, or monopolizing speaking time with irrelevant or incoherent contributions. +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +--- + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines when determining consequences for violations of this Code of Conduct. + +### 1. Correction + +**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact:** A violation through a single incident or series of actions. + +**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence:** A permanent ban from any sort of public interaction within the community. + +--- + +## Conflict Resolution Process + +To address and resolve conflicts effectively, the community will follow these steps: + +### Step 1: Direct Communication + +If a conflict arises, the involved parties are encouraged to address the issue directly and respectfully with one another to seek resolution. This conversation should focus on the behavior or issue at hand, avoiding personal attacks or assumptions. + +### Step 2: Mediation + +If direct communication does not resolve the issue, either party may request mediation from a neutral community leader. The mediator will facilitate a structured conversation to help clarify misunderstandings and find common ground. + +### Step 3: Formal Review + +If the conflict remains unresolved, the issue will be escalated to the community leadership team for review. The leadership team will gather relevant information, including accounts from all parties involved, and make a decision based on the Code of Conduct and the community’s best interests. + +### Step 4: Resolution and Follow-Up + +The leadership team will communicate their decision and any actions to be taken to the involved parties. Follow-up will be conducted to ensure that the resolution is effective and that no further issues arise. + +--- + +## Scope + +This Code of Conduct applies to all community spaces, including but not limited to: + +- Online forums, repositories, and communication channels. +- In-person or virtual meetings and events. +- External channels where the community is represented (e.g., social media). + +--- + +## Reporting + +If you experience or witness behavior that violates this Code of Conduct, please report it to the community leaders via [info@utopia-lab.org](mailto:info@utopia-lab.org). All reports will be handled with discretion and confidentiality. + +--- + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1. + From 20e8203b26574b89f3db32964b426edd146deeb4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 17 Dec 2024 09:47:32 +0100 Subject: [PATCH 2/3] make NavBar typesafe removed obsolete eslint disables fixed a type problem another type problem type check --- src/Components/AppShell/NavBar.tsx | 29 ++++++------------- src/Components/Gaming/Modal.tsx | 2 -- src/Components/Gaming/Quests.tsx | 1 - .../Map/Subcomponents/ItemFormPopup.tsx | 5 ++-- src/Components/Profile/ProfileForm.tsx | 2 +- .../Profile/Subcomponents/ContactInfoView.tsx | 1 - .../Profile/Templates/OnepagerView.tsx | 3 +- src/Components/Profile/Templates/TabsView.tsx | 2 +- src/Components/Templates/AttestationForm.tsx | 5 ++-- src/Components/Templates/DateUserInfo.tsx | 2 -- .../Templates/OverlayItemsIndexPage.tsx | 2 +- src/index.tsx | 5 ++-- types/Item.d.ts | 3 ++ types/UserItem.d.ts | 1 + 14 files changed, 24 insertions(+), 39 deletions(-) diff --git a/src/Components/AppShell/NavBar.tsx b/src/Components/AppShell/NavBar.tsx index 2a7a977b..0e627c1f 100644 --- a/src/Components/AppShell/NavBar.tsx +++ b/src/Components/AppShell/NavBar.tsx @@ -1,14 +1,3 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/no-unsafe-argument */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-floating-promises */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/restrict-plus-operands */ -/* eslint-disable @typescript-eslint/no-unnecessary-condition */ import QuestionMarkIcon from '@heroicons/react/24/outline/QuestionMarkCircleIcon' import { useEffect, useRef, useState } from 'react' import { Link, useLocation } from 'react-router-dom' @@ -31,19 +20,19 @@ export default function NavBar({ appName, userType }: { appName: string; userTyp 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: '' }) + : setUserProfile({ id: crypto.randomUUID(), name: user?.first_name ?? '', text: '' }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [user, items]) - useEffect(() => {}, [userProfile]) + // useEffect(() => {}, [userProfile]) - const nameRef = useRef(null) + const nameRef = useRef(null) const [nameWidth, setNameWidth] = useState(0) const location = useLocation() const [showNav, setShowNav] = useState(false) useEffect(() => { - showNav && nameRef && setNameWidth(nameRef.current.scrollWidth) + showNav && nameRef.current && setNameWidth(nameRef.current.scrollWidth) }, [nameRef, appName, showNav]) useEffect(() => { @@ -52,8 +41,8 @@ export default function NavBar({ appName, userType }: { appName: string; userTyp embedded !== 'true' && setShowNav(true) }, [location]) - const onLogout = () => { - toast.promise(logout(), { + const onLogout = async () => { + await toast.promise(logout(), { success: { render() { return 'Bye bye' @@ -63,7 +52,7 @@ export default function NavBar({ appName, userType }: { appName: string; userTyp }, error: { render({ data }) { - return `${data}` + return JSON.stringify(data) }, }, pending: 'logging out ..', @@ -123,7 +112,7 @@ export default function NavBar({ appName, userType }: { appName: string; userTyp to={`${userProfile.id && '/item/' + userProfile.id}`} className='tw-flex tw-items-center' > - {userProfile?.image && ( + {userProfile.image && (
@@ -156,7 +145,7 @@ export default function NavBar({ appName, userType }: { appName: string; userTyp
  • { - onLogout() + void onLogout() }} > Logout diff --git a/src/Components/Gaming/Modal.tsx b/src/Components/Gaming/Modal.tsx index 7d83ac5a..d58de15e 100644 --- a/src/Components/Gaming/Modal.tsx +++ b/src/Components/Gaming/Modal.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ import { useEffect } from 'react' export function Modal({ diff --git a/src/Components/Gaming/Quests.tsx b/src/Components/Gaming/Quests.tsx index 792b4faa..0e669c6f 100644 --- a/src/Components/Gaming/Quests.tsx +++ b/src/Components/Gaming/Quests.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { useEffect, useState } from 'react' import { useAuth } from '#components/Auth' diff --git a/src/Components/Map/Subcomponents/ItemFormPopup.tsx b/src/Components/Map/Subcomponents/ItemFormPopup.tsx index 64cb9b9f..ed35d861 100644 --- a/src/Components/Map/Subcomponents/ItemFormPopup.tsx +++ b/src/Components/Map/Subcomponents/ItemFormPopup.tsx @@ -4,7 +4,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { Children, cloneElement, isValidElement, useEffect, useRef, useState } from 'react' @@ -113,8 +112,8 @@ export function ItemFormPopup(props: ItemFormPopupProps) { if (!props.layer.onlyOnePerOwner || !item) { addItem({ ...formItem, - name: formItem.name ? formItem.name : user?.first_name, - user_created: user, + name: (formItem.name ? formItem.name : user?.first_name) ?? '', + user_created: user ?? undefined, type: props.layer.itemType, id: uuid, layer: props.layer, diff --git a/src/Components/Profile/ProfileForm.tsx b/src/Components/Profile/ProfileForm.tsx index b51344b8..c5339657 100644 --- a/src/Components/Profile/ProfileForm.tsx +++ b/src/Components/Profile/ProfileForm.tsx @@ -79,7 +79,7 @@ export function ProfileForm() { const layer = layers.find((l) => l.itemType.name === appState.userType) setItem({ id: crypto.randomUUID(), - name: user ? user.first_name : '', + name: user?.first_name ?? '', text: '', layer, new: true, diff --git a/src/Components/Profile/Subcomponents/ContactInfoView.tsx b/src/Components/Profile/Subcomponents/ContactInfoView.tsx index ae9fb812..a8368d24 100644 --- a/src/Components/Profile/Subcomponents/ContactInfoView.tsx +++ b/src/Components/Profile/Subcomponents/ContactInfoView.tsx @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/restrict-plus-operands */ import { useEffect, useState } from 'react' diff --git a/src/Components/Profile/Templates/OnepagerView.tsx b/src/Components/Profile/Templates/OnepagerView.tsx index 10e49a00..32a786ee 100644 --- a/src/Components/Profile/Templates/OnepagerView.tsx +++ b/src/Components/Profile/Templates/OnepagerView.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ import { TextView } from '#components/Map' @@ -14,7 +13,7 @@ export const OnepagerView = ({ item }: { item: Item }) => { item={item} shareBaseUrl={`https://www.wuerdekompass.org/aktivitaeten/gruppensuche/#/gruppe/${item.slug}`} /> - {item.user_created.first_name && } + {item.user_created?.first_name && } {/* Description Section */}
    diff --git a/src/Components/Profile/Templates/TabsView.tsx b/src/Components/Profile/Templates/TabsView.tsx index 1b0db156..d23d0c7b 100644 --- a/src/Components/Profile/Templates/TabsView.tsx +++ b/src/Components/Profile/Templates/TabsView.tsx @@ -132,7 +132,7 @@ export const TabsView = ({ {attestations - .filter((a) => a.to.some((t) => t.directus_users_id === item.user_created.id)) + .filter((a) => a.to.some((t) => t.directus_users_id === item.user_created?.id)) .sort( (a, b) => new Date(b.date_created).getTime() - new Date(a.date_created).getTime(), diff --git a/src/Components/Templates/AttestationForm.tsx b/src/Components/Templates/AttestationForm.tsx index 595280e8..1b308b81 100644 --- a/src/Components/Templates/AttestationForm.tsx +++ b/src/Components/Templates/AttestationForm.tsx @@ -2,7 +2,6 @@ /* eslint-disable @typescript-eslint/prefer-optional-chain */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/require-await */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-floating-promises */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/restrict-plus-operands */ @@ -49,7 +48,7 @@ export const AttestationForm = ({ api }: { api?: ItemsApi }) => { const sendAttestation = async () => { const to: any[] = [] - users?.map((u) => to.push({ directus_users_id: u.user_created.id })) + users?.map((u) => to.push({ directus_users_id: u.user_created?.id })) api?.createItem && toast @@ -76,7 +75,7 @@ export const AttestationForm = ({ api }: { api?: ItemsApi }) => { '/item/' + items.find( (i) => - i.user_created.id === to[0].directus_users_id && + i.user_created?.id === to[0].directus_users_id && i.layer?.itemType.name === 'player', )?.id + '?tab=2', diff --git a/src/Components/Templates/DateUserInfo.tsx b/src/Components/Templates/DateUserInfo.tsx index b7bbd7dc..4243a9c0 100644 --- a/src/Components/Templates/DateUserInfo.tsx +++ b/src/Components/Templates/DateUserInfo.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-unnecessary-condition */ /* eslint-disable @typescript-eslint/prefer-optional-chain */ diff --git a/src/Components/Templates/OverlayItemsIndexPage.tsx b/src/Components/Templates/OverlayItemsIndexPage.tsx index 62c4c2e0..3388cddc 100644 --- a/src/Components/Templates/OverlayItemsIndexPage.tsx +++ b/src/Components/Templates/OverlayItemsIndexPage.tsx @@ -99,7 +99,7 @@ export const OverlayItemsIndexPage = ({ if (success) { toast.success('New item created') } - addItem({ ...formItem, user_created: user, id: uuid, layer, public_edit: !user }) + addItem({ ...formItem, user_created: user ?? undefined, id: uuid, layer, public_edit: !user }) setLoading(false) setAddItemPopupType('') } diff --git a/src/index.tsx b/src/index.tsx index 6008084d..8592a9ee 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -41,7 +41,8 @@ export { TextInput, TextAreaInput, SelectBox } from './Components/Input' declare global { interface Window { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - my_modal_3: any + my_modal_3: { + showModal(): void + } } } diff --git a/types/Item.d.ts b/types/Item.d.ts index f35d720d..47560e66 100644 --- a/types/Item.d.ts +++ b/types/Item.d.ts @@ -1,6 +1,7 @@ import type { ItemsApi } from './ItemsApi' import type { LayerProps } from './LayerProps' import type { Relation } from './Relation' +import type { UserItem } from './UserItem' import type { Point } from 'geojson' export interface Item { @@ -21,6 +22,8 @@ export interface Item { subname?: string public_edit?: boolean slug?: string + user_created?: UserItem + image?: string // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any /* constructor( diff --git a/types/UserItem.d.ts b/types/UserItem.d.ts index 77512f2b..1d28817e 100644 --- a/types/UserItem.d.ts +++ b/types/UserItem.d.ts @@ -7,6 +7,7 @@ export interface UserItem { email?: string password?: string profile?: Profile + first_name?: string // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any } From c0f0349628601b7b4f3e57dda905a0509f6bbf8d Mon Sep 17 00:00:00 2001 From: Anton Tranelis Date: Tue, 7 Jan 2025 15:40:27 +0000 Subject: [PATCH 3/3] 3.0.34 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index eeeffbbc..eae7d0dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "utopia-ui", - "version": "3.0.33", + "version": "3.0.34", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "utopia-ui", - "version": "3.0.33", + "version": "3.0.34", "license": "GPL-3.0-only", "dependencies": { "@heroicons/react": "^2.0.17", diff --git a/package.json b/package.json index 2a350d55..dbf275f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "utopia-ui", - "version": "3.0.33", + "version": "3.0.34", "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/",