From e26dfc6e6614840b8546997dc849dcdb015bea63 Mon Sep 17 00:00:00 2001 From: Maximilian Harz Date: Wed, 4 Jun 2025 23:44:28 +0200 Subject: [PATCH] Adapt types --- src/Components/Profile/ProfileForm.tsx | 2 ++ .../Profile/Subcomponents/AvatarWidget.tsx | 2 +- .../Profile/Subcomponents/ContactInfoForm.tsx | 4 +--- .../Subcomponents/CrowdfundingForm.tsx | 4 +--- .../Profile/Subcomponents/FormHeader.tsx | 20 ++++++++++++------- .../Subcomponents/GroupSubheaderForm.tsx | 4 +--- .../Subcomponents/ProfileStartEndForm.tsx | 5 ++--- .../Profile/Subcomponents/ProfileTextForm.tsx | 6 +++--- .../Profile/Templates/OnepagerForm.tsx | 4 +--- src/types/FormState.d.ts | 3 ++- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Components/Profile/ProfileForm.tsx b/src/Components/Profile/ProfileForm.tsx index c68f7dcc..a1d773e2 100644 --- a/src/Components/Profile/ProfileForm.tsx +++ b/src/Components/Profile/ProfileForm.tsx @@ -47,6 +47,7 @@ export function ProfileForm() { start: '', end: '', openCollectiveSlug: '', + gallery: [], }) const [updatePermission, setUpdatePermission] = useState(false) @@ -140,6 +141,7 @@ export function ProfileForm() { start: item.start ?? '', end: item.end ?? '', openCollectiveSlug: item.openCollectiveSlug ?? '', + gallery: item.gallery ?? [], }) // eslint-disable-next-line react-hooks/exhaustive-deps }, [item, tags, items]) diff --git a/src/Components/Profile/Subcomponents/AvatarWidget.tsx b/src/Components/Profile/Subcomponents/AvatarWidget.tsx index 9434c535..57d4bcfe 100644 --- a/src/Components/Profile/Subcomponents/AvatarWidget.tsx +++ b/src/Components/Profile/Subcomponents/AvatarWidget.tsx @@ -13,7 +13,7 @@ import DialogModal from '#components/Templates/DialogModal' import type { Crop } from 'react-image-crop' interface AvatarWidgetProps { - avatar: string + avatar?: string setAvatar: React.Dispatch> } diff --git a/src/Components/Profile/Subcomponents/ContactInfoForm.tsx b/src/Components/Profile/Subcomponents/ContactInfoForm.tsx index 20571582..644bd363 100644 --- a/src/Components/Profile/Subcomponents/ContactInfoForm.tsx +++ b/src/Components/Profile/Subcomponents/ContactInfoForm.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { TextInput } from '#components/Input' import type { FormState } from '#types/FormState' @@ -9,7 +7,7 @@ export const ContactInfoForm = ({ setState, }: { state: FormState - setState: React.Dispatch> + setState: React.Dispatch> }) => { return (
diff --git a/src/Components/Profile/Subcomponents/CrowdfundingForm.tsx b/src/Components/Profile/Subcomponents/CrowdfundingForm.tsx index 71bce7f1..2fca373c 100644 --- a/src/Components/Profile/Subcomponents/CrowdfundingForm.tsx +++ b/src/Components/Profile/Subcomponents/CrowdfundingForm.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { TextInput } from '#components/Input' import type { FormState } from '#types/FormState' @@ -9,7 +7,7 @@ export const CrowdfundingForm = ({ setState, }: { state: FormState - setState: React.Dispatch> + setState: React.Dispatch> }) => { return (
diff --git a/src/Components/Profile/Subcomponents/FormHeader.tsx b/src/Components/Profile/Subcomponents/FormHeader.tsx index f72cef13..8f34dd55 100644 --- a/src/Components/Profile/Subcomponents/FormHeader.tsx +++ b/src/Components/Profile/Subcomponents/FormHeader.tsx @@ -1,14 +1,20 @@ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable react/prop-types */ + import { TextInput } from '#components/Input' import { AvatarWidget } from './AvatarWidget' import { ColorPicker } from './ColorPicker' -export const FormHeader = ({ item, state, setState }) => { +import type { FormState } from '#types/FormState' +import type { Item } from '#types/Item' + +interface Props { + item: Item + state: Partial + setState: React.Dispatch>> +} + +export const FormHeader = ({ item, state, setState }: Props) => { return (
@@ -34,7 +40,7 @@ export const FormHeader = ({ item, state, setState }) => {
setState((prevState) => ({ ...prevState, @@ -47,7 +53,7 @@ export const FormHeader = ({ item, state, setState }) => { setState((prevState) => ({ ...prevState, diff --git a/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx b/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx index 95d18104..5c37c316 100644 --- a/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx +++ b/src/Components/Profile/Subcomponents/GroupSubheaderForm.tsx @@ -1,6 +1,4 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { useEffect } from 'react' import ComboBoxInput from '#components/Input/ComboBoxInput' @@ -24,7 +22,7 @@ export const GroupSubheaderForm = ({ groupTypes, }: { state: FormState - setState: React.Dispatch> + setState: React.Dispatch> item: Item groupStates?: string[] groupTypes?: groupType[] diff --git a/src/Components/Profile/Subcomponents/ProfileStartEndForm.tsx b/src/Components/Profile/Subcomponents/ProfileStartEndForm.tsx index fa7d20c4..81699ec9 100644 --- a/src/Components/Profile/Subcomponents/ProfileStartEndForm.tsx +++ b/src/Components/Profile/Subcomponents/ProfileStartEndForm.tsx @@ -1,7 +1,6 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { PopupStartEndInput } from '#components/Map/Subcomponents/ItemPopupComponents' +import type { FormState } from '#types/FormState' import type { Item } from '#types/Item' export const ProfileStartEndForm = ({ @@ -9,7 +8,7 @@ export const ProfileStartEndForm = ({ setState, }: { item: Item - setState: React.Dispatch> + setState: React.Dispatch> }) => { return ( > + setState: React.Dispatch> dataField?: string heading: string size: string diff --git a/src/Components/Profile/Templates/OnepagerForm.tsx b/src/Components/Profile/Templates/OnepagerForm.tsx index f7612160..1532a5b5 100644 --- a/src/Components/Profile/Templates/OnepagerForm.tsx +++ b/src/Components/Profile/Templates/OnepagerForm.tsx @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { TextAreaInput } from '#components/Input' import { ContactInfoForm } from '#components/Profile/Subcomponents/ContactInfoForm' import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubheaderForm' @@ -13,7 +11,7 @@ export const OnepagerForm = ({ setState, }: { state: FormState - setState: React.Dispatch> + setState: React.Dispatch> item: Item }) => { return ( diff --git a/src/types/FormState.d.ts b/src/types/FormState.d.ts index 2384e6d2..c3766bc6 100644 --- a/src/types/FormState.d.ts +++ b/src/types/FormState.d.ts @@ -1,5 +1,5 @@ import type { markerIcon } from '#utils/MarkerIconFactory' -import type { Item } from './Item' +import type { GalleryItem, Item } from './Item' import type { Tag } from './Tag' export interface FormState { @@ -21,4 +21,5 @@ export interface FormState { start: string end: string openCollectiveSlug: string + gallery: GalleryItem[] }