mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-01-15 17:34:44 +00:00
* initialized donation widget * opencollective api calls * form element and styling * fix linting * removed unused import * 3.0.79 * get opencollectiva api key from app state * linting
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
|
|
import { ContactInfoView } from '#components/Profile/Subcomponents/ContactInfoView'
|
|
import { CrowdfundingView } from '#components/Profile/Subcomponents/CrowdfundingView'
|
|
import { GalleryView } from '#components/Profile/Subcomponents/GalleryView'
|
|
import { GroupSubHeaderView } from '#components/Profile/Subcomponents/GroupSubHeaderView'
|
|
import { ProfileStartEndView } from '#components/Profile/Subcomponents/ProfileStartEndView'
|
|
import { ProfileTextView } from '#components/Profile/Subcomponents/ProfileTextView'
|
|
|
|
import type { Item } from '#types/Item'
|
|
import type { Key } from 'react'
|
|
|
|
const componentMap = {
|
|
groupSubheaders: GroupSubHeaderView,
|
|
texts: ProfileTextView,
|
|
contactInfos: ContactInfoView,
|
|
startEnd: ProfileStartEndView,
|
|
gallery: GalleryView,
|
|
crowdfundings: CrowdfundingView,
|
|
// weitere Komponenten hier
|
|
}
|
|
|
|
export const FlexView = ({ item }: { item: Item }) => {
|
|
// eslint-disable-next-line no-console
|
|
console.log(item)
|
|
return (
|
|
<div className='tw-h-full tw-overflow-y-auto fade'>
|
|
{item.layer?.itemType.profileTemplate.map(
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(templateItem: { collection: string | number; id: Key | null | undefined; item: any }) => {
|
|
const TemplateComponent = componentMap[templateItem.collection]
|
|
return TemplateComponent ? (
|
|
<TemplateComponent key={templateItem.id} item={item} {...templateItem.item} />
|
|
) : (
|
|
<div key={templateItem.id}>Component not found</div>
|
|
)
|
|
},
|
|
)}
|
|
</div>
|
|
)
|
|
}
|