add create resource trpc function
This commit is contained in:
@ -42,13 +42,16 @@ const AdminActionButton = ({
|
||||
label,
|
||||
onClick,
|
||||
symbol,
|
||||
type = "button",
|
||||
}: {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
onClick?: () => void;
|
||||
symbol: JSX.Element | undefined;
|
||||
type?: HTMLButtonElement["type"];
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
type={type}
|
||||
className="py-auto group my-auto h-full space-x-2 rounded-lg border border-neutral-400 bg-neutral-800 px-2 hover:border-neutral-800 hover:bg-white"
|
||||
onClick={onClick}
|
||||
>
|
||||
|
@ -47,6 +47,7 @@ import { ResourcePhoto } from "~/components/ResourcePhoto";
|
||||
Modal.setAppElement("#__next");
|
||||
|
||||
export type ResourceUpdateInput = RouterInputs["auditoryResource"]["update"];
|
||||
export type ResourceCreateInput = RouterInputs["auditoryResource"]["create"];
|
||||
|
||||
/**
|
||||
* Renders the image selector for resource form.
|
||||
@ -361,14 +362,14 @@ function ResourceSummarySubForm({
|
||||
<InfoInputLine
|
||||
details={register("manufacturer.name", { required: true })}
|
||||
placeholder="manufacturer"
|
||||
value={resource?.manufacturer?.name ?? ""}
|
||||
hint="manufacturer"
|
||||
value={resource?.name}
|
||||
/>
|
||||
</span>
|
||||
<InfoInputLine
|
||||
details={register("name", { required: true })}
|
||||
placeholder="name"
|
||||
value={resource?.name ?? ""}
|
||||
value={resource?.name}
|
||||
hint="name"
|
||||
/>
|
||||
<span className="my-1 block w-full text-center text-xs italic text-neutral-400">
|
||||
|
@ -2,7 +2,9 @@ import { type HTMLInputTypeAttribute, useState } from "react";
|
||||
import {
|
||||
type UseFormRegisterReturn,
|
||||
type InternalFieldName,
|
||||
useFormContext,
|
||||
} from "react-hook-form";
|
||||
import { ResourceCreateInput } from "../admin/resources/form";
|
||||
|
||||
/**
|
||||
* Single line input for the fields found to the right of the
|
||||
@ -14,7 +16,7 @@ function InfoInputLine<TFieldName extends InternalFieldName>({
|
||||
hint,
|
||||
details,
|
||||
}: {
|
||||
value: string;
|
||||
value?: string | undefined;
|
||||
placeholder: string;
|
||||
hint?: string;
|
||||
details: UseFormRegisterReturn<TFieldName>;
|
||||
|
Reference in New Issue
Block a user