import { PaymentType, SkillLevel, Skill, type PlatformLink, } from "@prisma/client"; import Image from "next/image"; import { PencilSquareIcon } from "@heroicons/react/24/solid"; import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { PlusIcon } from "@heroicons/react/20/solid"; import { MultiSelectorMany, MultiSelectorOption, SelectedManyContext, SimpleSelectorManyOption, } from "../../forms/selectors"; import { InfoInputLine } from "~/components/forms/textInput"; import { PriceIcon } from "~/prices/Icons"; import { useState } from "react"; import { type UseFormReturn, FormProvider, useFormContext, } from "react-hook-form"; import { type RouterInputs } from "~/utils/api"; import { PlatformLinkButton } from "~/pages/resources/[id]"; export type ResourceUpdateInput = RouterInputs["auditoryResource"]["update"]; /** * Renders the image selector for resource form. * * File needs to be path relative to resource_logos/ */ const SelectImageInput = ({ file }: { file?: string }) => { return ( <> > ); }; /** * Contains the input fields for editing the links for a resource * @returns */ const ResourceLinkSubForm = ({ links }: { links: PlatformLink[] }) => { const { register } = useFormContext(); const [selectedLinks, setSelectedLinks] = useState(links); return ( Links Add {selectedLinks.map((link, index) => { return ( ); })} ); }; const PaymentTypeOption = ({ type, label, }: { type: PaymentType; label: string; }) => { return ( {(selected) => ( {label} )} ); }; /** * Resource summary inputs - ie description, manufacturer, etc. */ function ResourceSummarySubForm({ resource, }: { resource?: ResourceUpdateInput; }) { const { register } = useFormContext(); return ( Resource Details Edit the fields above {Object.values(SkillLevel).map((skillLevel, index) => { return ( ); })} {Object.values(Skill).map((skill, index) => { return ( ); })} ); } const ResourceDescriptionSubForm = () => { const [dropdownOpen, toggleDropdown] = useState(false); const { register } = useFormContext(); return ( Description { toggleDropdown(!dropdownOpen); }} className="group flex w-full flex-row justify-between border-b-[4px] border-neutral-700 bg-neutral-600 p-2 align-middle" > IMPORTANT open to edit ); }; const ResourceForm = ({ methods, resource, error, }: { resource?: ResourceUpdateInput; methods: UseFormReturn; error?: string; }) => { return ( {error ? ( Error Updating Resource:{" "} {error} ) : undefined} {" "} {/** //resource={resource} /> */} General ); }; export { ResourceForm };