import { useEffect, useState } from "react" import { TextAreaInput } from "../../Input" import { TextView } from "../../Map" import { ActionButton } from "../Subcomponents/ActionsButton" import { LinkedItemsHeaderView } from "../Subcomponents/LinkedItemsHeaderView" import { TagsWidget } from "../Subcomponents/TagsWidget" import { useNavigate } from "react-router-dom" import { useUpdateItem } from "../../Map/hooks/useItems" export const TabsForm = ({ item, state, setState, updatePermission, linkItem, unlinkItem, loading }) => { const [activeTab, setActiveTab] = useState(1); const navigate = useNavigate(); const updateItem = useUpdateItem(); const updateActiveTab = (id: number) => { setActiveTab(id); let params = new URLSearchParams(window.location.search); let urlTab = params.get("tab"); if (!urlTab?.includes(id.toString())) params.set("tab", `${id ? id : ""}`) navigate(location.pathname+ "?" + params.toString()); } const attestations = [{ from: "Timo", avatar: "https://api.utopia-lab.org/assets/262117f8-feb6-444f-9bd2-e84087285760?width=80&heigth=80", symbol: "🥇", text: "1. Platz im Bogenschießen", date: "21.06.2024", }, { from: "Sebastian", avatar: "https://api.utopia-lab.org/assets/7510a082-882b-41c3-aa7d-5a19f9502f25?width=80&heigth=80", symbol: "🌱", text: "danke fürs Rasen mähen", date: "29.06.2024", }, { from: "Yurij", avatar: "https://api.utopia-lab.org/assets/abe62291-35ad-45de-b978-e5906d8a3eb6?width=80&heigth=80", symbol: "🏆", text: "bester Coder ever", date: "04.07.2024", }, { from: "Luca", avatar: "https://api.utopia-lab.org/assets/e285e653-36e8-4211-a69d-00053c1f610e?width=80&heigth=80", symbol: "🙏", text: "Vielen Dank für deine Hilfe!!!", date: "04.07.2024", }, { from: "Lisa", avatar: "https://i.pinimg.com/originals/c0/ed/08/c0ed088cd6532d4fd27396aefddac57c.jpg", symbol: "❤️", text: "Vielen Dank für deine Hilfe!!!", date: "04.07.2024", }, { from: "Timo", avatar: "https://api.utopia-lab.org/assets/262117f8-feb6-444f-9bd2-e84087285760?width=80&heigth=80", symbol: "🥈", text: "2. Platz im Bogenschießen", date: "21.06.2024", }, { from: "Anton", avatar: "https://api.utopia-lab.org/assets/007dc678-6073-4ad1-9b47-f2cfe1dca582?width=80&heigth=80", symbol: "🌱", text: "danke fürs Rasen mähen", date: "29.06.2024" }, ] useEffect(() => { let params = new URLSearchParams(location.search); let urlTab = params.get("tab"); urlTab ? setActiveTab(Number(urlTab)) : setActiveTab(1); }, [location]) return (
updateActiveTab(1)} />
setState(prevState => ({ ...prevState, text: v }))} containerStyle='tw-h-full' inputStyle='tw-h-full tw-border-t-0 tw-rounded-tl-none' />
{item.layer?.itemType.questlog && <> updateActiveTab(2)} />
{attestations.map((a, i) => )}
{a.symbol}
{a.text}
Avatar Tailwind CSS Component
{a.from}
{a.date}
} {item.layer?.itemType.offers_and_needs && <> updateActiveTab(3)} />
setState(prevState => ({ ...prevState, offers: v }))} placeholder="enter your offers" containerStyle='tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' />
setState(prevState => ({ ...prevState, needs: v }))} placeholder="enter your needs" containerStyle='tw-bg-transparent tw-w-full tw-h-full tw-mt-3 tw-text-xs tw-h-[calc(100%-1rem)] tw-min-h-[5em] tw-pb-2 tw-overflow-auto' />
} {item.layer?.itemType.relations && <> updateActiveTab(7)} />
{state.relations && state.relations.map(i =>
navigate('/item/' + i.id)}> unlinkItem(id, item, updateItem)} loading={loading} />
)} {updatePermission && linkItem(id, item, updateItem)} colorField={item.layer.itemColorField}>}
}
) }