mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
Adapt types
This commit is contained in:
parent
91b88d6635
commit
e26dfc6e66
@ -47,6 +47,7 @@ export function ProfileForm() {
|
||||
start: '',
|
||||
end: '',
|
||||
openCollectiveSlug: '',
|
||||
gallery: [],
|
||||
})
|
||||
|
||||
const [updatePermission, setUpdatePermission] = useState<boolean>(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])
|
||||
|
||||
@ -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<React.SetStateAction<any>>
|
||||
}
|
||||
|
||||
|
||||
@ -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<React.SetStateAction<any>>
|
||||
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||
}) => {
|
||||
return (
|
||||
<div className='tw:mt-4 tw:space-y-4'>
|
||||
|
||||
@ -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<React.SetStateAction<any>>
|
||||
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||
}) => {
|
||||
return (
|
||||
<div className='tw:mt-4 tw:space-y-4'>
|
||||
|
||||
@ -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<FormState>
|
||||
setState: React.Dispatch<React.SetStateAction<Partial<FormState>>>
|
||||
}
|
||||
|
||||
export const FormHeader = ({ item, state, setState }: Props) => {
|
||||
return (
|
||||
<div className='tw:flex-none'>
|
||||
<div className='tw:flex'>
|
||||
@ -34,7 +40,7 @@ export const FormHeader = ({ item, state, setState }) => {
|
||||
<div className='tw:grow tw:mr-4 tw:pt-1'>
|
||||
<TextInput
|
||||
placeholder='Name'
|
||||
defaultValue={item?.name ? item.name : ''}
|
||||
defaultValue={item.name ? item.name : ''}
|
||||
updateFormValue={(v) =>
|
||||
setState((prevState) => ({
|
||||
...prevState,
|
||||
@ -47,7 +53,7 @@ export const FormHeader = ({ item, state, setState }) => {
|
||||
<TextInput
|
||||
placeholder='Subtitle'
|
||||
required={false}
|
||||
defaultValue={item?.subname ? item.subname : ''}
|
||||
defaultValue={item.subname ? item.subname : ''}
|
||||
updateFormValue={(v) =>
|
||||
setState((prevState) => ({
|
||||
...prevState,
|
||||
|
||||
@ -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<React.SetStateAction<any>>
|
||||
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||
item: Item
|
||||
groupStates?: string[]
|
||||
groupTypes?: groupType[]
|
||||
|
||||
@ -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<React.SetStateAction<any>>
|
||||
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||
}) => {
|
||||
return (
|
||||
<PopupStartEndInput
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { RichTextEditor } from '#components/Input/RichTextEditor'
|
||||
@ -21,7 +21,7 @@ export const ProfileTextForm = ({
|
||||
required,
|
||||
}: {
|
||||
state: FormState
|
||||
setState: React.Dispatch<React.SetStateAction<any>>
|
||||
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||
dataField?: string
|
||||
heading: string
|
||||
size: string
|
||||
|
||||
@ -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<React.SetStateAction<any>>
|
||||
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||
item: Item
|
||||
}) => {
|
||||
return (
|
||||
|
||||
3
src/types/FormState.d.ts
vendored
3
src/types/FormState.d.ts
vendored
@ -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[]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user