mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-04-06 01:25:33 +00:00
Adapt types
This commit is contained in:
parent
91b88d6635
commit
e26dfc6e66
@ -47,6 +47,7 @@ export function ProfileForm() {
|
|||||||
start: '',
|
start: '',
|
||||||
end: '',
|
end: '',
|
||||||
openCollectiveSlug: '',
|
openCollectiveSlug: '',
|
||||||
|
gallery: [],
|
||||||
})
|
})
|
||||||
|
|
||||||
const [updatePermission, setUpdatePermission] = useState<boolean>(false)
|
const [updatePermission, setUpdatePermission] = useState<boolean>(false)
|
||||||
@ -140,6 +141,7 @@ export function ProfileForm() {
|
|||||||
start: item.start ?? '',
|
start: item.start ?? '',
|
||||||
end: item.end ?? '',
|
end: item.end ?? '',
|
||||||
openCollectiveSlug: item.openCollectiveSlug ?? '',
|
openCollectiveSlug: item.openCollectiveSlug ?? '',
|
||||||
|
gallery: item.gallery ?? [],
|
||||||
})
|
})
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [item, tags, items])
|
}, [item, tags, items])
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import DialogModal from '#components/Templates/DialogModal'
|
|||||||
import type { Crop } from 'react-image-crop'
|
import type { Crop } from 'react-image-crop'
|
||||||
|
|
||||||
interface AvatarWidgetProps {
|
interface AvatarWidgetProps {
|
||||||
avatar: string
|
avatar?: string
|
||||||
setAvatar: React.Dispatch<React.SetStateAction<any>>
|
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 { TextInput } from '#components/Input'
|
||||||
|
|
||||||
import type { FormState } from '#types/FormState'
|
import type { FormState } from '#types/FormState'
|
||||||
@ -9,7 +7,7 @@ export const ContactInfoForm = ({
|
|||||||
setState,
|
setState,
|
||||||
}: {
|
}: {
|
||||||
state: FormState
|
state: FormState
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className='tw:mt-4 tw:space-y-4'>
|
<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 { TextInput } from '#components/Input'
|
||||||
|
|
||||||
import type { FormState } from '#types/FormState'
|
import type { FormState } from '#types/FormState'
|
||||||
@ -9,7 +7,7 @@ export const CrowdfundingForm = ({
|
|||||||
setState,
|
setState,
|
||||||
}: {
|
}: {
|
||||||
state: FormState
|
state: FormState
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<div className='tw:mt-4 tw:space-y-4'>
|
<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-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
||||||
/* eslint-disable react/prop-types */
|
|
||||||
import { TextInput } from '#components/Input'
|
import { TextInput } from '#components/Input'
|
||||||
|
|
||||||
import { AvatarWidget } from './AvatarWidget'
|
import { AvatarWidget } from './AvatarWidget'
|
||||||
import { ColorPicker } from './ColorPicker'
|
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 (
|
return (
|
||||||
<div className='tw:flex-none'>
|
<div className='tw:flex-none'>
|
||||||
<div className='tw:flex'>
|
<div className='tw:flex'>
|
||||||
@ -34,7 +40,7 @@ export const FormHeader = ({ item, state, setState }) => {
|
|||||||
<div className='tw:grow tw:mr-4 tw:pt-1'>
|
<div className='tw:grow tw:mr-4 tw:pt-1'>
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder='Name'
|
placeholder='Name'
|
||||||
defaultValue={item?.name ? item.name : ''}
|
defaultValue={item.name ? item.name : ''}
|
||||||
updateFormValue={(v) =>
|
updateFormValue={(v) =>
|
||||||
setState((prevState) => ({
|
setState((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
@ -47,7 +53,7 @@ export const FormHeader = ({ item, state, setState }) => {
|
|||||||
<TextInput
|
<TextInput
|
||||||
placeholder='Subtitle'
|
placeholder='Subtitle'
|
||||||
required={false}
|
required={false}
|
||||||
defaultValue={item?.subname ? item.subname : ''}
|
defaultValue={item.subname ? item.subname : ''}
|
||||||
updateFormValue={(v) =>
|
updateFormValue={(v) =>
|
||||||
setState((prevState) => ({
|
setState((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
import ComboBoxInput from '#components/Input/ComboBoxInput'
|
import ComboBoxInput from '#components/Input/ComboBoxInput'
|
||||||
@ -24,7 +22,7 @@ export const GroupSubheaderForm = ({
|
|||||||
groupTypes,
|
groupTypes,
|
||||||
}: {
|
}: {
|
||||||
state: FormState
|
state: FormState
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||||
item: Item
|
item: Item
|
||||||
groupStates?: string[]
|
groupStates?: string[]
|
||||||
groupTypes?: groupType[]
|
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 { PopupStartEndInput } from '#components/Map/Subcomponents/ItemPopupComponents'
|
||||||
|
|
||||||
|
import type { FormState } from '#types/FormState'
|
||||||
import type { Item } from '#types/Item'
|
import type { Item } from '#types/Item'
|
||||||
|
|
||||||
export const ProfileStartEndForm = ({
|
export const ProfileStartEndForm = ({
|
||||||
@ -9,7 +8,7 @@ export const ProfileStartEndForm = ({
|
|||||||
setState,
|
setState,
|
||||||
}: {
|
}: {
|
||||||
item: Item
|
item: Item
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<PopupStartEndInput
|
<PopupStartEndInput
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
/* 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-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { RichTextEditor } from '#components/Input/RichTextEditor'
|
import { RichTextEditor } from '#components/Input/RichTextEditor'
|
||||||
@ -21,7 +21,7 @@ export const ProfileTextForm = ({
|
|||||||
required,
|
required,
|
||||||
}: {
|
}: {
|
||||||
state: FormState
|
state: FormState
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||||
dataField?: string
|
dataField?: string
|
||||||
heading: string
|
heading: string
|
||||||
size: 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 { TextAreaInput } from '#components/Input'
|
||||||
import { ContactInfoForm } from '#components/Profile/Subcomponents/ContactInfoForm'
|
import { ContactInfoForm } from '#components/Profile/Subcomponents/ContactInfoForm'
|
||||||
import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubheaderForm'
|
import { GroupSubheaderForm } from '#components/Profile/Subcomponents/GroupSubheaderForm'
|
||||||
@ -13,7 +11,7 @@ export const OnepagerForm = ({
|
|||||||
setState,
|
setState,
|
||||||
}: {
|
}: {
|
||||||
state: FormState
|
state: FormState
|
||||||
setState: React.Dispatch<React.SetStateAction<any>>
|
setState: React.Dispatch<React.SetStateAction<FormState>>
|
||||||
item: Item
|
item: Item
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
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 { markerIcon } from '#utils/MarkerIconFactory'
|
||||||
import type { Item } from './Item'
|
import type { GalleryItem, Item } from './Item'
|
||||||
import type { Tag } from './Tag'
|
import type { Tag } from './Tag'
|
||||||
|
|
||||||
export interface FormState {
|
export interface FormState {
|
||||||
@ -21,4 +21,5 @@ export interface FormState {
|
|||||||
start: string
|
start: string
|
||||||
end: string
|
end: string
|
||||||
openCollectiveSlug: string
|
openCollectiveSlug: string
|
||||||
|
gallery: GalleryItem[]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user